Java 1

Dynamic VO
public void intEmployee(String empName,String empId)
{
String voName="DynamicVO";
OAViewObject vo = (OAViewObject) findViewObject(voName);
Number empNum = null;
try { empNum = new Number(empId);
}
catch(Exception e) { }
if (vo != null)
{ vo.setWhereClause(null);
vo.setWhereClauseParams(null);
if(!empName.equals("") && !empId.equals("") )
{ String s1 = " EMPLOYEE_ID = "+empNum+" AND "+" UPPER(EMPLOYEE_NAME) LIKE "+"UPPER("+"'"+empName+"'"+")";
 vo.setWhereClause(s1);
}
else if(!empName.equals(""))
{ String s2 = " UPPER(EMPLOYEE_NAME) LIKE "+"UPPER("+"'"+empName+"'"+")";
 vo.setWhereClause(s2);
}
else if(!empId.equals(""))
{ String s3 = " EMPLOYEE_ID = "+ empNum; vo.setWhereClause(s3);
}
}
vo.executeQuery();
}


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

OAApplicationModule am = pageContext.getApplicationModule(webBean);
String searchEmpName = pageContext.getParameter("EmployeeName");
String searchEmpId = pageContext.getParameter("EmployeeId");
System.out.println("EmployeeName: "+searchEmpName);
System.out.println("EmployeeId: "+searchEmpId);
if (pageContext.getParameter("Search") != null)
{
Serializable[] parameters = { searchEmpName, searchEmpId };
Class[] paramTypes = { String.class, String.class };
am.invokeMethod("intEmployee",parameters,paramTypes);
pageContext.setForwardURLToCurrentPage(null,true,OAWebBeanConstants.ADD_BREAD_CRUMB_NO,OAException.ERROR);
}
}


public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
OAApplicationModule am = pageContext.getApplicationModule(webBean);
String sessionVariable = (String)pageContext.getSessionValue("SessionVariable");
if (("N".equals(sessionVariable)) || (sessionVariable == null))
{ am.invokeMethod("intEmployee1");
  pageContext.putSessionValue("SessionVariable","Y");
}
}



public void intEmployee1()
{
OADBTransactionImpl dbTx = (OADBTransactionImpl)getTransaction();
Transaction txn = getTransaction();
String sqlText = "SELECT Employee1.EMPLOYEE_ID AS EMPLOYEE_ID,\n" +
"Employee1.FULL_NAME AS EMPLOYEE_NAME,\n" +
"Employee1.EMAIL_ADDRESS AS EMPLOYEE_EMAIL,\n" +
"Employee2.EMPLOYEE_ID AS MANAGER_ID,\n" +
"Employee2.FULL_NAME AS MANAGER_NAME,\n"+
"Employee2.EMAIL_ADDRESS AS MANAGER_EMAIL\n"+
"FROM FWK_TBX_EMPLOYEES Employee1,\n" +
"FWK_TBX_EMPLOYEES Employee2\n"+
"WHERE Employee1.MANAGER_ID = Employee2.EMPLOYEE_ID";

OAViewDef viewDef = dbTx.createViewDef();
viewDef.setSql(sqlText);
viewDef.setExpertMode(true);
viewDef.setViewRowClass("oracle.apps.fnd.framework.server.OAViewRowImpl");
viewDef.addSqlDerivedAttrDef("EMPLOYEE_ID", //Attr name
"EMPLOYEE_ID",
"oracle.jbo.domain.Number",
Types.NUMERIC, true, true,
AttributeDef.READONLY, (byte)15);
viewDef.addSqlDerivedAttrDef("EMPLOYEE_NAME", //Attr name
"EMPLOYEE_NAME",
"java.lang.String",
Types.VARCHAR, true, true,
AttributeDef.READONLY, (byte)7);
viewDef.addSqlDerivedAttrDef("EMPLOYEE_EMAIL", //Attr name
"EMPLOYEE_EMAIL",
"java.lang.String",
Types.VARCHAR,true, true,
AttributeDef.READONLY, (byte)15);
viewDef.addSqlDerivedAttrDef("MANAGER_ID", //Attr name
"MANAGER_ID",
"oracle.jbo.domain.Number",
Types.NUMERIC, true, true,
AttributeDef.READONLY, (byte)15);
viewDef.addSqlDerivedAttrDef("MANAGER_NAME", //Attr name
"MANAGER_NAME",
"java.lang.String",
Types.VARCHAR, true, true,
AttributeDef.UPDATEABLE, (byte)7);
viewDef.addSqlDerivedAttrDef("MANAGER_EMAIL", //Attr name
"MANAGER_EMAIL",
"java.lang.String",
Types.VARCHAR, true, true,
AttributeDef.UPDATEABLE, (byte)7);
String  voName="DynamicVO";
OAViewObject vo = (OAViewObject) findViewObject(voName);
if (vo != null)
{ vo.remove();
System.out.println("VO removed: " + voName);
}
vo = (OAViewObject) createViewObject(voName, viewDef);
}







