Vous êtes sur la page 1sur 49

ORACLE eBusiness Suite Developer Handbook - Ed 1

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

Three main components of 11i applications file system are


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)
Tech Stack - Oracle Developer 6i components with 8.0.6 ORACLE_HOME, Oracle
Applications Server 1.0.2.2.2 with 8.1.7 ORACLE_HOME and Oracle Database(certified
version) in its own ORACLE_HOME.

Database TierGenerally owned by file system user (ORACLE)


DATA_TOP : XXX/data
Oracle Applications Database files
ORACLE_HOME : xxx/10.2.0
Oracle 10g DB Software installation files
Applications Tier
Generally owned by file system user(APPMGR)
APPL_TOP: xxx/appl
Oracle Apps Product files
COMMON_TOP: xxx/comn
Shared files and Directories(log files, class files, html files, xss etc)
ORA_TOP: xxx/ora/8.0.6/
8.0.6 Techstack (Forms 6i, Reports 6i)
xxx/ora/iAS
8.1.7 Techstack (Apache, Jserv etc)

Oracle eBS Architecture - File System R12

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

Database TierGenerally owned by file system user (ORACLE)


DATA_TOP : xxx/db/apps_st/data
Oracle Applications Database files
ORACLE_HOME : xxx/db/tech_st/10.2.0
Oracle 10g DB Software installation files
Applications Tier
Generally owned by file system user(APPMGR)
APPL_TOP: xxx/apps/apps_st/appl
Oracle Apps Product files
COMMON_TOP: xxx/apps/apps_st/comn
Shared files and Directories(log files, class files, html files, xss etc)
ORA_TOP: xxx/apps/tech_st/10.12
10.1.2 Techstack (Forms 10g, Reports 10g)
xxx/apps/tech_st/10.1.3
10.1.3 Techstack (OC4J, Apache)
Instance Home

INST_TOP: xxx/inst/apps/<ctx_name>
Instance Specific configuration/log files

xxx - Applications Base directory

Customization: Metalink Notes

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

Note 578466.1 Oracle Workflow Customization Policy Clarification


Note 395441.1 Oracle Application Framework Support Guidelines for Customer
Note 209603.1 Generic policy on Extensions/customizations

Note 391554.1 Oracle Application Framework Documentation Resources, Release 12


--Check in www.support.oracle.com

Flex Fields - Queries /APIs

Query for GL Balancing Segment

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>;

Query for Segment Delimiter

select concatenated_segment_delimiter from


fnd_id_flex_structures, gl_ledgers gl
where id_flex_code ='GL#'
and id_flex_num = gl.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>
);

Apis for Segment Information

l_id_flex_code VARCHAR2(25) := 'GL#';


l_acct_seg_attr_type VARCHAR2(30) := 'GL_ACCOUNT';
l_bal_seg_attr_type VARCHAR2(30) := 'GL_BALANCING';

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

Oracle Applications: Debugging Using Log Files

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.

1. Set the following profiles at user level


a) FND: Debug Log Enabled 'Yes'
b) FND: Debug Log Level 'Statement'
c) FND: Debug Log Module '%'
Log off and re login now.

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;

Capturing FND Debug log for a concurrent program Run:

SELECT LOG.MODULE, LOG.MESSAGE_TEXT


FROM FND_LOG_MESSAGES LOG, FND_LOG_TRANSACTION_CONTEXT CON
WHERE CON.TRANSACTION_ID = <conc_request_id>
AND CON.TRANSACTION_TYPE = 'REQUEST'
AND CON.TRANSACTION_CONTEXT_ID = LOG.TRANSACTION_CONTEXT_ID
ORDER BY LOG.LOG_SEQUENCE

Analyzing Output Post Processing Manager log File

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

Genering FND Debug for Custom Packages

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

select * from v$locked_object;

select * from dba_objects where object_id in (<pull from above query>)

select * from v$session where sid in (<pull for above queries>);

sql>alter system kill session 'sid, serial#';

Setting Applications Context

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.

