Sep 26, 2019

OAF Attachment Page with AK Entity

To display the content of attachments in OAF, we need to follow the below approach in JDevloper as well in EBS Application

Step 1: Create the AK Entity for the attachment section and map it to the right database table with Primary column

Responsibility: AK Html Forms
Navigation: AK Entities





Step 2: Under the Page development in JDevloper, create the region and attachment item with type 'attachmentLink'

Create a Region with 'defaultSingleColumn' and create a sub-item with type 'attachmentLink' and map the correct VO in the View Instance. Add the attachment Prompt and Link Text for user convenience.




Step 3: Create the Primary Key and Category Map under the entity map section for attaching the item with AK entities.


Step 4: Tag the correct Primary Key column in the View Attribute column for linking the content with FND_ATTACHED_DOCUMENTS table.

Note: All the uploaded content will be stored in FND ATTACHED DOCUMENTS table with the mapped primary column crId.

 Category is mentioned as MISC (Miscellaneous) under the categoryMap for the uploaded content.















Step 5: Validate the OAF page and result will be displayed like below for the Attachment Section,


















Page Controller to capture the raised attachment events,

    if ("oaAddAttachment".equals(pageContext.getParameter(EVENT_PARAM)) ||
     "oaUpdateAttachment".equals(pageContext.getParameter(EVENT_PARAM)) ||
     "oaDeleteAttachment".equals(pageContext.getParameter(EVENT_PARAM)) ||
     "oaViewAttachment".equals(pageContext.getParameter(EVENT_PARAM)) )

{

System.out.println("Attachment Event Raised");
     
}

Sep 24, 2019

OAF Setup for DB and APP Connection

All the custom page can be developed and tested in our work system with the help of JDeveloper before deploying it to the Oracle Application. But still it need access to Application and DB in order to avoid the unnecessary error while deploying the custom page in the E-Business Suite.

For developing any custom page we need both DB as well APP connection detail string in order to fetch the database objects and application infra for the proper deployment. If the custom development runs well in JDeveloper then it will surely works well in the Application side too.. !!!


A. Database Connection setup

Enter the following details in the DB Setup

Navigation: JDevloper (Tools --> Project Properties --> Oracle Application --> Database Connection)

Step 1: Enter the Database name (Naming Convention can be anything and not related to DB TNS entry)



Step 2: Enter the DB Username and Password


Step 3: Enter the DB Host name, Port and SID as per your DB TNS entry


Step 4: Test the connection and make sure it return the status "SUCCESS"



B. Application Setup for the Login User with DBC file

Keep the DBC file under the path "jdevhome\jdev\dbc_files\secure"



Make sure the FND user have the correct responsibility attached before mapping it in the APP setup

Enter the following details in the APP Setup

Navigation: JDevloper (Tools --> Project Properties --> Oracle Application --> Runtime Connection)

Step 1: Place the DBC file under the specified path as mentioned above and BROWSE and map it under the 'DBC File Name'

Step 2: Enter the Username and Pwd with right Application Short name and Responsibility Key.


DBC file in JDeveloper Tool

How to get the DBC file from APP Server to use it in JDeveloper Tool

Step 1: Login to APP Server and go to $INST_TOP

cd $INST_TOP/appl/fnd/12.0.0.0/secure

ls -ltr

-rw-------. 1 applmgr dba 827 Jul 10 06:13 DEV.dbc

Step 2: Permission will be limited for other users other than application manager, so cat the file and save it

cat DEV.dbc

Copy the content and save it with .dbc extension

Step 3: JDevloper Path for DBC connection

If once saved the file, place it under jdevhome\jdev\dbc_files\secure

If all 3 steps done, try playing with OAF Page !!!

OAF Controller Functions

1. Deriving Various Bean values

a. messageStyledText

OAMessageStyledTextBean lvariable = (OAMessageStyledTextBean)webBean.findChildRecursive("column1");

b. messageTextInput

OAMessageTextInputBean lvariable = (OAMessageTextInputBean)webBean.findChildRecursive("column1");

c. messageChoice

OAMessageChoiceBean lvariable = (OAMessageChoiceBean)webBean.findChildRecursive("column1");

d. messageLovInput

OAMessageLovInputBean lvariable = (OAMessageLovInputBean)webBean.findChildRecursive("column1");

e. submitButton

OASubmitButtonBean lvariableSubmitButton = (OASubmitButtonBean)webBean.findChildRecursive("submitButton1");

f. button

OAButtonBean lvariableButton = (OAButtonBean )webBean.findChildRecursive("button1");

2. To commit the database transactions

getTransaction().commit();

3. To discard the database transactions

getTransaction().rollback();

4. To Forward a page from one screen to another