public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)throws OAException
  {
    super.processFormRequest(pageContext, webBean);
    OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
if ("Go".equals(pageContext.getParameter(EVENT_PARAM)))
         {
           DataObject fileUploadData = (DataObject)pageContext.getNamedDataObject("FileUploadItem");
           String fileName = null;
           String contentType = null;
           Long fileSize = null;
           Integer fileType = new Integer(6);
           BlobDomain uploadedByteStream = null;
           BufferedReader in = null;
   try
           {
             fileName = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME");
             contentType = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");
             uploadedByteStream = (BlobDomain)fileUploadData.selectValue(null, fileName);
             in =  new BufferedReader(new InputStreamReader(uploadedByteStream.getBinaryStream()));
fileSize = new Long(uploadedByteStream.getLength());
             System.out.println("fileSize  : " + fileSize);
             System.out.println("fileName :"+fileName);
             System.out.println("contentType :"+contentType);
           }
catch (NullPointerException ex)
           {
             throw new OAException("Please Select a File to Upload",OAException.ERROR);
           }


 
 The below are the BC4J components which work in OAF
 ENTITY OBJECT:
• The entity objects are used if one wishes to do some insert/update operations.
• Entity Objects represents a Data Base Row of a table.
• Entity Objects will be based on the View (Oracle View), Synonyms or snapshots.
• We need to create Entity Object if we want to perform DML operations on the OAF Page.
VIEW OBJECT :
• View Objects are used when we want some data to be displayed on page.
• View Objects access the result set of a SQL statement, it can be either based on the Entity Object or plain SQL query.
• View Objects are used just for displaying purpose.
APPLICATION MODULE:
• It is very important component in the Model.
• Every Oracle Application Framework (OAF) page should be attached to some Application Module.
• It is the interface between the Client transactions and Data Base transactions.










Insert Data

public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{super.processRequest(pageContext, webBean);
OAApplicationModule am=pageContext.getApplicationModule(webBean);

am.invokeMethod("CreateSupplierRow");
}


public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{super.processRequest(pageContext, webBean);
OAApplicationModule am=pageContext.getApplicationModule(webBean);

String event= pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM);
   

String source= pageContext.getParameter(OAWebBeanConstants.SOURCE_PARAM);

if(pageContext.getParameter("Apply")!=null)
{am.invokeMethod("SaveData");

//These five lines are there to display the confirmation Message
String supId=pageContext.getParameter("SupplierID");
String supName=page.Context.getParameter("SupplierName");

MessageToken[] tokens= {new MessageToken("SUPID",supId), new MessageToken("SNAME",supName)};
OAException msg = new OAException("PO","xxinsertData", tokens, OAException.Confirmation,null);
throw msg;
}
if(ADD_ROWS_EVENT.equals(event))
{
am.invokeMethod("CreateSitesRow");
}
}


public void CreateSupplierRow()
{
SuppliersEOVOImpl vo = getSuppliersEOVO1();

Row row= vo.createRow();
if(!vo.isPreparedForExecution())
{vo.setmaxFetchSize(0);
}
vo.insertRow(row);

Number seq = getOADBTransaction().getSequenceValue("fwk_tbx_suppliers_s");
row.setAttribute("SupplierId",seq)
row.setNewRowState(Row.STATUS_INITIALIZED);
}


public void CreateSitesRow()
{
SitesEOVOImpl vo = getSitesEOVO1();

SuppliersEOVOImpl vo1 = getSupplerEOVO1();

Row siterow=vo.createRow();
if(!vo.isPreparedForExecution())
{ vo.setMaxFetchSize(0);
}
int count = vo.getRowCount();
vo.insertRowAtRangeIndex(count,siterow);

//Setting the sequence value in SupplierID,SupplierSiteID Attribute Fields
Number seq= getOADBTransaction().getSequenceValue("fwk_tbx_supplier_sites_s");
String mSupId = vo1.getCurrentRow().getAttribute("SupplierId").to_String();

siterow.setAttribute("SupplierId",mSupId); //Setting the sequence value in SupplierID attribute
siterow.setAttribute("SupplierSiteId",seq); //Setting the sequence value in SupplierSiteID attribute
siterow.setAttribute("SerialNum",count+1); //Setting the sequence value in SerialNum Transient Attribute.

siterow.setNewRowState(Row.STATUS_INTIALIZED);
}

public void SaveData()
{this.getTransaction().commit();
}










JAVA CODE
if ("update".equals(pageContext.getParameter(EVENT_PARAM)))

pageContext.setForwardURL("OA.jsp?page=/prajkumar/oracle/apps/fnd/searchdemo/webui/UpdatePG",
                                    null,
                                    OAWebBeanConstants.KEEP_MENU_CONTEXT,                            
                                    null,                                                  
                                    null,
                                    true,                            
                                    OAWebBeanConstants.ADD_BREAD_CRUMB_NO,
                                    OAWebBeanConstants.IGNORE_MESSAGES);

-------------------------------------------------------------------------------------------------
public void remove()
{ super.remove();
} // end remove()


   
public void apply()
{ getTransaction().commit();
}

public void rollback()
{getTransaction().rollback();
}


if ("delete".equals(pageContext.getParameter(EVENT_PARAM)))




---------------------------------------------------------------------------------------------------


OADBTransaction oadbtransaction = (OADBTransaction)getTransaction();

StringBuffer str = new StringBuffer();
 str.append( " BEGIN ");
 str.append( " test_package.data_sum( ");
 str.append( " item1     => :1, ");
 str.append( " item2     => :2, ");
 str.append( " data_sum  => :3  ");
 str.append( "  ); ");
 str.append( " END; ");

OracleCallableStatement oraclecallablestatement =  (OracleCallableStatement)oadbtransaction.createCallableStatement(str.toString(), 1);

try
{
 oraclecallablestatement.setInt(1,  Integer.parseInt(item1) );
 oraclecallablestatement.setInt(2,  Integer.parseInt(item2) );
 oraclecallablestatement.registerOutParameter(3, Types.VARCHAR);
 oraclecallablestatement.execute();

 retValues = oraclecallablestatement.getString(3);
}


---------------------------------------------------------------------------------

vo.setWhereClause(null);
vo.setWhereClauseParams(null);




--------------------------------------------------------------------------------------



OAApplicationModule am = pageContext.getApplicationModule(webBean);
 String searchEmpName = pageContext.getParameter("EmployeeName");
 String searchEmpId = pageContext.getParameter("EmployeeId");



if (pageContext.getParameter("Search") != null)
  {
Serializable[] parameters = { searchEmpName, searchEmpId };
Class[] paramTypes = { String.class, String.class };
am.invokeMethod("intEmployee",parameters,paramTypes);
pageContext.setForwardURLToCurrentPage(null,true,OAWebBeanConstants.ADD_BREAD_CRUMB_NO,OAException.ERROR);
  }





---------------------------------------------------------------------------------



OAApplicationModule am = pageContext.getApplicationModule(webBean);
OAViewObject vo = (OAViewObject) am.findViewObject("empVO1");
String x = pageContext.getParameter("param");
vo.setwhereClauseParam(0,x);
if(!vo.isPreparedForExecution())
vo.executeQuery();

-------------------------------------------------------------------------------------


 OAMessageTextInputBean nameIDBean = (OAmessageTextInputBean)webBean.findIndexedChildRecursive("nameID");
         //alt +Enter//getting value/// this method will return memory pointer location of this component/bean

 String nameStr = nameIDBean.getText(pageContext);


 String welcomeStr = "Hello" +nameStr +"Welcome to OAF";

OAException exceptionObj = new OAException(welcomeStr,OAException.INFORMATION);// creating object, for displaying the information to the user;
throw exceptionObj;

        //another way
  thorw new OAException("user Clicked ",OAException.WARNING); //OAException(welcomeStr,OAException.warning) etc.----OAExceptionOAException is contructor
 
    else if(pageContext.getParameter("sb2")!=null)
     {thorw new OAException("user Clicked ",OAException.WARNING);
     }




----------------------------------------------------------------------------------------------

OAApplicationModule am = pageContext.getApplicationModule(webBean);
am.invokeMethod("initPerPeopleVO");

or we can write
AmazonBizzServiceImpl amazonAM = (AmazonBizzServicesImpl)pageContext.getApplicationModule(webBean);
amazonAM.initPerPeopleVO();






-----------------------------------------------------------------


we want to change the functionality of a page thats why we do controller extension.
Most of the time the we can change page propoerty by personalization in some casezs we have complex req that time it is very useful to change page definition at run time vy CO extension,.
Advantage
co CAN be done at responsibilty, site and function level.

I want to default the value anil. We can hide the email address,

1st. About this page, and find the page name.
2nd, And the controller involved is create CO,

Now i will extend my controller.

Now we create a custom controller. We create a custom controller which is based on standard controller. So when we create a custom controller,.
xxfaoCreateCo , this will be extending the standard CreateCO controller.

We exetend the standatrd controller so that we have the standard functionality aswell.



1st . Copy the the standard controller package
oracle.apps.ak.solution.employee.server

2nd. Right click, create a new file. It wil be java class.

Name:xxfaoCreateCo
Package:xxfao.oracle.apps.ak.solution.employee.webui
Extends: oracle.apps.ak.solution.employee.webui.createCO



public class xxfaoCreateCO extends CreateCO{
public xxfaoCreateCO(){

}

public void processRequest (OAPageContext pagecontext, OAWebBean webBean)

{super.processRequest(pageContext, webBean)
OAMessageTextInputBean  fname = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("FirstName");
fname.setText("Vivek");                        
// OA at start and bean at last in between MessageTextInput, that is how u find the corresponding class for the style of that item. OAStyleTextInputBean, OATableBean
//findIndexedChildRecursive : retrun generic bean item, i have to typecast into message textinput bean.


fname.setRendered(false);
}


Personalization (click on personalize page)

We will replace the standard controller with the new controller.
Standard will be called bcoz we are calling the super on the top.

We change at site , responsibiltuy or user level.

Controller class: xxfao.oracle.apps.ak.solution.employee.webui.xxfaoCreateCO











----------------------------------------------------------------------------------

We want to add a field which not there in View object.

Let add title and name field:

1st find the name of the VO view object.(detailsVO1)
(detailsVO1) location: oracle.apps.ak.solution.employee.server

We will create
xxfao.oracle.apps.ak.solution.employee.server.xxfaodetailsVO

1st Create a new view oject which extends standard view object.
2nd perform substitution.
3rd Create a new item using personalization which will display the title.


An extension is combination of extension + personalixation.

Right click, create a new ADFBusinessComponents -> View object

Package: xxfao.oracle.apps.ak.solution.employee.server
Name : xxfaodetailsVO
Extends: oracle.apps.ak.solution.employee.server.detailsVO


Binding style: OracleNamed


Add the new column. fwkTbxEmployeeEO.TITLE as xx_title (name all custom component as XX)



Go to-> Business Components-> Substitution
 Left ->Standrd VO     Right-> CustomVO
Click on Add.


personalize page-> add new item



Propert -> Run/Debug -> Edit -. -Djbo.project = ClassProject  (You have to specify the project name)

terminate Apache or OC4J server.
----------------if title is not create go to the attribute list and create it manually.
If its transient(not derived from DB), then Expression XX_TITLE




-----------------------------------------------

PPR

The evolution of PPR was time when developers had no choice except to refresh entire page in response to user interaction on OAF pages.The full page refresh can be slow, giving the user the impression that the application is unresponsive

The partial page rendering process breaks down into three main areas:-
1. Partial page event
2. Partial page rendering pass
3. Partial page replacement.



When the partial page event is received by the application, the application responds by determining the set of partial targets to render and performing the partial page rendering pass. The partial page rendering pass is similar to a full page rendering pass. In both cases, the UI-Node tree is traversed by calling render() on each node in the tree. However, in the partial page rendering case, only the contents generated by the partial targets are actually sent back to the browser. All other contents are dropped. So, although the scope of a partial page rendering pass and full page rendering pass are similar in the number of UI-Nodes that are rendered, the partial page response is generally much smaller, since only the modified contents are sent back to the browser. The final part of the PPR process is the partial page replacement. When the browser receives the partial page response, the new contents for each partial target node are copied from the hidden iframe into the main browser window, replacing the existing contents for each target node. So, for example, in the table navigation case, rather than replacing the entire page, just the contents of the table itself are replaced. The browser reflows in response to the modifications, displaying the new contents to the user without fully re-rendering the entire page.



1. Create a New OA Workspace and Empty OA Project

File> New > General> Workspace Configured for Oracle Applications
File Name -- PPRProj
Project Name – PPRDemoProj
Default Package -- prajkumar.oracle.apps.fnd.pprdemo



2. Create Application Module AM

PPRDemoProj right click > New > ADF Business Components > Application Module
Name -- PPRAM
Package -- prajkumar.oracle.apps.fnd.pprdemo.server


Check Application Module Class: PPRAMImpl Generate JavaFile(s)

3. Create a PPRVO View Object

PPRDemoProj> New > ADF Business Components > View Objects
Name – PPRVO
Package – prajkumar.oracle.apps.fnd.pprdemo.server

In Attribute Page

Click on New button and create transient primary key attribute with the following properties:

Attribute Property
Name RowKey
Type Number
Updateable Always
Key Attribute (Checked)


Click New button again and create transient attribute with the following properties:

Attribute Property
Name TextItem2Render
Type Boolean
Updateable Always



Note – No Need to generate any JAVA files for PPRVO



4. Add Your View Object to Root UI Application Module

Right click on PPRAM > Edit PPRAM > Data Model >
Select PPRVO in Available View Objects list and shuttle to Data Model list


5. Create a OA components Page

PPRDemoProj right click > New > OA Components > Page
Name – PPRPG
Package -- prajkumar.oracle.apps.fnd.pprdemo.webui



6. Modify the Page Layout (Top-level) Region


Attribute Property
ID PageLayoutRN
Region Style pageLayout
Form Property True
Auto Footer True
Window Title PPR Demo Window Title True
Title PPR Demo Page Header
AM Definition prajkumar.oracle.apps.fnd.pprdemo.server.PPRAM



7. Create the Second Region (Main Content Region)

Right click on PageLayoutRN > New > Region

Attribute Property
ID MainRN
Region Style messageComponentLayout



8. Create Two Text Items

Create First messageTextItem --

Right click on MainRN > New > messageTextInput

Attribute Property
ID TextItem1
Region Style messageTextInput
Prompt Text Item1
Length 20
Disable Server Side Validation True
Disable Client Side Validation True
Action Type firePartialAction
Event TextItem1Change
Submit True



Note -- Disable Client Side Validation and Event property appears after you set the Action Type property to firePartialAction



Create Second messageTextItem --

Select MainRN right click > New > messageTextInput


Attribute     Property
ID TextItem2
Region Style messageTextInput
Prompt Text Item2
Length 20

Rendered

${oa.PPRVO1.TextItem2Render}



9. Add Following code in PPRAMImpl.java



import oracle.apps.fnd.framework.OARow;
import oracle.apps.fnd.framework.OAViewObject;
import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
import oracle.apps.fnd.framework.server.OAViewObjectImpl;

public void handlePPRAction()
{
 Number val = 1;
 OAViewObject vo = (OAViewObject)findViewObject("PPRVO1");

 if (vo != null)
 {
  if (vo.getFetchedRowCount() == 0)
  {
   vo.setMaxFetchSize(0);
   vo.executeQuery();
   vo.insertRow(vo.createRow());
   OARow row = (OARow)vo.first();
     
   row.setAttribute("RowKey", val);
   row.setAttribute("TextItem2Render", Boolean.FALSE);  
  }
 }
}



10. Implement Controller for Page

Select PageLayoutRN in Structure pane right click > Set New Controller

Package Name -- prajkumar.oracle.apps.fnd.pprdemo.webui

Class Name – PPRCO



Write following code in processFormRequest function of PPRCO Controller



import oracle.apps.fnd.framework.OARow;
import oracle.apps.fnd.framework.OAViewObject;


public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
 super.processRequest(pageContext, webBean);
 PPRAMImpl am = (PPRAMImpl)pageContext.getApplicationModule(webBean);
   
 am.invokeMethod("handlePPRAction");
}

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
 super.processFormRequest(pageContext, webBean);
     
 PPRAMImpl am = (PPRAMImpl)pageContext.getApplicationModule(webBean);
 OAViewObject vo = (OAViewObject)am.findViewObject("PPRVO1");
 OARow row = (OARow)vo.getCurrentRow();
     
 if ("TextItem1Change".equals(pageContext.getParameter(EVENT_PARAM)))
 {
  if (pageContext.getParameter("TextItem1").equals(""))
  {
   row.setAttribute("TextItem2Render", Boolean.FALSE);
  }
  else
  {
   row.setAttribute("TextItem2Render", Boolean.TRUE);
  }
 }
}

 





