Monday, November 26, 2012

Advanced Table in OAF


Hi all,
Here I am showing how to use an Advanced Table region in oaf
Firstly advanced table is more or less like Normal table including all the features in Normal table and with some extra features like Add Another Row, Total etc.
First Create ViewObject (Vo) with the following Query
SELECT   empno, ename, sal FROM emp
and attach it to the Application Module

Create a page give the fields like AM, Window Title, Page Title
Now Under the PageLayout Region
Add a New Region advanced Table Region
Give View Instance for the Table.

Under advancedTableRegion  select the new Column



It will One column, column components under Column Components it will add Column Header
Now add an item under the Column in this case Employee Number
You can select type of item like Message Text Input, Message Styled Text etc here itself




Select View Attribute to the Item newly added item


Now under the Column Header Create a new Sortable Header


Now set the Desired prompt for the Sortable Header
This will be the Prompt Shown in Advanced Table region after Rendering



Follow these steps to all the columns
You page structure should be like this



save and run the page
You will see the output like this


Congrats you have completed Designing Advanced Table Region.

Restoring windows in Jdev

Some times in Jdeveloper by chance we change the default winodowing layout like (structure window,Log window etc) it will be difficult to again get the Initial Layout in that case just search for the following windowinglayout.xml file delete it and just close the Jdeveloper and Reopen it will Re-Arrange 
as Defualt

Calling a Processing Page in OAF

Here is a Sample Code Snippet for Calling a Processing page in oaf

if (pageContext.getParameter("ProcessBtn") != null)
    {
      OAProcessingPage page =
      new OAProcessingPage("xxx.oracle.apps.po.component.webui.xyzProcessingCO");
      page.setApplicationModuleDefName("xxx.oracle.apps.po.component.server.xyzAM");
      page.setRetainAMValue(false);
      page.setConciseMessage("This Will Submit Concurrent Program");
      //This Message will be displayed on the Processing Page as s short Message.
      page.setDetailedMessage("This Will Submit Concurrent Program To Load GL Exchange Rates For
selected Setting:"+Settingid);
     //This will be displayed on the Processing Page as a Detailed Message.
      page.setProcessName("Concurrent Program is Runing! please do not close this window");
     //This will be displayed on the Processing Page as a Processing Message.
      pageContext.forwardToProcessingPage(page);
     }
 

This Code should be in the Controller from which we are calling the Processing Page
==========================================
Code in the Controller of processing Page 

In this case  xyzProcessingCO

public void processRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    am.invokeMethod("xxxxxxx");
   //just invoke Some method that you want to use in Processing Page
  //Just after completion of the method Processing page will redirect to the Page which is provided below
    pageContext.forwardImmediately
                                                           (FullQualifiedPagepath,
                                                                                         null,
             OAWebBeanConstants.KEEP_MENU_CONTEXT,
                                                                                         null,
                                                                                         null,
                                                                                         true,
         OAWebBeanConstants.ADD_BREAD_CRUMB_YES);
    throw new OAException (message,OAException.INFORMATION);
    //This message will be appered on the Orginal page after redirecting to it
   }


Bundled Exceptions in OAF


Some times we need throw a bundle of exceptions at a time
So for this type of requirement we can use OAException.raiseBundledOAException
Sample Code Snippet

ArrayList  errMsg = new ArrayList();                

if(row.getAttribute("Attribute1")==null)
       {
         errMsg.add(new OAException("Message 1",OAException.ERROR));
       }
       if(row.getAttribute("Attribute2")==null)
       {
         errMsg.add(new OAException("Message 2",OAException.ERROR));
       }
       if(!row.getAttribute("Attribute3").equals("SomeString"))
       {
       if(row.getAttribute("Attribute4")==null)
       {
         errMsg.add(new OAException("Message 3",OAException.ERROR));
       }
       if(row.getAttribute("Attribute5")==null)
       {
         errMsg.add(new OAException("Message 4",OAException.ERROR));
       }
//finally in the event for validation put this code
  if (errMsg.size()> 0)
     {
       OAException.raiseBundledOAException(errMsg);
     }

This will show a Error message like this on the Screen


Friday, November 23, 2012

Filtering Rows in OAF

Hi
Some times if we have a check box in the table region and we need to some operation only for the checked rows then we need to filter the Rows of vo with that Check Box attribute

Here is a sample code for the same

OAViewObject  vo = (OAViewObject) getxxxVO1();
        xxxVORowImpl row = null;
       
        Row[] rows = vo.getFilteredRows("select","Y");
        //where select is the Vo attribute given for the check box in table region        
        for (int i=0;i       
            row = (xxxVORowImpl)rows[i];
          //using row.set and get attributes perform logic as show below           

        savelogic(row.getSupplierName,row.getSupplierId);
        }

VO Iterator in Oaf rows

Here am sharing a sample code to iterate in vo
       //Create a object with name vo for the ViewInstance
        if (vo != null)
        //Check for null
            vo.reset();
         //It will take you to the first row of Vo
        while (vo.hasNext())
        {
        XXXRowImpl currow = (xxxVORowImpl)vo.next();
        //it will return a rows in a order
        //now we can use currow.getAttributes,currow.setAttributes
         //for implementing our logic as shown below
         validatelogic (currow.getAttribute("Attr1"),currow.getAttributes("Attr2));
        //so this will check for every row of  a View Object
        }

Wednesday, August 8, 2012

Gruoping Radio Buttons in OAF

Hi all like in forms there is no declarative way to group Radio Buttons in OAF we have to group them dynamically some sample working  code 

import oracle.apps.fnd.framework.webui.beans.message.OAMessageRadioButtonBean;
 just import this package

    OAMessageRadioButtonBean rb1 =          (OAMessageRadioButtonBean)webBean.findIndexedChildRecursive("RadioBtn1");
 OAMessageRadioButtonBean rb2 =            (OAMessageRadioButtonBean)webBean.findIndexedChildRecursive("RadioBtn2");
         rb1.setName("ChoiceRadioGroup");
         rb2.setName("ChoiceRadioGroup");
         rb1.setValue("New");
         rb2.setValue("Update");
         rb1.setSelected(true);

where RadioBtn1,RadioBtn2 are the id of the Radio Buttons

to get selected value  
     String radioGroupValue = pageContext.getParameter("ChoiceRadioGroup");
In above Example String radioGroupValue will be New,Update on selecting the First and Second radio buttons respectively

Tuesday, August 7, 2012

OAF Related Posts

Hi All,

I am Manoj Kumar experienced OAF Developer

Hence forth OAF related sample codes and related posts will be posted here.