環境:

EBS : R11.5.10

JDeveloper: p8751878_GENERIC.zip 解壓至 D:\OAF_R11i

實作:

Step 01: 準備好程式檔案:HelloWorldPG.xml & HelloWorldMainCO.java

OAF_R11_Hello_01  

HelloWorldPG.xml

<?xml version = '1.0' encoding = 'UTF-8'?>
<!-- dbdrv: exec java oracle/jrad/tools/xml/importer XMLImporter.class java &phase=dat+24 checkfile:~PROD:~PATH:~FILE &fullpath:~PROD:~PATH:~FILE -username &un_apps -password &pw_apps -dbconnection &jdbc_db_addr  -userId "1" -rootPackage /oracle/apps/~PROD  -rootdir &fullpath:~PROD:mds:directory  -->
<page xmlns:jrad="http://xmlns.oracle.com/jrad" xmlns:oa="http://xmlns.oracle.com/oa" xmlns:ui="http://xmlns.oracle.com/uix/ui" version="9.0.3.8.13_1579" xml:lang="en-US" xmlns:user="http://xmlns.oracle.com/jrad/user" xmlns="http://xmlns.oracle.com/jrad" file-version="$Header$">
   <content>
      <oa:pageLayout id="PageLayoutRN" windowTitle="Polin-Demo: Hello World Window Title" title="Polin-Demo:Hello World Page Header" amDefName="oracle.apps.fnd.framework.server.OAApplicationModule">
         <ui:corporateBranding>
            <oa:image id="corporateBrandingImage" source="/OA_MEDIA/FNDSSCORP.gif"/>
         </ui:corporateBranding>
         <ui:contents>
            <oa:messageComponentLayout id="MainRN" controllerClass="polin.oracle.apps.ak.demo.webui.HelloWorldMainCO">
               <ui:contents>
                  <oa:messageTextInput id="HelloName" prompt="Name" columns="20" maximumLength="50"/>
                  <oa:messageLayout id="ButtonLayout">
                     <ui:contents>
                        <oa:submitButton id="Go" use="/oracle/apps/fnd/attributesets/Buttons/Go"/>
                     </ui:contents>
                  </oa:messageLayout>
               </ui:contents>
            </oa:messageComponentLayout>
         </ui:contents>
      </oa:pageLayout>
   </content>
</page>

HelloWorldMainCO.java

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

import oracle.apps.fnd.common.VersionInfo;
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.OAException;

/**
 * Controller for ...
 */
public class HelloWorldMainCO 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)
      {       
     String userContent = pageContext.getParameter("HelloName");  
     String message = "Hello, " + userContent + "!";
          throw new OAException(message, OAException.INFORMATION);
                  }
  }

}

 

Step 02:  Import OA Page to MDS

R11i 的 import.bat 是在目錄 D:\OAF_R11i\jdevbin\jdev\bin 下:

D:\OAF_R11i\jdevbin\jdev\bin\import.bat D:\OAF_R11i\jdevhome\jdev\myprojects\polin\oracle\apps\ak\demo\webui\HelloWorldPG.xml -rootdir D:\OAF_R11i\jdevhome\jdev\myprojects -username apps -password apps -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=erpdb.polin.com)(PORT=1522))(CONNECT_DATA=(SID=TEST)))"

 

OAF_R11_Hello_02  

檢查 MDS 是否有此筆資料

SET serveroutput ON;
BEGIN
  jdr_utils.printdocument('/polin/oracle/apps/ak/demo/webui/HelloWorldPG');
EXCEPTION
WHEN OTHERS THEN
  DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;

 若要刪除此筆 MDS,則可以用 jdr_utils.DeleteDocument 的函數

begin
  jdr_utils.DeleteDocument( '/polin/oracle/apps/ak/demo/webui/HelloWorldPG' ) ;
end ;
/

 

Step 03: FTP Upload class file to $JAVA_TOP

利用 FTP 工具將開發好所有 Package 的 class files,從開發本機目錄:D:\OAF_R11i\jdevhome\jdev\myclasses\polin\oracle\apps\ak\demo\webui,上載到 EBS 主機上的 $JAVA_TOP 相對應的目錄下,因為撰寫 Java 程式的 Package 為 polin.oracle.apps.ak.demo.webui ,所以 EBS 主機相對應的目錄為 $JAVA_TOP/polin/oracle/apps/ak/demo/webui

OAF_R11_Hello_03  
  

Step 04: Configure the Funtions

先規劃 Funtions 的相關屬性再作設定,HTML Call 則是 Step03 中,class file 上載到 EBS 主機上的 $JAVA_TOP 相對應的目錄下,此例為/polin/oracle/apps/ak/demo/webui/HelloWorldPG,所以HTML Call:OA.jsp?page=/polin/oracle/apps/ak/demo/webui/HelloWorldPG

Function User Function Name Description Function Type HTML Call
POLIN_OAF POLIN_OAF Polin OAF Demo SSWA jsp function

OA.jsp?page=/polin/oracle/apps/ak/demo/webui/HelloWorldPG

 

Step 05:Configure Menu

先規劃 MENU 的相關屬性再作設定

Menu Header

Menu User Menu Name Menu Type Description
POLIN_MENU POLIN_MENU Standard Polin OAF Menu

Menu Detail

Seq Prompt Submenu Function Description
10 Polin_OAF_HelloWorld   POLIN_OAF Polin_OAF_HelloWorld

 

Step 06:Configure Responsibility

OAF_R11_Hello_04  

 

這樣就可以測試正常了

 

 

文章標籤
創作者介紹
MIS

MISTECH 技術手抄本

MIS 發表在 痞客邦 PIXNET 留言(0) 人氣()