Join the OracleApps88 Telegram group @OracleApps88to get more information on Oracle EBS R12/Oracle Fusion applications.

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.

Wednesday, June 5, 2013

OAF Steps



Automatic Search Page Steps:
1)      Create the page as the normal way like create jws, jpr, bc4js, AM, page etc…. .
2)      Right click of the .jpr, Create the bc4j for VO.
EX: xxaam.oracle.apps.po.autosearch.server  
3)      Create VO under BC4J,  and attach VO to the AM.
Ex:AutosearchVO  -> add this into AM.
4)      Select  the page, Under page Layout RN,create one Region, region style as Query.
5)      Then select query region -> right click  -> Region using wizard ->dialogbox -> you can select your VO which you created in 3rd step.
6)      Click next to continue -> there you can select region style is table region, because we are going to display results in table region.
7)      Click next to continue ->Shuttle the items which you want to display in page and table region.
8)      Then right click query Region-> select simple search panel & simple search query region
9)      In simple search panel –create what ever you want to create the items means message text inputs, it will display in top of the Automatic search PG.
10)  In simple search mappings -> you have create mappings. Map all the fields to query columns to created message text inputs in simple search panel.
11)  Then run the automatic search PG.

How to Create LOV  in  OA Framework pages step by step:
1)       Create the bc4j for LOV.Right click the .jpr  create the BC4j for LOV.
   Ex: xxaam.oracle.apps.po.autosearch.lov.server     
2)       Under the LOV bc4j, create the LOVVO and LOVAM(this VO and AM called as LOVVO  and LOV AM).
Ex: xxxLOVVO and xxxLOVAM.
3)      Attach that LOVAM to VO.
Ex:Add xxxLOVVO to xxxLOVAM.
4)      Create the region under jpr, navigation path is -> right click .jpr->New->OAComponenst ->webtier->Region.
Ex:xxxLOVRN  
5)      Dialog Box->In region properties -> style as ListOfValues ->click OK.
6)      In structure window select region ->property inspector ->scope – public and add LOV AM To this Region.
7)      Come to item search allowed property should be true.
8)      Select the page, which item you want to make LOV and select item style as Message LOV Input.
9)      In property inspector window ->you have to add region path in external LOV.
10)  Come to mapping section , select  map1
Property inspector ->functional
LOV Region Item – data base column Name
Return Item – region Item
Criteria Item- same as return item

Manual Search Page Steps:
1)      Create the page as the normal way like create jws, jpr, bc4js, AM, page etc…. .
2)      Create one EO BC4J under that BC4J create EO.->Right click of the BC4J select New Entity Object.
EX: xxaam.oracle.apps.po.autosearch.schema.server and xxxEO.
Note : for Manual search no need to create Entity Object. Just for explaining how to create EO based VO.
3)      Then create VO based on EO. Create new VO under particular(VO) BC4J, there you can shuffle the EO (which you created in 2nd step) into selected side.
4)      Click next twice and query automatically will generate , if you want to change you select expert mode checkbox and you can change the query. Amend the where clause like below example.
      Ex: SELECT DepartmentEO.DEPT_ID,
       DepartmentEO.DEPTNO,
       DepartmentEO.DEPTNAME,
       DepartmentEO.LOCATION,
       DepartmentEO.CREATED_BY,
       DepartmentEO.CREATION_DATE,
       DepartmentEO.LAST_UPDATED_BY,
       DepartmentEO.LAST_UPDATE_DATE,
       DepartmentEO.LAST_UPDATE_LOGIN
FROM Department DepartmentEO
WHERE DepartmentEO.DEPTNAME LIKE NVL(:1,DepartmentEO.DEPTNAME)
AND DepartmentEO.LOCATION LIKE NVL(:2,DepartmentEO.LOCATION)
Then finish the creation VO.

5)      Add this VO into AM.

6)      Then design the page , create 3 regions 1 for getting page items, 2 for getting buttons and, 3 for table region for displaying results when you press the go button.

7)      Select AMimpl class file to write logic like below.

