How to use APPS_INITIALIZE

How to use APPS_INITIALIZE
------------------------------------------------------------------------------------------------------------------------


What is APPS_INITIALIZE :- 
FND_GLOBAL.APPS_INITIALIZE is used for proving the environment where we can initialize the session before calling any public or private API's in Oracle Ebusiness Suite.
also, we are able to use all profile option which oracle provide from the frontend.


SYNTAX:- 

fnd_global.APPS_INITIALIZE
(
user_id=>l_user_id,  /* l_user_id is the fnd user ID */
resp_id=>l_resp_id,  /* l_resp_id is the responsibility ID */
resp_appl_id=>l_resp_appl_id /* l_resp_appl_id is the responsibility application ID */
);

-----------------------------------------------------------------------------------------------------------------------

 Environment Values:- 

fnd_profile
fnd_profile.VALUE('PROFILEOPTION')
fnd_profile
fnd_profile.VALUE('MFG_ORGANIZATION_ID')
fnd_profile
fnd_profile.VALUE('ORG_ID')
fnd_profile
fnd_profile.VALUE('LOGIN_ID')
fnd_profile
fnd_profile.VALUE('USER_ID')
fnd_profile
fnd_profile.VALUE('USERNAME')
fnd_profile
fnd_profile.VALUE('CONCURRENT_REQUEST_ID')
fnd_profile
fnd_profile.VALUE('GL_SET_OF_BKS_ID')
fnd_profile
fnd_profile.VALUE('SO_ORGANIZATION_ID')
fnd_profile
fnd_profile.VALUE('APPL_SHRT_NAME')
fnd_profile
fnd_profile.VALUE('RESP_NAME')
fnd_profile
fnd_profile.VALUE('RESP_ID')
fnd_profile
fnd_profile.VALUE('PER_BUSINESS_GROUP_ID')
fnd_profile
fnd_profile.VALUE('GL_SET_OF_BKS_ID')
fnd_profile
fnd_profile.VALUE('CURRENT_ORG_CONTEXT')


fnd_global
fnd_global.USER_ID
fnd_global
fnd_global.USER_NAME
fnd_global
fnd_global.RESP_ID
fnd_global
fnd_global.RESP_NAME
fnd_global
fnd_global.APPLICATION_NAME
fnd_global
fnd_global.APPLICATION_SHORT_NAME
fnd_global
fnd_global.RESP_APPL_ID
fnd_global
fnd_global.BASE_LANGUAGE
fnd_global
fnd_global.CONC_LOGIN_ID
fnd_global
fnd_global.CONC_PRIORITY_REQUEST
fnd_global
fnd_global.CONC_PROCESS_ID
fnd_global
fnd_global.CONC_PROGRAM_ID
fnd_global
fnd_global.CONC_QUEUE_ID
fnd_global
fnd_global.CONC_REQUEST_ID
fnd_global
fnd_global.CURRENT_LANGUAGE
fnd_global
fnd_global.CUSTOMER_ID
fnd_global
fnd_global.EMPLOYEE_ID
fnd_global
fnd_global.FORM_APPL_ID
fnd_global
fnd_global.FORM_ID
fnd_global
fnd_global.GET_SESSION_CONTEXT
fnd_global
fnd_global.LANGUAGE_COUNT
fnd_global
fnd_global.LOGIN_ID
fnd_global
fnd_global.NEWLINE
fnd_global
fnd_global.NLS_DATE_FORMAT
fnd_global
fnd_global.NLS_DATE_LANGUAGE
fnd_global
fnd_global.NLS_LANGUAGE
fnd_global
fnd_global.NLS_NUMERIC_CHARACTERS
fnd_global
fnd_global.NLS_SORT
fnd_global
fnd_global.NLS_TERRITORY
fnd_global
fnd_global.ORG_ID
fnd_global
fnd_global.ORG_NAME
fnd_global
fnd_global.PARTY_ID
fnd_global
fnd_global.PER_BUSINESS_GROUP_ID
fnd_global
fnd_global.PER_SECURITY_PROFILE_ID
fnd_global
fnd_global.PROG_APPL_ID
fnd_global
fnd_global.QUEUE_APPL_ID
fnd_global
fnd_global.RT_TEST_ID
fnd_global
fnd_global.SECURITY_GROUP_ID
fnd_global
fnd_global.SERVER_ID
fnd_global
fnd_global.SESSION_ID
fnd_global
fnd_global.SUPPLIER_ID
fnd_global
fnd_global.TAB


Frontend:-



CREATE OR REPLACE PROCEDURE XXSD_APPS_INITIALIZE_PROC  (
ERRBUF    OUT   VARCHAR2,
RETCODE   OUT   NUMBER
) AS

BEGIN

fnd_file.put_line (fnd_file.log,(' User_id :- '|| FND_GLOBAL.USER_ID));
fnd_file.put_line (fnd_file.log,(' Application_id:- '||FND_GLOBAL.RESP_APPL_ID));
fnd_file.put_line (fnd_file.log,(' Responsibility_id :- '|| FND_GLOBAL.RESP_ID));