Supplier Page

supplierEO - india.oracle.apps.po.india.schema.server
supplierEOVO -india.oracle.apps.po.india.server

siteEO - india.oracle.apps.po.india.schema.server
siteEOVO -india.oracle.apps.po.india.server

xxSupplierAM - india.oracle.apps.po.india.server //select supplierEOVO1 , siteEOVO1


xxInsertPG - india.oracle.apps.po.india.webui

Select AM definition in MainRegion

Create New Region - Region 1-> Create 4 new item with (Message Text Input) , view instance(SuppliersEOVO), view Attribute(name), and data type
supplier ID, on hold flag(message text input) , enddate, start date, supplier name


Create another new region - Region2(Site Details) - in region select view instance (sitesEOVO1)

Create a new -> column (supplierID)
Click column -> right click -> new item  -> Properties-> (BC4J) view attribute-> SupplierID  //Item Style - message text input
Click Column Header -> right click ->  sortable header-> Prompt(supplierID)


Create a new -> column(SupplierSiteID)
Click column -> right click -> new item  -> Properties-> (BC4J) view attribute-> SupplierSiteID  //Item Style - message text input
Click Column Header -> right click ->  sortable header-> Prompt(SupplierSiteID)

Create a new -> column (SiteName)
Click column -> right click -> new item  -> Properties-> (BC4J) view attribute-> SiteName //Item Style - message text input
Click Column Header -> right click ->  sortable header-> Prompt(SiteName)

