Row Selection in Advanced Table

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 13

1.

Row Selection in advanced table


if("ROW_SELECTION".equalsIgnoreCase(s))
{
String s2 = pageContext.getParameter("evtSrcRowRef");
PosPOSummaryVORowImpl posposummaryvorowimpl =
(PosPOSummaryVORowImpl)am.findRowByRef(s2);
String poheaderID =
posposummaryvorowimpl.getAttribute("PO_HEADER_ID").toString();
pageContext.putSessionValue("poheaderID", poheaderID);
pageContext.writeDiagnostics(this,
"After Clicking the Request Changes Button"+poheaderID,
1);

};
2. Checking for Decimals
if (quant != null || quant.length() != 0) {
for (int i = 0; i < quant.length(); i++) {
if (!Character.isDigit(quant.charAt(i))) {
throw new OAException(" Please enter quantity in whole numbers for Serial
Control Item",
OAException.ERROR);
}
}
}
3.Accessing the VO with View Link:
PosAsnLotVOImpl parentvo=(PosAsnLotVOImpl)am.findViewObject("PosAsnLotVO");
pageContext.writeDiagnostics(1,
"PDI Lot Number Row Count" +parentvo,
1);
for( PosAsnLotVORowImpl parentVOrow =
(PosAsnLotVORowImpl)parentvo.first();
parentVOrow != null;
parentVOrow = (PosAsnLotVORowImpl)parentvo.next()
)
{

RowIterator rowiterator = parentVOrow.getPosAsnChdSerialVO();


PosAsnChdSerialVORowImpl posasnchdserialvorowimpl = null;
rowiterator.reset();
rowiterator.hasNext();
CO Trics:
package XXINDUS.oracle.apps.icx.por.req.webui;
import java.io.PrintStream;
import java.sql.*;
import java.sql.CallableStatement;
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import

oracle.apps.fnd.framework.*;
oracle.apps.fnd.framework.server.OADBTransaction;
oracle.apps.fnd.framework.webui.OAPageContext;
oracle.apps.fnd.framework.webui.beans.OAWebBean;
oracle.apps.fnd.framework.webui.beans.form.OASubmitButtonBean;
oracle.apps.icx.por.req.server.PoReqDistributionsVORowImpl;
oracle.apps.icx.por.req.server.PoRequisitionHeadersVORowImpl;
oracle.apps.icx.por.req.server.PoRequisitionLinesVOImpl;
oracle.apps.icx.por.req.server.PoRequisitionLinesVORowImpl;
oracle.apps.icx.por.req.webui.EditSubmitCO;
oracle.apps.icx.por.req.server.*;
oracle.apps.icx.por.schema.server.*;
oracle.jbo.RowIterator;
oracle.jbo.RowSetIterator;
oracle.jbo.domain.Number;

public class ExtendsEditSubmitCO extends EditSubmitCO {


public ExtendsEditSubmitCO() {
}
public void processRequest(OAPageContext oapagecontext,
OAWebBean oawebbean) {
super.processRequest(oapagecontext, oawebbean);
oapagecontext.writeDiagnostics(this, "Inside the Process Request", 1);
}
public void processFormRequest(OAPageContext oapagecontext,
OAWebBean oawebbean) {
OAApplicationModule oaapplicationmodule =
oapagecontext.getApplicationModule(oawebbean);
RequisitionAMImpl requisitionamimpl = (RequisitionAMImpl)oaapplicationmodule;
OASubmitButtonBean oasubmitbuttonbean =
(OASubmitButtonBean)oawebbean.findChildRecursive("Submit");
OAViewObject oaviewobject = null;
oaviewobject =
(OAViewObject)oaapplicationmodule.findViewObject("PoRequisitionHeadersVO");
PoRequisitionHeadersVORowImpl porequisitionheadersvorowimpl =
(PoRequisitionHeadersVORowImpl)oaviewobject.getCurrentRow();
String s =
porequisitionheadersvorowimpl.getRequisitionHeaderId().toString();
oapagecontext.writeDiagnostics(this,
(new StringBuilder()).append("Req Header ID in
Extended Controller").append(s).toString(),
1);
OADBTransaction oadbtransaction =
oaapplicationmodule.getOADBTransaction();
oapagecontext.writeDiagnostics(this,

(new StringBuilder()).append("Inside the


Process Form Request").append(s).toString(),
1);
//if user clicks on the submit button
if (oapagecontext.getParameter("Submit") != null) {
oapagecontext.writeDiagnostics(this,
(new StringBuilder()).append("When User
Pressed the Submit Button").append(s).toString(),
1);
oapagecontext.writeDiagnostics(this,
"Process Form Request Fires Submit",
1);
oapagecontext.writeDiagnostics(this,
(new StringBuilder()).append("Inside the
Process Form Request").append(s).toString(),
1);
if (checkStatus(s, oaapplicationmodule, oapagecontext,
oawebbean)) {
throw new OAException("PR Line Level Item Type Should Matches With The
PR Sub Type ",
(byte)0);
}
if (checkSiteWisePO(s, oaapplicationmodule, oapagecontext,
oawebbean)) {
throw new OAException("This Item is planned for direct delivery to
site. Please Select Site Information" +
" in PR line DFF level LOV against Site ID Field
",
(byte)0);
}
if (checkDecimalValues( oaapplicationmodule, oapagecontext, oawebbean)) {
throw new OAException("Please enter quantity in whole numbers for
Serial Control Item",
(byte)0);
}
if (projectCommomPool( oaapplicationmodule, oapagecontext, oawebbean)) {
throw new OAException("The item code can be used for Site Usage and it
is not permitted for Common Pool Expenses",
(byte)0);
}
}
//if user clicks on the save button
if (oapagecontext.getParameter("Save") != null) {
oapagecontext.writeDiagnostics(this,
(new StringBuilder()).append("When User
Pressed the Submit Button").append(s).toString(),
1);
oapagecontext.writeDiagnostics(this,
"Process Form Request Fires Submit",
1);
oapagecontext.writeDiagnostics(this,
(new StringBuilder()).append("Inside the
Process Form Request").append(s).toString(),
1);
if (checkStatus(s, oaapplicationmodule, oapagecontext,
oawebbean)) {
throw new OAException("PR Line Level Item Type Should Matches With The
PR Sub Type ",
(byte)0);
}
if (checkSiteWisePO(s, oaapplicationmodule, oapagecontext,
oawebbean)) {

throw new OAException("This Item is planned for direct delivery to


site. Please Select Site Information" +
" in PR line DFF level LOV against Site ID Field
",
(byte)0);
}
if (checkDecimalValues( oaapplicationmodule, oapagecontext, oawebbean)) {
throw new OAException("Please enter quantity in whole numbers for
Serial Control Item",
(byte)0);
}
}
if (oapagecontext.getParameter("Test") != null) {
oapagecontext.writeDiagnostics(this,
"Inside the Test Button Process",
1);
/*
PoRequisitionHeadersVOImpl porequisitionheadersvoimpl =
requisitionamimpl.getPoRequisitionHeadersVO();
PoRequisitionHeadersVORowImpl porequisitionheadersvorowimp =
(PoRequisitionHeadersVORowImpl)porequisitionheadersvoimpl.getCurrentRow();
PoRequisitionHeaderEOImpl porequisitionheadereoimpl =
porequisitionheadersvorowimp.getPoRequisitionHeaderEO();
RowIterator rowiterator =
porequisitionheadereoimpl.getPoRequisitionLineEO();
rowiterator.setRangeSize(-1);
oracle.jbo.Row arow[] = rowiterator.getAllRowsInRange();
for(int i = 0; i < arow.length; i++)
{
PoRequisitionLineEOImpl porequisitionlineeoimpl =
(PoRequisitionLineEOImpl)arow[i];
RowIterator rowiterator1 =
porequisitionlineeoimpl.getPoReqDistributionEO();
rowiterator1.setRangeSize(-1);
oracle.jbo.Row arow1[] = rowiterator1.getAllRowsInRange();
for(int j = 0; j < arow1.length; j++)
{
PoReqDistributionEOImpl poreqdistributioneoimpl =
(PoReqDistributionEOImpl)arow1[j];
String ccID =
poreqdistributioneoimpl.getCodeCombinationId().toString();
oapagecontext.writeDiagnostics(1, "Inside the ccid method"+ccID, 1);
}
}*/
if (checkCCID( oaapplicationmodule, oapagecontext,
oawebbean,requisitionamimpl)) {
throw new OAException("Check Funds in Error",
(byte)0);
}
}
super.processFormRequest(oapagecontext, oawebbean);
}
public static boolean checkStatus(String s,
OAApplicationModule oaapplicationmodule,
OAPageContext oapagecontext,
OAWebBean oawebbean) {
boolean flag = false;
Object obj = null;
String s1 = null;
String s2 = null;
Object obj1 = null;

OAViewObject oaviewobject =
(OAViewObject)oaapplicationmodule.findViewObject("PoRequisitionLinesVO");
oapagecontext.writeDiagnostics(Integer.valueOf(1),
"Inside the Process Form Request", 1);
oapagecontext.writeDiagnostics(Integer.valueOf(1),
(new StringBuilder()).append("Check
Status").append(oaviewobject.getQuery()).toString(),
1);
Object obj2 = null;
int i = oaviewobject.getRowCount();
oapagecontext.writeDiagnostics(Integer.valueOf(1),
(new StringBuilder()).append("Fetched Row
Count").append(i).toString(),
1);
System.out.println((new StringBuilder()).append("Fetched Row Count
is").append(i).toString());
OAViewObject oaviewobject1 =
(OAViewObject)oaapplicationmodule.findViewObject("PoRequisitionHeadersVO");
oapagecontext.writeDiagnostics(Integer.valueOf(1),
"Inside the Process Form Request", 1);
oapagecontext.writeDiagnostics(Integer.valueOf(1),
(new StringBuilder()).append("Check Status Of
the Headers VO").append(oaviewobject.getQuery()).toString(),
1);
OARow oarow = (OARow)oaviewobject1.first();
s2 = oarow.getAttribute("Attribute3").toString();
oapagecontext.writeDiagnostics(Integer.valueOf(1),
(new StringBuilder()).append("Fetched Row Count
Item ID").append(oarow.getAttribute("Attribute3").toString()).toString(),
1);
System.out.println((new StringBuilder()).append("Fetched Row Count
is").append(i).toString());
RowSetIterator rowsetiterator =
oaviewobject.createRowSetIterator("iterator");
if (i > 0) {
oapagecontext.writeDiagnostics(Integer.valueOf(1),
(new StringBuilder()).append("Insdie the
Fetched Row Count >0").append(s2).toString(),
1);
System.out.println((new StringBuilder()).append("Get First Line Item
Type").append(s2).toString());
rowsetiterator.setRangeStart(0);
rowsetiterator.setRangeSize(i);
for (int j = 0; j < i; j++) {
PoRequisitionLinesVORowImpl porequisitionlinesvorowimpl =
(PoRequisitionLinesVORowImpl)rowsetiterator.getRowAtRangeIndex(j);
try {
Connection connection =
oapagecontext.getApplicationModule(oawebbean).getOADBTransaction().getJdbcConnection()
;
String s3 =
"SELECT NVL(attribute16,NULL) FROM mtl_system_items_b
msib,mtl_parameters mp WHER" +
"E mp.organization_id = msib.organization_id AND
msib.inventory_item_id = :1 AND" +
" mp.master_organization_id = msib.organization_id";
PreparedStatement preparedstatement =
connection.prepareStatement(s3);
preparedstatement.setInt(1,
Integer.parseInt(porequisitionlinesvorowimpl.getAttribute("ItemId").toString()));

oapagecontext.writeDiagnostics(Integer.valueOf(1),
(new
StringBuilder()).append("Insdie the For
Loop").append(Integer.parseInt(porequisitionlinesvorowimpl.getAttribute("ItemId").toSt
ring())).toString(),
1);
ResultSet resultset = preparedstatement.executeQuery();
if (resultset.next()) {
s1 = String.valueOf(resultset.getString(1));
oapagecontext.writeDiagnostics(Integer.valueOf(1),
(new
StringBuilder()).append("Insdie the for loop").append(s1).toString(),
1);
}
resultset.close();
} catch (Exception exception) {
throw new OAException((new StringBuilder()).append("Failed to get
the Item Type").append(exception).toString(),
(byte)0);
}
if (!s2.equalsIgnoreCase(s1)) {
flag = true;
oapagecontext.writeDiagnostics(Integer.valueOf(1),
(new
StringBuilder()).append("Insdie the Condition flag").append(flag).toString(),
1);
}
}
}
rowsetiterator.closeRowSetIterator();
System.out.println((new
StringBuilder()).append("return").append(flag).toString());
oapagecontext.writeDiagnostics(Integer.valueOf(1),
(new StringBuilder()).append("Insdie the
Condition flag").append(flag).toString(),
1);
return flag;
}
public static boolean checkSiteWisePO(String s,
OAApplicationModule oaapplicationmodule,
OAPageContext oapagecontext,
OAWebBean oawebbean) {
boolean flag = false;
Object obj = null;
String s1 = null;
String s2 = null;
Object obj1 = null;
OAViewObject oaviewobject =
(OAViewObject)oaapplicationmodule.findViewObject("PoRequisitionLinesVO");
oapagecontext.writeDiagnostics(Integer.valueOf(1),
"Inside the Process Form Request", 1);
oapagecontext.writeDiagnostics(Integer.valueOf(1),
(new StringBuilder()).append("Check
Status").append(oaviewobject.getQuery()).toString(),
1);
Object obj2 = null;
int i = oaviewobject.getRowCount();
oapagecontext.writeDiagnostics(Integer.valueOf(1),
(new StringBuilder()).append("Fetched Row
Count").append(i).toString(),
1);

System.out.println((new StringBuilder()).append("Fetched Row Count


is").append(i).toString());
RowSetIterator rowsetiterator =
oaviewobject.createRowSetIterator("iterator");
if (i > 0) {
oapagecontext.writeDiagnostics(Integer.valueOf(1),
(new StringBuilder()).append("Insdie the
Fetched Row Count >0").append(s2).toString(),
1);
System.out.println((new StringBuilder()).append("Get First Line Item
Type").append(s2).toString());
rowsetiterator.setRangeStart(0);
rowsetiterator.setRangeSize(i);
for (int j = 0; j < i; j++) {
PoRequisitionLinesVORowImpl porequisitionlinesvorowimpl =
(PoRequisitionLinesVORowImpl)rowsetiterator.getRowAtRangeIndex(j);
try {
Connection connection =
oapagecontext.getApplicationModule(oawebbean).getOADBTransaction().getJdbcConnection()
;
String s3 =
"SELECT msib.attribute9 FROM mtl_system_items_b
msib,mtl_parameters mp WHERE mp.o" +
"rganization_id = msib.organization_id AND
msib.inventory_item_id = :1 AND mp.ma" +
"ster_organization_id = msib.organization_id";
PreparedStatement preparedstatement =
connection.prepareStatement(s3);
preparedstatement.setInt(1,
Integer.parseInt(porequisitionlinesvorowimpl.getAttribute("ItemId").toString()));
oapagecontext.writeDiagnostics(Integer.valueOf(1),
(new
StringBuilder()).append("Insdie the For Loop in
SiteWisePO").append(Integer.parseInt(porequisitionlinesvorowimpl.getAttribute("ItemId"
).toString())).toString(),
1);
ResultSet resultset = preparedstatement.executeQuery();
if (resultset.next()) {
s1 = String.valueOf(resultset.getString(1));
oapagecontext.writeDiagnostics(Integer.valueOf(1),
(new
StringBuilder()).append("Insdie the for loop in SiteWisePO").append(s1).toString(),
1);
}
resultset.close();
} catch (Exception exception) {
throw new OAException((new StringBuilder()).append("Failed to get
the Item Type").append(exception).toString(),
(byte)0);
}
if ((porequisitionlinesvorowimpl.getAttribute("Attribute10") ==
null ||
porequisitionlinesvorowimpl.getAttribute("Attribute10").equals(null) ||
porequisitionlinesvorowimpl.getAttribute("Attribute10").equals("")) &&
s1.equalsIgnoreCase("Y")) {
oapagecontext.writeDiagnostics(Integer.valueOf(1),
(new
StringBuilder()).append("Insdie the SiteWisePO

Condition").append(porequisitionlinesvorowimpl.getAttribute("Attribute10")).toString()
,
1);
flag = true;
oapagecontext.writeDiagnostics(Integer.valueOf(1),
(new
StringBuilder()).append("Insdie the Condition flag").append(flag).toString(),
1);
}
}
}
rowsetiterator.closeRowSetIterator();
System.out.println((new
StringBuilder()).append("return").append(flag).toString());
oapagecontext.writeDiagnostics(Integer.valueOf(1),
(new StringBuilder()).append("Insdie the
Condition flag").append(flag).toString(),
1);
return flag;
}
public static boolean checkDecimalValues(OAApplicationModule oaapplicationmodule,
OAPageContext oapagecontext,
OAWebBean oawebbean) {
boolean flag = false;
String itemTypeQ = null;
String itemTypeLov = null;
int attribute10 = 0;
String itemTypeInv = null;
ResultSet oracleResultSet = null;
/*Accessing the View Object*/
OAViewObject vo =
(OAViewObject)oaapplicationmodule.findViewObject("PoRequisitionLinesVO");
oapagecontext.writeDiagnostics(1, "Inside the Process Form Request", 1);
oapagecontext.writeDiagnostics(1, "Check Status" + vo.getQuery(), 1);
PoRequisitionLinesVORowImpl row = null;
int fetchedRowCount = vo.getRowCount();
oapagecontext.writeDiagnostics(1, "Fetched Row Count" + fetchedRowCount,
1);
System.out.println((new StringBuilder()).append("Fetched Row Count
is").append(fetchedRowCount).toString());
RowSetIterator itemType = vo.createRowSetIterator("iterator");
if (fetchedRowCount > 0) {
System.out.println("Get First Line Item Type" + itemTypeInv);
itemType.setRangeStart(0);
itemType.setRangeSize(fetchedRowCount);
for (int i = 0; i < fetchedRowCount; i++) {
row =
(PoRequisitionLinesVORowImpl)itemType.getRowAtRangeIndex(i);
String quantiry = row.getAttribute("Quantity").toString();
oapagecontext.writeDiagnostics(1,
"Checking the Decimal Values >0" +
quantiry,
1);
if (quantiry != null || quantiry.length() != 0) {
for (int j = 0; j < quantiry.length(); j++) {
if (!Character.isDigit(quantiry.charAt(j))) {
flag = true;
}
}
}

}
}
itemType.closeRowSetIterator();
oapagecontext.writeDiagnostics(1, "Insdie the Condition flag" + flag, 1);
return flag;
}
public static boolean projectCommomPool(OAApplicationModule oaapplicationmodule,
OAPageContext oapagecontext,
OAWebBean oawebbean) {
boolean flag = false;
String itemTypeQ = null;
String itemTypeLov = null;
String attribute9 = null;
String itemTypeInv = null;
String poLineid
= null;
String projectID
= null;
ResultSet oracleResultSet = null;
/*Accessing the View Object*/
OAViewObject vo =
(OAViewObject)oaapplicationmodule.findViewObject("PoRequisitionLinesVO");
oapagecontext.writeDiagnostics(1, "Inside the Process Form Request", 1);
oapagecontext.writeDiagnostics(1, "Check Status" + vo.getQuery(), 1);
PoRequisitionLinesVORowImpl row = null;
int fetchedRowCount = vo.getRowCount();
oapagecontext.writeDiagnostics(1, "Fetched Row Count in the scm89" +
fetchedRowCount,
1);
System.out.println((new StringBuilder()).append("Fetched Row Count
is").append(fetchedRowCount).toString());
RowSetIterator project = vo.createRowSetIterator("iterator");
if (fetchedRowCount > 0) {
System.out.println("Get First Line Item Type" + itemTypeInv);
project.setRangeStart(0);
project.setRangeSize(fetchedRowCount);
for (int i = 0; i < fetchedRowCount; i++) {
row =
(PoRequisitionLinesVORowImpl)project.getRowAtRangeIndex(i);
String itemID = row.getAttribute("ItemId").toString();
String orgID
= row.getAttribute("OrgId").toString();
poLineid
= row.getAttribute("RequisitionLineId").toString();
oapagecontext.writeDiagnostics(1,
"Item ID in the SCM89" + itemID,
1);
String outValue = "Y";
String outParamValue = null;
String outValue1 = "Y";
String outParamValue1 = null;
if ((itemID) !=null) {
//Enabling the Add Lines Button for the Specific Suppliers
OADBTransaction txn = oaapplicationmodule.getOADBTransaction();
CallableStatement callableStatement =
txn.createCallableStatement("begin :1 :=
XXINDUS_SCM_PERSONALIZATION.xxindus_scm89_sitewise_po(:2,:3); end;",
OADBTransaction.DEFAULT);

try {
callableStatement.registerOutParameter(1, Types.VARCHAR);
callableStatement.setInt(2, Integer.parseInt(itemID));
callableStatement.setInt(3, Integer.parseInt(orgID));
callableStatement.execute();
outParamValue = callableStatement.getString(1);
callableStatement.close();
oapagecontext.writeDiagnostics(1,
"Out put Value of the SITE9" +
outParamValue,
1);
} catch (SQLException sqle) {
throw new OAException(sqle.getMessage());
}
}
if (outParamValue.equalsIgnoreCase(outValue)) {
OAViewObject vo1 =
(OAViewObject)oaapplicationmodule.findViewObject("PoReqDistributionsVO");
vo1.setWhereClauseParam(0, poLineid);
oapagecontext.writeDiagnostics(1, "Inside the
PoReqDistributionVO", 1);
oapagecontext.writeDiagnostics(1, "Check Status" + vo1.getQuery(),
1);
OARow row1 = (OARow)vo1.first();
projectID = row1.getAttribute("ProjectId").toString();
if (projectID.equalsIgnoreCase(null) ||
projectID.equalsIgnoreCase("")) {
projectID = "0";
oapagecontext.writeDiagnostics(1, "Project ID"+projectID, 1);
}
else if(projectID != null) {
oapagecontext.writeDiagnostics(1, "Project ID"+projectID, 1);
OADBTransaction txn1 =
oaapplicationmodule.getOADBTransaction();
CallableStatement callableStatement1 =
txn1.createCallableStatement("begin :1 :=
XXINDUS_SCM_PERSONALIZATION.xxindus_scm89_common_pool(:2); end;",
OADBTransaction.DEFAULT);
try {
callableStatement1.registerOutParameter(1, Types.VARCHAR);
callableStatement1.setInt(2, Integer.parseInt(projectID));
callableStatement1.execute();
outParamValue1 = callableStatement1.getString(1);
callableStatement1.close();
oapagecontext.writeDiagnostics(1,
"Out put Value of the Project
Commom Pool" + outParamValue1,
1);
} catch (SQLException sqle) {
throw new OAException(sqle.getMessage());

}
}
if (outParamValue1.equalsIgnoreCase(outValue1))
{
flag = true;
}
}
}

}
project.closeRowSetIterator();
oapagecontext.writeDiagnostics(1, "Insdie the Condition flag" + flag, 1);
return flag;
}
public static boolean checkCCID (OAApplicationModule oaapplicationmodule,
OAPageContext oapagecontext,
OAWebBean oawebbean,
RequisitionAMImpl requisitionamimpl)
{
boolean flag = false;
int budget = 0;
String ccID
= null;
String plineID = null;
String amount = null;
PoRequisitionHeadersVOImpl porequisitionheadersvoimpl =
requisitionamimpl.getPoRequisitionHeadersVO();
PoRequisitionHeadersVORowImpl porequisitionheadersvorowimpl =
(PoRequisitionHeadersVORowImpl)porequisitionheadersvoimpl.getCurrentRow();
PoRequisitionHeaderEOImpl porequisitionheadereoimpl =
porequisitionheadersvorowimpl.getPoRequisitionHeaderEO();
RowIterator rowiterator = porequisitionheadereoimpl.getPoRequisitionLineEO();
rowiterator.setRangeSize(-1);
oracle.jbo.Row arow[] = rowiterator.getAllRowsInRange();
for(int i = 0; i < arow.length; i++)
{
PoRequisitionLineEOImpl porequisitionlineeoimpl =
(PoRequisitionLineEOImpl)arow[i];
RowIterator rowiterator1 = porequisitionlineeoimpl.getPoReqDistributionEO();
rowiterator1.setRangeSize(-1);
oracle.jbo.Row arow1[] = rowiterator1.getAllRowsInRange();
for(int j = 0; j < arow1.length; j++)
{
PoReqDistributionEOImpl poreqdistributioneoimpl =
(PoReqDistributionEOImpl)arow1[j];
ccID
= poreqdistributioneoimpl.getCodeCombinationId().toString();
plineID = poreqdistributioneoimpl.getRequisitionLineId().toString();
amount = poreqdistributioneoimpl.getEncumberedAmount().toString();
if (ccID.equalsIgnoreCase(null) || ccID.equalsIgnoreCase(""))
{
oapagecontext.writeDiagnostics(1, "Inside the ccid null"+ccID, 1);
poreqdistributioneoimpl.setCodeCombinationId(new Number(-1));
}
oapagecontext.writeDiagnostics(1, "Inside the ccid method ccid"+ccID, 1);
oapagecontext.writeDiagnostics(1, "Inside the ccid method amount"+amount,
1);
oapagecontext.writeDiagnostics(1, "Inside the ccid method
lineid"+plineID, 1);

}
//Enabling the Add Lines Button for the Specific Suppliers
OADBTransaction txn = oaapplicationmodule.getOADBTransaction();
CallableStatement callableStatement =
txn.createCallableStatement("begin :1 :=
xxindus_scm_personalization.xxindus_scm7_budget(:2,:3); end;",
OADBTransaction.DEFAULT);
try {
callableStatement.registerOutParameter(1, Types.NUMERIC);
callableStatement.setInt(2,Integer.parseInt(plineID) );
callableStatement.setInt(3,Integer.parseInt(ccID) );
callableStatement.execute();
budget = callableStatement.getInt(1);
callableStatement.close();
oapagecontext.writeDiagnostics(1,
"Budget Value" + budget,
1);
} catch (SQLException sqle) {
throw new OAException(sqle.getMessage());
}
if (budget < Integer.parseInt(amount)) {
flag = true;
}
}
return flag;
}
}

Calling the PLSQL Procedure in co:

import java.sql.CallableStatement;
import java.sql.SQLException;
import java.sql.Types;
import oracle.apps.fnd.framework.server.OADBTransactionImpl;
String outParamValue = null;
OADBTransaction txn = getDBTransaction();
CallableStatement cs = txn.createCallableStatement("begin xx_pkg.xx_procedure(:1, :2); end;");
{
((OracleCallableStatement)cs.registerOutParameter(2, Types.VARCHAR, 0, 2000);
cs.setString(1, "gyan");
outParamValue = cs.getString(1);
cs.execute();
cs.close();
}
catch (SQLException sqle)
{
cs.close();

You might also like