Sunday 3 June 2012

Tables that stores the OAF data.

JDR_UTILS PL/SQL package supports the MDS repository and can be used to query and maintain the repository.
Now let’s see how, all that is mentioned above, happens.
MDS repository has 4 tables in all. Just 4 tables? Yes you heard it right it has only 4 tables and that’s it. These 4 tables can manage all the stuff that we have discussed till now.
These 4 tables are:
1. JDR_PATHS: Stores the path of the documents, OA Framework pages and their parent child relationship.
2. JDR_COMPONENTS: Stores components on documents and OA Framework pages.
3. JDR_ATTRIBUTES: Stores attributes of components on documents and OA Framework pages.
4. JDR_ATTRIBUTES_TRANS: Stores translated attribute values of document components or OA framework pages.

How MOAC impacts the way we work in TOAD



11i
To set the Org id in TOAD
1. Get the Org_id from HR_ORGANIZATION_UNITS

2. In toad execute the below code
        begin
        fnd_client_info.set_org_context(&org_id);
        end;


To set the responsibility context in TOAD
1. Get the User id, Responsibility Id and Application id from Front end
    Help>Diagnostic>Examine and select BLOCK as "$PROFILES$" and then get the respective IDS

2. Using the IDs execute the below code in TOAD

      begin
      FND_GLOBAL.APPS_INITIALIZE(user_id in number,resp_id in number,resp_appl_id in number);
      end;

R12:
To set the Org id in TOAD
1. Get the Org_id from HR_ORGANIZATION_UNITS

2. In toad execute the below code
    --Sets the 201 as single Org id
    exec MO_GLOBAL.SET_POLICY_CONTEXT('S',201);
    Pass a value "S" in case you want your current session to work against Single ORG_ID
    Pass a value of "M" in case you want your current session to work against multiple ORG_ID's

To set the responsibility context and initiate MOAC in TOAD
1. Get the User id, Responsibility Id and Application id from Front end
     Help>Diagnostic>Examine and select BLOCK as "$PROFILES$" and then get the respective IDS

2. Using the IDs execute the below code in TOAD

       a. exec  FND_GLOBAL.INITIALIZE
          This will set your responsibility id, user_id etc

       b. call MO_GLOBAL.INIT('AR')
           This will read the MO profile option values for your responsibility/user, and will initialize the Multi
            Org Access.
        
MOAC for table access
In 11i _ALL Tables where non Org specific and Org specific views were created on these tables.
But in R12 its different concept
   a. For the table AP_INVOICES_ALL a synonym  AP_INVOICES_ALL is created in APPS.

  b. Also another synonym AP_INVOICES is created which refers to AP_INOICES_ALL.

 c. A Row Level security is applied to AP_INVOICES, using package function 
     MO_GLOBAL.ORG_SECURITY.
    This can be double-checked by running SQL select * from all_policies where
    object_name='AP_INVOICES'

e. The effect of this policy is that,whenever you access AP_INVOICES, Oracle RLS will dynamically
    append WHERE CLAUSE similar to below

    SELECT * FROM AP_INVOICES
    WHERE EXISTS (SELECT 1 FROM mo_glob_org_access_tmp oa WHERE oa.organization_id =
     org_id)

How to Enable "About the Page" in Oracle Application?


In order to enable "About the Page" in Oracle Application following profile needs to be set to Yes.

Profile name : "FND: Diagonistics"

Better try setting the above profile from Functional Administrator.

How to Submit A XML Publisher Report from Script

Follow the steps to Submit A XML Publisher Report from Script

1. Select and assign the layout before submitting the request as below.
l_attached := fnd_request.add_layout ( template_appl_name => 'XXXX'
,template_code => 'MFG_LABEL_PRN'
,template_language => 'US'
,template_territory => 'en'
,output_format => 'PDF'
);

2. Call the Submit_Request API next.
ln_req_id := fnd_request.submit_request (
'mfg', 'MFG_LABEL_PRN ', 'MFG Label', TO_CHAR(SYSDATE), TRUE);

How to switch on Diagnostics for Trace in OAF Pages?


Kindly follow the below steps for specific user who can reproduce the issue and provide the logs and trace files :
- Using System Administrator responsibility, set profile options at the user level:
FND: Debug Log Enabled : Yes
FND: Debug Log Filename : leave it as null
FND: Debug Log Level : Statement
FND: Debug Log Module : %
FND: Diagnostics = Yes
Click on Diagnostics Link on the top of the page and then select the option : set trace level , and then click