Create a new -> column (PaymentTermCode)
Click column -> right click -> new item  -> Properties-> (BC4J) view attribute-> PaymentTermCode //Item Style - message text input
Click Column Header -> right click ->  sortable header-> Prompt(PaymentTermCode)

Create a new -> column (CarrierCode)
Click column -> right click -> new item  -> Properties-> (BC4J) view attribute->CarrierCode //Item Style - messageLOVInput
Click Column Header -> right click ->  sortable header-> Prompt(CarrierCode)


Create a new -> column (PurchasingSiteFlag)
Click column -> right click -> new item  -> Properties-> (BC4J) view attribute->PurchasingSiteFlag //Item Style - message text input
Click Column Header -> right click ->  sortable header-> Prompt(PurchasingSiteFlag)


Create a new -> Footer
Click column -> right click -> new item  -> Properties-> (BC4J) view attribute->CarrierCode //Item Style - messageLOVInput
Click Column Header -> right click ->  sortable header-> Prompt(CarrierCode)


Create a new -> column
Click column -> right click -> Add Table Row -> Properties(Functional .add row lable= Add rows , rows to add = 1 , insert row auto = False)

------------------------------------------
For Carrier Code we need to add VO->

go to india.oracle.apps.po.india.server -> right click -> new view object
CarrierCodeVO -india.oracle.apps.po.india.server