public int deptsearchparams(OAPageContext pageContext, OAWebBean webBean)
{
int flag=0;
String Dname = "";
String Location ="";

DeptSearchVOImpl vo= getDeptSearchVO1();

if(pageContext.getParameter("DeptName")!=null && !pageContext.getParameter("DeptName").equals(""))
{
  Dname=pageContext.getParameter("DeptName").toString();

  vo.setWhereClauseParam(0,Dname);
  flag=1;
}

else
{
  vo.setWhereClauseParam(0,null);
}
  if(pageContext.getParameter("Location")!=null && !pageContext.getParameter("Location").equals(""))
{
  Location=pageContext.getParameter("Location").toString();

  vo.setWhereClauseParam(1,Location);
  flag=2;
}
else
{
  vo.setWhereClauseParam(1,null);
}
System.out.println("the flag value is"+flag);
return flag;
}


8)      Create Controller under pageLayouot region to handle the go button events and call the logic from AM. Follow logic below.
    if(pageContext.getParameter("Go")!=null)
    {
   
    XXnewAMImpl am=(XXnewAMImpl)pageContext.getApplicationModule(webBean);
   
    int fg=am. deptsearchparams (pageContext, webBean);
    if(fg==0)
    {
      am.getDepartmentVO1().setWhereClauseParam(0,"-gfdgdjghdj");
      am.getDepartmentVO1().setWhereClauseParam(1,"hkdffhkdkhgkk");
      throw new OAException("please select atleast one search criteria",OAException.ERROR);
     
    }
    else
    {
    am.getDepartmentVO1().executeQuery();
    }
  }

9)      Then run the page to test the Manual search page.


Create page Steps:
1)      Create the page as the normal way like create jws, jpr, bc4js, AM, page etc…. .
2)      EO should be mandatory to develop the create the page.
3)      Create the EO which table you want to insert the records through page.
4)      Create the BC4J for EO and develop the EO.
      Ex: xxaam.oracle.apps.po.autosearch.schema.server and xxxEO.
5)      Then create VO based on EO. Create new VO under particular(VO) BC4J, there you can         
       Shuffle the EO (which you created in 2nd step) into selected side
6)      Add above VO into AM.
7)      Then design the page for appropriate records insert into table and create two buttons for pressing in page.
8)      Then select AMimpl class file to develop the logic below.

public void CreateDept()
  {
     DepartmentCreationVOImpl vo= getDepartmentCreationVO1();

     OADBTransaction Tr=getOADBTransaction();

     if(!vo.isPreparedForExecution())
     {
       vo.executeQuery();
     }
        Row row1=vo.createRow();
        vo.insertRow(row1);
       row1.setNewRowState(Row.STATUS_INITIALIZED); 

       Number deptid=Tr.getSequenceValue("DEPT_DEPT_ID_SEQ");

//       vo.getCurrentRow().setAttribute("DeptId",deptid);
       vo.getCurrentRow().setAttribute("DeptId",deptid);
  }

9)      Create Controller under pageLayouot region to handle the go button events and call the logic from AM. Follow logic below.

Process Request :
DeptAMImpl am=(DeptAMImpl)pageContext.getApplicationModule(webBean);
am.invokeMethod("CreateDept");

Process Form request:
If (pageContext.getParameter("Save")!=null)
    {
      am.getOADBTransaction().commit();
    }

Update Page Steps:
1)      Create the page as the normal way like create jws, jpr, bc4js, AM, page etc…. .
2)      EO should be mandatory to develop the update page.
3)      Create the EO which table you want to update the records through page.
4)      Create the BC4J for EO and develop the EO.
      Ex: xxaam.oracle.apps.po.autosearch.schema.server and xxxEO.
5)      Then create VO based on EO. Create a new VO under particular(VO) BC4J, there you can  Shuffle the EO (which you created in 2nd step) into selected side
6)      Add above VO into AM.
7)      Select the search page, there select table region and create one item and style as image.
8)      In the image properties a) image uri as updateicon_enabled.gif b)Action Type as fire action. In the parameter window -> id = pdeptid  value -> ${oa.SearchVO1.DeptId}.
9)      Create the update page with appropriate records. And Buttons.
10)  Create Controller under pageLayouot region to handle the go button events and call the logic from AM. Follow logic below.

