Monday, 26 June 2017

OAF: The program can't start because MSVCR71.dll is missing from your computer.

In one of my project, in one machine we were not able to open the Jdeveloper  (Version 10.1.3.5 - Patch 19170592 ) which we downloaded from the Metalink Note. This post is to help those who face this issue and don't know what to do to fix this.

OA Framework - How to Find the Correct Version of JDeveloper for OA Extensions to Use with E-Business Suite 11i or Release 12.x (Doc ID 416708.1)

After downloading p19170592_R12_GENERIC.zip, unzipped the contents into C:/oracle/Jdev10.1.3.5. After that when we tried to open the Jdeveloper using C:/oracle/Jdev10.1.3.5/jdevbin/jdev/bin/jdevW.exe, we were getting the below error.

"The program can't start because MSVCR71.dll is missing from your computer. Try reinstalling the program to fix this problem."



Fix:  You just need to copy the msvcr71.dll file from C:/oracle/Jdev10.1.3.5/jdevbin/jdk/bin to C:/oracle/Jdev10.1.3.5/jdevbin/jdev/bin.

After copying the file, Jdeveloper opened successfully.




Feel free to point out if anything is missing/wrong in this blog.

Tuesday, 20 June 2017

Oracle Apps: Query to get the details of a Descriptive Flexfield

The below gives the details of Descriptive Flex Field defined in Oracle eBusiness Suite. This query can be used to find out all the DFF Segments defined for a specific table.

 select dffv.application_table_name          table_name  
       ,dffv.title  
       ,dcont.descriptive_flex_context_code context_code  
       ,dfusg.application_column_name       segment_column  
       ,dfusg.form_left_prompt              segment_window_prompt  
       ,dffv.concatenated_segs_view_name    view_name  
       ,(select x.application_name  
         from fnd_application_vl x  
         where x.application_id = dffv.application_id) application  
       ,dffv.description  
       ,dffv.descriptive_flexfield_name    name  
       ,dffv.context_column_name           structure_column  
       ,dffv.form_context_prompt           prompt  
       ,dffv.default_context_value         default_value  
       ,dffv.default_context_field_name    reference_field  
       ,dffv.context_required_flag         required  
       ,dffv.context_user_override_flag    displayed  
       ,dffv.context_synchronization_flag  synchronize_with_reference  
       ,dcont.descriptive_flex_context_code context_code  
       ,dcont.descriptive_flex_context_name context_name  
       ,dcont.description  
       ,dcont.enabled_flag  
       ,dfusg.column_seq_num           sequence_number  
       ,dfusg.end_user_column_name     segment_name  
       ,dfusg.form_left_prompt         segment_window_prompt  
       ,dfusg.application_column_name  segment_column  
       ,dfusg.enabled_flag  
       ,dfusg.display_flag  
       ,vset.flex_value_set_name      value_set  
       ,vset.*  
 from  apps.fnd_descriptive_flexs_vl     dffv  
      ,apps.fnd_descr_flex_contexts_vl   dcont  
      ,apps.fnd_descr_flex_col_usage_vl  dfusg  
      ,apps.fnd_flex_value_sets          vset  
 where dffv.descriptive_flexfield_name     = dcont.descriptive_flexfield_name  
 and   dcont.descriptive_flexfield_name    = dfusg.descriptive_flexfield_name(+)  
 and   dfusg.flex_value_set_id             = vset.flex_value_set_id(+)  
 and   dcont.descriptive_flex_context_code = dfusg.descriptive_flex_context_code(+)  
 --and  dffv.title LIKE 'Common Lookups'                -- Uncomment and add your DFF Title  
 --and  dffv.application_table_name LIKE 'GL_TAX_CODES' -- Uncomment and add your Table Name  
 order by dffv.application_id  
         ,dffv.title  
         ,dcont.descriptive_flex_context_code  
         ,decode(dfusg.enabled_flag, 'Y', 1, 'N', 2)  
         ,dfusg.column_seq_num  



Feel free to point out if anything is missing/wrong in this blog.

Wednesday, 7 June 2017

Oracle Apps: Query to get the details of a Table Type ValueSet

