Saturday 28 December 2013



QUIERY TO FIND APPLICATION SHORT NAME AND RESPONSIBILITY KEY



SELECT fr.responsibility_key,fa.application_short_name
  FROM fnd_responsibility fr, fnd_responsibility_tl frt, fnd_application fa
 WHERE fr.responsibility_id = frt.responsibility_id
   AND fa.application_id = fr.application_id
   AND frt.responsibility_name = 'Purchasing, Vision Operations (USA)'

Tuesday 3 December 2013

         CAPTURING THE VALUES FROM  DESCRIPTIVE FLEX FIELD





package dff.oracle.apps.ar.hz.components.address.webui;

import oracle.apps.ar.hz.components.address.webui.HzPuiAddressCreateUpdateCO;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.framework.webui.beans.OADescriptiveFlexBean;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;

import oracle.cabo.ui.RenderingContext;
import oracle.cabo.ui.action.FireAction;
import oracle.cabo.ui.action.FirePartialAction;

public class XxHzPuiAddressCreateUpdateCO3 extends HzPuiAddressCreateUpdateCO {
    public XxHzPuiAddressCreateUpdateCO3() {
    }
    public void processRequest(OAPageContext pageContext,OAWebBean webBean) {
    super.processRequest(pageContext,webBean);
    
       
        OADescriptiveFlexBean dff=(OADescriptiveFlexBean)webBean.findChildRecursive("HzAddressStyleFlex");
        dff.processFlex(pageContext);
        RenderingContext con = (RenderingContext) pageContext.getRenderingContext();

     
        if(dff!=null)
        {
        pageContext.writeDiagnostics(this,"Query->"+dff.getID(),1);      
        OAMessageTextInputBean mti1=(OAMessageTextInputBean)dff.findChildRecursive("HzAddressStyleFlex1");  
            OAMessageTextInputBean mti2=(OAMessageTextInputBean)dff.findChildRecursive("HzAddressStyleFlex2");     
            OAMessageTextInputBean mti3=(OAMessageTextInputBean)dff.findChildRecursive("HzAddressStyleFlex3"); 
            OAMessageTextInputBean mti4=(OAMessageTextInputBean)dff.findChildRecursive("HzAddressStyleFlex4"); 
            OAMessageTextInputBean mti5=(OAMessageTextInputBean)dff.findChildRecursive("HzAddressStyleFlex5"); 
            OAMessageTextInputBean mti6=(OAMessageTextInputBean)dff.findChildRecursive("HzAddressStyleFlex6"); 
            OAMessageTextInputBean mti7=(OAMessageTextInputBean)dff.findChildRecursive("HzAddressStyleFlex7"); 
            OAMessageTextInputBean mti8=(OAMessageTextInputBean)dff.findChildRecursive("HzAddressStyleFlex8"); 
            OAMessageTextInputBean mti9=(OAMessageTextInputBean)dff.findChildRecursive("HzAddressStyleFlex9"); 
            
            pageContext.writeDiagnostics(this,"Value 2-->"+mti2.getPrompt(),1);
            pageContext.writeDiagnostics(this,"Value 3-->"+mti3.getPrompt()+"Value 4-->"+mti4.getPrompt()+"Value 5-->"+mti5.getPrompt()+"Value 6-->"+mti6.getPrompt()+"Value 7-->"+mti7.getPrompt()+"Value 8-->"+mti8.getPrompt(),1);
            pageContext.writeDiagnostics(this,"Flex Context->"+dff.getAttributeValue(OAWebBeanConstants.FLEXFIELD_CONTEXT_CODE),1);              
        if(mti1!=null) {        
            pageContext.writeDiagnostics(this,"the second value prompt"+mti1.getPrompt(),2);
            pageContext.writeDiagnostics(this,"the second Value"+mti1.getValue(pageContext).toString(),3);       
            FireAction firePartialAction = new FirePartialAction();            
            pageContext.writeDiagnostics(this,mti1.getPrompt(),1);
            firePartialAction.setEvent("Address");
            firePartialAction.setUnvalidated(true);
            mti1.setPrimaryClientAction(firePartialAction);
            mti1.setFireActionForSubmit("Address",null,null,true);  
            mti2.setPrimaryClientAction(firePartialAction);
            mti2.setFireActionForSubmit("Address",null,null,true); 
            mti3.setPrimaryClientAction(firePartialAction);
            mti3.setFireActionForSubmit("Address",null,null,true); 
            mti4.setPrimaryClientAction(firePartialAction);
            mti4.setFireActionForSubmit("Address",null,null,true); 
            mti5.setPrimaryClientAction(firePartialAction);
            mti5.setFireActionForSubmit("Address",null,null,true); 
            mti6.setPrimaryClientAction(firePartialAction);
            mti6.setFireActionForSubmit("Address",null,null,true); 
            mti7.setPrimaryClientAction(firePartialAction);
            mti7.setFireActionForSubmit("Address",null,null,true); 
            mti8.setPrimaryClientAction(firePartialAction);
            mti8.setFireActionForSubmit("Address",null,null,true); 
            mti9.setPrimaryClientAction(firePartialAction);
            mti9.setFireActionForSubmit("Address",null,null,true); 
        }
        else {         
            pageContext.writeDiagnostics(this,"bean is Null",1);
        }      
        
        }
        else {          
            pageContext.writeDiagnostics(this,"dff bean is Null",1);
        }       
    }
    public void processFormRequest(OAPageContext pageContext,OAWebBean webBean) {
        pageContext.writeDiagnostics(this,"Before PFR",1);
        super.processFormRequest(pageContext,webBean);
        pageContext.writeDiagnostics(this,"After PFR",1);
      
        if("Address".equals(pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM))) 
        {
            OADescriptiveFlexBean dff=(OADescriptiveFlexBean)webBean.findChildRecursive("HzAddressStyleFlex");
            dff.processFlex(pageContext);
            OAMessageTextInputBean mti1=(OAMessageTextInputBean)dff.findChildRecursive("HzAddressStyleFlex1"); 
            mti1.getValue(pageContext);
            pageContext.writeDiagnostics(this,"PFR Value--"+mti1.getValue(pageContext),1);
            OAMessageTextInputBean mti2=(OAMessageTextInputBean)dff.findChildRecursive("HzAddressStyleFlex2"); 
            mti2.getValue(pageContext);
            pageContext.writeDiagnostics(this,"PFR Value--"+mti2.getValue(pageContext),1);
            OAMessageTextInputBean mti3=(OAMessageTextInputBean)dff.findChildRecursive("HzAddressStyleFlex3"); 
            mti3.getValue(pageContext);
            pageContext.writeDiagnostics(this,"PFR Value--"+mti3.getValue(pageContext),1);
            OAMessageTextInputBean mti4=(OAMessageTextInputBean)dff.findChildRecursive("HzAddressStyleFlex4"); 
            mti4.getValue(pageContext);
            pageContext.writeDiagnostics(this,"PFR Value--"+mti4.getValue(pageContext),1);
            OAMessageTextInputBean mti5=(OAMessageTextInputBean)dff.findChildRecursive("HzAddressStyleFlex5"); 
            mti5.getValue(pageContext);
            pageContext.writeDiagnostics(this,"PFR Value--"+mti5.getValue(pageContext),1);
            OAMessageTextInputBean mti6=(OAMessageTextInputBean)dff.findChildRecursive("HzAddressStyleFlex6"); 
            mti6.getValue(pageContext);
            pageContext.writeDiagnostics(this,"PFR Value--"+mti6.getValue(pageContext),1);
            OAMessageTextInputBean mti7=(OAMessageTextInputBean)dff.findChildRecursive("HzAddressStyleFlex7"); 
            mti7.getValue(pageContext);
            pageContext.writeDiagnostics(this,"PFR Value--"+mti7.getValue(pageContext),1);
            OAMessageTextInputBean mti8=(OAMessageTextInputBean)dff.findChildRecursive("HzAddressStyleFlex8"); 
            mti8.getValue(pageContext);
            pageContext.writeDiagnostics(this,"PFR Value--"+mti8.getValue(pageContext),1);
            OAMessageTextInputBean mti9=(OAMessageTextInputBean)dff.findChildRecursive("HzAddressStyleFlex8"); 
            mti9.getValue(pageContext);
            pageContext.writeDiagnostics(this,"PFR Value--"+mti9.getValue(pageContext),1);
            pageContext.writeDiagnostics(this,"PFR Value--"+pageContext.getParameter("HzAddressStyleFlex1"),1);
        }
    }
}

          Creation of Drop Down list in ADF PAGE


