Thursday, May 26, 2011

Programmatic Request Submission (FND_REQUEST.SUBMIT_REQUEST)



used when you need to issue a request within a PL/SQL block (normally from a parent request; parameters doesn’t include the errbuf and retcode). Oracle Apps will automatically assign a concurrent manager for this request. Once successful the function will return the request ID, otherwise it will return 0.

arguments (from source code)

application    - Short name of application under which the program is registered
program        - concurrent program name for which the request has to be submitted (short name)
description    - (optional) Will be displayed along with user concurrent program name
start_time    - (optional) Time at which the request has to start running
sub_request    - (optional) Set to TRUE if the request is submitted from another running request and has to be treated as a sub request. Default is FALSE
argument1..100    - (optional) Arguments for the concurrent request

After calling FND_REQUEST.SUBMIT_REQUEST, in case you want to wait for the sub request to be completed before proceeding with the rest of the PLSQL codes, you'll need to issue a COMMIT command and call FND_CONCURRENT.WAIT_FOR_REQUEST. Issuing COMMIT is required because during the process of submit request, records related to the request are inserted into relevant tables, which only becomes visible to the concurrent manager after the COMMIT. Otherwise, the concurrent manager will not be able to see the request and will not run it at all - which in effect FND_CONCURRENT.WAIT_FOR_REQUEST will keep on waiting for an nonexistent request and enter an endless loop.

arguments (from source code)

(IN) request_id    - Request ID to wait on
(IN) interval    - time between checks. Number of seconds to sleep (default 60 seconds)
(IN) max_wait    - Max amount of time to wait (in seconds) for request's completion
(OUT) phase         - Request phase (from meaning in fnd_lookups)
(OUT) status        - Request status(for display purposes)
(OUT) dev_phase    - Request phase as a constant string so that it can be used for comparisons
(OUT) dev_status    - Request status as a constatnt string
(OUT) message        - Completion message if request has completed

For instances you want to submit a request from OAF, you can utilize the oracle.apps.fnd.cp.request.ConcurrentRequest class and call its submitRequest method. It completely mirrors FND_REQUEST.SUBMIT_REQUEST arguments, the only thing is that you need to store the parameters inside a Vector (considering the PLSQL defaults the arguments to VARCHAR type, we could safely assume that the parameter Vector should contain String objects)

method signature

public int submitRequest(String ProgramApplication ,
                                      String ProgramName ,
                                      String ProgramDescription ,
                                      String StartTime,
                                      boolean SubRequest,
                                      Vector Parameters) throws RequestSubmissionException

(source)

1 comment:

  1. very useful and informative article. It saved my day !!! thansk a lot for posting this !

    Venki

    ReplyDelete