Thursday, August 15, 2019

Display Data from DB in the Page in OAF?

Requirement is to display Table data while loading the page.

Query:

SELECT SEGMENT1,CREATION_DATE,ORG_ID,VENDOR_ID FROM PO_HEADERS_ALL WHERE ROWNUM<100

Step 1) Create a Page like "Hello World Page"
Step 2) Create AM.
Step 3) Create VO by using Above Query
Step 4) Attach VO to AM.
Step 5) Right click on Page Main region and select Region using wizard option and there select your required AM and VO and create table with columns  and select column type as Message Text Input.
Step 6) Create a CO by selecting main region and write below code.

If you want to Display Data while page Loading Write code in Process Request.

/*===========================================================================+
 |   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.OAViewObject;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;

/**
 * Controller for ...
 */
public class PODispCO 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);
    
    OAApplicationModule am=(OAApplicationModule)pageContext.getApplicationModule(webBean);
      OAViewObject vo=(OAViewObject)am.findViewObject("PODetailsVO1");
      System.out.println("Test1");   
      vo.setWhereClause(null);
      System.out.println("Test2");   
      vo.setWhereClause("1=1");
      System.out.println("Test3");   
      vo.executeQuery();
      System.out.println("Test4"); 
  }

  /**
   * 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 you want to Display Date by click on GO button write code in Process form request.

/*===========================================================================+
 |   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.OAViewObject;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;

/**
 * Controller for ...
 */
public class PODispCO 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);
  
  }

  /**
   * 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("GO")!=null)
    {
        OAApplicationModule am=(OAApplicationModule)pageContext.getApplicationModule(webBean);
        OAViewObject vo=(OAViewObject)am.findViewObject("PODetailsVO1");
        System.out.println("Test1");   
        vo.setWhereClause(null);
        System.out.println("Test2");   
        vo.setWhereClause("1=1");
        System.out.println("Test3");  
        vo.executeQuery();
        System.out.println("Test4");  
    }
    }


}


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...