The below query gives the full details of a Table Type Valueset in Oracle eBusiness. The last column gives the actual query which gets executed by the Valueset.

 select ffvs.flex_value_set_id  
       ,ffvs.flex_value_set_name  
       ,ffvs.description  
       ,decode(ffvs.longlist_flag  
              ,'Y', 'Long List of Values'  
              ,'N', 'List of Values'  
              ,'X', 'Poplist') list_type  
       ,decode(ffvs.security_enabled_flag  
              ,'N' ,'No Security'  
              ,'H' ,'Hierarchical Security'  
              ,'Y' ,'Non-Hierarchical Security') security_type  
       ,decode(ffvs.format_type  
              ,'C' ,'Char'  
              ,'D' ,'Date'  
              ,'T' ,'DateTime'  
              ,'N' ,'Number'  
              ,'X' ,'Standard Date'  
              ,'Y' ,'Standard DateTime'  
              ,'I' ,'Time') format_type  
       ,ffvs.maximum_size  
       ,ffvs.number_precision precision
       ,decode(ffvs.alphanumeric_allowed_flag  
              ,'N', 'Y'  
              ,'Y', 'N') numbers_only  
       ,ffvs.uppercase_only_flag uppercase_only  
       ,ffvs.numeric_mode_enabled_flag right_justify_and_zero_fill  
       ,ffvs.minimum_value min_value  
       ,ffvs.maximum_value max_value  
       ,decode(ffvs.validation_type  
              ,'I' ,'Independent'  
              ,'D' ,'Dependent'  
              ,'N' ,'None'  
              ,'P' ,'Pair'  
              ,'U' ,'Special'  
              ,'F' ,'Table'  
              ,'X' ,'Translatable Independent'  
              ,'Y' ,'Translatable Dependent') validation_type  
       ,(select application_name   
         from fnd_application_vl x   
         where x.application_id = ffvt.table_application_id) table_application  
       ,ffvt.application_table_name table_name  
       ,ffvt.value_column_name  
       ,decode(ffvt.value_column_type  
              ,'V', 'Varchar2'  
              ,'N', 'Number'  
              ,'C', 'Char'  
              ,'D', 'Date') value_column_type  
       ,ffvt.value_column_size  
       ,ffvt.meaning_column_name  
       ,decode(ffvt.meaning_column_type  
              ,'V', 'Varchar2'  
              ,'N', 'Number'  
              ,'C', 'Char'  
              ,'D', 'Date') meaning_column_type  
       ,ffvt.meaning_column_size  
       ,ffvt.id_column_name  
       ,decode(ffvt.id_column_type  
              ,'V', 'Varchar2'  
              ,'N', 'Number'  
              ,'C', 'Char'  
              ,'D', 'Date') id_column_type  
       ,ffvt.id_column_size  
       ,ffvt.additional_where_clause  
       ,ffvt.additional_quickpick_columns  
       ,('select ' ||NVL(value_column_name,NULL)   ||', '  
                   ||NVL(meaning_column_name,NULL) ||', '  
                   ||NVL(id_column_name,NULL)      ||' '||  
         'from '  || ffvt.application_table_name   ||' '||  
         'where ' || decode(upper(substr(ltrim(to_char(ffvt.additional_where_clause)),0,5))  
                           ,'WHERE', substr(to_char(ffvt.additional_where_clause),6)  
                           ,to_char(ffvt.additional_where_clause)) )valueset_query  
 from  apps.fnd_flex_value_sets        ffvs  
      ,apps.fnd_flex_validation_tables ffvt  
 where ffvs.flex_value_set_id = ffvt.flex_value_set_id  
 and   ffvs.flex_value_set_name = 'XXAJ_VALUESET'; -- Replace the valuesetname  

This query is helpful when we need to find out all the value sets which is using a particular profile_option or another valueset or a specific table etc...


Add the below where clause to the above query to find out all the valuesets which uses a specific value in the whereclause.

 and  ffvt.additional_where_clause like '%AJ%'; -- Replace the value with the string you want to search for.  








Feel free to point out if anything is missing/wrong in this blog.

Saturday, 3 June 2017

