Thursday 31 January 2013

oracle.adf.mds.MetadataDefException: Unable to find component with absolute reference



I tried Mirgraing it on EBS but i'm getting below error error is
:oracle.adf.mds.MetadataDefException: Unable to find component with absolute
reference = /xxidea/oracle/apps/fa/ats/webui/SplitPG



Solution:


1)Please check your below path is correct

"OA.jsp?page=/xxidea/oracle/apps/fa/ats/webui/SplitPG

2)Run Below Command in database editor and check Result

  DECLARE
  BEGIN
  jdr_utils.printdocument
  (p_document => '/xxidea/oracle/apps/fa/ats/webui/SplitPG');
  END;

  if  Result not found then Run below scripts to insert Page in Your MDS repository

  java \
oracle.jrad.tools.xml.importer.XMLImporter \
/$JAVA_TOP/xxidea/oracle/apps/fa/ats/webui/SplitPG.xml \
-username <USERNAME> \
-password <PASSWORD> \
-rootdir /$JAVA_TOP/ \
-dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<hostname>)(PORT=<port>)) (CONNECT_DATA= (SID=<InstanceName>)))"

After Succefully Import Run Below scripts One More Time in data base editor,This time xml result should dsiplay in Database output.

 DECLARE
  BEGIN
  jdr_utils.printdocument
  (p_document => '/xxidea/oracle/apps/fa/ats/webui/SplitPG');
  END;
 

Wednesday 23 January 2013

Populate LOV when pressing tab in OAF

In my LOV,if I type something and  press tab key nothing is happening
I want it to open LOV popup what should i change?


Solution:

  Set disable validation Property to False for LOV.

Tuesday 22 January 2013

Issue when Fetching records from db in OAF

I have a table in my page, in PR i am fetching records from db.
I have one transient column in my table, it is calculated based on 2 column.

Problem is, when data is fetched, i want to fill this transient column but i'm failing. 
I am using myvo.getAllRowsInRange(); which returns 1 row only.
However, when i reload page it return all column.

Code here

public void disp_ass_num()
{
  SplitVOImpl svo = getSplitVO1();

  Row r[] = svo.getAllRowsInRange();
  for(int i=0;i<r.length;i++)
  {
  r[i].setAttribute("DispAssNum",""+r[i].getAttribute("AssetNum")+"-"+r[i].getAttribute("RevNum"));
  }

Please help
 
 
Solution:
 
Please Refer  Below Code
 
 
 public void disp_ass_num()
{
SplitVOImpl svo = getSplitVO1();
for(Row row=svo.first();row!=null;row=svo.next())
{
SplitVORowImpl rowi = (SplitVORowImpl)row;

// Do  get set attribute here
}

}
 
 
 
 

Saturday 19 January 2013

Integrating XML Publisher and OAF


It is a very common requirement where we want to generate reports in PDF,
format from an OAF page itself without submitting any concurrent program.

To generate the output in PDF formats we need the following:

1 Design the OAF BC4J Object.
2) Design the OAF Page and generate the Data XML
3) Design the RTF Template using Data XML
4) Register the Template with Oracle Applications.
5) Integrating the OAF page With XML Publisher.
6) Invoking the report from OAF

//In Controller

import com.sun.java.util.collections.ArrayList;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.Serializable;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import javax.servlet.ServletOutputStream;
import oracle.apps.xdo.oa.schema.server.TemplateHelper;
import oracle.xml.parser.v2.XMLNode;
import java.lang.System;
import oracle.apps.fnd.framework.server.OADBTransactionImpl;
public class XXCO extends OAControllerImpl
{
private static final int DEPTH = 4;
private static final int APP_ID = 20003;
private static final String APP_NAME = "TPC";
private static final String TEMPLATE_CODE = "TPCFULLRUGTPEF"
private static final int BUFFER_SIZE = 32000;

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


}


public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);
OAApplicationModule am = pageContext.getApplicationModule(webBean);
am.invokeMethod("executeEdVO");