Creting drop down list for job id. First we can create one view object. For naming conversion we can teke it as VVO.here we can create on vieobject and select property as read only.




Go to ADF Business Components and Click on View Object





Select Readonly



write sql Queiry select * from Employee


Attach VVo to AM


Go to View Attribute of Employee VO




Select Jobid Attribute in Employeevo

select listof values to that attribute jobid








Delete The Jobid Attribute on That page





Drag from Data Control window to and Drop on Structure Window





Now Run The Page and Click New Button


HOW TO CREATE SIMPLE ADF PAGE

Go to file ->new






Now we are creating entity object.






Now we are creating one view object.





Click next -> next->Finish. Now we create one Application Module.


Now we create jsf page









Change create insert button property


Text:New  and  commit :save.





Delete the  data in disabled column.

Now run the page.Click on new button.




Enter the value s and click on save button .it  will  save the value in data base

Check the values whether they are saved in database or not.





Sunday 24 November 2013

                           How  To  Debugg Errors in OAF



Debugging Errors in Local Machine




1. Using sop Statments In Controller:

        system.out.println(" Enters into The statement");

2.Using Internal Debugger in the Statement:


Put Break points Which You Want to run




After run The page It shows Arrow mark on the Code . so Press F9. it follow the flow and if any Error is there it skips the flow. we Can see this is logg window.


