Monday, October 23, 2017

OAF JDR Utilities and Commands

OAF JDR Utilities and Commands


Jpximport, export and import commands are located in below path
<JDEV INSTALL DIR>\jdevbin\oaext\bin

For ex:-
E:\JDeveloper\jdevbin\oaext\bin

 JPXImport Command for applying substitutions

jpximport jpx_file_path
             -username "username"
             -password "password"
             -dbconnection "database connection string in TNSNAMES format"

Example:
<JDEV INSTALL DIR>\jdevbin\oaext\bin\jpximport d:\myprojects\project1.jpx -username "apps" -password "<apps password>"  -dbconnection "(description=(address_list=(address=(protocol=tcp)(host=<hostname>)(port=<port>)))(connect_data=(sid=<YOUR SID>)))"

d:\myprojects\project1.jpx contains substitution details.

Export command for exporting OAF pages from server

export package or document name
          -rootdir "Output directory"
          -username "Username"
          -password "Password"
          -dbconnection "Database connection string in TNSNAMES format"

Example:-
Navigate to <JDEV_HOME>\myprojects and execute below command, so that ReqLinesNotificationsRN.xml file will be created in <JDEV_HOME>\myprojects\oracle\apps\icx\por\wf\webui directory i.e.

cd <JDEV_HOME>\myprojects
<JDEV INSTALL DIR>\jdevbin\oaext\bin\export    /oracle/apps/icx/por/wf/webui/ReqLinesNotificationsRN     -username "apps" -password "<apps password>"  -dbconnection "(description=(address_list=(address=(protocol=tcp)(host=<hostname>)(port=<port>)))(connect_data=(sid=<YOUR SID>)))" -rootdir .

Import command for importing OAF pages into the server

import package directory path* or XML file path
          -rootdir "XML source directory"
          -username "Username"
          -password "Password"
          -dbconnection "Database connection string in TNSNAMES format"

For ex:-
Navigate to <JDEV_HOME>\myprojects and execute below command, so that <JDEV_HOME>\myprojects\xxcust\oracle\apps\icx\por\webui\XXFileUploadPG.xml file will be imported to the server

cd <JDEV_HOME>\myprojects
<JDEV INSTALL DIR>\jdevbin\oaext\bin\import xxcust/oracle/apps/icx/por/webui/XXFileUploadPG.xml -username "apps" -password "<apps password>"  -dbconnection "(description=(address_list=(address=(protocol=tcp)(host=<hostname>)(port=<port>)))(connect_data=(sid=<YOUR SID>)))" -rootdir .

Some JDR Utilities


1.       jdr_utils.listdocuments

                prints the list of all OAF customizations/personalizations done for a given path.
               
For ex:- jdr_utils.listdocuments('/oracle/apps/icx/por/wf/server',TRUE);
Second parameter denotes whether it should be recursive search or not. Above command prints all customizations/personalizations under /oracle/apps/icx/por/wf/server path
Sample output for above command, if ReqLinesNotificationsVO, RCOReqLinesNotificationsVO, RCOBuyerApprovalNotfnVO are substituted with custom VOs is:-

                Printing contents of /oracle/apps/icx/por/wf/server recursively
                /oracle/apps/icx/por/wf/server/customizations/site/0/RCOBuyerApprovalNotfnVO
                /oracle/apps/icx/por/wf/server/customizations/site/0/RCOReqLinesNotificationsVO
                /oracle/apps/icx/por/wf/server/customizations/site/0/ReqLinesNotificationsVO

2.       jdr_utils.listcustomizations

Lists the details of levels of Personalizations/customizations done for a given document .
For ex:-
jdr_utils.listcustomizations('/oracle/apps/icx/por/req/webui/ShoppingCartPG');

Lists below output to denote that there are personalizations/customizations done at site level, at 34 org level, and at 50345 responsibility level.
                /oracle/apps/icx/por/req/webui/customizations/site/0/ShoppingCartPG
                /oracle/apps/icx/por/req/webui/customizations/org/34/ShoppingCartPG