//for carrier code
Rightclick  -> india.oracle.apps.po.india. -> OA Component -> Region (Stle: List Of Values)
xxCarrierCodeRN

RightClick on region -> use table using wizard

Lookupcode column property-> Functional (search allowed : Yes)

Region Property:' Scope-> public
and select application module

Now go to the carrier code in main page
go to the property > External LOV-> click browse (go to following path /india/oracle/apps/po/india/webui) -> click search
select the carrier code

Go to LOV mapping->

Functional
LOV Region Item: LOOkupcode
Retuen Item: Carrier Code
Criteria Item : Carrier Code

----
sitedetails-> property -> width-> 100%



---------------------------

go to siteEOVO -> add a new attribute-> Serial number->
add this new column under supplier region


---------------------------------------------






























OAF Registration

The basic file available in OAF is java file and XML file.

we never move java file to server
*.java(we never move source code)

-----------------------------------
if we want to deploy OAF page

.*xml, .*java
----------------------------
we move
class file(eo,vo, am)
xml file--> bc4j objects, pg files

-----------------------------------

Class,XML--> JAVA_TOP
PG.xml--> MDS Layer

--------------------------------------------

open putty
echo applmgr$echo $JAVA_TOP  --> (D:\oracle\VIS\apps\apps_st\comn\java\classes\) move the folder in this folder

oracle seeded files will be in oracle folder

-------------------
for pg.xml we have import statement


import C:\jdev\jdevhome\jdev\febpaftraining\myprojrcts\xxibm\oracle\apps\fnd\webui\studentDNMUsingEOPG.xml
-username apps -password apps -dbconnection
"(DESCRIPTIOn=(ADDRESS=(PROTOCOL=tcp)(HOST=glo.dev.com)(PORT=1521))(CONNECT_DATA=(SID=VIS)))" -rootDor C:\jdev\jdevhome\jdev\
feboaftraining\myprojects