Friday 1 June 2012

Set Environment Variable for VO /AM (jpx import)


  1. Right-click My Computer -> Propoerties -> Advanced -> Environment Variables
  • If you already have one called JDEV_USER_HOME, update the value to C:\JDEVOAFR12\jdevhome\jdev
  •  
  •  
  • and jpx import command use from putty root as follow  (write in one line )
  • oracle.jrad.tools.xml.importer.JPXImporter $JAVA_TOP/Extend/oracle/apps/FND/application/server/Extend.jpx -username apps -password apps -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xx.xx.com)(PORT=1525))(CONNECT_DATA=(SID=DEV)))"

OAF Page To register in Oracle apps

1)CREATE THE OAF PAGE IN THE SPECIFIC PACKAGE AND THE RUN THE PAGE ON LOCAL
 MACHINE INSTANCE
2)COPY THE SPECIFIC PACKAGE FROM SPECIFIC DIRECTORY(MYCLASS DIRECTORY)

(WE REQIURED THE CLASS FILE SO COPY THE DIRECTORY FROM MYCLASS PACKAGE)
 TO THE
/u03/DEV/devcomn/java/mansoft/oracle/apps


3)THEN IMPORT THE XML PAGE FORM OUR COMMAND PROMT AND FROM BIN OF JDEV JAVADEVELOPER9I
LIKE

import D:\JDEVELOPER9i\jdevbin\jdev\myprojects\mansoft\oracle\apps\per\selfservice\lovdemo1\lov\webui\region1.xml
 -username apps -password apps -rootdir D:\JDEVELOPER9i\jdevbin\jdev\myprojects\
-dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.125.125.10)(PORT=1541))(CONNECT_DATA=(SID=DEV)))"


OR  IN ONE LINE only it will takeee it is right oneeee
import D:\JDEVELOPER9i\jdevbin\jdev\myprojects\mansoft\oracle\apps\per\selfservice\lovdemo1\lov\webui\region1.xml -username apps -password apps -rootdir D:\JDEVELOPER9i\jdevbin\jdev\myprojects\ -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.125.125.10)(PORT=1541))(CONNECT_DATA=(SID=DEV)))"


4)REGISTER THE XML PAGE AS FORM FUNCTION.IN AOL......WITH PROPERTY TYPE AS---
-----SSWA jsp function

   AND WEB HTML CALL AS
  OA.jsp?page=/mansoft/oracle/apps/per/atestassociation/webui/ForFileUploadPG

import D:\JDEVELOPER9i\jdevbin\jdev\myprojects\mansoft\oracle\apps\per\atestassociation\webui\ForFileUploadPG.xml -username apps -password apps -rootdir D:\JDEVELOPER9i\jdevbin\jdev\myprojects\ -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.125.125.10)(PORT=1524))(CONNECT_DATA=(SID=FAUAT)))"
 ATTACH THIS FORM FUNCTION TO MENU AND MENU TO RESPOSIBILITY AND RESPOSIBILITY TO USER
AND RUN THE FORM ON AOL

mansoft\oracle\apps\per\atestassociation\webui

5)TIP TO REMEMBER

ALWAYS IMPORT THE LOV REGIN ALSO TO RUN THE OAF PAGE

User Hook



Overview

1.     API User Hooks allow users to extend the business logic of the standard business rules that are executed by APIs. This is done by allowing custom procedures to be called at specific points in the standard APIs. For instance, we are implement User Hooks for extending the validation of data beyond what the standard system has provided.

Steps for Implementing User Hooks

 


1.     Choose the API you wish to hook some extra logic to.
2.     Write the PL/SQL procedure that you wish to be called by the hook.
3.     Register or associate the procedure you have written with one or more specific user hooks.
4.     Run the pre-processor program which builds the logic to execute your PL/SQL procedure from the hook specified in 3. 


Example

1.     If validations need to be done on Person Extra Information when the information is created then we need to check the availability of module_name called as CREATE%PERSON%EXTRA%INFO% 
OR we need to guess related API in all_objects
SELECT *
  FROM  hr_api_modules
WHERE  api_module_type = 'BP'
     AND  module_name LIKE 'CREATE%PERSON%EXTRA%INFO%'
OR
select * from all_objects where object_name like '%PERSON%EXTRA%API'  
 

2.     If module exist we need to find out it’s module_id and related hook_ids