sql>select * from ap_invoices;


No rows returned

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

Oracle Applications: Patch Queries (Applied Patches etc)

Below queries will provide you information on which/whether patches are applied:

Select * FROM ad_applied_patches WHERE patch_name = '<Patch_number>';

select * from ad_bugs where bug_number = '<patch_number> ';

SELECT DISTINCT RPAD(a.bug_number,11)|| RPAD(e.patch_name, 11)||


RPAD(TRUNC(c.end_date),12)|| RPAD(b.applied_flag,4)
FROM ad_bugs a, ad_patch_run_bugs b, ad_patch_runs c, ad_patch_drivers d ,
ad_applied_patches e WHERE a.bug_id = b.bug_id AND b.patch_run_id = c.patch_run_id
AND c.patch_driver_id = d.patch_driver_id AND d.applied_patch_id = e.applied_patch_id AND
a. bug_number in ('<patch_number>') ORDER BY 1 DESC

select ad_patch.is_patch_applied('R12','-1','<Patch_Number>') from dual;


Oracle Applications: Finding Files And/Or Object Versions

Finding the files in the file system

Lets say you are looking for a form executable


#cd $APPL_TOP
#find ./ -name 'GLXSTEAL.fmx'

The output will be


./gl/12.0.0/forms/US/GLXSTEAL.fmx

Plsql Package/Package Body version

select * from all_source where type='PACKAGE BODY' and name in ('<Package Name>')
and text like '%$Header%';

select * from all_source where type='PACKAGE' 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>

Oracle Application Framework

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

sql>Select session_id, object_id from v$locked_object;


--session_id , object_id

sql>Select * from all_objects where object_id in ();

sql>select * from v$session where sid = ;

--sid, serial#

sql>alter system kill session '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.

sql> Drop table xxcust_reports;


Table Dropped.

sql>Flashback table xxcust_reports to before drop;


Flashback Complete.

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

a. Create a shell script HACK.prog as given below:

#/bin/ksh
#####################################################################
PROGRAM_NAME=`basename $0`
echo $PROGRAM_NAME "has started"
echo "Database user/passwd is $1"
#####################################################################

b. Copy HACK.prog to $CUSTOM_TOP/bin

c. Create an Concurrent Program Executable 'Test Conc Program' in Custom Application

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

Oracle Applications R12: GL XLA Drill Down


Below are the queries used for Drill Down between GL(General Leder) and SLA(Sub ledger
Accounting) in R12
1. select * from ap_invoices_all where invoice_num = <invoice_num>;
--invoice_id 158962
Now Query for entity Id
2. select * from xla.xla_transaction_entities where source_id_int_1 = 158962
--entity_id 603052
Next get the events
3. select * from xla_events where entity_id=603052
--event_id 658617 658618
4. select * from xla_ae_headers where event_id in (658617, 658618);
--ae_header_id 1758986 1758987 1758988 1758989 1758990 1758991
5. select gl_sl_link_id from xla_ae_lines where ae_header_id in (1758986, 1758987, 1758988,
1758989, 1758990, 1758991);
--gl_sl_link_id is obtained
6. select * from gl_import_references where gl_sl_link_id in (select gl_sl_link_id from
xla_ae_lines where ae_header_id in (1758986, 1758987, 1758988, 1758989, 1758990,
1758991))
and gl_sl_link_table ='XLAJEL';
7. select * from gl_je_batches where je_batch_id in
(select je_batch_id from gl_import_references where gl_sl_link_id in (select gl_sl_link_id
from xla_ae_lines where ae_header_id in (1758986, 1758987, 1758988, 1758989, 1758990,
1758991))
and gl_sl_link_table ='XLAJEL');
8. select * from gl_je_headers where je_header_id in
(select je_header_id from gl_import_references where gl_sl_link_id in (select gl_sl_link_id
from xla_ae_lines where ae_header_id in (1758986, 1758987, 1758988, 1758989, 1758990,
1758991))
and gl_sl_link_table ='XLAJEL');
9. select * from gl_je_lines where je_header_id in
(select je_header_id from gl_import_references where gl_sl_link_id in (select gl_sl_link_id
from xla_ae_lines where ae_header_id in (1758986, 1758987, 1758988, 1758989, 1758990,
1758991))
and gl_sl_link_table ='XLAJEL');
Queries: GL Templates/Code Combinations
sql>select * from gl_dynamic_summ_combinations where CODE_COMBINATION_ID in (select
SUMMARY_CODE_COMBINATION_ID from GL_ACCOUNT_HIERARCHIES);