if (pageContext.getParameter("nextPage")!=null) {

      pageContext.forwardImmediately("OA.jsp?page=/oracle/apps/fnd/framework/newpage/webui/xxSearchPG",
                                           null,
                                           OAWebBeanConstants.KEEP_MENU_CONTEXT,
                                           null,
                                           params,
                                           true, // retain AM
                                           OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
     

    }

5. To initiate an Application Module (AM)

xxSearchAMImpl am = (xxSearchAMImpl)pageContext.getApplicationModule(webBean);
 
am.invokeMethod("apply");

6. To put a session value

pageContext.putSessionValue("currentPage","Page1");

7. To get a session value

String variableNew = (String)pageContext.getSessionValue("variableOld");

8. To hide a button/submit button using the Render property

OASubmitButtonBean SaveVariable = (OASubmitButtonBean)webBean.findChildRecursive("button1");

SaveVariable.setRendered(false);

SaveVariable.setRendered(true);

9. Forming Dynamic Parameter in Controller

HashMap params = new HashMap(1);
params.put("PageMode","CREATE");

      if ( pageContext.getParameter("PageMode")!=null && pageContext.getParameter("PageMode").equals("CREATE")  )

       {
     
System.out.println("Page for Create Action");

 am.invokeMethod("createRecord");

//Set Parameter value for PageMode back to Original State.
             
           HashMap params = new HashMap(1);
           params.put("PageMode","NULL");
         
         }

Oracle Application Framework Developer and Personalization Guide

URL to find the OAF Developer and Personalization Guide for the version R12.2

Oracle Application Framework Developer Guide:

Oracle Application Framework Developer's Guide, Release 12.2.4 (Doc ID 1676216.1)




Oracle Application Framework Personalization Guide:

https://docs.oracle.com/cd/E26401_01/doc.122/e22031.pdf





Sep 23, 2019

Table Events | OAF Page

Table events are HTTP requests that are trapped and processed by OA Framework and handled during the processFormRequest phase.



1. EVENT_PARAM - indicates the event generated by a web bean (a table, in this case).


2. GOTO_EVENT - when 'Next' or 'Previous' navigation links are selected


3. SORT_EVENT - when a column header is selected to sort that column


4. HIDE_EVENT - when the 'Hide' link of a detail disclosure is selected


5. SHOW_EVENT - when the 'Show' link of a detail disclosure is selected


6. ADD_ROWS_EVENT - when the 'Add Another Row' button is selected


7. UPDATE_EVENT - when the total row 'Recalculate' button is selected


8. VALUE_PARAM - indicates a value that is relevant to a particular event: When a detail disclosure Hide/Show is selected, the value parameter contains the row index corresponding to the row whose Hide/Show was selected. When the 'Next' or 'Previous' link of table navigation bar is selected, the value parameter contains the index of the first row of the current range. For example, when the row range 1-10 is displayed, the value is 1 and when the row range 11-20 is displayed, the value is


9. SIZE_PARAM - indicates the number of rows currently displayed in the table (relevant only to the navigation event).


10. STATE_PARAM - indicates the current sort state (ascending or descending) of the column on which sorting is invoked (relevant only for the sort event).



Hide a mandatory field | OAF Page

If the business wants to hide a field in the seeded page, you can do it by personalizing the page and set Rendered property to false.
But this solution will not help you if the field is marked as mandatory by the seeded page.

The reasons are Mandatory Validations are usually done at the EO level. Hence even if you hide the mandatory field, the validation would still happen at the server. If the column has not null constraint in the table, it will throw a database error.


How to solve this ?

You can fix this by setting a default value for the mandatory field.

Extend the controller and set the value in the process Request() method. This is the safest way to default the value to the mandatory field.

After defaulting the mandatory variable, personalize the page and set the rendered property to false.

Hope it helps !!

Sep 4, 2019

OAF Date Field conversion to String using standard library SimpleDateFormat

In OAF if we create an attribute with DATE type then the value retained will be in the format of  yyyy-MM-dd hh:mm:ss.S

Ex: 2019-05-25 00:00:00.0



In order to convert the date format from yyyy-MM-dd hh:mm:ss.S to dd-MMM-yyyy, use the below piece of snippet.

Code to handle the Date Conversion:

import java.text.SimpleDateFormat;

    String convStr1=null;

OAMessageDateFieldBean  par1=(OAMessageDateFieldBean )webBean.findIndexedChildRecursive("crTargetFrom");             
                Timestamp TargetFrom = (Timestamp)par1.getValue(pageContext);

System.out.println("Target From :"+TargetFrom);

SimpleDateFormat format                = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.S");
SimpleDateFormat formatDate            = new SimpleDateFormat("dd-MMM-yyyy");

                try
                   {

                    java.util.Date dateStr1 = format.parse(TargetFrom.toString());

                    convStr1 = formatDate.format(dateStr1);

                                     
                    System.out.println("String date Converted : "+convStr1);

                    }
                 
                catch (Exception e)
                    {

                    System.out.println("String date exception "+e);

                    }

Useful Workflow Commands

  WFLOAD apps/columbus789 0 Y DOWNLOAD APEXP_FINDEV.wft APEXP Locations: $PO_TOP/patch/115/import/US/porpocha.wft $PO_TOP/patch/115/import/U...