Friday, August 16, 2019

Data Entry Page in OAF

Create page like Step 2 and when you file the data and click on add button it will insert data into Table and if click clear button it will clear the data.

Step 1)
Create table by using below script;

CREATE TABLE xx_employee (empno NUMBER(7),
ename VARCHAR2(30),
salary NUMBER(10),
doj DATE,
address VARCHAR2(20),
last_update_date DATE NOT NULL,
last_updated_by NUMBER NOT NULL,
creation_date DATE NOT NULL,
created_by NUMBER NOT NULL,
last_update_login NUMBER);

Step 2) Create a Page Like Below.


Step 3) Create EO by using above table and while create Select Generate VO. so it will create automatically VO.

Step 4) Attach VO to AM.

Step 5) open Your AM , AMImpl.java file and Write below code.

    public  void DataEntryRecord()
    {
        DataEntryManEOBaseVOImpl vo= getDataEntryManEOBaseVO1();
        OADBTransaction trans= getOADBTransaction();
        vo.executeQuery();
        Row v_row;
        v_row = (Row)vo.createRow();
        vo.insertRow(v_row);
    }

Step 6)  Create Controller and Write below code.

/*===========================================================================+
 |   Copyright (c) 2001, 2005 Oracle Corporation, Redwood Shores, CA, USA    |
 |                         All rights reserved.                              |
 +===========================================================================+
 |  HISTORY                                                                  |
 +===========================================================================*/
package xxamw.oracle.apps.po.requisition.webui;

import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;

import oracle.apps.fnd.framework.webui.beans.message.OAMessageDateFieldBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;

import xxamw.oracle.apps.po.requisition.server.HelloWorldAMImpl;

/**
 * Controller for ...
 */
public class DataEntryCO extends OAControllerImpl
{
  public static final String RCS_ID="$Header$";
  public static final boolean RCS_ID_RECORDED =
        VersionInfo.recordClassVersion(RCS_ID, "%packagename%");

  /**
   * Layout and page setup logic for a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
   */
  public void processRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processRequest(pageContext, webBean);
    HelloWorldAMImpl he = (HelloWorldAMImpl)pageContext.getApplicationModule(webBean);
    he.DataEntryRecord();
  }

  /**
   * Procedure to handle form submissions for form elements in
   * a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
   */
  public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processFormRequest(pageContext, webBean);
    
    if (pageContext.getParameter("Add")!=null) 
    {
        HelloWorldAMImpl he1= (HelloWorldAMImpl)pageContext.getApplicationModule(webBean);
        he1.getOADBTransaction().commit();
        
        OAMessageTextInputBean a1=(OAMessageTextInputBean) webBean.findChildRecursive("EmpNo") ;
        OAMessageTextInputBean a2=(OAMessageTextInputBean) webBean.findChildRecursive("Ename") ;
        OAMessageTextInputBean a3=(OAMessageTextInputBean) webBean.findChildRecursive("Salary") ;
        OAMessageDateFieldBean a4= (OAMessageDateFieldBean)webBean.findChildRecursive("Doj");
        OAMessageTextInputBean a5=(OAMessageTextInputBean) webBean.findChildRecursive("Address") ;
        
        a1.setText(pageContext, null);
        a2.setText(pageContext, null);
        a3.setText(pageContext, null);
        a4.setValue(pageContext,null);
        a5.setText(pageContext, null);
        
        throw new OAException("Records Succesfully Inserted",OAException.CONFIRMATION);
        
    }
    
        if (pageContext.getParameter("Clear")!=null) 
        {
            OAMessageTextInputBean a1=(OAMessageTextInputBean) webBean.findChildRecursive("EmpNo") ;
            OAMessageTextInputBean a2=(OAMessageTextInputBean) webBean.findChildRecursive("Ename") ;
            OAMessageTextInputBean a3=(OAMessageTextInputBean) webBean.findChildRecursive("Salary") ;
            OAMessageDateFieldBean a4= (OAMessageDateFieldBean)webBean.findChildRecursive("Doj");
            OAMessageTextInputBean a5=(OAMessageTextInputBean) webBean.findChildRecursive("Address") ;
            
            a1.setText(pageContext, null);
            a2.setText(pageContext, null);
            a3.setText(pageContext, null);
            a4.setValue(pageContext,null);
            a5.setText(pageContext, null);
            
           throw new OAException("Records Succesfully Cleared",OAException.CONFIRMATION);
            
        }
    }

}

No comments:

Post a Comment

AME (Approval Management Engine)

AME (Approval Management Engine) : AME Stands for Oracle Approval Management Engine. AME is a self service web application that enables...