Debugg  Errors  in Server:

Here we can Debug using Following statement  in Controller:

 pageContext.writeDiagnostics(this, "I am at disble item3", 
                                     OAFwkConstants.STATEMENT);


IN AM:

OADBTransaction.writeDiagnostics(this, "I am at disble item3", 
                                     OAFwkConstants.STATEMENT);


Using Diagnostics:




  











Passing parameters from one OAF page to another OAF Page




Ways to pass parameters in Request:

·                     Adding in URL: We can specify parameters as literal values or token substituted values (mapped to VO Attributes). Following are the examples:
o                  OA.jsp?page=/xxabc/oracle/apps/xxabc/custommodule/webui/CustomPG&order={@OrderNum}
o                  OA.jsp?OAFunc=XXABC_ADM_SUPP_ENGR&asset=123
·                     OAPageContext.putParameter()
o                  Values are not technically added to request, but are stored in a special page cache.
o                  Equivalent to HttpServletRequest.setAttribute()
·                     Hidden fields (form values)
·                     Passing parameters in Hashmap using setForwardUrl().
1.HashMap xxhashMap = new HashMap(1);
xxhashMap .put("ParamName1", "Value1");

oapagecontext.setForwardURL("MY_FUNCTION", (byte)0, null, xxhashMap , true, "N", (byte)0);

OR
oapagecontext.setForwardURL("OA.jsp?page=/xxelng/oracle/apps/per/hiring/webui/XXConfermationPG", 
                                      null,
 
                                      OAWebBeanConstants.KEEP_MENU_CONTEXT,
 
                                      null, xxhashMap , true,
 
                                      OAWebBeanConstants.ADD_BREAD_CRUMB_NO,
 
                                      OAWebBeanConstants.IGNORE_MESSAGES);

You can then retrieve this parameter in processRequest() via:
oapagecontext.getParameter("ParamName1");


Passing parameters in Hashmap is the better approach for following reasons:
1.             URL has size restrictions.
2.             URL is visible to users.
3.             putParamater() and hidden fields are not stored in Request as parameters, thus if we navigate with Breadcrumbs or for other reasons in case the webBean hierarchy needs to be reconstructed, these will not be available.

Transaction:

Transaction has wider scope than Request thus its not preferred approach.
·                     OAPageContext.putTransactionValue()
·                     OAPageContext.getTransactionValue()
·                     ((OADBTransactionImpl)getTransaction()).putValue()
·                     ((OADBTransactionImpl)getTransaction()).getValue()

Session:

Again, a wider scope than Transaction and not recommended.

·                     pageContext.putSessionValue();
·                     pageContext.getSessionValue();



Multi Delete in OAF


1. Create Item Under rowlayout Region Style SubmitButton Id&Prompt: MultiDelete
2. Create Transist Attribute in XXSearchVO Name:XXMDelete, Type:String
3. Rt Click on Table Region_MultipleSelection_InProperties
     View Instance: XXSearchVO
     View Attribute: XXMDelete(TransistAttribute)
