Search This Blog

Wednesday, April 27, 2016

OAF Creating Child Page (Data Entry) in different page

1. To Create OAF Master-Child (Detail) page in the same screen chk the below link.
http://mogalafzal.blogspot.ae/2016/03/17-oaf-entry-master-detail-page.html

2. To create OAF Master in Single Page and Child (Detail)  in another page, then

Create a Master Page as a Normal Data Entry Page then do the below steps.

Creating Child Page
Xxchild --> Table Name (make sure you have foreign key directing to the master table, and keep the both columns same )
1. right click>/xxmasdet/oracle/apps/per/md/server package>new
ADF Business components >Business components from Tables.
2.
Give your new child table name>next>Change the package path for View>next>Select your AM which is already existing in last window.
Created automatically:
EO: Xxchild
EOLink: (Association) XxchildFkAssoc
View: XxchildView
3.
Create ViewLink
go to the views path>right click> view link
Give viewlink name>XxchildFkLink
left window> Expand the master table View> select the select  XxchildFkAssoc
Right window> Expand the child table View> select the select  XxchildFkAssoc
yes both tables select the same field.

4.
Right click the EO Xxchild>Edit> java> Enable 'Create Method'

5.
Right Click XxchildFkAssoc> Edit>Association Properties> Enable 'Composition Association'

6.
Right Click XXAM (Application Module)> Edit>
6.1 Move first your View Object> XxChildView> to right side
6.2 Move under 'XxMasterView' left side  record  'XxchildView via  XxchildFkLink' --> to as child record under 'XxMasterView'


7.
Under AMImpl java file add create row method as below

    public void AddXxChild() {
            OAViewObject vo = (OAViewObject)getXxChildView2();
           // if (!vo.isPreparedForExecution()) {
                    vo.executeQuery();
           // }
            Row row = vo.createRow();
            vo.insertRow(row);
            row.setNewRowState(Row.STATUS_INITIALIZED);
    }

8.
Open EOImpl java file   
Under   
        public void create(AttributeList attributeList) {
        super.create(attributeList);
        /* add your logic from here to get default values*/
        OADBTransactionImpl transaction = (OADBTransactionImpl)getOADBTransaction();
                 Number FileNumberseq = transaction.getSequenceValue("FFRD_FILE_NO_S"); //Sequence to get into field FileNumeber
                //String FiileNumberStr = FileNumberseq;
                String getNum = FileNumberseq.toString();
                setFileNumber(getNum);       
               setFileDate(transaction.getCurrentDBDate());//sysdate to get into field FileDate
 
    }

9. Invoking above method or invoking row initialize using the below in ProcessFormRequest

      else if (pageContext.getParameter("Child") != null) { //Child is the item id of type Submitbutton
          am.invokeMethod("addPlayerAction");
          pageContext.setForwardURL("OA.jsp?page=/xxmasdet/oracle/apps/per/md/webui/ChildPG",
                                     null,
                                     OAWebBeanConstants.KEEP_MENU_CONTEXT,
                                     null,
                                     null,
                                     true, // Retain AM
                                     OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
                                     OAWebBeanConstants.IGNORE_MESSAGES);
      }

10.
Creat items as buttons from Master to Child and check the Master Primary_column should be defaulted into Child Foregin_key Column automatically
Else something is wrong.
   

No comments:

Post a Comment