Process  request:
  if(pageContext.getParameter("pdeptid")!=null)
    {
      String deptid=pageContext.getParameter("pdeptid").toString();
      String whereclause="DEPT_ID='"+deptid+"'";
      am.getCreateVO1().setWhereClauseParams(null);
      am.getCreateVO1().setWhereClause(whereclause);
      am.getCreateVO1().executeQuery();
    }

Process Form request:
If (pageContext.getParameter("Save")!=null)
    {
      am.getOADBTransaction().commit();
    }

Create the table and synonym example:
Create table modpos.DEPARTMENT
     (
          DEPT_ID number PRIMARY KEY,
          DEPTNO  VARCHAR2(50),
          DEPTNAME VARCHAR2(100),
          LOCATION  VARCHAR2(100),
          CREATED_BY NUMBER,
          CREATION_DATE Date,
          LAST_UPDATED_BY NUMBER,
          LAST_UPDATE_DATE Date,
          LAST_UPDATE_LOGIN NUMBER
     )
                              
CREATE SYNONYM DEPARTMENT FOR modpos.DEPARTMENT

Create the Sequene with example:
create sequence DEPT_DEPT_ID_SEQ
Start with 1 increment by 1
Grant all on DEPT_DEPT_ID_SEQ to apps
create sequence DEPT_DEPT_ID_SEQ
Start with 4 increment by 1  cus

Grant all on DEPT_DEPT_ID_SEQ to apps  cus

Create synonym  DEPT_DEPT_ID_SEQ for cus.DEPT_DEPT_ID_SEQ  apps

Call one OAF page from another  OAF page Syntax:
if (pageContext.getParameter("Create")!=null)
    {
    pageContext.setForwardURL("OA.jsp?page=rajesh/oracle/apps/po/dept/webui/DepartmentCreationPage",
                               null,
                               OAWebBeanConstants.KEEP_MENU_CONTEXT,
                               null,
                               null,
                               false, // Retain AM
                               OAWebBeanConstants.ADD_BREAD_CRUMB_NO, // Do not display breadcrums
                               OAWebBeanConstants.IGNORE_MESSAGES);
    }


Follow Bc4j for each object:
Ø   AM AND VO -> BC4J
XXAAM.oracle.apps.po.xxname.server
Ø   Entity Object(EO) -> BC4J
XXAAM.oracle.apps.po.xxname.schema.server
Ø   LOV ->BC4J
XXAAM.oracle.apps.po.xxname.LOV.server
Ø   Poplist ->BC4J
XXAAM.oracle.apps.po.xxname.poplist.server
Ø   Controller,Page & Region
XXAAM.oracle.apps.po.xxname.webui


Delete page steps
1)      For delete no need to create any pages.
2)      Select search page , in table region you create one item and style as image. Below set of properties needs to set for this image.

Image Uri    - deleteicon_enabled.gif
Action Type – fireAction
Event           - Any Name (delete)

Parameter window:SPEL

Name – DeptId
Value - ${oa.SearchVO1.DeptId}

3)      write the delete login AM, start with creating  method ->
public void deletedepartment(String departmentid)
 {
   // First, we need to find the selected Program in our VO.
    // When we find it, we call remove( ) on the row which in turn
    // calls remove on the associated ModposVendorProgsImpl object.

    int deptidtodelete=Integer.parseInt(departmentid);
   
    SearchVOImpl vo=getSearchVO1();
   
    SearchVORowImpl row=null; 
      // This tells us the number of rows that have been fetched in the
    // row set, and will not pull additional rows in like some of the
    // other "get count" methods.
 
     int fetchedrowcount =vo.getFetchedRowCount();
      System.out.println("Fetched Row Count is"+fetchedrowcount);
        // We use a separate iterator -- even though we could step through the
    // rows without it -- because we don't want to affect row currency.
      RowSetIterator deleteiter=vo.createRowSetIterator("deleteiter");
     
     if (fetchedrowcount >0)
     {
       deleteiter.setRangeStart(0);
       deleteiter.setRangeSize(fetchedrowcount);

       for (int i=0;i<fetchedrowcount;i++)
       {
         row=(SearchVORowImpl)deleteiter.getRowAtRangeIndex(i);
             // For performance reasons, we generate ViewRowImpls for all
        // View Objects. When we need to obtain an attribute value,
        // we use the named accessors instead of a generic String lookup.
         Number deptid=row.getDeptId();
         if(deptid.compareTo(deptidtodelete)==0)
         {
             // This performs the actual delete.
            row.remove();
            getOADBTransaction().commit();
            break;          
         }      
           
       }
             
     }
   deleteiter.closeRowSetIterator();
 }