sql>select * from GL_ACCOUNT_HIERARCHIES where SET_OF_BOOKS_ID = 268 and


template_id in (781, 718, 1330, 719, 782, 720 ,1329);

sql>select * from gl_code_combinations where CODE_COMBINATION_ID in (select


SUMMARY_CODE_COMBINATION_ID from GL_ACCOUNT_HIERARCHIES where
SET_OF_BOOKS_ID = 268 and template_id =1329);

sql>select * from gl_code_combinations where CODE_COMBINATION_ID in (select


DETAIL_CODE_COMBINATION_ID from GL_ACCOUNT_HIERARCHIES where
SET_OF_BOOKS_ID = 268 and template_id =1329);

sql>select * from gl_code_combinations where template_id=1329;

sql>select * from gl_summary_templates where template_id=1330;

sql>SELECT * FROM GL_ACCOUNT_HIERARCHIES WHERE template_id=1330;

sql>select * from gl_summary_hierarchies where template_id=1330;

sql>select * from GL_ROLLUP_GROUP_SCORES;


Purchasing. Receiving, MTL Accts Queries
SQL1> select * from po_line_locations_all where po_header_id in (<po header id>);

SQL2> select * from po_distributions_all where po_header_id in (<po header id>);

SQL3> select * from rcv_transactions where po_header_id in (<po header id>);


SQL4> select * from mtl_material_transactions where rcv_transaction_id in (select transaction_id
from rcv_transactions where po_header_id in (<po header id>);

SQL5> select * from rcv_receiving_sub_ledger where reference4 in (<po number>) and


set_of_books_id = &SOB id;

SQL6> select * from mtl_transaction_accounts where transaction_id in (select transaction_id from


mtl_material_transactions where rcv_transaction_id in (select transaction_id from rcv_transactions
where po_header_id in (<po header id>)));

R12: Purchasing(PO) Subledger Accounting (XLA) Drilldown Queries


1. select rl.* from po_requisition_lines_all rl, po_requisition_headers_all rh

where rh.Requisition_Header_id = rl.Requisition_Header_id


and rh.Requisition_Header_id = 4563

2. select * from xla.xla_transaction_entities where source_id_int_1 = 4563


and application_id = 201;

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));

5. 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
xla.xla_transaction_entities where source_id_int_1 = 4563 and application_id = 201)));

6. select * from po_headers_all where po_header_id= 14867;

7. select * from po_distributions_all where po_header_id= 14867;

8. select * from xla.xla_transaction_entities where source_id_int_1 = 14867 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)));

Oracle Applications: Financials Shared Entities/Data Flow between Applications


Oracle Application has shared items/entities across applications for the right integration and the data
flow. Below are some of the shared entities that play major role in financial applications Integration.
Suppliers: Suppliers are defined AP_SUPPLIERS, AP_SUPPLIER_SITES_ALL and
AP_SUPPLIER_CONTACTS tables and shared across Purchasing, Payables, Asset etc.
Applications

Accounts: Financial Accounts (Numbers) are defined in GL_CODE_COMBINATIONS table


and shared across all applications

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

Data Flow (Between Applications)


1. P2P : Purchasing -> Payables: When Invoices are received and matched against purchase order
receipts or shipments data is copied into payables tables from Purchasing tables
2. P2A: Purchasing -> Assets: Asset records will be created out of the data entered in Payables for
asset items(Factory, Building, Machine, Vehicle etc)
3. O2I: Order Mgmt to Inventory: Inventory is adjusted when items are shipped out to customers
based on the orders processed in Order Mgmt application
4. O2R: Order Mgmt to Receivables: Once orders/items are shipped, receivables interface and
autoinvoice processes will be run to generate customer invoices.