/oracle/apps/icx/por/req/webui/customizations/responsibility/50345/ShoppingCartPG

3.        jdr_utils.printdocument

prints the details of customization/personalization done, given the path for document.

For ex:-
jdr_utils.printdocument('/oracle/apps/icx/por/wf/server/customizations/site/0/ReqLinesNotificationsVO');
Prints below output, to denote that standard VO “/oracle/apps/icx/por/wf/server/ReqLinesNotificationsVO” is substituted with custom VO “/xxcust/oracle/apps/icx/por/wf/server/xxReqLinesNotificationsVO”

<?xml version='1.0' encoding='UTF-8'?>
<customization xmlns="http://xmlns.oracle.com/jrad" xmlns:ui="http://xmlns.oracle.com/uix/ui" xmlns:oa="http://xmlns.oracle.com/oa" xmlns:user="http://xmlns.oracle.com/user" version="10.1.3_1312" xml:lang="en-US"
               customizes="/oracle/apps/icx/por/wf/server/ReqLinesNotificationsVO">
   <replace with="/xxcust/oracle/apps/icx/por/wf/server/xxReqLinesNotificationsVO"/>
</customization>

4.       jdr_utils.deletedocument

This deletes the personalization/customization, given the corresponding document path.


For ex:- jdr_utils.deletedocument(‘/oracle/apps/icx/por/wf/server/customizations/site/0/ReqLinesNotificationsVO’); deletes the VO substitution.

Tuesday, September 26, 2017

How to make OAF Controller Changes reflect without Application Bounce

How to make OAF Controller Changes reflect without Application Bounce


Often, when working with OAF customizations, we usually need to change the java code frequently and test in server, which requires application tier or apache bounce. Bouncing the application tier frequently effects multiple users and slows down the pages performance. In order to overcome this, if changes only involve controller changes, developer can follow below procedure(before that one needs to understand that controller code is cached using the Controller Class Name).

  1. Whenever you want to modify existing controller class code(say, ControllerA), create a new Controller Class(ControllerB) which is exactly as a copy of ControllerA.
  2. Make desired changes in ControllerB code.
  3. Mention ControllerB as controller using personalization.
  4. See the changes reflected on the page
  5. Note: Once ControllerB class name is registered with server, second change to this class will not be reflected unless server is bounced.
  6. To summarize, use different controller names for each change.




Thursday, August 17, 2017

Conditionally Displaying Columns in Excel output – RTF Template

Conditionally Displaying Columns in Excel output – RTF Template

In this article we shall see how to define RTF template for displaying column conditionally in excel output.

Consider below student XML data, which lists details of each student, our requirement is to display “Avg Marks” column only when ROLE is “ADMIN”, for other roles “Avg Marks” column should NOT appear.

<STUDENTINFO>
              <ROLE>ADMIN</ROLE>
                <LIST_G_STUDENT>       
                                <G_STUDENT>
                                                <ROLLNO>1111</ROLLNO>
                                                <NAME>ADAM</NAME>
                                                <CLASS>10</CLASS>
                                                <PASSYR>2016</PASSYR>
                                                <AVGMARKS>52</AVGMARKS>
                                </G_STUDENT>
                                <G_STUDENT>
                                                <ROLLNO>2222</ROLLNO>
                                                <NAME>BILL</NAME>
                                                <CLASS>10</CLASS>
                                                <PASSYR>2017</PASSYR>
                                                <AVGMARKS>63</AVGMARKS>
                                </G_STUDENT>
                                <G_STUDENT>
                                                <ROLLNO>3333</ROLLNO>
                                                <NAME>MARY</NAME>
                                                <CLASS>9</CLASS>
                                                <PASSYR>2016</PASSYR>
                                                <AVGMARKS>72</AVGMARKS>
                                </G_STUDENT>
                                <G_STUDENT>
                                                <ROLLNO>4444</ROLLNO>
                                                <NAME>JOHN</NAME>
                                                <CLASS>9</CLASS>
                                                <PASSYR>2017</PASSYR>
                                                <AVGMARKS>63</AVGMARKS>
                                </G_STUDENT>
                                <G_STUDENT>
                                                <ROLLNO>5555</ROLLNO>
                                                <NAME>PETER</NAME>
                                                <CLASS>8</CLASS>
                                                <PASSYR>2017</PASSYR>
                                                <AVGMARKS>82</AVGMARKS>
                                </G_STUDENT>
                </LIST_G_STUDENT>
