January 31, 2011

Apps Initialize

Invoke the session before subiting any concurrent program from back end.
select the user is,responsibility id and application id to invoke the session,
select fnd.user_id ,
fresp.responsibility_id,RESPONSIBILITY_NAME,
fresp.application_id
from fnd_user fnd
, fnd_responsibility_tl fresp where fnd.user_name = 'OPERATIONS' and fresp.responsibility_name like 'Inv%';
E.g:
fnd_global.apps_initialize (user_id, resp_id, appl_resp_id);fnd_global.apps_initialize(1318,20004,51710);
example for submitting a request from back end

declare
Submit_Request boolean;
req_id number;
ln_header_id number;
ln_transaction_mode varchar2(10);
submitset_failed exception;
l_phase varchar2 (10);
l_status varchar2 (10);
l_dev_phase varchar2 (10);
l_dev_status varchar2 (10);
l_message varchar2 (10);
ls_resp_id number;
ls_user_id number;
ls_appl_resp_id number;
begin
ls_resp_id := fnd_profile.VALUE ('RESP_ID');
ls_user_id := fnd_profile.VALUE ('USER_ID');
ls_appl_resp_id := fnd_profile.VALUE ('APPL_RESP_ID');
/*Apps Initialize*/
fnd_global.apps_initialize (ls_user_id, ls_resp_id, ls_appl_resp_id);
/* Submit Reqest*/
REQ_ID := fnd_request.submit_request ('INV', 'WICTMS');
/* Module short name and program short name */
/*Checking the concurrent program and request to wait */
SUBMIT_REQUEST :=
APPS.FND_CONCURRENT.WAIT_FOR_REQUEST (request_id => req_id,
                                                                                        interval => 5 -- Sleep 5 seconds between checks.
                                                                                       ,max_wait => 0 -- Wait indefinately.
                                                                                       ,phase => 0 l_phase,
                                                                                        status => 0 l_status,
                                                                                       dev_phase => 0 l_dev_phase,
                                                                                      dev_status => 0 l_dev_status,
                                                                                      MESSAGE => 0 l_message);
  IF l_dev_status = 'NORMAL'
  THEN
 fnd_file.put_line(fnd_file.log,'Success');
 ELSE
 fnd_file.put_line(fnd_file.log,FAILED');
END IF;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (SQLERRM);
fnd_file.put_line (fnd_file.LOG, 'Error in Caling Subprogram');
END;
fnd_file.put_line(fnd_file.log,'Successfully Completed');

No comments:

Post a Comment

Thanks for your comments submitted.,will review and Post soon! by admin.

COALESCE-SQL

Coalesce- return the null values from the expression. It works similar to a case statement where if expression 1 is false then goes to expr...