Oracle Apps: PA_TASKS Hierarchy Query to get all the tasks in Project /Template in the correct order

The below query can be used to get the PA Tasks in a hierarchical order which belongs to a Project/Template which is defined in the Project Accounting Module.

Thanks to Sajeer Omar.

Replace the below hardcoded values before executing :
Project/Template ID

 select x.project_id  
       ,x.task_id  
       ,(lpad(' ',(wbs_level-1)*5,' ')||x.task_number) task_number  
       ,x.parent_task_id  
       ,x.top_task_id  
       ,x.wbs_level  
       ,sys_connect_by_path(x.task_id, '/')  
 from  pa_tasks x  
 where x.project_id = 1 -- Project/Template ID  
 connect by prior x.task_id = x.parent_task_id  
 start with x.parent_task_id is null  
 order by sys_connect_by_path(x.task_id, '/');  


Feel free to point out if anything is missing/wrong in this blog.

Tuesday, 21 March 2017

Oracle Apps: Sample Concurrent Program Shell script to call multiple SQL scripts

In one of my project, the client to wanted to have a Host Concurrent Program, which calls multiple sql statements. It was easy to create one shell script which calls multiple sql statements. But the client wanted the concurrent program to fail (complete in ERROR status), if any of the sql statements fail (not just the last one).

A sample code which we used in this scenario:
 #!/bin/ksh  
 
 #Do whatever you want here  
 echo Connecting to apps...  
 
 sql_output=`sqlplus -s /nolog <<EOF  
 
 connect apps/$PASSWORD  
 
 prompt getting sysdate value into a variable...  
 COLUMN today NOPRINT NEW_VALUE g_today  
 SELECT to_char(sysdate,'DD-MON-YYYY') today  
 FROM dual;  
 
 set serveroutput on size 1000000  
 
 prompt get the count from debug table...  
 select count(*) from xxaj_debug;  
 
 prompt truncate debug table...  
 truncate table xxaj_debug1;  
 
 prompt populate temporary table...  
 insert into xxaj_debug values (xxaj_seq.nextval, 'Anoop', sysdate);   
 
 update xxaj_debug  
 set msg = 'Anoop Johny';  
 
 COLUMN old_count NOPRINT NEW_VALUE g_old_count  
 select count(*) old_count from xxaj_debug;  
 delete from xxaj_debug;  
 
 EOF`  
 
 if [ `echo "$sql_output" | egrep 'ORA-[0-9]{5}:' | wc -l` -ne 0 ]   
 then   
 echo "$sql_output"   
 exit 1   
 else   
 echo "$sql_output"   
 exit 0  
 fi   
The above script with exit with status 0 if every sql statement is success.

Now if any of the statement fails, it will return with status 1.



Feel free to point out if anything is missing/wrong in this blog.

Friday, 17 March 2017

Oracle Apps: Organization Hierarchy Query to get the organizations in a specific Hierarchy

The below query can be used to get the Organizations which belongs to a hierarchy which is defined in the Organization Hierarchy.

Thanks to Sajeer Omar.

Replace the below hardcoded values before executing :
Business group ID
Organization Hierarchy Name
Top Organization Name

If you want to get only the organization as a specific level, uncomment the commented whereclause.
 select (lpad(' ', (lvl - 1) * 5, ' ') || haou_c.name) org_name  
        ,org_hier.*  
 from  hr_all_organization_units haou_c  
      ,(select hier.organization_id_parent  
              ,hier.organization_id_child  
              ,level lvl  
              ,sys_connect_by_path(hier.organization_id_child, '/') org_level  
              ,sys_connect_by_path(level, '/')                      hier_level  
        from  per_org_structure_elements hier  
             ,(select vers.org_structure_version_id  
               from  per_organization_structures_v struct  
                    ,per_org_structure_versions_v  vers  
               where struct.business_group_id = 0 -- Business group ID  
               and  struct.name = 'AJ Hierarchy' -- Organization Hierarchy Name  
               and  struct.organization_structure_id = vers.organization_structure_id  
               and  struct.business_group_id = vers.business_group_id  
               and  SYSDATE BETWEEN vers.date_from and nvl(vers.date_to, sysdate)  
               and  rownum = 1) orgstr  
        where hier.org_structure_version_id = orgstr.org_structure_version_id  
        and  hier.business_group_id = 0 -- Business group ID  
        start with hier.organization_id_parent =  
                                                (select a.organization_id  
                                                 from  hr_all_organization_units a  
                                                 where a.name = 'AJ Pty Ltd (Australia)') -- Top Organization Name  
              and  hier.org_structure_version_id = orgstr.org_structure_version_id  
              and  hier.business_group_id = 0 -- Business group ID  
        connect by prior organization_id_child = organization_id_parent) org_hier  
 where haou_c.organization_id = org_hier.organization_id_child  
 --and  org_hier.lvl = 2 -- If you want to get only a specific level values  
 order by org_hier.org_level;  


