Showing posts with label concurrent program from backend. Show all posts
Showing posts with label concurrent program from backend. Show all posts

Tuesday, 8 August 2017

Get Concurrent Program Request Status and Wait For Request completion

FND_CONCURRENT.GET_REQUEST_STATUS

This API Returns the Status of a concurrent request. It also returns the completion text if the request is already completed. The return type is Boolean (Returns TRUE on successful retrieval of the information, FALSE otherwise).
function get_request_status(request_id     IN OUT NOCOPY number,
                    appl_shortname IN varchar2 default NULL,
                    program        IN varchar2 default NULL,
                    phase      OUT NOCOPY varchar2,
                    status     OUT NOCOPY varchar2,
                    dev_phase  OUT NOCOPY varchar2,
                    dev_status OUT NOCOPY varchar2,
                    message    OUT NOCOPY varchar2) return boolean;
The parameters are:
  • REQUEST_ID: Request ID of the program to be checked.
  • APPL_SHORTNAME: Short name of the application associated with the program. The default is NULL.
  • PROGRAM: Short name of the concurrent program. The default is NULL.
  • PHASE: Request phase.
  • STATUS: Request status.
  • DEV_PHASE: Request phase as a string constant.
  • DEV_STATUS: Request status as a string constant.
  • MESSAGE: Request completion message.

FND_CONCURRENT.WAIT_FOR_REQUEST

This API waits for the request completion, then returns the request phase/status and completion message to the caller. It goes to sleep between checks for the request completion. The return type is Boolean (Returns TRUE on successful retrieval of the information, FALSE otherwise).

function wait_for_request(request_id IN number default NULL,
        interval   IN  number default 60,
        max_wait   IN  number default 0,
        phase      OUT NOCOPY varchar2,
        status     OUT NOCOPY varchar2,
        dev_phase  OUT NOCOPY varchar2,
        dev_status OUT NOCOPY varchar2,
        message    OUT NOCOPY varchar2) return  boolean;
The parameters are:
  • REQUEST_ID: Request ID of the request to wait on. The default is NULL.
  • INTERVAL: Number of seconds to wait between checks. The default is 60 seconds.
  • MAX_WAIT: Maximum number of seconds to wait for the request completion. The default is 00 seconds.
  • PHASE: User-friendly Request phase.
  • STATUS: User-friendly Request status.
  • DEV_PHASE: Request phase as a constant string.
  • DEV_STATUS: Request status as a constant string.
  • MESSAGE: Request completion message.
There are few other useful apis too.
  • FND_CONCURRENT.SET_COMPLETION_STATUS: Called from a concurrent request to set its completion status and message.
  • FND_CONCURRENT.GET_REQUEST_PRINT_OPTIONS: Returns the print options for a concurrent request.
  • FND_CONCURRENT.GET_SUB_REQUESTS: Get all sub-requests for a given request id. For each sub-request it provides request_id, phase,status, developer phase , developer status and completion text.
  • FND_CONCURRENT.Cancel_Request: It cancels a given Concurrent Request.

For Detailed information of the above requests you can open the package FND_CONCURRENT in your instance.

Thursday, 3 August 2017

Submit Concurrent Program From Back-end in Oracle Apps

You can submit concurrent Program from backend in oracle apps using below script. There are mandatory parameters you need to pass for the standard procedure and Concurrent program parameters can be passed with arguments.

For examples:- argument1 will be first parameter for you concurrent program, the similar way argument2 will be second parameter of your concurrent program and So On.


Script :-

DECLARE
l_conc_request_id   fnd_concurrent_requests.request_id;      -- This is OUT parameter
l_program                VARCHAR2(30);                                  -- This concurrent program short name
l_application            VARCHAR2(10);                -- Application name like AR, OM
l_description            VARCHAR2(40);     -- Description of your program
l_patameter1            VARCHAR2(20);   -- first parameter
l_parameter2            VARCHAR2(20);   --second parameter

BEGIN

l_conc_request_id := fnd_request.submit_request
            (
                application => l_application,
                program     => l_program,
                description =>l_description,
                start_time  => null,
                sub_request => false,                                   -- False as its not a subrequest
                argument1   => l_patameter1,
                argument2   => l_patameter2
            );

COMMIT;

EXCEPTION

WHEN OTHERS THEN
dbms_output.put_line ('Exception' || SQLERRM);

END;