Search Results


Wednesday, November 26, 2008

Hide a mandatory field

How to hide a mandatory field in OAF Page


If the business wants to hide a field in the seeded page, you can do it by personalizing the page and set Rendered property to false.
But this solution will not help you if the field is marked as mandatory by the seeded page.

The reasons are Mandatory Validations are usually done at the EO level. Hence even if you hide the mandatory field, the validation would still happen at the server. If the column has not null constraint in the table, it will throw a database error.


Can I extend the VO or EO and remove the mandatory property?
No, you cannot change the mandatory property through extension.


How to fix this?
You can fix this by setting a default value for the mandatory field.


Should I extend the VO/EO and set the default value?
Do not extend the VO/EO for the defaulting logic. Because extensions are applied at the site level and the Oracle seeded pages share the same VO/EO all over the Applications.


Where to default the value?

Extend the controller and set the value in the processRequest(){} method. This is the safest way to default the value to the mandatory field.

After defaulting the mandatory variable, personalize the page and set the rendered property to false.



Article By:
Prasanna Jayaraman

Please post your Ideas and Comments

New to OAF

New to OA Framework


Following are the most frequently asked questions in the OAF forums by new OAF Developers
  1. What is OAF?
  2. What are the prerequisites for learning OAF?
  3. I am a forms developer and I want to learn a web technology, should I go for OAF or ADF?
  4. Where to get the jdeveloper for OA Framework?
  5. How to learn OAF and where to find step by step tutorial?
  6. Can I practice OAF in home?
In this article I am going to explain what the developer should do if he is new to OA framework technology.

What is OAF?
OAF is web development framework based on MVC architecture for developing HTML pages and customizations in the Oracle Applications 11i/R12.


What are the prerequisites for learning OA framework?
You need the basic level knowledge in J2EE, good level of knowledge in Java and Oracle database (very important). Especially in java you should have good knowledge of inheritence, overriding, exception handling and collections etc.


I am a forms developer and I want to learn a web technology, should I go for OAF or ADF?
It depends on the purpose of learning the web technology. If you are an ebiz developer and want to do customization and extensions for the HTML based pages in the Oracle applications 11i/R12 then you should go for OA framework. This statment holds well till the release of fusion applications because ADF is well integrated with fusion apps. Also remember learning OAF is not going to be wasted, because ADF uses same bc4j in the name of ADF bc (of course, with good improvements over bc4j), so OAF developers can easily learn ADF in minimal duration.

If you're a forms developer, you're not working in Oracle Applications and you want to develop a new web application for your business, then you should go for ADF 11g. For more information about difference between OAF and ADF follow this link


Where to get the jdeveloper for OA Framework?
The jdeveloper available in the otn.oracle.com is meant for j2ee developers. So it cannot be used for OAF development. There are different set of jdeveloper versions available in the metalink corresponding to the OAF version of your Oracle Applications. First you need to identify the version of OA Framework available in the Oracle Application instance.

To know that
  1. Open any OAF page
  2. Select the "About this Page" link located at the bottom of the page.
  3. Choose the technology components tab
  4. There you can find the versions of OAF and all technology components of the Oracle application.
  5. You can find the jdeveloper corresponding to the OAF version in the following metalink note How to find the correct version of JDeveloper to use with eBusiness Suite 11i or Release 12
  6. And you need a Metalink login to view the above link and to download the jdeveloper zip file.


How to learn OA framework and where to find step by step tutorial?
The best way to learn OA framework is to start with toolbox tutorials. If you have any doubts in the tutorial you can refer the Developers guide and Personalization Guide. If you want to refer the documentation for OAF java methods like setForwardURL() etc. you can see it in Java Doc available in the index.htm page.

To See the tutorial index
  1. Go to jdevDoc folder in the path where you unziped your jdeveloper.zip file.
  2. Open the index.htm
  3. There you can find Oracle Application Framework Toolbox Tutorials link.
There are around 15 topics in this tutorial to illustrate the basic and advanced topics of the OA framework. It will take 5-10 days to complete all the lessons in this tutorial. These tutorial lessons include almost everything you might need in the OA framework development and customization.