Feel free to point out if anything is missing/wrong in this blog.




Tuesday, 7 March 2017

OAF: oracle.apps.fnd.framework.OAException: oracle.jbo.NameClashException: JBO-25001: Name LOV_oracle_apps_xx_xxx_server_XXXXXXXAM of object type ApplicationModule already exists

In one of my project, the client was getting the below error when opening an OA Page. Since the issue was not a straight forward case, I thought of adding the issue to the blogpost.

Error when opening the OA Page:
 oracle.apps.fnd.framework.OAException: oracle.jbo.NameClashException: JBO-25001: Name LOV_oracle_apps_xx_xxx_server_XXXXXXXAM of object type ApplicationModule already exists  
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1247)  
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(OAPageErrorHandler.java:1435)  
         at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2736)  
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1963)  
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:557)  
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:439  
         at _OA._jspService(_OA.java:213)  
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)  
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:390)  
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)  
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)  
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)  
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)  
         at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)  
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)  
         at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:429)  
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:642)  
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:391)  
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:911)  
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:458)  
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)  
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)  
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)  
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)  
         at java.lang.Thread.run(Thread.java:745)  
 ## Detail 0 ##  
 oracle.apps.fnd.framework.OAException: oracle.jbo.NameClashException: JBO-25001: Name LOV_oracle_apps_xx_xxx_server_XXXXXXXAM of object type ApplicationModule already exists  
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:912)  
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1169)  
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(OAPageErrorHandler.java:1435)  
         at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2736)  
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1963)  
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:557)  
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:439)  
         at _OA._jspService(_OA.java:213)  
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)  
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:390)  
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)  
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)  
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)  
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)  
         at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)  
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)  
         at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:429)  
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:642)  
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:391)  
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:911)  
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:458)  
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)  
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)  
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)  
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)  
         at java.lang.Thread.run(Thread.java:745)  
 oracle.apps.fnd.framework.OAException: oracle.jbo.NameClashException: JBO-25001: Name LOV_oracle_apps_xx_xxx_server_XXXXXXXAM of object type ApplicationModule already exists  
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:912)  
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1169)  
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(OAPageErrorHandler.java:1435)  
         at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2736)  
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1963)  
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:557)  
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:439)  
         at _OA._jspService(_OA.java:213)  
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)  
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:390)  
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)  
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)  
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)  
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)  
         at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)  
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)  
         at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:429)  
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:642)  
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:391)  
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:911)  
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:458)  
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)  
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)  
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)  
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)  
         at java.lang.Thread.run(Thread.java:745)  

In this case : 

Problem : The specified AM,  oracle.apps.xx.xxx.server.XXXXXXXAM, ( which was an AM associated with an external LOV region in the page) was substituted in the Application for another page. AM Substitution is like a site level Personalization as it applies to all the pages where the AM is referenced.

Solution : Remove the AM Substitution.

Note: In this specific case, we were able to replace the AM Substitution with just VO Substitution.

I have seen several cases, where AM Substitution is done, things start failing in the page. Especially, if there is a LOV in the page, you might get different types of errors which will be difficult to debug.



Feel free to point out if anything is missing/wrong in this blog.

Saturday, 4 March 2017

PL/SQL: Some helpful SQL queries -2

Continuation of PL/SQL: Some helpful SQL queries -1