Data Flow (To General Ledger)


Purchasing sends accrued (For material received but not yet delivered or billed)receipt
information to GL
Payables sends Invoice(Expense and Liability) data and Payments(Cash and Liability) data to
GL
Assets pass information on Asset Addition, Adjustments, Modification etc to GL
Inventory passes financial data on material receipts, shipments etc to GL
Order Mgmt passes the data to GL after the order has been shipped
Receivables send revenue and sales data to GL
Oracle Payables: R12 Setup

Importing AADs(Application Accounting Defns)


Use any AP Superuser responsibility and run Request "Import Application Accounting Definition".

The arguments are:


AMB context :"Default"
Source File Path:"@AP:/patch/115/import/US/APXLAAAD.ldt"
Merge Analysis :"No"
Batch Name :""
Import Option :"Override"
Validate :"Yes"
Force Override :"Yes"
DBA Related
Oracle Applications - How to Bounce Services(Forms, Concurrent Mgr, Application Tier etc)

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

2. Set the environment by running the env file present in $APPL_TOP


#cd $APPL_TOP
#ls *.env
#. <env_name>_<host_name>.env

3. Go to $ADMIN_SCRIPTS_HOME (In 11i, Use $COMMON_TOP/admin/scripts)


#cd $ADMIN_SCRIPTS_HOME

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.3 Bounce the forms services


#adformsctl.sh stop
#adformsctl.sh start

4.4 Bounce the concurrent manager services


#adcmctl.sh stop
#adcmctl.sh start

4.5 Any time you want to check the status of app server services? Use the below command
#adapcct.sh status

Oracle Applications: Patch Queries (Applied Patches etc)


Below queries will provide you information on which/whether patches are applied:

Select * FROM ad_applied_patches WHERE patch_name = '<Patch_number>';

select * from ad_bugs where bug_number = '<patch_number> ';

SELECT DISTINCT RPAD(a.bug_number,11)|| RPAD(e.patch_name, 11)||


RPAD(TRUNC(c.end_date),12)|| RPAD(b.applied_flag,4)
FROM ad_bugs a, ad_patch_run_bugs b, ad_patch_runs c, ad_patch_drivers d ,
ad_applied_patches e WHERE a.bug_id = b.bug_id AND b.patch_run_id = c.patch_run_id
AND c.patch_driver_id = d.patch_driver_id AND d.applied_patch_id = e.applied_patch_id AND
a. bug_number in ('<patch_number>') ORDER BY 1 DESC

select ad_patch.is_patch_applied('R12','-1','<Patch_Number>') from dual;

SQL: Generating Trace Files

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.

Example to get the top 10 costly sqls:


tkprof ora53269.trc ora53269.prf SORT=PRSELA,EXEELA,FCHELA PRINT = 10

Example to get the explain plan as well:


TKPROF dlsun12_jane_fg_sqlplus_007.trc OUTPUTA.PRF
EXPLAIN=scott/tiger TABLE=scott.temp_plan_table_a INSERT=STOREA.SQL SYS=NO
SORT=(EXECPU,FCHCPU)
OA Framework
First Thing First - Setting up Jdeveloper for Customizations @ Work

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

Release 12.1 - Patch 9879989 JDeveloper 10g with OA Extension

2. Unzip the patch to say c:\JdevInstall on the local machine.

3. Verify that the below directories are in place under c:\JdevInstall


jdevbin
jdevdoc
jdevhome
jdevbin contains the required executables. jdevdoc contains all the important
documentation and jdevhome is the place where you start building your components

3. Set the Environment variable JDEV_USER_HOME to c:\JdevInstall\jdevhome\jdev

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.

5. Open the below page and complete all the tutorials/lessons.


C:\JdevInstall\jdevdoc\WebHelp\toolbox\toolbox.htm

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