How to practice it in Home?
Running a OAF page from the jdeveloper needs a Oracle Applications Instance up and running. So should have the whole Oracle Applications instance installed in your laptop/desktop or you should have network connection to Oracle Applications instance.


And if you get any doubts in the OA Framework you can get the experts help at the OAF forum http://forums.oracle.com/forums/forum.jspa?forumID=210&start=0



Article By:

Prasanna Jayaraman

Please post your Ideas and Comments

Tuesday, November 04, 2008

Callable Statement

How to Call a PL/SQL block from OA framework


You can call PL/SQL block from the OA Framework using callable statement. Use the following code from application module.


import java.sql.CallableStatement;
import oracle.apps.fnd.common.VersionInfo;
import
java.sql.SQLException;


CallableStatement
updateStmt = null;

try
{
// Put your PL/SQL block in a String variable.

String
deleteStmt = "begin delete test_table where header_id = :1; "+
" :2 = xxx_pkg.yyy_function(); end;";

OADBTransaction
txn = getOADBTransaction();

// Pass the PL/SQL block to the callable Statement

updateStmt = txn.createCallableStatement(deleteStmt, 1);


// Set all the bind variables before calling the execute command

updateStmt.setInt(1, headerIdToDelete);

// And register the output parameter types
updateStmt.registerOutParameter(2, Types.DOUBLE);

updateStmt.executeUpdate();

// After execute you can get the value of pl/sql block output
Number amount = new Number(updateStmt.getDouble(2));
updateStmt.close();


// Commit the transaction in the database
txn.commit();


}
catch(SQLException sqle) {
updateStmt.close();

}



If you want to call pl/sql from the controller then get the application module from the pageContext.
And then get the db transaction from the application module
OADBTransaction txn = pageContext.getApplicationModule(webBean).getOADBTransaction();


Article By:
Prasanna Jayaraman

Please post your Ideas and Comments

Call Concurrent Program from OA Framework

How to Call a Concurrent Program from OA framework


OA Framework provides the ConcurrentRequest class to call the concurrent program from the page. The submitRequest() method in the ConcurrentRequest class takes 6 parameters and returns request id of the submitted concurrent request:

public int submitRequest(
String ProgramApplication ,
String ProgramName ,
String ProgramDescription ,
String StartTime,
boolean SubRequest,
Vector Parameters ) throws RequestSubmissionException


ProgramApplication -Application Short name of application under which the program is registered.
ProgramName - Concurrent Program Name for which the request has to be submitted
ProgramDescription - Concurrent Program Description
StartTime - Time at which the request has to start running.
SubRequest - Set to TRUE if the request is submitted from another running request and has to be treated as a sub request.
Parameters - Parameters of the concurrent Request


Here is the example for calling a concurrent program from a OA framework page.


import oracle.apps.fnd.cp.request.ConcurrentRequest;
import oracle.apps.fnd.framework.server.OADBTransaction;

public int submitCPRequest(Number headerId) {

try {


OADBTransaction tx = (OADBTransaction)getDBTransaction();
java.sql.Connection pConncection = tx.getJdbcConnection();
ConcurrentRequest cr = new ConcurrentRequest(pConncection);

String applnName = "PO"; //Application that contains the concurrent program
String cpName = "POXXXX"; //Concurrent program name
String cpDesc = "Concurrent Program Description"; // concurrent Program description

// Pass the Arguments using vector
// Here i have added my parameter headerId to the vector and passed the vector to the concurrent program

Vector cpArgs = new Vector();
cpArgs.addElement(headerId.stringValue());


// Calling the Concurrent Program

int requestId = cr.submitRequest(applnName, cpName, cpDesc, null, false, cpArgs);
tx.commit();

return requestId;

} catch (RequestSubmissionException e) {
OAException oe = new OAException(e.getMessage());
oe.setApplicationModule(this);
throw oe;

}
}



How to monitor the submitted concurrent request OA Framework