--------------------
open command prompt
cd c:\jdev
cd jdevbin
cd oaext
cd bin
dir


it will show dorectory of C:\jdev\jdevbin\oaext\bin

execute the import command
-------------------------------------


select * from jdr_paths where path_name = 'StudentDMLUsingEOPG' ---page info  ---- created_by (interal means its custom page)

select * from jdr_components where comp_docid = 95411;--- iitem / region info

select * from jdr_attributes where att_comp_docid = 95411;--- attributes/properties of item/region

select jdr_mds_internal.getdocumentname(95411) from dual;


-----------------------------------
registration of page

AOL function and menu

Description
Function: XX_IBM_PG
User Function Name: XX_IBM_PG

Properties
Type: SSWA jsp function    ----------if we are rejestering ADF Page we use External ADF Application

WEBHTML
OA.jsp?page=/xxibm/oracle/apps/fnd/webui/StudentDMLUsingEOPG    (select jdr_mds_internal.getdocumentname(95411) from dual;)


------------------------------

assign function to menu

-------------------------

clear cache in function administrator
------------------------------------------------

Bouncing sever

cd $ADMIN_SCRIPTS_HOME
ls  (will show alll script to bounce different servers)

$adopmnct_.sh status

$adapmnctl.sh status  (it will show the server this script will stop)

$adopmnctl.sh stop all

$adopmnctl.sh status  (status 0 error)

$adapmnctl.sh start all


-------------------------------------
starting each server manually (oacore, form, report and http server)

applmgr$adoa--- shows script with this name like operator


$adoafmctl.sh start all     ----$adapcctl.sh status

$adformsctl.sh start all

$adoacorectl.sh start all










copy the folder to java top
D:\oracle\VIS\apps\apps_st\comn\java\classes

prepare import script
go to command promt

D:\oracle\VIS\apps\apps_st\comn\java\classes\ebspage\oracle\apps\po\requisition\webui\ebsPG.xml -rootdir




--------------------------------------------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------------------------------------------


controller -> Java file to handel the event. -> At page level or region level

On the main region we create controller. (right click and create new controller.)


package-> strucure in which files are saved.

import-> whenever we are accessing any method which is available in another class, we have to import that particular.

public class HelloWorldCO extend OAControllerImpl  ---> it is extending java api whcih will have core logic for handelling event.
it will have all the access of OAControllerImpl class. (it will have field , constructor and methods. it is provided by oracle)

--->to handel the buuton or hyperlink event, without using OA framework will be extra 20 line of code.
    it will have the access of OAControllerImpl.  Double click on OAControllerImpl, which will have constructor and set of methods.


CO---> OAControllerImpl(JavaAPI---core for handelling events.)

HelloWorldCO--> Extending --> OAControllerImpl
Thers 3 methods have 2 parameters

1.---> ProcessRequest(OAPageContext pageContext, OAWebBean webBean)
During page load, initialization. (Before report, before parameter)

2.--> ProcessFormData(OAPageContext pageContext, OAWebBean webBean)
it is used for getting value for the components, for validation of data of fields when user enter it. and setting the value.

3.--->ProcessFormRequest(OAPageContext pageContext, OAWebBean webBean)
        called afer page load.when we click button event, LOV , Popups. Handellig events.

pageContext  --> Store page related infor, parameter information , user ino, resp , appl name ...etc,
webBean      --> Store the hierarchy of the OAF UI Components.

parameter information-> whenevr we are passing data from one page to another this particula page context object or variable will store it.




Hellow World Page
-----------------
1.we will create a text Input box --> it is Java Bean  (for setting and getting value)
---> java API for the purpose of setting the properties.
---> itemStyle--> message TextInput
----> OAmessageTextInputBean (refer class name)


2. Create submit button

3. //OAException(welcomeStr,OAException.warning) etc.----this is contructor
  OAException A is a constructor --- in java class , if method name = class name its construcor


OAMessageTextInputBean CLASS
nameIDBean OBJECT
webBean WE ARE GTTING THE VALUE
nameID PASSING THE nameID



public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
 {
   super.processFormRequest(pageContext, webBean);
   String eventName = pageContext.getParameter("go");  // it will have event value when we click submit button
   System.out.println("event name is ---->"+eventName);
 
    if(pageContext.getParameter("go")!=null)  // it check whether event is clicked.
     {
         OAMessageTextInputBean nameIDBean = (OAmessageTextInputBean)webBean.findIndexedChildRecursive("nameID");
           //alt +Enter//getting value/// this method will return memory pointer location of this component/bean
         String nameStr = nameIDBean.getText(pageContext);
         String welcomeStr = "Hello" +nameStr +"Welcome to OAF";

        OAException exceptionObj = new OAException(welcomeStr,OAException.INFORMATION);// creating object, for displaying the information to the user;
        //another way
        thorw new OAException("user Clicked ",OAException.WARNING); //OAException(welcomeStr,OAException.warning) etc.----OAExceptionOAException is contructor
        throw exceptionObj;

      }
    else if(pageContext.getParameter("sb2")!=null)
     {thorw new OAException("user Clicked ",OAException.WARNING);
     }
}



in java whenver method name = class name then its a constructor


--------------------------------------------------------------------------------------------------------------------------------------------