4)      Call that delete even tin Controller like below. Below logic having how to create OADialog box in OA Framework.

 if ("delete".equals(pageContext.getParameter(EVENT_PARAM)))
    {
      // The user has clicked a "Delete" icon so we want to display a "Warning"
      // dialog asking if she really wants to delete the employee. Note that we
      // configure the dialog so that pressing the "Yes" button submits to
      // this page so we can handle the action in this processFormRequest( ) method.
       String DeptId =  pageContext.getParameter("DeptId");
      
      OAException mainMessage = new OAException("POS","xxx");
          // Note that even though we're going to make our Yes/No buttons submit a
      // form, we still need some non-null value in the constructor's Yes/No
      // URL parameters for the buttons to render, so we just pass empty
      // Strings for this.

        OADialogPage dialogPage = new OADialogPage(OAException.WARNING,
      mainMessage, null, "", "");
        // Always use Message Dictionary for any Strings you want to display.
      String yes = pageContext.getMessage("AK", "FWK_TBX_T_YES", null);
      String no = pageContext.getMessage("AK", "FWK_TBX_T_NO", null);
       // We set this value so the code that handles this button press is
      // descriptive.
       dialogPage.setOkButtonItemName("DeleteYesButton");
         // The following configures the Yes/No buttons to be submit buttons,
      // and makes sure that we handle the form submit in the originating
      // page (the "Employee" summary) so we can handle the "Yes"
      // button selection in this controller.
 
       dialogPage.setOkButtonToPost(true);
      dialogPage.setNoButtonToPost(true);
      dialogPage.setPostToCallingPage(true);
       // Now set our Yes/No labels instead of the default OK/Cancel.
      dialogPage.setOkButtonLabel(yes);
      dialogPage.setNoButtonLabel(no);
         // The OADialogPage gives us a convenient means
      // of doing this. Note that the use of the Hashtable is 
      // most appropriate for passing multiple parameters. See the OADialogPage
      // javadoc for an alternative when dealing with a single parameter.
      Hashtable formParams = new Hashtable();

      formParams.put("DeptId", DeptId);
     
      dialogPage.setFormParameters(formParams);
  
      pageContext.redirectToDialogPage(dialogPage);
           
    }
   else if (pageContext.getParameter("DeleteYesButton") != null)
    {
      // User has confirmed that she wants to delete this employee.
      // Invoke a method on the AM to set the current row in the VO and
      // call remove() on this row.
      String DeptId = pageContext.getParameter("DeptId");
    
      Serializable[] parameters = { DeptId };
    //  OAApplicationModule am = pageContext.getApplicationModule(webBean);
      am.invokeMethod("deletedepartment", parameters);
 
      // Now, redisplay the page with a confirmation message at the top. Note
      // that the deleteComponent() method in the AM commits, and our code
      // won't get this far if any exceptions are thrown.



      OAException message = new OAException("POS","xxxxxxxx",
                                            null,OAException.CONFIRMATION,null);

      pageContext.putDialogMessage(message);
     
    }
  }


Emp advance table row
public void createemp()
{
  EmployeeCreationVOImpl vo= getEmployeeCreationVO1();
  DepartmentCreationVOImpl vo1= getDepartmentCreationVO1();

  OADBTransaction tr=getOADBTransaction();

  vo.setMaxFetchSize(0);

  Row row1=vo.createRow();
  vo.insertRow(row1);
row1.setNewRowState(Row.STATUS_INITIALIZED);
Number empid=tr.getSequenceValue("EMPLOEE_EMP_ID_SEQ");
vo.getCurrentRow().setAttribute("EmployeeId",empid);
 String departmentid=vo1.getCurrentRow().getAttribute("DeptId").toString();
 vo.getCurrentRow().setAttribute("DeptId",departmentid);
 
}

  if (ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM)))
    {
      am.invokeMethod("createemp");
    }

No comments:

Post a Comment

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.
Best Blogger TipsGet Flower Effect