4. Write Code SearchCO in ProcessFoamRequest
    if(pageContext.getParameter("MultiDelete")!=null)
{
OAViewObject vo=(OAViewObject)am.getXXSearchVO1();
for (XXSearchVORowImpl row=(XXSearchVORowImpl)vo.first();
row!=null;row=(XXSearchVORowImpl)vo.next())
{
if(row.getAttribute("XXMDelete")!=null && row.getAttribute("XXMDelete").equals("Y"))
{
String hid=row.getAttribute("HeaderId").toString();
String query="delete from XXCUSTOMER_REBATELINE where HEADER_ID="+hid;
try
{
PreparedStatement
ps=am.getOADBTransaction().getJdbcConnection().prepareStatement(query);
ps.executeUpdate();
}
catch (Exception e)
{
e.printStackTrace();
}
row.remove();
am.getOADBTransaction().commit();
} } }
Capturing Values from Lov()
if (pageContext.isLovEvent())
    {
      pageContext.writeDiagnostics(this, "I am at disble item2",
                                   OAFwkConstants.STATEMENT);
      String lovid = pageContext.getLovInputSourceId();

      if ("Category".equals(lovid))
      {
        pageContext.writeDiagnostics(this, "I am at disble item3",
                                     OAFwkConstants.STATEMENT);
        String category = pageContext.getParameter("Category").toString();
        pageContext.writeDiagnostics(this, "I am at disble item4" + category,
                                     OAFwkConstants.STATEMENT);

        
Creating the button programmatically

  public void processRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    //first excute standard functionality by call super as below
    super.processRequest(pageContext, webBean);
    //now create new button programatically
    OASubmitButtonBean oasb= (OASubmitButtonBean)pageContext.getWebBeanFactory().createWebBean(pageContext,"BUTTON_SUBMIT");
    oasb.setID("xxSubmitSendEmailButton");
    oasb.setUINodeName("xxSubmitSendEmailButton");
    oasb.setEvent("xxSubmitSendEmailButton");
    oasb.setText("xxSubmitSendEmailButton");
    webBean.addIndexedChild(oasb);
  }

Dynamically creating of Advance Table  Bean:

 private void setReportSumText(OAPageContext pageContext, OAWebBean webBean) 
  {
    OAAdvancedTableBean advancedTableBean = (OAAdvancedTableBean)webBean.findIndexedChildRecursive("BuyerTableRN");
    advancedTableBean.prepareForRendering(pageContext);
    if (advancedTableBean != null)
    {
      OATableFooterBean tableFooterBean = (OATableFooterBean)advancedTableBean.getFooter();
      if(tableFooterBean != null)
      {
        OATotalRowBean totalRowBean = (OATotalRowBean)tableFooterBean.getTotal();
        if(totalRowBean != null)
        {
          totalRowBean.setText("Report-Sum");
        }
      }
   }
  }
Loop Throught the Fetched Records in VO
Example 1:

This particular example was written for Oracle Sourcing.
       OAApplicationModule rootAM = pageContext.getRootApplicationModule();           
       OAViewObject ReqVO   =      (OAViewObject)rootAM.findViewObject("BidHeaderSectionsVO");
           
            if (null!=ReqVO) {
                Row ReqRow = ReqVO.first();           
                if (null != ReqRow) {
                           
                int idx = ReqVO.getRowCount();
   
                for (int xx = 0; xx < idx; xx++) {
                    if (null != ReqRow) {
                       // Do some work....
                       ReqRow = ReqVO.next();
                    }
                    else {}
                }
              }
            }

Example 2:
OAViewObject vo = (OAViewObject)getPPVCMHeadersVO2();
   PPVCMHeadersVORowImpl row = null;
   int fetchedRowCount = vo.getRowCount();
   RowSetIterator insertIter = vo.createRowSetIterator("insertIter");
   if (fetchedRowCount > 0)
    {
     insertIter.setRangeStart(0);
     insertIter.setRangeSize(fetchedRowCount);
     for (int i = 0; i < fetchedRowCount; i++)
      {  
        row = (PPVCMHeadersVORowImpl)insertIter.getRowAtRangeIndex(i);
        row.setAttribute("Sno",new Integer(i+1));
      }
    }