In the page that initiates the long-running process, add code to instantiate and navigate to the processing page
as shown in the example below. (Taken from Oracle Developers Guide)
import oracle.apps.fnd.framework.webui.OAProcessingPage;
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);
// This example assumes a submit button named "StartProcess" initiates the long-running process.
if (pageContext.getParameter("StartProcess")!= null)
{
// Create the processing page and pass it the fully qualified name of the controller that
// you created to launch the process.
OAProcessingPage page = new
OAProcessingPage("oracle.apps.fnd.toolbox.samplelib.webui.processCO");
// The concise message is displayed in bold and should briefly describe the process.
// NOTE: never hard-code text display values as shown here. Always use message dictionary.
page.setConciseMessage("This is the concise processing page message.");
// The detailed message displays below the concise message in plain text. It provides
// additional information about what's happening.
page.setDetailedMessage("This is the detailed message which should explain what's happening.");
// This is displayed in the processing page title.
page.setProcessName("<Process Name>");
// Forward to the processing page. Note that the OA Framework assumes you
// are retaining the root application module. Since we haven't specified a different root AM on
// the processing page, the OA Framework assumes it uses the same root AM as the launching page.
pageContext.forwardToProcessingPage(page);
}
}
This blog is written to help developers starting with Oracle Applications Framework Personalization and Extension.All code has been tested and working using R 12.1.1 both in development and production environment.
Total Pageviews
Wednesday, July 13, 2011
Friday, July 8, 2011
Call Procedure in OAF (1 input, 1 output parameter)
String sql = "BEGIN xx_custom_pkg.custom_prc (:1,:2); END;";
try {
OracleCallableStatement cs =
(OracleCallableStatement)oam.getOADBTransaction().createCallableStatement(sql,
2);
((OracleCallableStatement)cs.registerOutParameter(2,
Types.VARCHAR,
0, 2000));
cs.setString(1, xxAttribute1Value);
cs.execute();
String outParamValue = cs.getString(1);
pageContext.writeDiagnostics(this,
"Result is:" + outParamValue,
OAFwkConstants.PROCEDURE);
cs.close();
} catch (Exception ex) {
pageContext.writeDiagnostics(this, "Error:" + ex.toString(),
OAFwkConstants.PROCEDURE);
}
try {
OracleCallableStatement cs =
(OracleCallableStatement)oam.getOADBTransaction().createCallableStatement(sql,
2);
((OracleCallableStatement)cs.registerOutParameter(2,
Types.VARCHAR,
0, 2000));
cs.setString(1, xxAttribute1Value);
cs.execute();
String outParamValue = cs.getString(1);
pageContext.writeDiagnostics(this,
"Result is:" + outParamValue,
OAFwkConstants.PROCEDURE);
cs.close();
} catch (Exception ex) {
pageContext.writeDiagnostics(this, "Error:" + ex.toString(),
OAFwkConstants.PROCEDURE);
}
Labels:
Java Programming,
OAF,
Oracle Applications
Wednesday, July 6, 2011
Call Procedure in OAF (2 input parameters)
Call a custom procedure. Two input parameters of type Varchar:
OAApplicationModule oam = pageContext.getApplicationModule(webBean);
String sql = "BEGIN xx_custom_pkg.custom_prc (:1,:2); END;";
try {
OracleCallableStatement cs =
(OracleCallableStatement)oam.getOADBTransaction().createCallableStatement(sql,
2);
cs.setString(1, xxAttribute1Value);
cs.setString(2, xxAttribute2Value);
cs.execute();
cs.close();
}
catch (Exception ex) {
pageContext.writeDiagnostics(this,
"Error:" + ex.toString(),
OAFwkConstants.PROCEDURE);
}
OAApplicationModule oam = pageContext.getApplicationModule(webBean);
String sql = "BEGIN xx_custom_pkg.custom_prc (:1,:2); END;";
try {
OracleCallableStatement cs =
(OracleCallableStatement)oam.getOADBTransaction().createCallableStatement(sql,
2);
cs.setString(1, xxAttribute1Value);
cs.setString(2, xxAttribute2Value);
cs.execute();
cs.close();
}
catch (Exception ex) {
pageContext.writeDiagnostics(this,
"Error:" + ex.toString(),
OAFwkConstants.PROCEDURE);
}
Labels:
Java Programming,
OAF,
Oracle Applications
Call Function in OAF
The segment below calls a custom function with 1 input parameter of type Varchar and returns a Varchar :
OAApplicationModule oam = pageContext.getApplicationModule(webBean);
String sql = "BEGIN :1 := xx_custom_pkg.call_custom_function (:2); END;";
OracleCallableStatement cs =
(OracleCallableStatement)oam.getOADBTransaction().createCallableStatement(sql,2);
try {
//Register your function output...
cs.registerOutParameter(1, Types.VARCHAR, 0, 2000);
//Your input parameter below...
cs.setString(2, LinesRow.getAttribute("ReportLineId").toString());
cs.execute();
String p_res = cs.getString(1);
cs.close();
}
catch (Exception ex) {
pageContext.writeDiagnostics(this,
"Error:" + ex.toString(),
OAFwkConstants.PROCEDURE);
}
OAApplicationModule oam = pageContext.getApplicationModule(webBean);
String sql = "BEGIN :1 := xx_custom_pkg.call_custom_function (:2); END;";
OracleCallableStatement cs =
(OracleCallableStatement)oam.getOADBTransaction().createCallableStatement(sql,2);
try {
//Register your function output...
cs.registerOutParameter(1, Types.VARCHAR, 0, 2000);
//Your input parameter below...
cs.setString(2, LinesRow.getAttribute("ReportLineId").toString());
cs.execute();
String p_res = cs.getString(1);
cs.close();
}
catch (Exception ex) {
pageContext.writeDiagnostics(this,
"Error:" + ex.toString(),
OAFwkConstants.PROCEDURE);
}
Labels:
Java Programming,
OAF,
Oracle Applications
Tuesday, July 5, 2011
Returns a date string in the users date format
/*
* Returns a date string in the users date format
*
* @param nlsServ instance of OANLSServices
* @param dateStr string in 'dd-mm-yyyy' format
*/
public static String stringToDateString(OANLSServices nlsServ, String dateStr) {
if (dateStr != null && !dateStr.equals(""))
{
Date date = null;
if (databaseDateFormat != null) {
try {
date = databaseDateFormat.parse(dateStr);
} catch (ParseException e) {
}
}
if (date != null)
return nlsServ.dateToString(date);
}
return null;
}
* Returns a date string in the users date format
*
* @param nlsServ instance of OANLSServices
* @param dateStr string in 'dd-mm-yyyy' format
*/
public static String stringToDateString(OANLSServices nlsServ, String dateStr) {
if (dateStr != null && !dateStr.equals(""))
{
Date date = null;
if (databaseDateFormat != null) {
try {
date = databaseDateFormat.parse(dateStr);
} catch (ParseException e) {
}
}
if (date != null)
return nlsServ.dateToString(date);
}
return null;
}
Labels:
Java Programming,
OAF,
Oracle Applications
Subscribe to:
Posts (Atom)