Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
ORACLE
eBusiness
Suite August 25
Developer 2012
Handbook -
Ed 1
In this book you will learn some of the key techniques in
developing/debugging and maintaining technical components that make Suman Thota
up Oracle eBusiness Suite application
Contents
Introduction 3
Technical 4
Oracle eBS Architecture - File System 11i 4
Oracle eBS Architecture - File System R12 5
Customization: Metalink Notes 6
Flex Fields - Queries /APIs 7
Oracle Applications: Debugging Using Log Files 9
Setting Applications Context 11
Oracle Applications: Patch Queries (Applied Patches etc) 12
Oracle Applications: Finding Files And/Or Object Versions 13
Resolving Database Locks 15
Oracle Database 10g - Flashback Support 16
Oracle Applications - How to Hack Oracle Database Apps Password 17
Techno Functional 18
Oracle Applications R12: GL XLA Drill Down 18
Queries: GL Templates/Code Combinations 19
Purchasing. Receiving, MTL Accts Queries 20
R12: Purchasing(PO) Subledger Accounting (XLA) Drilldown Queries 21
Oracle Applications: Financials Shared Entities/Data Flow between Applications 22
Oracle Payables: R12 Setup 23
DBA Related 24
Oracle Applications - How to Bounce Services(Forms, Concurrent Mgr, Application Tier
etc) 24
Oracle Applications: Patch Queries (Applied Patches etc) 25
SQL: Generating Trace Files 26
Using Tkprof 27
OA Framework 28
First Thing First - Setting up Jdeveloper for Customizations @ Work 28
Enable FND Logging in OA Framework 30
Extract/Export OAF Personalizations 31
Import OAF Personalizations 33
Clear Framework Cache 36
BI/XML Publisher 37
XML/BI Publisher Template/Report Migration 37
Interview Preparation 40
XML/BI Publisher Interview Questions 40
Oracle Applications Framework (OAF) Interview Questions 43
Introduction
This book covers the essential concepts required for an Oracle Applications Developer. There are
many tips and useful information across technologies including OA Framework and BI Publisher. The
book will be handy when debugging your code or building new components.
In this first edition Ed1 of the book wel talk about Architecture of Oracle Applications, Debugging
Techniques and DBA developer related information. We will also touch up on the BI Publisher in
regard to the interview preparation and also the migration of BI Publisher objects across instances.
OAFramework section will give developer a head start into developing new pages/objects.
Thanks for reading this book and I hope you will enjoy this. I have around 9 years of experience in
developing/maintaining technical components in Oracle Applications and with your encouragement I
am sure the future editions will be more informative.
-Suman Thota
Technical
Oracle eBS Architecture - File System 11i
Below are the main components of Oracle Applications R12 file system :
APPL_TOP - Main Oracle applications files, environment file and product specific sub
directories
COMMON_TOP - Files shared across the products including log/out and exe(class files)
INST_TOP - Instance Specific configuration and log files are stored here. Using for
configuring multiple OC4J/Apache ports as well. Multiple application server configurations
result in multiple instance tops for the single installation of oracle applications in R12
Tech Stack - Oracle Developer 10g(Forms 10g, Reports 10g) components 10.1.2
ORACLE_HOME, Oracle Applications Server 10.1.3 ORACLE_HOME and Oracle
Database(certified version) in its own ORACLE_HOME 10.2.0
INST_TOP: xxx/inst/apps/<ctx_name>
Instance Specific configuration/log files
Though Oracle supports customization there are many restrictions to the way Oracle supports
customization and Metalink is the right place for search for complete listing. Here are key notes as
example
SELECT application_column_name
FROM fnd_segment_attribute_values , gl_ledgers gl
WHERE id_flex_code = 'GL#'
AND attribute_value = 'Y'
AND segment_attribute_type = 'GL_BALANCING'
AND application_id = 101
AND id_flex_num = gl.chart_of_accounts_id
AND gl.chart_of_accounts_id = <v_chart_of_accounts_id>
AND gl.ledger_id = <v_ledger_id>;
vg_delimiter := Fnd_Flex_Ext.get_delimiter
(
'SQLGL',
<v_id_flex_code>,
<v_coa_id>
);
l_retval := fnd_flex_apis.get_segment_column
(
x_application_id => l_application_id,
x_id_flex_code => l_id_flex_code,
x_id_flex_num => p_chart_of_accounts_id,
x_seg_attr_type => l_acct_seg_attr_type,
x_app_column_name => p_acct_segment
); /* Gives you Accouting Segment Information*/
l_retval := fnd_flex_apis.get_segment_column
(
x_application_id => l_application_id,
x_id_flex_code => l_id_flex_code,
x_id_flex_num => p_chart_of_accounts_id,
x_seg_attr_type => l_bal_seg_attr_type,
x_app_column_name => p_bal_segment
); /* Gives you Balancing Segment Information*/
l_ret_val := FND_FLEX_APIS.GET_SEGMENT_COLUMN
(
x_application_id => 200,
x_id_flex_code => 'GL#',
x_id_flex_num => 1120,
x_seg_attr_type => 'GL_BALANCING',
x_app_column_name => vg_bal_segment
Many a times we would need to go through the log to find out the cause of the problem. Below is one
quicker and easier way to do.
2.
a) Run the following query and note its output as log_val_1.
select max(log_sequence) from fnd_log_messages;
b) Perform the test case now.
Once the process completes run the below query again and note its output as
log_val_2.
select max(log_sequence) from fnd_log_messages;
c) Run the following query to fetch the log messages.
select log_sequence, module, message_text
from fnd_log_messages
where log_sequence between log_val_1 and log_val_2
order by log_sequence;
In case where your BI/XML Publisher report errors out you may need to access the OPP file and look
for errors. Here is how you get to the file.
#cd $APPLCSF/$APPLLOG
#grep -i <conc_req_id> *OPP*.txt
Once you find the file
#cat xxOPPxx.txt |more
Below statement has to be used in your custom plsql packages so that debug statements are included
in the FND Debug log when generated
fnd_log.string(fnd_log.LEVEL_STATEMENT, 'XX Module Name',' Statement to Log ');
Resolving Locks
When running the queries against multi-org views from your sql developer or some sql sessions you
need to set the Apps Context so that the rows are retrieved.
Example: ap_invoices_all is a table, ap_invoices is a view. Running a query such as below will not
result in any rows if apps context is not set prior to running the query.
For 11i
-----------
You can set the context using fnd_global.apps_initialize(user_id, resp_id, application_id);
or
dbms_application_info.set_client_info(org_id);
user_id -> From fnd_user table
resp_id -> From fnd_responsibility, fnd_responsibility_tl tables
application_id -> From fnd_application table
org_id -> org id or the operating unit id
For R12
------------
We can use the mo global apis here:
begin
mo_global.init('AR');
mo_global.set_policy_context('S',84);
end;
Here 'AR' is a valid application name where multi org access is enabled, you can give any relevant
application name also. 'S' for single and 84 is the org id or the operating unit id
Below queries will provide you information on which/whether patches are applied:
select * from all_source where type='PACKAGE BODY' and name in ('<Package Name>')
and text like '%$Header%';
OR
Unix version
# cd $GL_TOP/patch/115/sql
# grep -ir 'CREATE OR REPLACE PACKAGE <Package_Name>' *
Forms
#cd $GL_TOP/forms/US
#adident Header <form_name>.fmx
Reports
#cd $GL_TOP/reports/US
#adident Header <report_name>.rdf
Pro*C
#cd $GL_TOP/bin
#adident Header <EXE_NAME>
Pages/Regions
#cd $GL_TOP/mds/webadi/webui
#adident Header <Page/Region>.xml
OR (#grep -ir Header <Page/Region>.xml
Controller/Model Objects
#cd $JAVA_TOP/oracle/apps/gl/budgetwizard/query
#adident Header <File_name>.class
Resolving Database Locks
Sometimes it would be really a wise decision to look for the database locks when you see the
performance of your program deteriorating. Here are simple steps to verify/resolve locks
--sid, serial#
Deadlocks
Ensure your code is not recursive.Watch your locks so that they dont turn into 'Deadlocks'
Oracle Database 10g - Flashback Support
Oracle Database 10g provides a new SQL DDL command to restore the state of a table to an earlier
point in time in case the table was manipulated unintentionally. Users can invoke 'Flashback' table
command on one or more tables.
Please note that we also have the luxury of looking at the drop changes to the table using 'recylebin'
sql>select original_name, operation, drop_time from recyclebin;
Oracle Applications - How to Hack Oracle Database Apps Password
Well, this section may not be liked by the DBA community. Here are the simple steps to hack the apps
user database password for your ERP/oracle applications system. This will work most likely unless
the implementer was smart enough when creating the Custom top/application
1. Create a new concurrent program, a HOST based concurrent program in your custom application
#/bin/ksh
#####################################################################
PROGRAM_NAME=`basename $0`
echo $PROGRAM_NAME "has started"
echo "Database user/passwd is $1"
#####################################################################
d. Create a Concurrent Program Definition 'Test Conc Program' in Custom Application using the
executable created in Step c
e. Attach the concurrent program to the desired 'Request Group' and submit it.
The output of the concurrent program run will give you the apps database username/pwd.
Techno Functional
3. select * from xla_events where entity_id= (select entity_id from xla.xla_transaction_entities where
source_id_int_1 = 4563 and application_id = 201);
4. select * from xla_ae_headers where event_id in ( select event_id from xla_events where entity_id=
(select entity_id from xla.xla_transaction_entities where source_id_int_1 = 4563 and application_id
= 201));
9. select * from xla_events where entity_id= (select entity_id from xla.xla_transaction_entities where
source_id_int_1 = 14867 and application_id = 201);
10. select * from xla_ae_headers where event_id in (select event_id from xla_events where
entity_id= (select entity_id from xla.xla_transaction_entities where source_id_int_1 = 14867and
application_id = 201));
11. select * from xla_ae_lines where ae_header_id in (select ae_header_id from xla_ae_headers
where event_id in (select event_id from xla_events where entity_id=(select entity_id from
la.xla_transaction_entities where source_id_int_1 = 14867 and application_id = 201)));
Items: Items are defined in INV application MTL_SYSTEM_ITEMS table and is shared by
Order Management, Receivables , Purchasing, Inventory etc. applications
Customers: Customers are defined in HZ_PARTIES table (As part of R12 TCA Trading
Community Architecture changes) and shared across Order Management, Receivables etc.
applications
This section gives you a handy information on bouncing the services in eBusiness Suite Applications
11i/R12
Steps to Bounce
1. Login to your unix box
4. Here you will see a list of files and based on the need you will have to run various scripts as given
below
4.1. Bounce All Services ( Note the 'dot' after the # sign in the commands below and above)
# . adstpall.sh apps/<pwd>
#. adstrtal.sh apps/<pwd>
4.2 Bouce Mid Tier for OAF (Oracle Applications Framework) to be reflected
# adoacorectl.sh stop (For R12)
# adapcctl.sh stop
#adoacorectl.sh start (For R12)
# adapcctl.sh start
4.5 Any time you want to check the status of app server services? Use the below command
#adapcct.sh status
Oracle Database Server trace files can be generated at the session or instance level.
Instance level tracing can be enabled using SQL_TRACE init.ora parameter
Session level tracing for a particular session can be enabled as :
sql> Execute dbms_system. set_sql_trace_in_session(x, y, TRUE);
--Here x is the system identifier and y is the serial number
Session level tracing for the connected user:
sql>alter session set sql_trace=TRUE; Trace files can be obtained from
USER_DUMP_DEST directory
Using Tkprof
The SQL Trace facility and TKPROF are two basic performance diagnostic tools that can help you
monitor and tune applications running against the Oracle Server.
You can run the TKPROF program to format the contents of the trace file and place the output into a
readable output file. Optionally, TKPROF can also:
Determine the execution plans of SQL statements
Create a SQL script that stores the statistics in the database
TKPROF reports each statement executed with the resources it has consumed, the number of times it
was called, and the number of rows which it processed. This information lets you easily locate those
statements that are using the greatest resource. With experience or with baselines available, you can
assess whether the resources used are reasonable given the work done.
Below steps will help you in successfully configuring the development environment for working on
Oracle Applications Framework (OAF) components in your project.
Basics:
1. Dowload the correct version of the Jdeveloper patch from Metalink.
Release 11i - Patch 6739235 JDeveloper With OA Extension
Patch 8751878 JDeveloper with OA Extension
Release 12.0 -Patch 7523554 Jdeveloper 10g With OA Extension
In windows, you can set this variable by righ clicking on 'My Computer' > Advanced
System
Properties > Set variables.
4. Open the c:\JdevInstall\jdevdoc\index.htm. This is the main dashboard for all your learning
exercises,
documentation etc.
6. Read through the chapters in the below page not missing the Chapter 9(Extending and Deploying
OA
Framework Applications)
C:/JdevInstall/jdevdoc/WebHelp/devguide/devguide.htm
Above steps will help you in becoming self sufficient in developing/deploying new OAF components.
Advanced
Ensure the directory structure is maintenaned during copy. ie. files recursively from
$JAVA_TOP/oracle/apps//*.* should be copied to
C:\JdevInstall\jdevhome\jdev\myclasses/oracle/apps//*.*
8. Above step is optional, in case you have problems copying/running the standard pages from
Jdeveloper
you can still proceed with copying only the class files that are required.
9. Identify the structure of the Oracle standard components/pages using 'About this page' link. If the
link is
not enabled in your environments ensure that the profile FND:Diagnostics is set.
11. Any required help can be sought from Oracle Technology Applications Framework forum:
https://forums.oracle.com/forums/forum.jspa?forumID=210
Enable FND Logging in OA Framework
Logging in Controller:
if (pageContext.isLoggingEnabled(OAFwkConstants.PROCEDURE)){
pageContext.writeDiagnostics(this, "Debug Message ", OAFwkConstants.PROCEDURE);
}
if (pageContext.isLoggingEnabled(OAFwkConstants. STATEMENT)){
pageContext.writeDiagnostics(this, "Debug Message ", OAFwkConstants.STATEMENT);
}
if (txn.isLoggingEnabled(OAFwkConstants.PROCEDURE)) {
txn.writeDiagnostics(this, "Debug Message ", OAFwkConstants.PROCEDURE);
}
if (txn.isLoggingEnabled(OAFwkConstants.STATEMENT)) {
txn.writeDiagnostics(this, "Debug Message ", OAFwkConstants.STATEMENT);
}
if (txn.isLoggingEnabled(OAFwkConstants.EXCEPTION)) {
txn.writeDiagnostics(this, "Debug Message", OAFwkConstants.EXCEPTION);
}
Here you will see how to extract the OAF personalizations made to your applications Instance.
Set the system profile value for 'FND: Personalization Document Root Path' using System
Administrator responsibility to a valid path on the server filesystem as shown below
Ensure 'Functional Administrator' responsibility is added to the user logged in applications and
navigate as shown below
Enter the Application Name > Go. Once all the personalizations are listed in the result region at
the bottom of the page click 'Export to File System' button to get the confirmation as shown
below
Login to the unix server where applications is hosted and verify that the files are extracted, by
navigating through the directory structure and/or opening them.
Verify the structure of the copied files. Below is an example of how it can be:
oracle\apps\eam\construction\estimate\server\customizations\site\0\EstimateSearchPG.xml
oracle\apps\eam\construction\estimate\webui\customizations\responsibility\50691\EstWorkBenchPG.x
Its time to Import the personalizations using 'Functional Administrator' responsibility. Use the
navigation as shown below: Functional Administrator > Personalization > Exported
Personalizations
Note that the structure shown below is the directory structure that was 'ftp'ed from the source
system to the directory specified by the profile option mentioned initially
Now we can import the 'site' level or the 'responsibility' level personalizations by selecting
them individually or all at one go. Before that we have to take of one important thing ie. the
responsibility id in the source system should be same as the one in the destination/target
instance else we will have to rename the directory to the required
one
For Example 'Test Responsiblity' Id in source system is 50690 and in the destination system the same
responsibility is given a different Id say 50692 you will need to rename the directories accordingly in
the target file system
Note: sql> SELECT responsibility_id FROM FND_RESPONSIBILITY_TL WHERE
RESPONSIBILITY_NAME LIKE 'Test Responsibility'; --Will give you the responsibility id
Now for renaming the directories you have two options:
1. Either rename in the windows file system and copy them again to the directory specified by
'FND: Personalization Document Root Path' profile
2. Run the unix commands to find and rename as shown below
After the directories have been renamed for importing responsibility level personalizations
navigate again to the Functional Administrator responsibility to ensure that you see new
responsibility id
Now Import the personalizations as shown below by 'Selecting' All and clicking on 'Import
from File System'
Bounce the Apache if required to verify if all the personalizations are imported successfully.
Clear Framework Cache
Changes to OAF page components sometimes do not get reflected in the environment, for example a
page that has been updated using jdeveloper and deployed in the instance using XmlImporter utility
may not show up the changes once the user is logged into applications. Clearing framework cache is
the solution for this instead of a bounce of mid-tier services.
Log off and Log in to the applications for the changes to take effect.
BI/XML Publisher
Download the Layout template physically from the instance. Please note after the command is
run successfully output will be the file stored in the current directory from where the command
is run.
COPY THE FILES TO THE TARGET ENV USING FTP AND THEN UPLOAD.
Uploading to an Environment
Upload AOL Defn of Data/Layout templates and the Concurrent program using below
commands
What is BI Publisher?
A. It is a reporting tool for generating the reports. More than tool it is an engine that can be
integrated with systems supporting the business.
What are the various components required for developing a BI publisher report?
Data Template, Layout template and the integration with Concurrent Manager.
How does the concurrent program submitted by the user knows about the datatemplate or layout
template it should be using for generating the output?
The concurrent program shortname will be mapped to the code of the Datatemplate. Layout
template is attached to the datatemplate, this forms the mapping between all the three.
What is a datatemplate?
Datatemplate is an xml structure which contains the queries to be run against the database so that
desired output in xml format is generated, this generated xml output is then applied on to the layout
template for the final output
Can you have multiple layout templates for a singe data template?
Yes, multiple layouts can be defined, user has a choice here to use one among them at run time
during conc request submission
What is the tool to map required data output and layout templates so that they can be tested in local
machine?
Template viewer will be used for the same.
Which component is responsible for generating the output in xml format before applying it to layout
template?
DataEngine will take DataTemplate as the input and the output will be generated in xml format
which will then be applied on layout template
If we have to initialize something during the page loading, which is the right place?
A. ProcessRequest() method of the Controller file is the right place.
Where does the client BC4J objects get placed in the server?
A. They are located in the oracle.apps.<product>.<application>.server
Where does the server BC4J objects get placed in the server?
They are located in the oracle.apps.<product>.<application>.schema.server
Where does the Page and Controller related files get placed?
They are located in oracle.apps.<product>.<application>.webui
What is the property to set for an AM so that the transaction state is maintained across pages?
RETENTION_LEVEL property is set to value MANAGE_STATE for an AM.
What is extension?
Extension is the changing of the existing components for adding more features or customer required
features. View Objects, Controller, Application Module can be extended.
What is substitution?
When view objects are extended, we need to tell the applications that our extended view object
should be used or substituted during runtime, substitution will serve this purpose
How is the applications security maintained during the OA Framework components development or
how is the required security obtained?
The Database connectivity file ( .dbc file) has the applications username and password along with
the responsibility to be used for connecting to the applications at page run time.
What are the different layers of onion reuse object model in OAF?
The hierarchy is as :
Controller (XXCO.java)
|__
Application Module (XXAMImpl.java, XXAM.xml)
|__
View Objects(XXVOImpl.java, XXVORowImpl.java, XXVO.xml)
|__
Entity Objects(XXEOImpl.java, XXEO.xml)
|_ Database
What is the bean used for supporting transactions across pages visually to the user?
OATrainBean is used to link the pages across the transaction. AM supports the transaction context
or state here across the pages.
After you modify a class file and move it to the server what is the immediate step that will be
followed?
The services of the instance ie. Apache server etc. have to be bounced so that the new code in the
class file takes effect.
Where does the two categories of files in OAF be placed in the server?
All the xml files of the page/region will be placed in the respective TOPs mds directory. All the
class files irrespective of TOP will be placed under $JAVA_TOP which can be
$COMMON_TOP/java
What is the default top region of any new page that you create?
PageLayout is the top level default region