Monday 15 September 2014

Parameterized Popup in OAF for R12.1.3



As per Dev Guide, There are two popup screen we can prepare in OAF, embedded and Parametrized, oracle has its tutorial on embedded popup, but little documentation on parametrized popups.

We will create a parameterized popup.

1. Create a package for popup as below

xxcom.oracle.apps.ibe.popup.server
 => create VOs
=> add VO to local AM

xxcom.oracle.apps.ibe.popup.webui

Identify the item which needs to be displayed as popup



ceate a stack layout on the item to be displayed as popup.

add one region, as popup, and another as link
Add caption
 
  above region is popup region



We need to create a popup region, which I prefer as Tablelayout, other only option is messagecomponnetlayout.

 


Now see How the popRN is defined



See How Parameter is Passed:

this is defined in parameter, while creating the popup region
param1={@ProductCode}&param2={@InventoryItemId}

 ProductCode and InventoryItemId are here the viewAttribute of the OrderLineVO, and can be called in below manner in PopUpCO, which is controller of additional regionn define here as popUpProductRN




Below is the code snippet of popUpProductRN controller



  public void processRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processRequest(pageContext, webBean);

      pageContext.writeDiagnostics(this, "popup > processRequest Starts****",6);
      String param1 =(String)pageContext.getParameter("param1");
      String param2 = (String)pageContext.getParameter("param2");


//Param1 is ProductCode Passed from View Attribute of the base page'
//param2 is inventoryitemid passed from viewObject's viewatribute of base page.
       try
      {
        popUpProductInfoVOImpl prodInfoVO =
          (popUpProductInfoVOImpl)am.findViewObject("popUpProductInfoVO1");
        prodInfoVO.setWhereClause(null);
        prodInfoVO.setWhereClause("CUST_ACCOUNT_ID=" + custAccId +
                                  " and SHIP_FROM_ORG_ID=" + InvOrgId +
                                  " and ORG_ID=" + pageContext.getOrgId() +
                                  "  and PRODUCT_CODE='" + product + "'");
        prodInfoVO.executeQuery();

      } catch (Exception e)
      {
      }

      try
      {
        popUpProductSpecVOImpl prodSpecVO =
          (popUpProductSpecVOImpl)am.findViewObject("popUpProductSpecVO1");
        prodSpecVO.setWhereClause(null);
        prodSpecVO.setWhereClause("CUST_ACCOUNT_ID=" + custAccId +
                                  " and ORGANIZATION_ID=" + InvOrgId +
                                  " and ORG_ID=" + pageContext.getOrgId() +
                                  "  and PRODUCT_CODE='" + product + "'");
        prodSpecVO.executeQuery();
      } catch (Exception e)
      {
      }

      try
      {
        OAImageBean productImage =
          (OAImageBean)webBean.findChildRecursive("productImage");
        productImage.setSource("/OA_MEDIA/ITEMS_IMAGES/" + product + ".jpg");
      } catch (Exception e)
      {
       }

      }
  }

 Popup page open up as below:



















 











4 comments:

  1. Guys one important note. Parameterized popup needs a separate AM, you can use the main page AM as the main page will not work once you close the popup.

    ReplyDelete
  2. Hi,

    How to get parameter from popup to main page when the popup is closed ?

    ReplyDelete
  3. Hi
    how to create Popup region in Processform Request

    With Regards,
    Suneetha

    ReplyDelete
    Replies
    1. To programmatically add a parameterized pop-up to a component , add the following code in processRequest method

      Step 1: Create an OAPopupBean
      OAPopupBean popupBean1=(OAPopupBean)createWebBean(pageContext,POPUP_BEAN,null,"myPopup1");
      popupBean1.setID("myPopup1");
      popupBean1.setUINodeName("myPopup1");
      popupBean1.setRegion("/oracle/apps/per/xyz/webui/PopupRN");
      popupBean1.setHeight("130");
      popupBean1.setWidth("320");
      popupBean1.setTitle("Popup Title");
      popupBean1.setParameters("personId={@PersonId}");
      popupBean1.setType(PARAMETERIZED_POPUP);

      Step 1: Add popup to item which you want to enable the pop-up, for example "EmpDtlBtn" button
      OAButtonBean empDtlBtnBean = (OAButtonBean)webBean.findChildRecursive("EmpDtlBtn");
      empDtlBtnBean.setPopupEnabled(true);
      empDtlBtnBean.setPopupRenderEvent("onClick");
      empDtlBtnBean.setPopupID("myPopup1");
      webBean.addIndexedChild(popupBean1);

      Delete