Saturday, August 17, 2019

SPEL in OAF ?

SPELL stands for "Simplest Possible Expression Language".

SPELL is used to carry values dynamically.

SPELL will get the values dynamically at run time.

SPELL is the Boolean value (TRUE/FALSE).

Syntax:




Employee Information when we click on “Get Employee Information” button now the same output we are adding one image icon so that it appears to each and every row as shown in the below figure:



Step 1)  Create a page like below.

Step 2) Added Edit Image for each and every row. below are the steps.
  • Now go to the table region, right click on the table region select New -> Item.
  • In the Property Inspector of item do the following changes:
  1. Select the Item style as image.
  2. In Image URL give the name of the image for example for edit image we have predefined images in “p9879989_R12_GENERIC\jdevhome\jdev\myhtml\OA_MEDIA” , give the following image in Image URI /OA_MEDIA/detailsicon_enabled.gif.
  3. In client action select Action Type as “fireAction“.
  4. In client action give Event name as “Edit“


Now the page structure looks like:

Step 3) Write click on Main region and Select Set New Controller and create controller and write below code and compile and see the test the output. when you click on Edit button you will go to the edit page for corresponding record.

Write this code in Process form request.

if("Edit".equals(pageContext.getParameter(EVENT_PARAM)))
{
pageContext.setForwardURL("OA.jsp?page=/xxapples/oracle/apps/po/insertingrecords/webui/InsertDataPG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}


In IF condition “Edit” is the Client Action Event Name which we have given.

if you click on Pencil update button it will go to edit page and that looks like.





but here we need to carry the data to that page rather than creating employee.
if you click on Employee Number 2 update icon it should show employee number 2 data instead of showing empty page , so to do that we have to use SPELL functionality.
The steps are SPELL syntax we know already. so use that and implement the steps.
The VO to get employee details is EmployeeSearchVO1
Empno is the primary key value (attribute name)/ column name of the table in view.
Now we need to pass the above spel to image, for that select the image and then in Property Inspector,
Client Action -> Parameters
Once we click on the icon a Parameters window will get open in that, click on Add Parameters button and then give some name (example pempno) in the value pass the SPEL what we created ( ${oa.EmployeeSearchVO1.Empno} ). 
After giving name and passing SPEL value in the Value field click on OK button.


Now we need to call this parameter in the Create Employee page CO because whenever we click on the image item in the table list showing employee details it takes us to the Create Employee Page but it will not carry any values here our task is to carry values.
write below code in Process request when employee create page open it should carry values.and the code like below.

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

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

/**
 * Controller for ...
 */
public class SpellCO 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("DataEntryManEOBaseVO1");
    vo.executeQuery();
      HelloWorldAMImpl ham=(HelloWorldAMImpl)pageContext.getApplicationModule(webBean);
    if(pageContext.getParameter("pEmpno")!=null)
    {
        String hid = pageContext.getParameter("pEmpno").toString();
        String whereclause = "EMPNO='"+hid+"'";
        ham.getDataEntryManEOBaseVO1().setWhereClause(whereclause);
        ham.getDataEntryManEOBaseVO1().executeQuery();

    }
  }

  /**
   * 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("update".equals(pageContext.getParameter(EVENT_PARAM))) 
    {
        pageContext.setForwardURL("OA.jsp?page=/xxamw/oracle/apps/po/requisition/webui/DataEntryPG",
                                   null,
                                   OAWebBeanConstants.KEEP_MENU_CONTEXT,
                                   null,
                                   null,
                                   true,
                                   OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
                                   OAWebBeanConstants.IGNORE_MESSAGES
                                   );
   
    }
  }


}

Yo can see output like below.




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