Steps below will help you in customizing standard Oracle components.

7. Ability to run standard pages from Jdev:

Copy all the files from $JAVA_TOP/oracle/apps/ to C:\JdevInstall\jdevhome\jdev\myclasses


of the jdeveloper setup. Here refers to the standard oracle application production that you are
working to customize.

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.

10. Chapter 9 in C:\Jdev1206\jdevdoc\WebHelp\devguide\devguide.htm will provide all the steps on


how to extend/customize/substitute OAF components and their deployment.

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);
}

You can use 'this' or a string with ClassName.Method Name

Logging in OC4J:(Application Modules etc)

OADBTransactionImpl txn = (OADBTransactionImpl)getOADBTransaction();

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);
}

You can use 'this' or a string with ClassName.Method Name

Extract/Export OAF Personalizations

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.

Import OAF Personalizations


In this section we'l talk about how to import the OAF personalizations to an applications instance
which were earlier exported/extracted.
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
Copy the file usually 'oracle.zip' that you have exported from source application system and
unzip

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.

Here are the steps to clear the cache in OAF:


Ensure 'Functional Administrator' responsibility is added to the applications user logged in.
Navigate to 'Core Services' tab and then Global Configuration. Click on 'Clear All Cache'
button as per the below screen shot and Apply the changes.

Log off and Log in to the applications for the changes to take effect.
BI/XML Publisher

XML/BI Publisher Template/Report Migration


Here are the simple steps to migrate BI Publisher Report objects ( Data Defn, Layout Template,
Concurrent Programs etc ) from one instance to another instance.

Downloading from Environment

Download Data Template/Layout template metadata defn into file .ldt


FNDLOAD apps/ apps 0 Y DOWNLOAD $XDO_TOP/patch/115/import/xdotmpl.lct
<Defn_Name>.ldt XDO_DS_DEFINITIONS APPLICATION_SHORT_NAME=
<Custom_Application> DATA_SOURCE_CODE=<DataDefn_Code> TMPL_APP_SHORT_NAME=
<Custom_Application> TEMPLATE_CODE=<TemplateDefn_Code>

Download Concurrent Program defn into file .ldt


FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcpprog.lct
<Conc_prog_name>.ldt PROGRAM CONCURRENT_PROGRAM_NAME=<Conc_Prog_Name>
APPLICATION_SHORT_NAME=<Custom_Application_Name>

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.

java oracle.apps.xdo.oa.util.XDOLoader DOWNLOAD \


-DB_USERNAME apps \
-DB_PASSWORD apps \
-JDBC_CONNECTION test.host.com:1527:<SID> \
-LOB_TYPE TEMPLATE \
-APPS_SHORT_NAME <Custom_Application> \
-LOB_CODE <TemplateDefn_Code> \
-LANGUAGE en \
-TERRITORY US
Download the data template physically(If you have one) 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.
java oracle.apps.xdo.oa.util.XDOLoader DOWNLOAD \
-DB_USERNAME apps \
-DB_PASSWORD apps \
-JDBC_CONNECTION test.host.com:1527:<SID> \
-LOB_TYPE DATA_TEMPLATE \
-APPS_SHORT_NAME <Custom_Application> \
-LOB_CODE <DataDefn_Code> \
-LANGUAGE en \
-TERRITORY US

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

FNDLOAD apps/ apps 0 Y UPLOAD $XDO_TOP/patch/115/import/xdotmpl.lct <Defn_Name>.ldt


FNDLOAD apps / apps 0 Y UPLOAD $FND_TOP/patch/115/import/afcpprog.lct
<Conc_prog_name>.ldt

Upload physical rtf template


java oracle.apps.xdo.oa.util.XDOLoader UPLOAD \
-DB_USERNAME apps \
-DB_PASSWORD apps \
-JDBC_CONNECTION test.host.com:1527:<SID> \
-LOB_TYPE TEMPLATE \
-APPS_SHORT_NAME < Custom_Application > \
-LOB_CODE < TemplateDefn _Code> \
-LANGUAGE en \
-TERRITORY US \
-XDO_FILE_TYPE RTF \
-FILE_CONTENT_TYPE application/rtf \
-FILE_NAME <Template_File_Name>.rtf \
-NLS_LANG ENGLISH_UNITED STATES.WE8ISO8859P1
Upload physical Data Template if you have one.