The Request Monitoring user interface provides the ability to search for a current user's requests. It allows the user to specify criteria to search for a request based on a specific request ID, requests for a specific program or a range of scheduled requests. Using the search results list, a user can select a request to see the details of that request or view its output file. From the Details page for a request, a user can place a hold on a pending request, cancel a pending request or view the request's log file.



You can call the Request Monitoring page by calling following URL
OA.jsp?akRegionCode=FNDCPREQUESTVIEWREGION&akRegionApplicationId=0



Article By:

Prasanna Jayaraman


Please post your Ideas and Comments

Thursday, June 19, 2008

OAF vs ADF 10g

OAF vs ADF 10g

Hi all,

With the emergence of next generation Fusion technology middleware stack there is confusion between the technologies OA framework and ADF among Oracle developers especially for the people who are developing extensions for Oracle Applications 11i/R12. Both are Oracle technologies for developing web based User Interface with Jdeveloper. Hence I decided to bring out the detailed overview of OA framework and ADF, and identify the rite technology for your web development projects.


OA Framwork


OAF (Oracle Applications Framework) is used to create the web based Oracle Application extensions and it is the default web technology for 11i and R12 development. It is closely integrated with Oracle Apps hence it is meaningless outside apps context. OAF is a model-view-controller technology stack which comprised of OA framework View (regions and pages) and BC4j respectively as view and model layers.

OAF and Oracle Applications 11i/R12
  • OAF includes AOL which provides e-business functionality like functions, menus, responsibility, functional security, data security, messages, profiles, flexfields, and concurrent programs.
  • List of Values – validation, auto complete, auto clear is available in OAF.
  • Transactional Search – Query Bean is available in OAF.
  • Data export, Configurable pages and Rich text editor is available in OAF.
  • OAF supports translatable table (TL tables).
  • Who columns like created by, modified by, creation date, modified date are supported in OAF.
  • Since OAF is tightly integrated with E-Business session management is done automatically.
  • Menu that appears at the top of the page is integrated with AOL menus. Hence the menus can be configured dynamically by manipulating AOL menus and no coding is required.
  • Functional security is available in OAF which allows you to configure the responsibility dynamically for the user.
  • User authentication is done from SSO. So no need to configure or write any code.
  • Data security is available.
  • Secured against cross site scripting attack.
  • OAF page access can be tracked.
  • Standards and guidelines are available for developing extensions in OAF which is the most important thing.
  • Reusable regions are available in OAF.
  • UI cannot be migrated to ADF 11g (may be in the future Oracle will come up with migration utility for UI but even then only declarative pages would be migrated and the UI pages should have followed the coding standards strictly).
  • BC4J can be migrated with minimal code change.
  • Controller cannot be migrated hence you have to rewrite all the logics in the controller if you want to migrate it to ADF 11g.

ADF 10g

ADF 10g (Application Development Framework) is the core technology for Fusion Applications and uses lot of open standards and technologies. ADF can also be used for common J2EE applications because ADF technology stack allows you choose between various options. ADF is primarily comprised of ADF Faces, ADF model and ADFbc (which is previously known as bc4j in OAF)

ADF 10g and Oracle Applications 11i/R12
  • ADF 10g does not include any support for AOL
  • List of Values and its associated features like validation, auto complete and clear does not exists in ADF.
  • No Transactional search, Data Export, Configurable pages or Rich text editor.
  • No support of Translatable Table and who columns.
  • No support for E-business suite session management.
  • No support for integration with Oracle Workflow.
  • E-business security features are totally unavailable in ADF 10g. (security features include Data security, functionally security, SSO etc)
  • Page access cannot be tracked in ADF 10g.
  • No support of for menus in ADF.
  • Reusable regions cannot be created in ADF 10g.
  • ADF 10g can be easily migrated to ADF 11g.
  • And most of all you cannot extend or personalize the existing page with the help of ADF.

And the advantage of ADF 10g over OA framework is that your investments would be protected when you want to migrate to ADF 11g.