OAF PG -> CO -> AM -> VO -> DB
to display the data from DB  using SQL Query.


1. Requirement Diplay Employee data in OAF Page.

EmployeePG.XML
EmployeeCO.java -> to initialize data we need Controller.
AM  -> it will have .java file and .xml file
VO  -> PerPeopleVO ---> select * from per_people_x

1st create VO --> (PerPeopleVO VO will have PerPeopleVO.xml and PerPeopleVO.java)

2nd we have to assign to AM. All BC4J object has to be assigned to AM.  .java file in AM will add new method automatically
AmazonBizzServices.XML
AmazonBizzServicesImpl.java


public PerPeopleVOImpl getPerPeopleVO1()
 { :return (PerPeopleVOImpl)findViewObject("PerPeopleVO1"); // for initializing our VO and getting pointer location, allocating memory
 }

3rd create page . Use table wizard. Region Style: Table

4th AMImpl.java ---> vo.executeQuery();

public void initPerPeopleVO()
{ PerPeopleVOImpl vo = getPerPeopleVO1();
vo.executeQuery();
}

5th Controller

public void ProcessRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
OAApplicationModule am = pageContext.getApplicationModule(webBean);
am.invokeMethod("initPerPeopleVO");

or we can write
AmazonBizzServiceImpl amazonAM = (AmazonBizzServicesImpl)pageContext.getApplicationModule(webBean);
amazonAM.initPerPeopleVO();
}



---------------------------------------------------------------------------------------------------------------------------------------------------


---------------------------------------------------------------------------------------------------------------------------------------------

HRMS Module --> 15 pages to be developed

15 pages--> header information --> employee details --> empid, no, name, location, bgid

Shared region

1. VO--> emp details
2. AM
3. RN
4. CO

1. Create VO
Select person_id, employee_number, full_name, business_group_id, email_address from per_people_f where
person_id = (select employee_id from fnd_user where user_id = FND_PROFILE.VALUE('USER_ID'))

2. Right Click on webui -> New -> OA Component -> Region
New Region
Name : Region1
Package: xxibm.oracle.apps.fnd.webui
Style: Header

2. Down right click on region and Create a cotroller
Package Name : xxibm.oracle.apps.fnd.webui
ClassName: MYCO
Assign the AM in properties.
Text:> Employee Details

New Region Wizard-> Next-> Select the column to be displayed.
Region Style: defaultDoubleColumn               or messagecomponentlayout (properties 2 rows and 3 column, width 90%, move it down to another region and give a text field : Emplooyee Detail)

Style: messageStyleText

3. Go to application Module , AMImpl.java ----initialize the VO

public void initEmployeeDetailsVO()
{EmployeeDetailVOImpl vo = getEmployeeDetailsVO1();
vo.initEmpVO();
}

4. Go to EmployeeDetailVOImpl.java, by double clicking on it in AM

public void initEmpVO()
{executeQuery();
}

5. Write the code in controller

super.processRequest(pageContext, webBean);
OAApplicationModule am = pageContext.getApplicationModule(webBean);
am.invokeMethod("initEmployeeDetailsVO");



Now if we want to use the detail in another pages

We will copy the region path given in the URL

GO to any webui-> xyz.xml
Down in the structure-> Right Click on Main Region -> New -> region (drag it to top of the already existing region)
Properties: Extends: xxibm/oracle/apps/fnd/webui/EmployeeDetailsRN



import C:\jdev\jdevhome\jdev\febpaftraining\myprojrcts\xxibm\oracle\apps\fnd\webui\EmployeeDetailRN.xml
-username apps -password apps -dbconnection
"(DESCRIPTIOn=(ADDRESS=(PROTOCOL=tcp)(HOST=glo.dev.com)(PORT=1521))(CONNECT_DATA=(SID=VIS)))" -rootDor C:\jdev\jdevhome\jdev\
feboaftraining\myprojects


----------------------------------------------------------------------------------------------------------------------------


-------------------------------------------------------------------------------------------------------------------------------------


SEARCH PAGE

Create VO ->
india.oracle.apps.po.SerchPG.server
xxManualPageVO



select fs.supplier_id, fs.name, fs.on_hold_flag, fs.start_date, fs.end_date, fst.supplier_site_id, fst.site_name, fst.carrier_code, fst.purchasing_site_flag, fst.address_id
from fwk_tbx_suppliers fs, fwk_tbx_supplier_sites fst
where fs.supplier_id = fst.supplier_id
and fs.supplier_id like nvl(:1,fs.supplier_id)
and fs.name like nvl(:2,fs.name)
and nvl(fs.on_hold_flag,'N') like nvl(:3,NVL(fs.on_hold_flag,'N'))



Create AM

Pacjkge: india.oracle.apps.po.SearchPG.server
Name : xxSupplierAM


Create Page
name : xxManualSearchPG
Package: india.oracle.apps.po.SearchPG.webui

Create Region
Attach the AM
Window Title : Serch Page

Create Another Regiion under Main Region
Text Supplier Details
Region Style : defaultDoubleColumn

Creating Item
SuppllierID
SupplierName
onHoldFlag
StartDate

Click on the main region create another region
ID : RowLayoutRN
Region Style : rowLayout

Create GO and Clear Button

ID : Search
Item Style : Submit Button

ID : ButtonSpacer
Item Style :spacer
width: 50

ID : Cancel
Item Style :Submit Button