fnd_file.put_line (fnd_file.log,(' (P) Business_Group_id:- '||fnd_profile.VALUE('PER_BUSINESS_GROUP_ID')));
fnd_file.put_line (fnd_file.log,(' (P) User_id :- '|| fnd_profile.VALUE('USER_ID')));
fnd_file.put_line (fnd_file.log,(' (P) User_Name :- '|| fnd_profile.VALUE('USERNAME')));
fnd_file.put_line (fnd_file.log,(' (P) Responsibility_id :- '|| fnd_profile.VALUE('RESP_ID')));
fnd_file.put_line (fnd_file.log,(' (P) Responsibility_Name :- '|| fnd_profile.VALUE('RESP_NAME')));

END;







Log:-
XXSD_APPS_INITIALIZE_PROC: XXSD APPS INITIALIZE PROGRAM
+---------------------------------------------------------------------------+

Current system time is 11-AUG-2019 11:23:37

+---------------------------------------------------------------------------+

**Starts**11-AUG-2019 11:23:38
**Ends**11-AUG-2019 11:23:38
+---------------------------------------------------------------------------+
Start of log messages from FND_FILE
+---------------------------------------------------------------------------+
 User_id :- 15790
 Application_id:- 0
 Responsibility_id :- 20419

 (P) Business_Group_id:- 81
 (P) User_id :- 15790
 (P) User_Name :- DEVELOPER
 (P) Responsibility_id :- 20419
 (P) Responsibility_Name :- Application Developer

+---------------------------------------------------------------------------+

Backend:-

create or replace PROCEDURE XXSD_REPORT_SUBMIT_PROC (
      errbuf               OUT   NUMBER,
      retcode              OUT   VARCHAR2) AS

--DECLARE
      l_request_id         NUMBER;
      v_phase              VARCHAR2 (20);
      v_dev_phase          VARCHAR2 (20);
      v_dev_status         VARCHAR2 (20);
      v_message            VARCHAR2 (20);
      v_wait_status        VARCHAR2 (20);
      l_return_status      BOOLEAN;
      e_submit_error       EXCEPTION;
      e_program_status     EXCEPTION;
      e_program_status1    EXCEPTION;
      v_lay                BOOLEAN;


BEGIN

--FND_GLOBAL.APPS_INITIALIZE(
--      user_id      => 15790  /* USER_ID  => DEVELOPER*/
--   ,  resp_id      => 20419  /* RESPONSIBILITY_ID => Application Developer*/
--   ,  resp_appl_id => 0  /* APPLICATION_ID => Application Object Library */
--        );

FND_GLOBAL.APPS_INITIALIZE(
      user_id      => 1147  /* USER_ID => MANISH.KUMAR*/
   ,  resp_id      => 20639  /* RESPONSIBILITY_ID =>   Payables Manager*/
   ,  resp_appl_id => 200  /* APPLICATION_ID  => Payables*/
        );



                                    
         l_request_id :=
         fnd_request.submit_request
                            (application       => 'XXSD',
                             program          => 'XXSD_APPS_INITIALIZE_PROC',
                             description       => 'XXSD_APPS_INITIALIZE_PROC',
                             start_time        => SYSDATE,
                             sub_request     => FALSE
                            );

         COMMIT;


         IF l_request_id = 0  THEN
            fnd_file.put_line (fnd_file.LOG, 'Request Not Submitted');
         ELSIF l_request_id != 0
         THEN
            fnd_file.put_line (fnd_file.LOG,  'Request Submitted : ' || l_request_id );
         fnd_file.put_line (fnd_file.LOG,'(XXSD APPS INITIALIZE PROGRAM ) || '|| v_dev_phase||' With '||v_dev_status);                    

         END IF;      


EXCEPTION WHEN OTHERS  THEN

fnd_file.put_line (fnd_file.LOG, 'Errored In exception'||SQLERRM);
END;



------------------------------  Submit Program -------------------------------

declare
V_CODE VARCHAR2(100);
V_ERROR VARCHAR2(100);
V_DEPT_NO NUMBER:= 10;
begin
XXSD_REPORT_SUBMIT_PROC(V_CODE, V_ERROR);
end;


Program LOG:-


XXSD_APPS_INITIALIZE_PROC: XXSD APPS INITIALIZE PROGRAM
+---------------------------------------------------------------------------+
 
Current system time is 11-AUG-2019 11:24:50
 
+---------------------------------------------------------------------------+
 
**Starts**11-AUG-2019 11:24:50
**Ends**11-AUG-2019 11:24:50
+---------------------------------------------------------------------------+
Start of log messages from FND_FILE
+---------------------------------------------------------------------------+
 User_id :- 1147
 Application_id:- 200
 Responsibility_id :- 20639
 
 (P) Business_Group_id:- 81
 (P) User_id :- 1147
 (P) User_Name :- MANISH.KUMAR
 (P) Responsibility_id :- 20639
 (P) Responsibility_Name :- Payables Manager
 
+---------------------------------------------------------------------------+










Comments

Post a Comment

Popular posts from this blog

E-Text Report In Fusion | Types of E-Text reports

Supplier API's

How to pass default Parameter in cursor