#7. How to convert Multiple Columns into Rows (Unpivot multiple columns). 
Source Data


Expected output

 with t as  
 (select '1001' emp_no,'Anoop' emp_first_name, 'Johny' emp_last_name
        ,'Developer' job_role, 'Senior Developer' new_job_role  
        ,'150000'    salary  , '175000'           new_salary 
        ,'Australia' country , 'Australia'        new_country  
  from dual  
  union  
  select '1002' emp_no,'Sajeer' emp_first_name, 'Omar' emp_last_name
       ,'Senior Developer' job_role, 'Developer' new_job_role  
       ,'105000'           salary  , '100000'    new_salary 
       ,'Australia'        country , 'Australia' new_country   
  from dual  
 )
 select (case when row_number() over (partition by emp_no order by emp_no ) = 1    
              then emp_no   
         end) emp_no  
       ,(case when row_number() over (partition by emp_no order by emp_no ) = 1    
              then emp_first_name   
         end) emp_first_name  
       ,(case when row_number() over (partition by emp_last_name order by emp_no ) = 1    
              then emp_last_name   
         end) emp_last_name   
       ,col     detail  
       ,val     old_value  
       ,new_val new_value  
 from t    
 unpivot include nulls ((val,new_val) for col in ((job_role,new_job_role) as 'Job Role'  
                                                 ,(salary,new_salary)     as 'Salary'  
                                                 ,(country,new_country)   as 'Country'));  

Refer:
PIVOT and UNPIVOT Operators in Oracle Database 11g Release 
Pivot and Unpivot


Feel free to point out if anything is missing/wrong in this blog.

Sunday, 26 February 2017

Oracle Apps: How to get Oracle Apps (FND user) password from backend

You can run the below script from backend to retrieve the FND User password from backend.

Create the below packge:
 create or replace package xxaj_get_pwd  
 as  
   function decrypt (key in varchar2, value in varchar2)  
   return varchar2;  
 end xxaj_get_pwd;  
 /  
 create or replace package body xxaj_get_pwd  
 as  
   function decrypt (key in varchar2, value in varchar2)  
   return varchar2  
   as  
    language java  
    NAME 'oracle.apps.fnd.security.WebSessionManagerProc.decrypt(java.lang.String,java.lang.String) return java.lang.String';  
 end xxaj_get_pwd;  
 /  

Execute the below script with the username to get the password.
 select fu.user_name  
       ,xxaj_get_pwd.decrypt ((select xxaj_get_pwd.decrypt (fnd_web_sec.get_guest_username_pwd
                                                           ,usertable.encrypted_foundation_password )  
                               from fnd_user usertable  
                               where usertable.user_name = regexp_substr(fnd_web_sec.get_guest_username_pwd,'(.*)/(.*)',1,1,NULL,1))  
                             ,fu.encrypted_user_password ) password  
 from fnd_user fu  
 where upper(fu.user_name) = upper('<USER_NAME>');  
 /  

Related links :
Oracle Apps: Reset FND User password from backend
Oracle Apps: Create User and Add Responsibility from backend


Feel free to point out if anything is missing/wrong in this blog.



Friday, 10 February 2017

Oracle Apps: Helpful Queries on FND Users / Roles / Menus / Responsibilities

Some queries which will be helpful when querying on User / Responsibility / Menu in Oracle Apps (eBusiness Suite).