-------------------------------------------

Right Click on the main region -> Create Item

ID : regionSpacer
Item Style :spacer
height : 10

-------------------------------------------------


Right Click on the main region -> Create region
---------------------
ID : Site Details
Region Style :tab;e
Width : 100%


Right Click on the main region -> Create Item
ID : SupplierId
ItemStyle: messageStyledText
Prompt: supplierDI
View instance: xxManualSearchVO1
View Attribute: SupplierId

ID : SupplierSiteId
ItemStyle: messageStyledText
Prompt: SupplierSiteId
View instance: xxManualSearchVO1
View Attribute: SupplierSiteId

ID : SiteName
ItemStyle: messageStyledText
Prompt: SiteName
View instance: xxManualSearchVO1
View Attribute: SiteName

ID : StartDate
ItemStyle: messageStyledText
Prompt: StartDate
View instance: xxManualSearchVO1
View Attribute: StartDate

ID : EndDate
ItemStyle: messageStyledText
Prompt: EndDate
View instance: xxManualSearchVO1
View Attribute: EndDate


ID : HoldFlag
ItemStyle: messageStyledText
Prompt: HoldFlag
View instance: xxManualSearchVO1
View Attribute: HoldFlag

ID : CarrierCode
ItemStyle: messageStyledText
Prompt: CarrierCode
View instance: xxManualSearchVO1
View Attribute: CarrierCode


--------------------------------
Right Click on sitedetails region -> Table Actions

Right Click on table action region -> Create Item

ID: create Supplier
Iten Style: Submit Button
Prompt: Create Supplier

-------------------------------------------


creating Controller--------------To Handle Event

Right Click on Maiin region -> new ->Set new Controller
india.oracle.apps.po.SearchPG.webui
xxManualSerarchCo


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

xxSupplierAMImpl am = (xxSupplierAMImpl)pageContext.getApplicationModule(webBean);

if(pageContext.getParameter("Search")!=null)
{
String Sup_ID = pageContext.getParameter("SupplierID");
String Sup_Name = pageContext.getParameter("SupplierName");
String HFlag = pageContext.getParameter("onHoldFlag");
String Start_Date = pageContext.getParameter("StartDate");

am.xxinitQuery(Sup_ID,Sup_Name,HFlag, Start_Date);
}

if (pageContext.getParameter("Clear")!=null)
{pageContext.setForwardURLToCurrentPage(null,false,null,OAWebBeanConstants,IGNORE_MESSAGES);
}
}


--------------Application Module

public void xxintQuery(String Sup_ID, String Sup_Name, String onHoldFlag, String SDate)
{xxManualSearchVOImpl vo = getxxMaualSearchVO1();
vo.xxGetSuppDate(Sup_ID,Sup_Name,onHoldFlag,SDate);
}

-----------------VOCode

public void xxGetSuppData(String Sup_ID, String Sup_Name, String onHoldFlag, String SDate)
{
this.clearCache();   //clearing the cashe
String oldQuery = this.getQuery();   //method to get query

String flag = null;

if(Sup_ID!=null &&!"".equals(Sup_ID))
{
this.setWhereClauseParam(0,Sup_ID);  // indexing starts from zero,1st parameter
flag = "Supplier_ID";
}
else
{this.setWhereClauseParam(0,null);} // else it will pass null to where clause



if(Sup_Name!=null&&!"".equals(Sup_Name))
{
this.setWhereClauseParam(0,Sup_Name);
flag = flag+"-"+"Supplier_Name";
}
else
{this.setWhereClauseParam(1,null);}



if(onHoldFlag!=null&&!"".equals(onHoldFlag))
{
this.setWhereClauseParam(2,onHoldFlag);
flag = "onHoldFlag";
}
else
{this.setWhereClauseParam(2,null);}



if(SDate!=null&&!"".equals(SDate))
{
this.addWhereClause(SDate);
this.setWhereClauseParam(3,SDate);
flag = "Start_Date";
}
else
{}


if (flag!=null)

{
if (flag.equalsIgnoreCase("Supplier_ID")||flag.equalsIgnoreCase("Supplier_Name")||flag.contains("null"||"Supplier_ID-Supplier_Name".equals(flag))
{
if(!"Supplier_ID-Supplier_Name".equals(flag))
{
throw new OAException("Please enter Supplier ID and Supplier Name or HoldFlag", OAException.ERROR);
}
else
{flag= "EXECUTE";
}
}

if (flag.equalsIgnoreCase("ONHOLDFLAG")||flag.equalsIgnoreCase("Start_Date")||flag.equalsIgnoreCase("EXECUTE"))
{this.executeQuery();
this.setQuery(oldQuery);
}
}

else
{throw new OAException("Please Enter Atlease One Search Criteria", OAException.ERROR);
}

}

public void addWhereClause(String SDate)
{
String oldQuery = this.getQuery();
StringBuffer newQuery = new StringBuffer(oldQuery);
newQuery = newQuery.append("AND NVL(fs.START_DATE,sysdate)= nvl(:4,NVL(fs.START_DATE,sysdate))");
this.setQuery(newQuery.toString());
}

pubic void clearCache()
{
this.setWhereClauseParam(0,"-9999");
this.setWhereClauseParam(1,null);
this.setWhereClauseParam(2,null);
}








Comments

Popular posts from this blog

OAF Registration

Java Excel