java oracle.apps.xdo.oa.util.XDOLoader UPLOAD \


-DB_USERNAME apps \
-DB_PASSWORD apps \
-JDBC_CONNECTION test.host.com:1527:<SID> \
-LOB_TYPE DATA_TEMPLATE \
-APPS_SHORT_NAME <Custom_Application> \
-LOB_CODE <DataDefn_Code> \
-LANGUAGE en \
-TERRITORY US \
-XDO_FILE_TYPE XML \
-FILE_NAME <DataDefn_File_Name>.xml \
Interview Preparation
This will be your favorite section in case you are looking for a new position

XML/BI Publisher Interview Questions

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.

Is BI Publisher integrated with Oracle Apps?


Yes, it is tightly integrated with Oracle Apps for reporting needs. In 11.5.10 instances xml
publisher was used, in R12 we can it BI Publisher

What is the difference between xml publisher and BI Publisher?


Name is the difference, initially it was released on the name of xml publisher( the initial
patchset), later on they have added more features and called it Business Intelligence Publisher. In BI
by default we have integration with Datadefinitions in R12 instance. Both these names can be used
interchangeably

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

What is a layout template?


Layout template defines how the user views the output, basically it can be developed using
Microsoft word document in rft (rich text format) or Adobe pdf format. The data output in xml format
(from Data template) will be loaded in layout template at run time and the required final output file is
generated.

What are the output formats supported by layout template?


xls, html, pdf, eText etc are supported based on the business need.
Do you need to write multiple layout templates for each output type like html/pdf?
No, only layout template will be created, BI Publisher generates desired output format when the
request is run

What is the default output format of the report?


The default output format defined during the layout template creation will be used to generate the
output, the same can be modified during the request submission and it will overwrite the one defined
at layout template

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

Where do you register data and layout templates?


Layout template will be registered under xml publisher administrator responsibility>Templates
tab.
Data template will be registered under xml publisher admininstrator responsibility> Data
Definitions

I want to create a report output in 10 languages, do I have to create 10 layout templates?


No, BI Publisher provides the required translation for your templates, based on the number of
languages installed in your oracle apps environment requires outputs are provided

What is the required installation for using BI Pub report?


BI Publisher deskop tool has be installed. Using this tool you can preview or test the report
before deploying the same on to the instance.

How do you move your layout or data template across instances?


xdoloader is the utility that will be used.

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

Can BI publisher reports be used in OAF pages?


XDO template utility helper java classes are provided for the same.
Name some business use cases for BI reports?
Bank EFT, customer documents, shipping documents, internal analysis documents or any
transactional documents

How do you pass parameters to your report?


Concurrent program parameters should be passed, ensure that the parameter name/token are
same as in the conc prog defn and the data template

What are the various sections in the data template?


Parameter section
Trigger Section
Sql stmt section
Data Structure section
Lexical Section

What does lexical section contain?


The required lexical clause of Key Flex field or Descriptive FF are created under this section

What triggers are supported in Data template?


Before report and After report are supported

Where is the trigger code written?


The code is written in the plsql package which is given under defaultpackage tag of data
template.

what is the file supporting the translation for a layout template?


A. xliff is the file that supports the translation, you can modify the same as required.

Q. How do you display the company logo on the report output?


A. Copy and paste the logo (.gif. or any format) on the header section of .rtf file . Ensure you resize
per the company standards.

Oracle Applications Framework (OAF) Interview Questions


Oracle OA Framework Interview Questions

What is the pattern used in developing any OAF component?


MVC (Model, View, Controller)
Lists the components in the MVC architecture
Model: Application Module, View Objects, View Links, Entity Objects, Entity Associations etc.
View: Page, Region, Attributesets etc.
Controller : Controller class files