</STUDENTINFO>

RTF Template with out any condition is like this


Sample output without any condition


Now lets add condition for “Avg Marks” column as shown in below screenshot


"IFADMIN" at column header level is defined as "<?if@column:ROLE="ADMIN"?>", as shown below:-
 
"END IF" at column header level is defined as "<?END IF?>"


"IFADMIN" in column data is defined as "<?if@column:../../ROLE="ADMIN"?>", as shown below:-


Sample output when role = “ADMIN”

Sample output when role = “TEACHER”


Friday, June 23, 2017

Exporting OAF Personalizations using SQL

Exporting OAF Personalizations using SQL 

In this article we shall see the query which will return all OAF personalizations done along with XML file.

Following query returns OAF personalizations along with a CLOB column which is the personalized page XML, this can be used for analyzing OAF personalizations done in any given instance:-

SQL query to export OAF personalizations along with personalization XML

SELECT   jpath.path_docid perz_doc_id,
         jdr_mds_internal.getdocumentname (jpath.path_docid) perz_doc_path,
         xxcust_getpern_doc_pkg.get_persn_doc
                 (jdr_mds_internal.getdocumentname (jpath.path_docid)
                 ) persn_doc
    FROM jdr_paths jpath
   WHERE jpath.path_docid IN (
            SELECT DISTINCT comp_docid
                       FROM jdr_components
                      WHERE comp_seq = 0
                        AND comp_element = 'customization'
                        AND comp_id IS NULL)
ORDER BY perz_doc_path;

We have used custom package xxcust_getpern_doc_pkg..get_persn_doc for getting personalization XML file in a CLOB. This custom package internally uses jdr_mds_internal.exportDocumentAsXML for getting personalization XML in 32k chunks.

Custom package code is given below:-

CREATE OR REPLACE PACKAGE BODY APPS.xxcust_getPern_doc_pkg AS

   -- function to get personalization document
   FUNCTION get_persn_doc(p_document_name IN VARCHAR2
                )
   RETURN CLOB
   IS
      isDone INTEGER;
      l_pern_clob clob := '';
      l_pern_info  VARCHAR2(32000);
   BEGIN
           dbms_lob.createtemporary(lob_loc => l_pern_clob, cache => true, dur => dbms_lob.call);
           l_pern_info := jdr_mds_internal.exportDocumentAsXML(isDone,p_document_name);
           dbms_lob.writeappend( l_pern_clob, length(l_pern_info), l_pern_info );
           WHILE (isDone = 0) LOOP
             l_pern_info := jdr_mds_internal.exportDocumentAsXML(isDone, NULL);
             dbms_lob.writeappend( l_pern_clob, length(l_pern_info), l_pern_info );
           END LOOP;
          
           RETURN l_pern_clob;
   END get_persn_doc;

END xxcust_getPern_doc_pkg;
/


Monday, June 19, 2017

Embedding Custom Region into Standard OAF Page

Embedding Custom Region into Standard OAF Page

In this article, we shall see how to insert custom OAF region into standard page using personalization.

Make sure that you enable following profile options for enabling the “Personalization” link on OAF page
1.       Personalize Self-Service Defn” to “Yes”
2.       FND: Personalization Region Link Enabled” for displaying region level personalization links

Create an item on standard page by clicking on “Personalize” link for ex:- “Personalize Stack Layout” as shown in below screenshot:-





Click on “Create Item” icon as shown in below screenshot:-



