Wednesday, December 26, 2018

Oracle OAF : get OrgId UserName ResponsibilityId UserId

If in Process Form Request
===================================

String userid = String.valueOf(pageContext.getUserId());
String username = pageContext.getUserName();
String respid = String.valueOf(pageContext.getResponsibilityId());
String respname =  pageContext.getResponsibilityName();
String OrganizationId = pageContext.getSessionValue("OrganizationId").toString();
Date currdate=pageContext.getCurrentDBDate();
String rowRef = pageContext.getParameter(EVENT_SOURCE_ROW_REFERENCE);

If Adding in AM
===================================

      OAApplicationModule am = pageContext.getApplicationModule(webBean);
      OAViewObject vo=(OAViewObject)am.findViewObject("CpxReqHVO1");
      OARow row=(OARow)vo.getCurrentRow();
      row.setAttribute("OrgId",pageContext.getProfile("ORG_ID") );

In VO
===================================

   AND ac.org_id = fnd_global.org_id


Following are the FND_PROFILE values that can be used in the PL/SQL code:

   fnd_profile.value('PROFILEOPTION');
   fnd_profile.value('MFG_ORGANIZATION_ID');
   fnd_profile.value('ORG_ID');
   fnd_profile.value('LOGIN_ID');
   fnd_profile.value('USER_ID');
   fnd_profile.value('USERNAME');
   fnd_profile.value('CONCURRENT_REQUEST_ID');
   fnd_profile.value('GL_SET_OF_BKS_ID');
   fnd_profile.value('SO_ORGANIZATION_ID');
   fnd_profile.value('APPL_SHRT_NAME');
   fnd_profile.value('RESP_NAME');
   fnd_profile.value('RESP_ID');

Following are the FND_GLOBAL values that can be used in the PL/SQL code:

   FND_GLOBAL.USER_ID;
   FND_GLOBAL.APPS_INTIALIZE;
   FND_GLOBAL.LOGIN_ID;
   FND_GLOBAL.CONC_LOGIN_ID;
   FND_GLOBAL.PROG_APPL_ID;
   FND_GLOBAL.CONC_PROGRAM_ID;
   FND_GLOBAL.CONC_REQUEST_ID;

For example, I almost always use the following global variable assignments in my package specification to use throughout the entire package body:

   g_user_id      PLS_INTEGER  :=  fnd_global.user_id;
   g_login_id     PLS_INTEGER  :=  fnd_global.login_id;
   g_conc_req_id  PLS_INTEGER  :=  fnd_global.conc_request_id;
   g_org_id       PLS_INTEGER  :=  fnd_profile.value('ORG_ID');
   g_sob_id       PLS_INTEGER  :=  fnd_profile.value('GL_SET_OF_BKS_ID');

And initialize the application environment as follows:

   v_resp_appl_id  := fnd_global.resp_appl_id;
   v_resp_id       := fnd_global.resp_id;
   v_user_id       := fnd_global.user_id;
   


 FND_GLOBAL.APPS_INITIALIZE(v_user_id,v_resp_id, v_resp_appl_id);

Reference :- https://docs.oracle.com/cd/E18727_01/doc.121/e12897/T302934T462356.htm

VariableDescription
USER_IDThe USER_ID number
RESP_IDThe ID number of the responsibility
RESP_APPL_IDThe ID number of the application to which the responsibility belongs

   

No comments:

Post a Comment