#1. Query to get the Menu/Submenu/Function list (prompts) for a responsibility as you see when you login.
 SELECT (lpad(' ', (LEVEL-1) * 5, ' ') || LEVEL)                        lvl  
       ,(lpad(' ', (LEVEL-1) * 5, ' ') || x.entry_sequence)             entry_sequence  
       ,(lpad(' ', (LEVEL-1) * 5, ' ') || x.prompt)                     prompt  
       ,(SELECT (a.user_menu_name || '[' || a.menu_name || ']')  
         FROM   fnd_menus_vl a  
         WHERE  a.menu_id = x.sub_menu_id)                              menu_name  
       ,(SELECT (a.user_function_name || '[' || a.function_name || ']')  
         FROM   fnd_form_functions_vl a  
         WHERE  a.function_id = x.function_id)                          function_name  
       ,x.sub_menu_id  
       ,x.function_id       
       ,x.grant_flag  
 FROM apps.fnd_menu_entries_vl x  
     ,(SELECT a.menu_id  
             ,a.responsibility_id  
       FROM  apps.fnd_responsibility_vl a  
       WHERE UPPER(a.responsibility_name) = UPPER('System Administrator')) y     -- Replace the responsibility based on your requirement  
 START WITH x.menu_id = y.menu_id  
       AND x.prompt IS NOT NULL -- Comment this if you want all the Functions/Menus  
       --Menu/Function Exclusions  
       AND NVL(x.menu_id,-1)     NOT IN (SELECT b.action_id 
                                         FROM   apps.fnd_resp_functions b   
                                         WHERE  b.responsibility_id = y.responsibility_id 
                                         AND    b.rule_type         = 'M')  
       AND NVL(x.sub_menu_id,-1) NOT IN (SELECT b.action_id 
                                         FROM   apps.fnd_resp_functions b   
                                         WHERE  b.responsibility_id = y.responsibility_id 
                                         AND    b.rule_type         = 'M')  
       AND NVL(x.function_id,-1) NOT IN (SELECT b.action_id 
                                         FROM   apps.fnd_resp_functions b   
                                         WHERE  b.responsibility_id = y.responsibility_id 
                                         AND    b.rule_type         = 'F')  
 CONNECT BY PRIOR x.sub_menu_id = x.menu_id  
            AND  x.prompt IS NOT NULL -- Comment this if you want all the Functions/Menus  
            --Menu/Function Exclusions  
            AND  NVL(x.sub_menu_id,-1) NOT IN (SELECT b.action_id 
                                               FROM   apps.fnd_resp_functions b   
                                               WHERE  b.responsibility_id = y.responsibility_id 
                                               AND    b.rule_type            = 'M')  
            AND  NVL(x.function_id,-1) NOT IN (SELECT b.action_id 
                                               FROM   apps.fnd_resp_functions b   
                                               WHERE  b.responsibility_id = y.responsibility_id 
                                               AND    b.rule_type         = 'F')  
 ORDER SIBLINGS BY x.entry_sequence;

#2. Query to get all the Responsibilities associated with a specific User / all the users which have a specific Responsibility 
 SELECT resp_type  
       ,user_id  
       ,user_name  
       ,responsibility_id  
       ,responsibility_name  
       ,start_date  
       ,end_date  
       ,application_short_name  
       ,application_name  
 FROM  (SELECT 'DIRECT' resp_type  
              ,fu.user_id  
              ,fu.user_name  
              ,resp.responsibility_id  
              ,resp.responsibility_name  
              ,frd.start_date  
              ,frd.end_date  
              ,app.application_short_name  
              ,app.application_name  
        FROM  fnd_user                    fu  
             ,fnd_user_resp_groups_direct frd  
             ,fnd_responsibility_vl       resp  
             ,fnd_application_vl          app  
        WHERE fu.user_id            = frd.user_id  
        AND   frd.responsibility_id = resp.responsibility_id  
        AND   resp.application_id   = app.application_id  
        UNION ALL  
        SELECT 'INDIRECT' resp_type  
              ,fu.user_id  
              ,fu.user_name  
              ,resp.responsibility_id  
              ,resp.responsibility_name  
              ,fri.start_date  
              ,fri.end_date  
              ,app.application_short_name  
              ,app.application_name  
        FROM  fnd_user                      fu  
             ,fnd_user_resp_groups_indirect fri  
             ,fnd_responsibility_vl         resp  
             ,fnd_application_vl            app  
        WHERE fu.user_id           = fri.user_id  
        AND  fri.responsibility_id = resp.responsibility_id  
        AND  resp.application_id   = app.application_id)  
 WHERE 1=1  
 AND   user_name           = 'AJTEST'                -- Comment this if you need all user of a responsibility  
 AND   responsibility_name = 'System Administrator'; -- Comment this if you need all responsibilities of a user  



Feel free to point out if anything is missing/wrong in this blog.