Sample PLSQL Code to Call Submit Program using FND_SUBMIT API


I am sure you like to test your program or need to run them in batch mode/ back end. here is a sample, you can use them using sql*plus or any editor.

This sample code will call "Submit Accounting" (Program short name is "ARACCPB ") in Release 12 using FND_REQUEST.SUBMIT_REQUEST API
Submit Accounting will in turn spawn Create Accounting (XLAACCPB) which will create Accounting for Entities as on a given date,calls Accounting Program (XLAACCUP ) and can transfer the data to GL (based on parameters).
This will help users to use this code to control the Accounting process programmatically.

First find out user_id and RESPONSIBILITY_ID through which you will submit the program to set the context :

SELECT USER_ID,RESPONSIBILITY_ID,RESPONSIBILITY_APPLICATION_ID,
SECURITY_GROUP_ID
FROM FND_USER_RESP_GROUPS
WHERE USER_ID = (SELECT USER_ID
FROM FND_USER
WHERE USER_NAME = ‘&user_name’)
AND RESPONSIBILITY_ID = (SELECT RESPONSIBILITY_ID
FROM FND_RESPONSIBILITY_VL
WHERE RESPONSIBILITY_NAME = ‘&resp_name’);

 

 

DECLARE

v_request_id VARCHAR2(100) ;
BEGIN

— Fnd_Global.apps_initialize(userId,responsibilityId,applicationId)
— replace the following code with correct value as get from sql above

Fnd_Global.apps_initialize(1012178,50559,222);
v_request_id := FND_REQUEST.SUBMIT_REQUEST (‘AR’, — Application short name
‘ARACCPB’, — Program short name
”, — description (Not require)
”, — start_time (start immediately)
FALSE,– sub_request (default FALSE)
— Next is the parameters list of ARACCPB
‘S’, — 1st parameter (Print Format = Summary)
2, — 2nd paramter Maximum Number of Workers
60, — Interval(default value 60)
180, — Max wait (default value 180)
”, — p_request_id (default NULL)
”, — p_entity_id (default NULL)
222, — p_src_app (222 is Application id for AR)
222, — p_app (222 is Application id for AR)
‘Y’, — Dummy Parameter 0
1, — Ledger_id of Vision Operations
”, — Process Category NULL
to_char(sysdate,’YYYY/MM/DD HH24:MI:SS’), — End date
‘Y’, — Create Accounting (Y:Yes / N:No)
‘Y’, — Dummy Parameter 1
‘F’, –Accounting Mode (F:Final / D:Draft)
‘Y’, — Dummy Parameter 2
‘N’, –Errors Only No
‘S’, — Report (S:Summary / D:Detail / N:No Report)
‘Y’, — Transfer to GL (Y:Yes / N:No)
‘Y’, –Dummy Parameter 3
‘Y’, — Post to GL (Y:Yes / N:No)
”, — GL Batch Name
2, –Mixed Currency Precision
”, — Valuation Method (default NULL)
”, — (default NULL)
”, — (default NULL)
”, — (default NULL)
”, — (default NULL)
”, — (default NULL)
”, — (default NULL)
‘N’, — User Transaction Identifiers flag
‘No’, — Translated value for ‘Include User Transaction Identifiers’ flag
‘N’, — P_DEBUG_FLAG
CHR(0) — End of parameters

);
dbms_output.put_line(‘Request submitted. ID = ‘ || v_request_id);
commit ;
exception
when others then
dbms_output.put_line(‘Request set submission failed – unknown error: ‘ || sqlerrm);
END;
/

You may get output with the request Id as
Request submitted. ID = 4559840
In case of error/failure, you will get sql error message.

One thought on “Sample PLSQL Code to Call Submit Program using FND_SUBMIT API

Want to give some comment to author ( Shivmohan Purohit )

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s