(ADF has many advantages starting from the underlying architecture, the level of support for Web Services and SOA development and going all the way to the actual development experience of UIs using visual editor and drag and drop binding. -- Shay)

Conclusion

Consider following points when choosing technology.
  • If you want to build few pages with close integration of e-business suite then opt for OA framework. Remember if you want to migrate your code to ADF 11g in the future, you have to follow the coding standards strictly and code all the business logic in bc4j rather than handling the logic in controller.
  • If you don’t want a close integration e-business suite or your building entirely new application then go for ADF 10g.



Article By:
Prasanna Jayaraman

Please post your Ideas and Comments

Wednesday, February 20, 2008

Deploy OA Framework

How to Deploy OA framework in the Instance

Deployment of OA framework consists of 5 steps.
  • Deploying Class files and VO/EO/AM xml files
  • Deploying PG/RN xml files
  • Deploying jpr files for Substitution
  • Setup AOL to access the page
  • Restart the server

Let's look at these one by one.

Deploying Class files


The files such as
  • Controllers *CO.class
  • Application modules *AM.class
  • View Objects *VOImpl.class, *VORowImpl.class, *VO.xml
  • Entity objects *EO.xml, *EOImpl.java

should be deployed in the $JAVA_TOP/<path of your file>.

For eg:

if your files path in jdeveloper is
$jdev_home/myprojects/oracle/apps/ap/setup/webui/setupCO.java

then place your class files in the following path in the instance
$JAVA_TOP/oracle/apps/ap/setup/webui/setupCO.class


Deploying Page and Region files


The Page xml files(*PG.xml) and region xml(*RN.xml) files resides in the database. So you have to import the file into the database to make it work in the instance. Oracle application provides XMLExporter/XMLImporter to export and import page files from and to the database.

Deploy the files to the Instance

java oracle.jrad.tools.xml.importer.XMLImporter /home/prasanna/pages/SetupPG.xml -username <data base user name> -password <data base password> -dbconnection "(description = (address_list = (address = (community = tcp.world)(protocol = tcp)(host =<hostname> ) (port = <port id>)))(connect_data = (sid = <sid>)))"

This command will import the SetupPG.xml file into the database.


Extracting from instance

If you have done your personalizations in the developement instance and you want to deploy the personalizations into the production instance, then you can extract the personalization using XMLExporter command from the developement instance and Import the extracted xml file into the production instance in the same way you did for PG.xml files.

java oracle.jrad.tools.xml.exporter.XMLExporter /oracle/apps/ap/setup/webui/customizations/site/0/SetupPG -rootdir <destination path> -username <data base user name> -password <data base password> -dbconnection "(description = (address_list = (address = (community = tcp.world)(protocol = tcp)(host =<hostname> ) (port = <port id>)))(connect_data = (sid = <sid>)))"

The above command will export the SetupPG from the data base to your file system at the destination path as XML file (SetupPG.xml)


Deploying jpr files for Substitutions, if any


If you have extended EO, VO or AM and created substitutions in your project. Then you have to deploy your .jpx file into the instance.

java oracle.jrad.tools.xml.importer.JPXImporter $AP_TOP/xxx/Setup.jpx -username <data base user name> -password <data base password> -dbconnection "(description = (address_list = (address = (community = tcp.world)(protocol = tcp)(host =<hostname> (port = <port id>)))(connect_data = (sid = <sid>)))"


Setup AOL to access the page


In case your page is referred in existing pages of Oracle applications you can skip this step. But if you want to access the page as a new Function then follow these steps.


Create Function as
ID: XX_SETUP
Name: SETUP
Function type(HTML tab) : SSW
URL: OA.jsp?page=/oracle/apps/ap/XXX/SetupPG&parameter1=xx&parameter1=xx


Attach the function to a Menu
Attach the menu to a Responsibility

Restart the server


After deployement you cannot see the page immediately on the server instance. This is because your Pages and class files would be cached in the middle tier. So you have to bounce the apache.

$COMMON_TOP/admin/scripts/adapcctl.sh stop
$COMMON_TOP/admin/scripts/adapcctl.sh start