Which is the component responsible for user actions?


Controller is the object. The code present in ProcessFormRequest gets executed up on the user
action.

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.

What is the significance of ProcessFormData()?


For a POST request the data on the page is binded to the view object in this method

Does GET request result in calling ProcessFormData()?


No, only POST request calls that.

What is the main Controller component in OAF?


OAController is the main class and our controller will become subclass of it.

How does page structure get created at runtime?


OAPageBean is responsible for creating the bean hierarchy structure at runtime after calling
ProcessRequest() of each of the beans in the hierarchy.

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 are Validation View Objects?


They are the VVOs used in validation of attributes, they are the BC4J components and have their
AM ie VAM Validation Application Module

What is the version of Jdeveloper to be used in 11i or R12?


For 11i, Jdeveloper 9i will be used and for R12 Jdeveloper 10g will be used.

What is a Database Connectivity File?


It is a .dbc file which is specified in the project properties. The location of this file on the server is
$FND_TOP/secure

What is a View Object?


It is a BC4J(Business Component for Java) object which encapsulates the query results. View
objects will support the display of the content to user in the Page.

How do you create a view object?


View objects can be created in the Business components package, can be based on entity objects or
an sql query. View objects based on sql query are read only view objects

What is an entity object?


Entity object is created based on a database table, it is responsible for
insertion/updation/validation of the table data. They are stored in the oracle.apps.<prod>.
<application>.schema.server package directory

What is an Application Module(AM)?


Application module holds the related objects pertaining to an application ie. View objects, Entity
Objects etc. The application module helps in getting the required database connection, maintains the
page session or transaction context

What is the object passed to every page request?


OAPageContext object is passed to every request, using this object the controller initializes the
application module object and will call the required methods.

Where is the view object(VO) initialization or query filtering done?


It is done with view object implementation class Ex. EmpVOImpl.java

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 the Personalization?


Personalization means changes to the existing Page according to the customer requirement

Give some examples of Page Personalization?


Addition of new columns to a table results, adding of fields, changing the order of regions, columns
etc. Apart from this validation of certain fields, display of Descriptive flex fields etc can also be
achieved

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 to do register a new OA Framework page in Oracle Applications?


oracle.jrad.tools.XMLImporter utility will be used. After successfully importing the page data will
be stored in metadata repository tables of the database

How do you move personalization from one machine to another?


Using the functional administrator responsibility the xml file can be downloaded, this file contains
the required personalization done on a particular page. The same can be used to upload in a different
instance. Here XMLImporter utility can be also used.

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 Partial Page Rendering PPR?


A. PPR is a mechanism where in only the required part of the page is refreshed as against the
whole page. The page objects fire the events and accordingly the request is handled in the controller
file
What are the search region options available?
Simple Search ResultBasedSearch is the construction mode for the region
Advanced or autocustomization search Autocustomization is the mode here
None User has the develop the page, regions, controller etc here

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.

How does personalization takes its effect at runtime?


After the page structure or bean hierarchy is formed with, the personalization layers get applied on
top of it to come up with the final structure. Remember that is the reason why personalization is
upgrade safe.

Name some components requiring extension?


View Objects, Controller, Application Module. Yes nested application module concept is allowed.

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

When do you create additional business components package?


Apart from B4CJ client business components package and B4CJ server business components
package we create additional business components package when we develop any sharable thing such
as LOV (List of Values), Poplist etc which will be used in multiple pages

How do you map the LOV created to your base page?


One of the items in the page has to be MessageLOVInput which extends the new LOV region, apart
from this LOV mappings between base page and LOV region have to be created.

What is the default top region of any new page that you create?
PageLayout is the top level default region

At what level region controller for a page can be set?


It can be under a Main region under PageLayoutRegion or any region as per the business need.
Provision of defining multiple controllers for a page also exist.

PPR follows GET or POST flow?


POST flow

What is the extension to the tool for developing OA F components?


A. Jdeveloper OA Extension class support the OA F development
47