SELECT  ahk.api_hook_id,ahm.api_module_id, ahk.hook_package, ahk.hook_procedure,    ahk.api_hook_type, ahm.api_module_type
  FROM  hr_api_hooks ahk, hr_api_modules ahm
 WHERE ahm.module_name = 'CREATE_PERSON_EXTRA_INFO'
     AND  ahm.api_module_type in('BP')
     AND  ahk.api_hook_type in('AP','BP')
     AND  ahk.api_module_id = ahm.api_module_id



Query Result :
API_HOOK_ID
API_MODULE_ID
HOOK_PACKAGE
HOOK_PROCEDURE
API_HOOK_TYPE
API_MODULE_TYPE
2759
1226
HR_PERSON_EXTRA_INFO_BK1
CREATE_PERSON_EXTRA_INFO_A
AP
BP
2758
1226
HR_PERSON_EXTRA_INFO_BK1
CREATE_PERSON_EXTRA_INFO_B
BP
BP

Here BP – Before Process and AP – After Process
The 2 Business Process hook and 3 Row Handler Hooks available:
Before Process – These hooks execute logic before the main API logic. The majority of validation will not have taken place. No database changes will have been made.
After Process  – These hooks will execute after the main API validation has completed and database changes made. If the main validation failed then the user hook will not be called.
The 3 types of Row Handler (RH) hook available are:
§  After Insert
§  After Update
§  After Delete


3.     Usually we use After Process. (say : CREATE_PERSON_EXTRA_INFO_A)

4.     Create Custom Package and procedure code

 CREATE OR REPLACE PACKAGE ak_user_hook_leave_return_pkg
IS
 PROCEDURE Air_ticket_request (p_person_id          IN NUMBER,
                                                 p_information_type   IN VARCHAR2,
                                      p_pei_information1   IN VARCHAR2);   
 END ak_user_hook_leave_return_pkg;

Note : While creating Custom procedure pass the parameters which are present in standard procedure
Parameters in procedure Air_ticket_request should match with parameters in CREATE_PERSON_EXTRA_INFO_A.
Due to this standard procedure CREATE_PERSON_EXTRA_INFO_A passes values like p_person_id, p_information_type, p_pei_information1 dynamically to our custom procedure Air_ticket_request.




5.    Registering the User Hook

DECLARE
   l_api_hook_call_id        NUMBER;
   l_object_version_number   NUMBER;
BEGIN
   hr_api_hook_call_api.create_api_hook_call (
      p_validate                => FALSE,
      p_effective_date          => TO_DATE (sysdate),
      p_api_hook_id             => 2759,                                                  ---from point 2
      p_api_hook_call_type      => 'PP',
      p_sequence                => 3000,
      p_enabled_flag            => 'Y',
      p_call_package            => 'XX_USER_HOOK_PKG', ---our custom package
      p_call_procedure          => ‘XXAIR_TICKET_REQ',                       ---our custom procedure
      p_api_hook_call_id        => l_api_hook_call_id,
      p_object_version_number   => l_object_version_number);
END;

Delete User Hook created (Use when required)

DECLARE
   l_api_hook_call_id        NUMBER := 1210;           --pass appropriate  value  

   l_object_version_number   NUMBER := 27;          --pass appropriate  value
BEGIN
   hr_api_hook_call_api.delete_api_hook_call (
      p_validate                => FALSE,
      p_api_hook_call_id        => l_api_hook_call_id,
      p_object_version_number   => l_object_version_number);
END;

6.    Check the Table : hr_api_hook_calls
If custom code is properly hooked with standard code then one record will be created

SELECT * FROM hr_api_hook_calls WHERE TRUNC (SYSDATE) = TRUNC (creation_date)


7.    Running the Pre-Processor  (Mostly done by DBA)
      Run following is the command in Putty
(We need to find location of file : hrahkone.sql)
> cd $PER_TOP/admin/sql or > cd $PER_TOP/ patch/115/sql or any other suggested by DBA

(Open sqlplus)
> sqlplus username/password

(Run the file hrahkone.sql)
> @hrahkone.sql

It will ask for api_module_id which we found at point 2
> Enter value for api_module_id: 1226

If all works fine it will show message as:
--------------------------------------------------
PL/SQL procedure successfully completed.
CREATE_PERSON_EXTRA_INFO(Business Process API) successful.


8.    Check the Table again : hr_api_hook_calls
If Pre-Processor is successful STATUS will be ‘V’ else it will be ‘I or N’