Where The Streets Have No Name

Oracle API Availability - Concurrent Program 본문

Developement/DataBase

Oracle API Availability - Concurrent Program

highheat 2008. 11. 9. 10:42
출처 : http://www.oracleappshub.com/api/oracle-api-availability-concurrent-program/

Many times, we need to submit concurrent requests and request sets from non SRS window like operating system or PL/sql . In Oracle Applications there are API’s to take these options. Here are some of the API’s function and usage..

  • FND_REQUEST
    • This API is used Submit concurrent requests from backend. As we know there are couple of options avaible in oracle application to submit a concurrent requset like SRS, CONSCUB and FND’s API. This is API offers some great functionality to use via PL/sql or any other technology like , Host Program or java program.
  • FND_CONCURRENT
    • Retrieve information about concurrent requests
    • Set information about concurrent requests
  • Set_Options ·
    • This is a function of boolen type
    • Set request options
    • This is Call before submitting the request

usage:

FND_REQUEST.SET_OPTIONS(IMPLICIT = > ‘ERROR’);

  • Set_Repeat_Options ·
    • Function, returns TRUE or FALSE
    • Set repeat options
    • Call before submitting the request
  • Set_Print_Options ·
    • Function, returns TRUE or FALSE
    • Set print options (note, some options can not be over-ridden)
    • Call before submitting the request

Called before submitting request if the printing of output has to be controlled with specific printer/style/copies etc., Optionally call for each program in the request set.

Usage :

fnd_submit.set_print_options(NULL,NULL,NULL,TRUE,’N');

or

  • fnd_request.set_print_options (printer =>’<printer name>’,
    style =>’LANDSCAPE’, 
    copies=>1,
    save_output => TRUE,
    print_together => ‘N’)
  • Add_printer
    • Called after set print options to add a printer to the print list.Optionally call for each program in the request set.
    • Returns TRUE on successful completion, and FALSE otherwise

Usage

Function FND_SUBMIT.ADD_PRINTER (printer =>’Printer Name’, 
copies => null) ;

  • Submit_Request
    • Function, returns Request Id or 0·
    • If submitting from a form, all Arguments must be specified
  • Set_Mode (server only)
    • Function, returns TRUE or FALSE
    • Must use if request is submitted from a database trigger.
    • Call before submitting the request
    • Failure in the database trigger call of FND_SUBMIT.SUBMIT_SET does not rollback changes
  • Get_Request_Status
    • Function returns TRUE or FALSE
    • Returns status information in function output parameters
  • Wait_For_Request

When submitting concurrent requests using PL/SQL, it is often desired to have the parent process wait until all the child processes have completed before completing itself.

This function Wait for the request completion, then return the request phase/status and completion message to the caller. Also call sleep between database checks.

  • Function, returns TRUE or FALSE
  • Returns status information in function output parameters

FUNCTION WAIT_FOR_REQUEST (request_id IN number default NULL,
interval IN number default 60, 
max_wait IN number default 0,
phase OUT varchar2,
status OUT varchar2, 
dev_phase OUT varchar2,
dev_status OUT varchar2,
message OUT varchar2) return Boolean;

This API Wait for the request completion, then return the request phase/status and completion message to the caller. Also call sleep between database checks.

  • Arguments (input)
    • request_id :The request ID of the program to wait on.
    • interval :Time to wait between checks. This is the number of seconds to sleep. The default is 60 seconds.
    • max_wait :The maximum time in seconds to wait for the requests completion.
  • Arguments (output) :
    • phase :The user friendly request phase from FND_LOOKUPS.
    • status :The user friendly request status from FND_LOOKUPS.
    • dev_phase :The request phase as a constant string that can be used for program logic comparisons.
    • dev_status :The request status as a constant string that can be used for program logic comparisons.
    • message :The completion message supplied if the request has completed.

Usage

IF request_id = 0 THEN
fnd_file.put_line(fnd_file.log, ‘Request Not Submitted.’);
ELSE

call_status := fnd_concurrent.wait_for_request(request_id, v_interval, v_max_wait, request_phase, request_status, dev_request_phase, dev_request_status, request_status_mesg);

END IF;

IF call_status = TRUE THEN
IF dev_request_phase!= ‘Completed’ OR
dev_request_status IN (’Cancelled’,'Error’,'Terminated’) THEN
DBMS_OUTPUT.PUT_LINE(’STATUS=JOB FAILED’);
END IF;
ELSE
DBMS_OUTPUT.PUT_LINE(’WAIT FOR REQUEST FAILED - STATUS UNKNOWN’);
DBMS_OUTPUT.PUT_LINE(’STATUS=JOB FAILED’);
END IF;

  • Set_Complete_Status (server only)
    • Function, returns TRUE or FALSE
    • Called from a concurrent program to set its own completion status
    • These have three status
      • NORMAL
      • WARNING
      • ERROR
  • Add_notification
    • Called before submission to add a user to the notify list.
    • Optionally call for each program in the reques set.
    • ReturnsTRUE on sucessful completion, and FALSE otherwise.

Usage
FND_SUBMIT.ADD_NOTIFICATION (user ==>’ANAND’) ;

Make sure the name should be from fnd_user table

  • SET_NLS_OPTIONS
    • Called before submitting request to set request attributes.
    • Optionally call for each program in the request set.
    • Returns TRUE on successful completion, and FALSE otherwise.

Usage
FND_SUBMIT.SET_NLS_OPTIONS (language =>’US’,
territory => NULL);