After this process, clear the cache from the functional administrator responsibility and this step is optional.

Some times we may need to restart the whole middle tier to see the depolyed pages in the instance.

To Restart the instance use following command

Stop the instance
cd $INST_TOP/admin/scripts
adstpall.sh apps/apps

Start the instance
adstrtal.sh apps/apps



Article By:
Prasanna Jayaraman

Please post your Ideas and Comments

Tuesday, February 05, 2008

Managed Bean

Managed Bean

Managed beans are Java classes that you register with the. The managed beans are initialized when they are referenced in the application for the first time. It helps to handle UI events or write data manipulation code. TIP: Use managed beans to store only logic that is related to the UI rendering.

Managed beans can be registered in three files

  1. adfc-config.xml
  2. Task flow definition file
  3. faces-config.xml

adfc-config.xml

Managed bean declared in this file can be of any scope.

Task Flow definition file

Managed bean scope can any scope. However, managed beans of request, pageFlow, or with scope set to none accessed within the task flow definition, must be defined within the task flow definition file. Managed bean definitions within task flow definition files will only be visible to activities executing within the same task flow.

faces-config.xml

Allows any managed bean scope other than pageFlow scope.

The order of searching a managed bean in the application is faces-config.xml, adfc-config.xml and Task flow definition file (if exists). Hence managed bean defined in the faces-config.xml takes the precedence.

As a general rule in fusion web applications, a bean that may be used in more than one page or task flow is defined in the adbc-config.xml and a bean that is used within the task flow is defined in the task flow definition XML file.


Add a managed bean

To add a managed bean

  1. Click the adbc-config.xml file or task flow definition file.
  2. Go to Property editor -> Managed bean tab
  3. Choose the +(Add) Icon.



Difference between Managed Bean and Backing Bean

Backing bean and Managed bean are not different they are the same. Managed bean is about how the bean is created and initialized. Backing bean is about the role a particular managed bean plays.

In other way, Managed bean is a JavaBean registered in the adfc-config.xml file. These beans have properties that are bound to the values of UIComponents.

Backing bean is a special type of managed-bean consisting of properties that are UIComponents. Instead of the bean properties being bound to the UIComponent values, they are instead bound to the UIComponents themselves.


Task Flows

Bounded and Unbounded Task Flows

Unbounded
A specialized form of task flow that has a single entry point and zero or more exit points. It is configured in adfc-config.xml file.

  • It cannot declaratively specify parameters.
  • It contains default activity
  • It cannot be called by another task flow.


Unbounded task flow can be used when
  • You want to take advantage of ADF controller features not offered by bounded task flows
  • You don’t need ADF controller features that are offered when using a bounded task flow.
  • The task flow will not be called by another task flow.
  • The application has multiple points of entry.




Bounded
A set of activities, control flow rules and managed beans that interact to allow a user to complete a task. It is used to encapsulate a reusable portion of an application.

  • A bounded task flow can be called another bounded task flow or unbounded task flow.
  • The bounded task flow always specifies a default activity
  • Managed bean specified in pageFlow scope is visible only within the task flow, and isolated from rest of application.

Because of the resuability features, bounded task is mostly used in all applications.


Features of Bounded Task Flow

  1. Well-defined boundary An ADF bounded task flow consists of its own set of private control flow rules, activities and managed beans. Input and Ouput parameters are available to bounded task flow just like a function call. Data controls can be shared between task flows.
  2. Single point of entry An ADF bounded task flow has a default activity that executes before all other activities in the task flow.
  3. PageFlow memory scope Its a new scope introduced in ADF. And its lifespan is ADF bounded task flow.
  4. Reuse You can identify an entire group of activities as a single entity and reuse it in another application.
  5. Parameters and return values You can pass the parameters and get the output just like a function call.
  6. Transaction ManagementIt represents a transactional unit of work. While entering a bounded task flow you can create new transaction or join the existing one.
  7. Reentry You can choose to reenter the bounded task flow.
  8. Security Secure a bounded task flow using fusion security.