Enter details for “Create Item” as follows:-

Level
Site
Item Style
Stack Layout
ID
Unique Id for ex:- customRegion
Extends
Custom region path for ex:- /xxcust/oracle/apps/per/irc/webui/MyCustomRN

Same is shown in below screenshot:-


Tuesday, June 13, 2017

OAF Interview Questions

OAF Interview Questions

1.       What architecture Oracle Application Framework(here onwards referred as OAF) uses?
ANS: MVC

2.       What is meant by MVC, explain in brief?
    ANS: Please google.

3.       What corresponds to “View” w.r.t OAF in MVC architecture?
ANS: UIX pages

4.       Does “View Object” in OAF, really correspond to “View” in MVC architecture?
ANS: No, “View Object” is part of BC4J objects which is core of “Model” in MVC architecture.

5.       What is the significance of having “Application Module” in BC4J in OAF in brief?
ANS: Application Module acts as container of View objects and entity objects and takes care of transaction handling and session management.

6.       Consider you have oracle standard OAF page,  which you would like to customize by adding an extra database field to it, what is the approach you would follow in below cases:-
a.       If Existing page already has a view objects which is fetching required database column
ANS: Will personalize the standard page to add a field to show already fetched database column
b.       If existing page doesn’t fetch required database column.
ANS: This will require customization which can be further explained in 3 sub steps
                                                                                 I.            Existing view object has to be extended to fetch required database column
                                                                               II.            JpxImport command has to be run to make the server pick newly created custom view object
                                                                             III.            Mid tier bounce is required to tell the server that new view object is to be picked up instead of standard one.
                                                                            IV.            personalization has to be done to show the newly added database column.

7.       Considering the requirement mentioned in Qn No. 6, how would you revert the customization done to show the newly added column?
ANS: This consists of below steps:
                                                                                 I.            Remove personalization to not to show the newly added column.
                                                                               II.            Delete the substitution by executing below pl/sql command jdr_utils.deletedocument
                                                                             III.            Bounce the mid-tier to make the server pick standard view object.

8.       Can you tell some of utility packages available in jdr_utils and brief description of the need of the function/procedure name
a.       Jdr_utils.deletedocument
b.       Jdr_utils.printdocument
c.       Jdr_utils.listcustomizations
d.       Jdr_utils.listdocuments

9.       Oracle recommends not to extend standard view object which is query based, do you know the reason why?
ANS: Yes, as standard view object is query based, when we extend standard view object, we actually copy paste the query from standard view object and modify the query accordingly. In case if Oracle modifies the standard view object for any patches, our custom view object will have old standard code.  There is also a possibility of page getting errored out after patch is applied.

10.   If you do not want to extend query based VO, do you find any alternative of achieving the same?
ANS: Yes, if custom view object just needs new database field to be added, we can add new transient attribute dynamically to the existing standard view object from extended custom controller. Value can be set to the transient view attribute after fetching from new custom view object (which can be created dynamically or statically).

11.   What is the profile you need to set before exporting personalizations form an instance?
ANS: FND: Personalization Document Root Path, this is the path on the server where exported personalization files get saved.

12.   Why do you define Database connection settings twice in Jdeveloper?
ANS:      Connections which we create in JDeveloper is design time connection, which is used when we create entity objects or view objects.
                Connection details which we mentione when we select DBC file, is used at runtime, when OAF pages run from local system.

13.   What are the 3 methods available in any OAF controller, what is the purpose of each method
a.       ProcessRequest
b.       ProcessFormRequest
c.       ProcessFormData

14.   Tell in brief steps for creating a pop up lov.
a.       Create a region for lov page
b.       In the page which acts as base page, define an lov item and mention external URL to region that you defined in step a.
c.       Define LOV mappings for passing the values between base page and lov page.

15.   What are the steps for debugging the custom code ?
ANS:   Write “writediagnostics” method calls from custom code which gets printed on the screens when “Diagnostics” is turned on.

More to come in next post….