//Print Edward
if(pageContext.getParameter("edPrintBtn") != null)
{
// Get the HttpServletResponse object from the PageContext. The report output is written to HttpServletResponse.
DataObject sessionDictionary = (DataObject)pageContext.getNamedDataObject("_SessionParameters");
HttpServletResponse response = (HttpServletResponse)sessionDictionary.selectValue(null,"HttpServletResponse");
try {
ServletOutputStream os = response.getOutputStream();

// Set the Output Report File Name and Content Type
String contentDisposition = "attachment;filename=TPCEdward.pdf";
response.setHeader("Content-Disposition",contentDisposition);
response.setContentType("application/pdf");

// Get the Data XML File as the XMLNode
XMLNode xmlNode = (XMLNode) am.invokeMethod("getEdwardDataXML");
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
xmlNode.print(outputStream);
ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
ByteArrayOutputStream pdfFile = new ByteArrayOutputStream();

//Generate the PDF Report.
TemplateHelper.processTemplate(
((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getAppsContext(),APP_NAME,TEMPLATE_CODE, ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getLanguage(), ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getCountry(),inputStream,TemplateHelper.OUTPUT_TYPE_PDF,null,pdfFile);

// Write the PDF Report to the HttpServletResponse object and flush.
byte[] b = pdfFile.toByteArray();
response.setContentLength(b.length);
os.write(b, 0, b.length);
os.flush();
os.close();
}
catch(Exception e)
{
response.setContentType("text/html");
throw new OAException(e.getMessage(), OAException.ERROR);
}
pageContext.setDocumentRendered(true);

}

}

}





in AMImpl.java

public void executeEdVO()
{
OAViewObject vo = (OAViewObject)findViewObject("TpcEdwardVO1");
//OAViewObject vo = getTpcEdwardVO1();
if (vo.getFetchedRowCount() == 0)
{
// Setting the match fetch size to 0 for an in-memory VO
// prevents it from trying to query rows.
// Calling executeQuery() is a small workaround to a known
// BC4J issue that ensures that modified rows in this
// transient view object are not lost after commit. See
// View Objects in Detail for additional information about
// both of these calls.
vo.setMaxFetchSize(0);
vo.executeQuery();
vo.insertRow(vo.createRow());
}
}

public XMLNode getEdwardDataXML()
{
OAViewObject vo = (OAViewObject)findViewObject("TpcEdwardVO1");
XMLNode xmlNode = (XMLNode) vo.writeXML(4, XMLInterface.XML_OPT_ALL_ROWS);
return xmlNode;
}

Sunday 6 January 2013

Execute parameterized PL SQL procedure from OAF page

Let us try to call PL/SQL package from OAF page. We will try to remove selected line from Database.

Package Spec


CREATE OR REPLACE PACKAGE APPS.genpack_pkg
AS
   PROCEDURE roll_delete_proc (num IN VARCHAR2);
END genpack_pkg;
/



Package Body


CREATE OR REPLACE PACKAGE BODY APPS.genpack_pkg
AS
   PROCEDURE roll_delete_proc (num IN VARCHAR2)
   AS
   BEGIN
      DELETE FROM pklist_roll_details_temp
            WHERE roll_line_id = num;
      COMMIT;
   END roll_delete_proc;
END genpack_pkg;
/





import java.sql.CallableStatement;

//in Controller PFR

 if (pageContext.getParameter("ActionsButton") != null)
    {
      String val = pageContext.getParameter("ActionsChoice");

      if ("DELLN".equals(val))
       {
      
        CallableStatement cstmt = null;
       for (OAViewRowImpl row = (OAViewRowImpl)tempvo.first(); row != null; row = (OAViewRowImpl)tempvo.next()) {
           if ((row.getAttribute("Selectflag") == null) ||
             (!row.getAttribute("Selectflag").toString().equals("Y"))) continue;
          try {
             int rollid = Integer.parseInt((String)row.getAttribute("RollLineId"));
             Connection conn = am.getOADBTransaction().getJdbcConnection();
             if (rollid == 1)
            {
           
              temphm.put(row.getAttribute("PoLineId").toString(), row.getAttribute("PoNumber").toString());
             tempvo.removeCurrentRow();
            }
            else
            {
              try
              {
                StringBuilder sb = new StringBuilder();
                sb.append(rollid);
                String strI = sb.toString();
                 System.out.println("Inside else in delete");
                cstmt = conn.prepareCall("{call GENPACK_PKG.tpc_roll_delete_proc(?)}");
               cstmt.setString(1, strI);
                System.out.println("Oracle Callable Statment Execution Init for Delete");
                cstmt.execute();
               
              }
              catch (SQLException e) {
                throw new OAException(e.toString(), (byte)0);
              }tempvo.removeCurrentRow();
            }
          }
          catch (OAException e) {
            throw new OAException("No row selected", (byte)3);
           }

       }
      }