Вы находитесь на странице: 1из 212

Prerequisites for Technical Oracle Apps Training

This blog is an effort to help you become a technical Oracle Apps consultant. In this blog,
I will publish articles on Oracle Applications training right from the very basics.

In my case, 10 years ago, I first took training in some programming languages like C, C+
+, VB, & of course Oracle. The good thing that came out was that I realised all
programming languages have a commonality, i.e logic. But logic I was the thing I feared
the most, I never knew I could do it. At university, I had always bunked my Fortran and
Unix lessons simply because of the logic phobia I had in my mind. Anyway, eventually I
learnt Oracle SQL-PL/SQL, Forms and Reports. The bottom line is, keep your fears aside
and take the dive and get started with the learning path.

Please note the pre-requisites. Kindly note that you can't jump onto becoming an Oracle
Apps Technical Career path without having learnt the prerequisites that will form the base
of Oracle Apps Development work.

Pre-requisites
------------------
1. Learn SQL and PL/SQL.
Firstly learn SQL. I think this link for w3schools will get you started from the very basics.
You may also install Oracle Lite from technet and practice some SQL. Just the basic SQL
with couple of joins and couple of where clauses are good enough to get started. When
learning SQL, try to imagine/visualize the scanning and filtering of records that Oracle
will be performing behind the scenes.

2. Learn D2k. More importantly Oracle Forms 6i and Reports 6i. All you need to learn are
the fundamentals at this stage. You should be able to create a Master Detail block based
form that calls from PL/SQL and one pll. For Oracle Reports, you must try to develop a
report from scratch that has at least two queries with one link joining the two. You should
also know things like formula column, b4 report & after param triggers.

3. It is good to know some Java Programming; however, knowledge of java has not yet
become mandatory for Oracle Apps Technical Consultants. Ditto for XML and HTML. If
you are a beginner, then dont bother to learn Java right now. Java can be learnt in parallel
while you work on Oracle Applications.

Once having learnt the above tools, you will then be ready to begin Oracle Apps
Technical Training from scratch.
Basics Of Oracle Apps Training Material (Step by Step
Learning of Oracle Apps)
What happens when you login to Oracle Apps
Why is it called apps
What is a profile option?
What is org_id. Why is it important.
Relationship between Applications and Modules
Where to find/deploy the code (Forms tier/Middle tier or DB Tier)
The testing cycle in Oracle Apps
Difference between forms and form functions and menu
What is a Concurrent Program
What is Concurrent Manager
What is a Value set
What is a lookup in oracle apps
How does lookup differ from Value Sets
Descriptive Flexfield Basics in Oracle Apps
How to make context sensitive descriptive flexfields ( step by step)
Key Flexfields Basics
Setting up your PC for development environment
Your first custom form from scratch
Your first pl/sql concurrent program from scratch
Oracle FNDLOAD Script Examples
Restart or Bounce Apache in Oracle Apps 11i
Playing with CUSTOM.pll
Read Only Schema in Oracle APPS 11i
Create Oracle FND_USER with System Administrator ( Using Script )
A New Custom Form in Oracle Apps
Forms Customization Steps in Oracle Applications
Reports Customization Steps in Oracle Applications
Your first Migration program in Apps. Migrate Customers
FNDLOAD for Oracle Web ADI
API to Update FND_USER and Add Responsibility
Forms Personalization Example 1
Various Examples of Forms Personalizations [ Everything that you wanted to know about
FP ]
Oracle Fusion Development Tools
Debugging In Oracle Applications
XML Publisher Concurrent Program Report
Audit Trail in Oracle Apps
Hierarchy Profile Options in Oracle Apps
Design and Development of Open Interfaces in Oracle Apps
Customization of Reports in Oracle Apps , How to find the Request Group for
Concurrent program , Smart Descriptive Flexfields
Using XML Publisher with Pre-Printed Stationary

Procure to Pay, Order to Cash, End to End Cycle Functional Documents


What happens when you login to Apps?

Firstly and surely there is a URL for Oracle Applications that is structured possibly in
below format, although it can vary from version of apps.

http://machinename:portnumber/OA_HTML/US/ICXINDEX.htm
Eg: http://linuxerp.com:8000/OA_HTML/US/ICXINDEX.htm

http://machinename:portnumber /oa_servlets/AppsLogin

When you join an Oracle Apps development team for an employer, you will first be given
URL of the development environment.

In any Oracle Apps implementation project (assuming it has gone live), there are
minimum of three Environments, each with different URL's and different Database
Instances.

These are:-
---------------
Development environment
Testing environment
Production environment

NOTE:-You will most probably, as a Techie, be given URL, User name and Password of
the Development environment.

What happens when you login (no advanced info here):-


-----------------------------------------------------------------
A. Your login gets authenticated against a table named FND_USER for your user name
and password. The screen below is where User name and Password defined. This screen is
called User Definition screen, Only System Administrators have access to this screen.

B. As you can see below, this User name xxpassi is attached to two responsibilities (this
will be discussed in details in latter training lesson). It is this assignment to the
responsibility that controls what a logged in person can do and can't do. In laymans
words, A Responsibility is a group of Menus.
User Definition screen

C. When you successfully login you will see below screens.

This screen below will prompt you to change your password, to a value different than that
assigned by System Administrator.

Click on either of the above Responsibility Names, will initiate Oracle Apps( Note: You
might be prompted to install jinitiator..just keep clicking OKOK for all Jinitiator
messages). Effectively, what I mean to say is that you do not need to download jInitiator
from anywhere; Oracle will do this automatically (provided your DBAs got this
cofiged) for you during your first logon attempt from the PC. Once your jInitiator gets
installed

Hurray, we have logged into apps.

Some notes on advanced info (beginners may ignore this):


Oracle internally uses a login named GUEST, prior to invoking validation of actual
username. Some people regard this as a security threat, but it isnt. Your DBAs can
change the guest password from its default value after installation.
Oracle uses a DB User account named applsyspub to which it first connects during
validation of LOGIN. This user account has very restricted privileges and has access to
below objects (primarily for authentication purposes):-
FND_APPLICATION
FND_UNSUCCESSFUL_LOGINS
FND_SESSIONS
FND_PRODUCT_INSTALLATIONS
FND_PRODUCT_GROUPS
FND_MESSAGES
FND_LANGUAGES_TL
FND_APPLICATION_TL
FND_APPLICATION_VL
FND_LANGUAGES_VL
FND_SIGNON
FND_PUB_MESSAGE
FND_WEBFILEPUB
FND_DISCONNECTED
FND_MESSAGE
FND_SECURITY_PKG
FND_LOOKUPS
Why call it Apps and not Oracle ERP?

Ever wondered why is Oracles eBusiness Suite nicknamed apps?

Is it just the short name of Oracle Applications? Possibly yes, however this question is an
excuse for me to explain to you the evolution of APPS schema.

I started working in Oracle Financials 9 years ago. Those days each module had its own
Database Schema (which we still have). However, a purchasing user (until version 10.6)
used to connect to PO schema (by the virtue of the screen being a PO screen).

Hence, if a report or screen of AR ( Oracle Receivables ) module wanted to access a


table named PO_HEADERS_ALL, they would then use notation
PO.PO_HEADERS_ALL

However, now we have several database schemas(in most cases one schema per module).

The tables are still owned by their respective schema, but now we have a Central
Schema named APPS.

Oracle ERP simply connects to APPS database schema for all its operations (with a
couple of exceptions that are best ignored for now).

Hence, if Oracle wants to create a new table named PO_HEADERS_ALL, they will do
the following

Step 1: CONNECT po/po@XX_DEVDB;


CREATE TABLE PO_HEADERS_ALL ( ...all columns here );

Step 2: GRANT ALL ON PO_HEADERS_ALL TO APPS;

Step 3: CONNECT apps/apps@XX_DEVDB;


CREATE OR REPLACE SYNONYM PO_HEADERS_ALL FOR
PO.PO_HEADERS_ALL;

By following the above steps, as you can see, APPS schema is able to access
PO_HEADERS_ALL without the notation PO.PO_HEADERS_ALL

In Oracle ERP, now we have 100s of schemas, example PO, AR, AP, GL etc.

But the screens, reports, workflows etc in Oracle Applications connect to APPS schema
only. Just like saying, ALL ROADS LEAD TO ROME. Here, All schemas lead to APPS.

Hence if you have a Pseudo report that joins AP_INVOICES_ALL table( in AP schema)
to PO_HEADERS_ALL table( in AP schema), you will simply need to do the below
once connected to APPS.
SELECT *
FROM po_headers_all p, ap_invoices_all a
WHERE a.po_Id = p.po_Id;

Note thata prior to version 10.6(of Oracle ERP not database version), one had to do
SELECT *
FROM PO.po_headers_all p, AP.ap_invoices_all a
WHERE a.po_Id = p.po_Id;

Note: To keep matters simple, I havent considered Org_Id in this example.


Org_Id will be covered in one of the following chapters (have a look at index).

Moral of the Story is:-


1. All the PL/SQL Packages will be created in APPS Schema
2. All the Views will be created in APPS Schema
3. For each Table in Individual schema, there will exsist one Synonym in APPS schema
4. Tables are not created in APPS schema
5. Every implementation has at least one CUSTOM schema, where Custom tables are
created
6. For each Custom table created by you, you will need to create a Synonym in APPS
schema
7. As a developer, you will either connect to APPS Schema or to the CUSTOM schema
where you will create new tables.

Some notes:-
Custom tables are generally required in Oracle ERP because:-
1. You wish to create a Custom screen (your own screen to capture some info) for a
functionality that is not delivered by Oracle.
2. Pre-Interface tables (Interface will certainly be discussed in one of the latter chapters)
3. Temp processing
4. Staging of data for third party Extract Interfaces.and much more
What are Profile Options in Oracle Apps?

Profile Options provide flexibility to Oracle Apps. They are a key component of Oracle
Applications, hence these much be understood properly. I will be taking multiple
examples here to explain what profile options mean. I will also try to explain by stepping
into Oracle shoes "How will you design a program that is flexible", by using Profile
Options.For the learners of Oracle Apps, understanding profile options is mandatory.

What is Profile Option?


The profile option acts like a Global Variable in Oracle.

Why does Oracle provide Profile Options?


These are provided to keep the application flexible. The business rules in various
countries and various companies can be different. Hence the profile options are delivered
by Oracle in such a manner to avoid hard-coding of logic, and to let the implementation
team at site decide the values of those variables.

Enough definitions, give me some scenarios where profile options are used by
Oracle....
1. There are profile options which can turn the debugging on, to generate debug messages.
Say one of 1000 users reports a problem, and hence you wish to enable debugging against
just that specific user. In this case you can Turn On the debugging profile option "again
that specific user".

2. There are profile options that control which user can give discount to their customers at
the time of data entry. You can set profile option "Discount Allowed" to a value of either
Yes or No against each Order Entry user.

3. Lets assume an Organization has departments D1 and D2. Managers of both the
Departments have "HRMS Employee View" responsibility. But you do not want
Manager of D2 to be able to see the list of Employees in Organization D1. Hence you can
set a profile option against the username of each of these users. The value assigned to
such profile option will be "Name of the Organization" for which they can see the
employees. Of course, the SQL in screen that displays list of employees will filter off the
data based on logged in users profile option value.

Lets take an example:-


Lets assume you are a developer in Oracle Corporation building a screen in ERP. Let us
further assume that you are developing an Order Entry screen.
Assume that business requirements for your development work is:-

1. Screen should be flexible to ensure that different users of the screen can give different
levels of discounts. For example, in Order Entry screen a Clerk can not enter an Order
with more than 5% discount. But Sales Manager can enter an Order with 15% discount.

2. There should not be any hard-coding regarding the maximum permissible discount.
3. In the screen there will be a discount field.

4. When the discount value is entered in discount field, an error will be raised if user
violates the maximum permissible discount.

Here is how Oracle will code this screen:


1. They will define a profile option named "OEPASSI Maximum Discount Allowed".

2. The Short name of this profile option is "OEPASSI_MAX_DISCOUNT"

3. In the WHEN-VALIDATE-ITEM trigger of the discount field(assuming Oracle


Forms), following code will be written

IF
:OE_LINE_BLOCK.DISCOUNT_VALUE >
FND_PROFILE.VALUE('OEPASSI_MAX_DISCOUNT')
THEN
MESSAGE(
'You cant give discount more than '
|| FND_PROFILE.VALUE('OEPASSI_MAX_DISCOUNT') || '%'
);
RAISE FORM_TRIGGER_FAILURE; -- Raise error after showing message
END IF;

Here is how, the client implementing Oracle Order Entry will configure
their system:
1. Navigate to System Administrator and click on System->Profile menu.

2. For Clerk user(JOHN), set value of profile "OEPASSI Maximum Discount Allowed" to
5 For Sales Manager user(SMITH), set value of profile "OEPASSI Maximum Discount
Allowed" to 15

Question: This sounds good, but what if you have 500 Order Entry Clerks and 100
Order Entry Sales Managers? Do we have to assign profile option values to each 600
users?
Answer : Well, in this case, each Clerk will be assigned Responsibility named say XX
Order Entry Clerk Responsibility

Each Sales Manager will be assigned Responsibility named say XX Order Entry Sales
Manager Responsibility

In this case, you can assign a profile option value to both these responsibilities.
XX Order Entry Clerk Responsibility will have a value 5% assigned against it.

However, XX Order Entry Sales Manager Responsibility will have a profile option
value of 15% assigned.

In the WHEN-VALIDATE-ITEM trigger of the discount field, following code will then
be written

IF
:OE_LINE_BLOCK.DISCOUNT_VALUE >
FND_PROFILE.VALUE('OEPASSI_MAX_DISCOUNT')
THEN
MESSAGE(
'You cant give discount more than '
|| FND_PROFILE.VALUE('OEPASSI_MAX_DISCOUNT') || '%'
);
RAISE FORM_TRIGGER_FAILURE; -- Raise error after showing message
END IF ;

Please note that our coding style does not change even though the profile option is now
being assigned against responsibility. The reason is that API (Application Program
Interface) FND_PROFILE.VALUE will follow logic similar to below.

Does Profile option value exist against User?


--Yes: Use the profile option value defined against the user.
--No: Does Profile option value exist against Responsibility
-----Yes: Use the profile option value defined against the current responsibility in which
user has logged into.
-----No: Use the profile option value defined against Site level.
Profile Options Examples Screen shots

1. Firstly, lets define the responsibility for Clerk and save the responsibility, as we
discussed in the above article.

2. Next, lets define the Sales Manager responsibility and save the responsibility, as we
discussed in Article.
3. Lets define user JOHN, that is Clerk

4. And also, lets define user SMITH ( Sales manager )


5. Now, we need to define the profile option for discount, hence go to responsibility
"Application Developer"

6. When you click on menu "Profile" above, you will then see below screen for defining
Profile Option. Please note that the "Name" field is the short name of profile option, and
it is this name used in API call to FND_PROFILE.value
7. Now, after having defined a profile option, its time to assign these to JOHN & SMITH.
Hence go to responsibility "System Administrator"

8. Click on Menu Profile->System, as below


9. The Profile Option Assignment screen looks like below. Enter JOHN in User,
OEPASSI% in Profile, to select profile named "OEPASSI Maximum Discount Allowed"

Then click Find button, the below screen pops up.

10. Assign a value of 5 to the User and save it.

11. Click on torch, to return to Search screen as below

12. And this time we will assign value of 15 against user SMITH.
OK, what if we have too many Clerks, we can also simply assign profile value to
Responsibility of Clerk. Doing so, all the users that use this responsibility, will inherit
profile option value against Responsibility.

1. Assign 5% max discount for Clerks


2. Now, lets select Sales Manager responsibility in profile screen

3. Search on this...as below......

4. Assign value 15% to Sales Manager responsibility.

That's it for setup.


Org_Id and Multi Org in Oracle Apps

Before I tell you what is org_id, lets do some questions & answers:-

Why do we need Org_Id


In any global company, there will be different company locations that are autonomous in
their back office operations. For example, lets take the example of a gaming company
named GameGold Inc that has operations in both UK and France.

Please note the following carefully:-


1. This company (GameGold Inc) has offices in both London and Paris
2. UK has different taxation rules that France, and hence different tax codes are defined
for these countries.
3. GameGold Inc has implemented Oracle Apps in single instance (one common Oracle
Apps database for both UK & France).
4. When "UK Order Entry" or "UK Payables" user logs into Oracle Apps, they do not
wish to see tax codes for their French sister company. This is important because French
tax codes are not applicable to UK business.
5. Given the single database instance of GameGold Inc, there is just one table that holds
list of taxes. Lets assume that the name of the Oracle table is ap_tax_codes_all
6. Lets assume there are two records in this table.
Record 1 tax code -"FRVAT"
Record 2 tax code - "UKVAT"
7. Lets further assume that there are two responsibilities
Responsibility 1 - "French order entry".
Responsibility 2 - "UK order entry"
8. Now, users in France are assigned responsibility 1 - "French order entry"
9. Users in UK will be using responsibility named "UK order entry"
10. In the Order Entry screen, there is a field named Tax Code (or VAT Code).
11. To the French user, from the vat field in screen, in list of values UKVAT must not be
visible.
12. Also, the "French order entry" user should only be able to select "FRVAT" in the tax
field.
13. Similarly, UK order entry user, that uses responsibility "UK Order Entry", only
"UKVAT" should be pickable.

How can all this be achieved, without any hard coding in the screen.
Well....the answer is org_id

ORG_ID/Multi-Org/Operating Unit are the terminologies that get used interchangeably.

In brief steps, first the setup required to support this....


The screenshots are at the bottom of the article
1. You will be defining two organizations in apps named "French operations" and "UK
Operations". This can be done by using Organization Definition screen.
2. In Oracle Apps, an Organization can be classified as HRMS Org, or Inventory
Warehouse Org, or Business Group, or Operating Unit Org or much more types.
Remember, Organization type is just a mean of tagging a flag to an organization
definition.
3. The two organizations we define here will be of type Operating Unit. I will be using
words Org_Id & Operating Unit interchangeably.
4. Lets say, UK organization has an internal Org_Id =101
and French organization has Org_Id =102.

Qns: How will you establish a relation between UK responsibility and UK organization
Ans: By setting profile option MO: Operating unit to a value of UK Org, against UK
order entry responsibility

Qns: How will the system know that UK VAT belongs to UK org?
Ans: In VAT code entry screen (where Tax Codes will be entered), following insert will
be done
INSERT INTO ap_vat_codes_all
VALUES(:ScreenBlock.vatfield, Fnd_Profile.Value('org_id'));

Alternately, use USERENV ('CLIENT_INFO');

Qns: when displaying VAT Codes in LOV, will oracle do:


SELECT * FROM ap_vat_codes_all
WHERE org_id = Fnd_Profile.Value('org_id');?
Ans: almost yes.

Oracle will do the following:


1. At the time of inserting data into multi-org table, it will do
INSERT INTO (vatcode,org_id) ....

2. Creates a View in APPS schema as below:


CREATE OR REPLACE VIEW ap_vat_codes
AS
SELECT * FROM ap_vat_codes_all
WHERE org_id = Fnd_Profile.Value('org_id');

3. In the Lov,
SELECT * FROM ap_vat_codes;

If the above doesn't make sense, then keep reading.

May be quick revesion is necessary:_


1. In Multi Org environment (like UK + France in one data base), each Multi-Org table
will have a column named Org_Id. Tables like Invoices are Org Sensitive, because UK
has no purpose to see and modify French invoices. Hence an Invoice table is a
Candidate for Org_Id column.
By doing so, UK Responsibities will filter just UK Invoices. This is possible because in
Apps, Invoice screens will use ap_invoices in their query and not AP_INVOICES_ALL.

2. Vendor Sites/Locations are partitined too, because UK will place its orders from
dell.co.uk whereas France will raise orders from dell.co.fr. These are called Vendor Sites
in Oracle Terminology.

3. Any table that is Mutli-Org (has column named Org_Id), then such table name will
end with _ALL

4. For each _ALL table, Oracle provides a correspondong View without _ALL. For
example,
CREATE OR REPLACE VIEW xx_invoices
AS
SELECT * FROM xx_invoices_all
WHERE org_id=Fnd _Profile.Value('org_id');

5. At the time of inserting records in such table, Org_Id column will always be populated.

6. If you ever wish to report across all operating units, then select from _ALL table.

7. _ALL object in APPS schema will be a Synonym to the corresponding _ALL table in
actual schema. For example po_headers_all in APPS schema is a Synonym for
po_headers_all table in PO schema.

8. When you connect to iSQL*Plus do the below


CONNECT apps/apps@dbapps ;

---Assuming 101 is French Org Id


EXECUTE Dbms_Application_Info.Set_Client_Info ( 101 );
SELECT tax_code FROM ap_tax_codes ;
---Returns FRVAT

---Assuming 102 is UKOrg Id


EXECUTE Dbms_Application_Info.Set_Client_Info ( 102 );
SELECT tax_code FROM ap_tax_codes ;
---Returns UKVAT
Now some screenshots

Organization Definition screen

Responsibility Definition screen


Applications in Oracle Apps

In this training chapter I will explain what Application means, in Oracles context.

As a thumbrule, for one module there is one single application.

Untill 8 years ago, it was mandatory for each table to be registered against an Application
in Oracle Financials; but now such a relation no longer exists.

Oracle is a mixture of various applications like Payables, General Ledger, Payroll, Human
Resources, and Manufacturing. You can call these Modules, but officially these are
called Applications. Hence the name Oracle Applications (i think)

Is there a relation between Application and Table:-


Indirectly/logically there is, as the Table is owned by a specific Schema, and then a
Schema is related to an Application( though logically, as this relation is not enforced by
the System).

What precautions do I take when creating a new table in oracle apps:-


Ans: Find out from DBA's the schema in which your Custom tables are meant to be
created. Create the desired table in Custom schema.
Note: If your Custom table will support Multi-org, then its name must finish with _ALL
and also it must have an Integer column named Org_id

Qns: For an Oracle Apps developer, what else must be the consideration with
respect to Application.
Ans: I will jump the training ship to explain this. In case you do not understand, then wait
for the training lesson on Concurrent programs.

1. Each program has an Executable. For example Reports have .rdf, Sql*plus has
.sql file, Forms has .fmx, Unix Shell Script has .prog (in apps) & D2K libraries
have .plx

2. When you register an Executable with Oracle Apps, you must then register this against
an Application.

3. Each application is mapped to a specific path, say to a directory in Unix box. For
example, Applicaton XXPO (that holds PO Customizations) may Map
to /home/oracle/apps/appl/po

4. Say you have developed/customized a report for PO Module. Assume your report
Executable name is XXPOPRINT.rdf . If you register this Executable with XXPO
applicaton, then this .rdf must be copied/ftp'ed to /home/oracle/apps/appl/po

5. When running this report in Oracle Apps, oracle will ask below series of questions to
itself
I see that user is running XXPOPRINT.rdf, which applicaton is this report registered
against? Oh well, it is XXPO application, then where is the directory location where I can
expect to find this file? Oh ok, application definition of XXPO is mapped
to /home/oracle/apps/appl/po (as per application definition), hence lets pick the rdf
from /home/oracle/apps/appl/po/reports/US
Here lies the significance of applicaton in oracle apps.

Now some notes:-


1. Profile options can be defined at Application level too.
2. All the Forms & Reports are attached to an Application.
3. Each application has a Base path, which effectively is also the Environment variable on
operating system.

The below image can be clicked to see how applications are defined in Oracle Apps. One
needs to navigate to System Administrator responsibility and select
Menu /Application/Register.

As a developer, it is not your responsibility to define the Application, however I suggest


that you understand this well.

Application Definition Screen


Oracle Apps Deployment Training

When you are a fresh new Oracle Apps developer, your fundamental question is...where
to find the piece of code that you are being asked to customize?
Before I begin to explain you this, first some fundamentals.

1. You will most likely find that any implementation of oracle apps will involve at least
two machines, i.e. Database tier and then at least one Web/Forms tier (also known as
Middle-tier).

2. Oracle thought very logically to decide which Executable runs on Database tier and
which on Web/Forms tier (also known as Mid-tier).Any Executable that has intense
Database operations is deployed /stored at Database tier. To give you some examples....
.sql files, Oracle report Java concurrent programs, Sql*loader are all deployed in
Database tier of Oracle Applications.

3. Any Executable that has intense UI operations is deployed at Forms tier. Examples
are Oracle Forms .fmx files, .jsp files, .pll/.plx etc.

Qns: The above sounds good in most cases, but what if you have to build a Form that
has intense database processing.
Ans: Well the Form will still be deployed in the Mid-tier, otherwise your Form will never
be run. However, for such Forms, you must handle most of the database processing within
PL/SQL Packages. The APIs that you build in PL/SQL must have well defined
Parameters.
I am saddened to see that some apps programmers write tons of sql code/DMLs inside the
Oracle forms Triggers. In this era of high speed networks, such aproach may be justified
to an extent, but what if some other developer desires to use validations developed for
your Form in other areas of APPS? Hence building Pl/Sql API's is the preferred approach.

Qns: Why do we have multiple Middle tiers for one database?


Ans: Most implementations install multiple mid-tiers to distribute the user load. The user
requests are first sent to a Load Balancer Switch, this switch decides which middle tier to
use. Hence, if one server has 1000 user capacity, then you can have 5 Mid tiers to handle
5000 Concurrent users.

Qns: That's fine for the theory, but how do multiple Mid-tiers impact my forms
deployment?
Ans: You will need to deploy your Forms file to each Middle tier machine (unless Shared
APPL_TOP) has been implemented.

Qns: Where do I pick the .fmb files delivered by oracle?


Ans: These are picked from $AU_TOP/forms/us
Qns: Where do I deploy the .fmx file on Mid tier, assuming a Purchasing screen has
been customized?
Ans: This will be deployed at $XXPO_TOP/forms/us.
Basically by deployment I mean that .fmx file will be copied to xxpo_top/forms/us

Qns: Where do I deploy a PL/SQL Package?


Ans: All of the PL/SQL Packages are installed in APPS schema.
This includes your Custom packages and also Oracle delivered packages.

Qns: Where do we create the database Views?


Ans: Views will be created in APPS schema too.

Qns: How do I generate .fmx, should this be done on PC or on the Mid tier?
Ans: This must always be done on the Mid tier i.e., Oracle Applications Server.
For example use below steps
Step 1
FORMS60_PATH=$FORMS60_PATH:$AU_TOP/forms/US

Step 2
export FORMS60_PATH

Step 3
cd $XXPO_TOP/forms/US

Step 4 ----Below in one single line


f60gen Module=XXPOSCREEN.fmb Userid=apps/apps Module_type=Form Batch=no
compile_all=special

Qns: I have deployed the form at $XXPO_TOP but I can't run it, I get message Can
not find Form
Ans: Firstly find out the Application to which this Form is registered against. In reality
the Forms are attached to Form Functions and it is the Form Function that is attached to
an Application

Qns: How can I generate the CUSTOM.plx or any other Forms Library?
Ans:
----Below statements in one single line

cd $AU_TOP/resource

f60gen Module=$AU_TOP/resource/CUSTOM.pll Userid=apps/apps


Output_file=./CUSTOM.plx Module_type=LIBRARY

f60gen Module=$AU_TOP/resource/XX_POENT.pll Userid=apps/apps


Output_file=./XX_POENT.plx Module_type=LIBRARY
Qns: All the above sounds good, but how on earth do I connect to Mid Tier to
generate Forms
Ans: For Mid-tier Server, you will be provided with a Unix/Linux Username & Password.
Before you start moaning, let me clarify that I assume that hosting OS will be Unix. As
soon as you logon to your Mid-tier, your Environment should Automatically be setup
based on scripts within .profile file. To know whether your environment has been setup
on Unix box, do the below:

echo $FND_TOP

If the above returns blank, then it means you need to contact your DBAs to find out why
Environment variables are not being populated on your sign-on to Unix
...Ditto for DB Tier
Oracle Apps Training Testing Environments

In every implementation, there is always more than one environment in Oracle Apps.

The rule of thumb states that below environment are a must:-


1. Development environment:
Where developers usually have System Administrator responsibility and also
the apps password. If not System Administrator then at least they should have access to
"Application Developer" responsibility.

2. Testing environment:
Developers usually do not and must not have apps password to this
environment. This is where users Sign-off customizations or even setup changes.

3. Production environment:
This is where the business runs

Optional environments:-

1. CRP (Conference Room Pilot) environment:


Conference room pilot environment is where usually implementation team gets
buying to their product offering from user community, during implementation. This
environment is usually used for sign off during new implementations.

2. Patching environment:
This is where all new Oracle Patches are Sanity tested.

3. Support environment:
This environment is exclusive to support staff. This environment is usually the
most frequently cloned environment in Oracle Apps site that has gone live. Frequent
cloning helps the Oracle Applications support staff to reproduce production issues

4. Migration Environment:
This is where repeated data migration can take place before migration code gets
frozen and ready for UAT.

5. User Training Environment:


Some clients mix this with the CRP itself. But Post-Go Live of APPS, when
rolling out new module, an environment like this comes handy.

You as a developer do not need to worry about these environments, as your focus
will be on Development Environment only.
5.

Now some notes:-


1. There can be more than one Development environment at any implementation site,
when different big modules are being implemented, all having different timelines.
However, the changes to each environment are UAT'ed on a common Test environment.

2. The Development to Production Cycle is.... Developer does Development & Unit
Testing on Development environment, and their code gets promoted to User Testing
environment. Following this, the changes get applied to Production environment.

3. The changes done to "Development environment" must be Scripted in all cases where
possible. As a thumb rule, everything except for Functional Configuration can be scripted.
Oracle FNDLOAD Script Examples

In this article I wish to give real working examples of Oracle's FNDLOAD utility.
Besides that, I have included some useful notes on FNDLOAD utility

I have used FNDLOAD successfully in past for several different entities/data types within
Oracle 11i for almost all my previous clients, ever since this utility became available.
Some of the examples in this FNDLOAD article include:-
FNDLOAD to transfer Request Groups
FNDLOAD for moving Concurrent Programs
FNDLOAD to download and upload Forms Personalizations ( or Personalisations
depending on where you are located )

To FNDLOAD Web ADI, visit the link Web ADI FNDLOAD

Use FNDLOAD for transferring value set definitions.


-->Please note that when transferring Key Flex Fields and Descriptive flex fields the
respective value sets against each segment will be extracted and loaded automatically.

Also, FNDLOAD can be used to migrate Key FlexFields, Descriptive Flexfields,


Responsibilities and almost every other FND entity.

Please note that the text written down here could get wrapped in the browser.
Hence you may have to use \ to continue the single line command on Unix, in case you
find the lines wrapping
In my case I am ensuring that $CLIENT_APPS_PWD has the apps password before
running the scripts

------------------------------------------------------------------------------------------

##To FNDLOAD Request groups


FNDLOAD apps/$CLIENT_APPS_PWD O Y DOWNLOAD
$FND_TOP/patch/115/import/afcpreqg.lct XX_MY_REPORT_GROUP_NAME.ldt
REQUEST_GROUP
REQUEST_GROUP_NAME="XX_MY_REPORT_GROUP_NAME"
APPLICATION_SHORT_NAME="XXGMS"
##Note that
##---------
## <> will be your Application Shortname where request group is registered
## XX_MY_REPORT_GROUP_NAME
Will be the name of your request group
## ##To upload this Request Group in other environment after having transferred the ldt
file

FNDLOAD apps/$CLIENT_APPS_PWD O Y UPLOAD


$FND_TOP/patch/115/import/afcpreqg.lct
------------------------------------------------------------------------------------------

##To FNDLOAD Concurrent Programs


FNDLOAD apps/$CLIENT_APPS_PWD O Y DOWNLOAD
$FND_TOP/patch/115/import/afcpprog.lct
XX_CUSTOM_ORACLE_INTERFACE_PROG.ldt PROGRAM
APPLICATION_SHORT_NAME="XXGMS"
CONCURRENT_PROGRAM_NAME="XX_CUSTOM_ORACLE_INTERFACE_PRO
G"
##Note that
##---------
## XXGMS will be your custom GMS Application Shortname where concurrent program
is registered
## XX_CUSTOM_ORACLE_INTERFACE_PROG
Will be the name of your request group
## XX_CUSTOM_ORACLE_INTERFACE_PROG.ldt is the file where concurrent
program definition will be extracted
## ##To upload
FNDLOAD apps/$CLIENT_APPS_PWD O Y UPLOAD
$FND_TOP/patch/115/import/afcpprog.lct
XX_CUSTOM_ORACLE_INTERFACE_PROG.ldt

------------------------------------------------------------------------------------------

##To FNDLOAD Oracle Descriptive Flexfields


$FND_TOP/bin/FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD
$FND_TOP/patch/115/import/afffload.lct XX_PO_REQ_HEADERS_DFF.ldt
DESC_FLEX APPLICATION_SHORT_NAME=PO
DESCRIPTIVE_FLEXFIELD_NAME='PO_REQUISITION_HEADERS'
##Note that
##---------
## PO is the Application Shortname against which descriptive flexfield against PO
Headers is registered
## PO_REQUISITION_HEADERS
is the name of Descriptive Flexfield against PO Requisition Headers
## Use the SQL below to find the name of DFF, rather than logging into the screen (ooops
via jinitiator)
########----->SELECT
########----->application_id, DESCRIPTIVE_FLEXFIELD_NAME,
application_table_name
########----->FROM
########-----> fnd_descriptive_flexs_vl
########----->WHERE
########-----> APPLICATION_TABLE_NAME like '%' || upper('&tab_name') || '%'
########----->ORDER BY APPLICATION_TABLE_NAME
########----->/
## To upload into another environment
$FND_TOP/bin/FNDLOAD apps/$CLIENT_APPS_PWD 0 Y UPLOAD
$FND_TOP/patch/115/import/afffload.lct XX_PO_REQ_HEADERS_DFF.ldt

## OK another example for DFF against FND_LOOKUPS


FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD
$FND_TOP/patch/115/import/afffload.lct XX_FND_COMMON_LOOKUPS_DFF.ldt
DESC_FLEX APPLICATION_SHORT_NAME=FND
DESCRIPTIVE_FLEXFIELD_NAME='FND_COMMON_LOOKUPS'
## OK another example for DFF against Project Accounting Expenditure Types
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD
$FND_TOP/patch/115/import/afffload.lct
XX_PA_EXPENDITURE_TYPES_DESC_FLEX_DFF.ldt DESC_FLEX
APPLICATION_SHORT_NAME=PA
DESCRIPTIVE_FLEXFIELD_NAME='PA_EXPENDITURE_TYPES_DESC_FLEX'

------------------------------------------------------------------------------------------

##To FNDLOAD Oracle Menus


$FND_TOP/bin/FNDLOAD apps/$CLIENT_APPS_PWD O Y DOWNLOAD
$FND_TOP/patch/115/import/afsload.lct ICX_POR_SSP_HOME.ldt MENU
MENU_NAME="ICX_POR_SSP_HOME"
##Note that
##---------
## Oracle Menus are not attached to applications. Hence no need to include application
short name
## ICX_POR_SSP_HOME is the menu name. This can be validated via below SQL
## select user_menu_name from fnd_menus_vl where menu_name =
'ICX_POR_SSP_HOME' ;
## Also note that we do not pass in the User_menu_name in this example
## OK, now to upload this file
$FND_TOP/bin/FNDLOAD apps/$CLIENT_APPS_PWD O Y UPLOAD
$FND_TOP/patch/115/import/afsload.lct ICX_POR_SSP_HOME.ldt

------------------------------------------------------------------------------------------------------------

## Well, now for FND Messages to download a single message


FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD
$FND_TOP/patch/115/import/afmdmsg.lct \
XX_ICX_POR_LIFECYCLE_PAY_TIP.ldt FND_NEW_MESSAGES
APPLICATION_SHORT_NAME='ICX'
MESSAGE_NAME=XX_ICX_POR_LIFECYCLE_PAY_TIP
## Or you may as well download all the messages within an application
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD
$FND_TOP/patch/115/import/afmdmsg.lct \
XX_ALL_GMS_MESSAGES_00.ldt FND_NEW_MESSAGES
APPLICATION_SHORT_NAME='XXGMS'

## now to upload using FNDLOAD


FNDLOAD apps/$CLIENT_APPS_PWD 0 Y UPLOAD
$FND_TOP/patch/115/import/afmdmsg.lct XX_ICX_POR_LIFECYCLE_PAY_TIP.ldt

------------------------------------------------------------------------------------------------------------

## Now it's the turn of Lookup values. Again, its not a rocket science
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD aflvmlu.lct
XX_TRX_BATCH_STATUS.ldt FND_LOOKUP_TYPE
APPLICATION_SHORT_NAME ='XXGMS'
LOOKUP_TYPE="XX_TRX_BATCH_STATUS"
## Note that
## XX_TRX_BATCH_STATUS is the name of FND Lookup Type in this example
## This will download all the lookup codes within the defined lookup
## To upload
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y UPLOAD aflvmlu.lct
XX_TRX_BATCH_STATUS.ldt

------------------------------------------------------------------------------------------------------------

## You can also move the User definitions from FND_USER


FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD
$FND_TOP/patch/115/import/afscursp.lct ./XX_FND_USER_PASSI.ldt FND_USER
USER_NAME='ANILPASSI'
#Do not worry about your password being extracted, it will be encrypted as below in ldt
file
#BEGIN FND_USER "ANILPASSI"
# OWNER = "PASSIA"
# LAST_UPDATE_DATE = "2005/10/19"
# ENCRYPTED_USER_PASSWORD =
"ZGE45A8A9BE5CF4339596C625B99CAEDF136C34FEA244DC7A"
# SESSION_NUMBER = "0"
To upload the FND_USER using FNDLOAD command use
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y UPLOAD
$FND_TOP/patch/115/import/afscursp.lct ./XX_FND_USER_PASSI.ldt
Notes for using FNDLOAD against FND_USER:-
1. After uploading using FNDLOAD, user will be promoted to change their password
again during their next signon attempt.
2. All the responsibilities will be extracted by FNDLOAD alongwith User Definition in
FND_USER
3. In the Target Environment , make sure that you have done FNDLOAD for new
responsibilities prior to running FNDLOAD on users.

------------------------------------------------------------------------------------------------------------
----------------

## Now lets have a look at the profile option using oracle's FNDLOAD
FNDLOAD apps/$CLIENT_APPS_PWD O Y DOWNLOAD
$FND_TOP/patch/115/import/afscprof.lct POR_ENABLE_REQ_HEADER_CUST.ldt
PROFILE PROFILE_NAME="POR_ENABLE_REQ_HEADER_CUST"
APPLICATION_SHORT_NAME="ICX"
## Note that
## POR_ENABLE_REQ_HEADER_CUST is the short name of profile option
## We aren't passing the user profile option name in this case. Validate using ...
########----->select application_id, PROFILE_OPTION_NAME || '==>' ||
profile_option_id || '==>' ||
########----->USER_PROFILE_OPTION_NAME
########----->from FND_PROFILE_OPTIONS_VL
########----->where PROFILE_OPTION_NAME like '%' ||
upper('&profile_option_name') || '%'
########----->order by PROFILE_OPTION_NAME
########----->/
## Now to upload
FNDLOAD apps/$CLIENT_APPS_PWD O Y UPLOAD
$FND_TOP/patch/115/import/afscprof.lct POR_ENABLE_REQ_HEADER_CUST.ldt

------------------------------------------------------------------------------------------------------------
----------------

## Now for the request sets that contain the stages and links for underlying
concurrent programs
## For this you will be firstly required to download the request set definition.
## Next you will be required to download the Sets Linkage definition
## Well, lets be clear here, the above sequence is more important while uploading
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD
$FND_TOP/patch/115/import/afcprset.lct XX_GL_MY_INTERFACE_SET.ldt
REQ_SET REQUEST_SET_NAME="FNDRSSUB4610101_Will_look_like_this"
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD
$FND_TOP/patch/115/import/afcprset.lct XX_GL_MY_INTERFACE_SET_LINK.ldt
REQ_SET_LINKS
REQUEST_SET_NAME="FNDRSSUB4610101_Will_look_like_this"
## Note that FNDRSSUB4610101 can be found by doing an examine on the
########----->select request_set_name from fnd_request_sets_vl
########----->where user_request_set_name = 'User visible name for the request set
here'
## Now for uploading the request set, execute the below commands
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y UPLOAD
$FND_TOP/patch/115/import/afcprset.lct XX_GL_MY_INTERFACE_SET.ldt
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y UPLOAD
$FND_TOP/patch/115/import/afcprset.lct XX_GL_MY_INTERFACE_SET_LINK.ldt
------------------------------------------------------------------------------------------------------------
----------------

## Now for the responsibility


FNDLOAD apps/$CLIENT_APPS_PWD O Y DOWNLOAD
$FND_TOP/patch/115/import/afscursp.lct XX_PERSON_RESPY.ldt
FND_RESPONSIBILITY RESP_KEY="XX_PERSON_RESPY"
## note that XX_PERSON_RESPY is the responsibility key
## Now to upload
FNDLOAD apps/$CLIENT_APPS_PWD O Y UPLOAD
$FND_TOP/patch/115/import/afscursp.lct XX_PERSON_RESPY.ldt

------------------------------------------------------------------------------------------------------------

## OK, now for the forms personalizations


## For the forms personalizations, I have given three examples as below.
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD
$FND_TOP/patch/115/import/affrmcus.lct XX_PERWSHRG.ldt
FND_FORM_CUSTOM_RULES function_name="PERWSHRG-404"
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD
$FND_TOP/patch/115/import/affrmcus.lct XX_HZ_ARXCUDCI_STD.ldt
FND_FORM_CUSTOM_RULES function_name="HZ_ARXCUDCI_STD"
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD
$FND_TOP/patch/115/import/affrmcus.lct XX_AP_APXVDMVD.ldt
FND_FORM_CUSTOM_RULES function_name="AP_APXVDMVD"
## Note that the function name above is the function short name as seen in the Function
Definition Screen
## Now to upload the forms personalizations that are defined against these forms
functions....
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y UPLOAD
$FND_TOP/patch/115/import/affrmcus.lct XX_PERWSHRG.ldt
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y UPLOAD
$FND_TOP/patch/115/import/affrmcus.lct XX_HZ_ARXCUDCI_STD.ldt
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y UPLOAD
$FND_TOP/patch/115/import/affrmcus.lct XX_AP_APXVDMVD.ldt
------------------------------------------------------------------------------------------------------------

Notes :
1. Give special attention when downloading Menus or Responsibilities.
In case your client has several developers modifying Responsibilities and Menus, then be
ultra carefull. Not being carefull will mean that untested Forms and Functions will
become available in your clients Production environment besides your tested forms,
functions and menus.

2. Be very careful when downloading flexfields that reference value sets with independent
values for GL Segment Codes.
By doing so, you will download and extract all the test data in GL Codes that might not be
applicable for production.

3. There are several variations possible for FNDLOAD, for example you can restrict the
download and uploads to specific segments within Descriptive Flex Fields. Please amend
the above examples as desired for applying appropriate filterations.

4. The list of examples by no mean cover all possible FNDLOAD entities.

5. FNDLOAD is very reliable and stable, if used properly. This happens to by one of my
favourite Oracle utilities.

6. Last but not the least, please test your FNDLOAD properly, so as to ensure that you do
not get any unexpected data. In past I have noticed undesired results when the Lookup
gets modified manually directly on production, and then the FNDLOAD is run for similar
changes. If possible, try to follow a good practice of modifying FNDLOADable data only
by FNDLOAD on production environment.

7. As the name suggests, FNDLOAD is useful for FND Related objects. However in any
implementation, you will be required to migrate the Setups in Financials and Oracle
HRMS from one environment to another. For this you can use iSetup. "Oracle iSetup".
Some of the things that can be migrated using Oracle iSetup are
GL Set of Books, HR Organization Structures, HRMS Employees, Profile Options Setup,
Suppliers, Customers, Tax Codes & Tax Rates, Financials Setup, Accounting Calendars,
Chart of Accounts, GL Currencies.
Oracle Form Functions, Menus and their relationship

Every screen we develop delivers a business functionality of sorts. Notice the word
functionality.
Hence the word Function or call it "Form Function" is related to Oracle Forms.

You all know that a Form is nothing but a screen from where users can enter or retrieve
(query) existing data.

Qns: In Oracle why do we have a Form and then also a Form Function? Isn't just
having a Screen/Form just well enough?
Ans: What if, for the same Form, you wish to provide slightly different functionalities
depending upon which Menu is clicked to invoke that Form??

Question: Are there any examples?


Answer: Lets assume the following

There are two Responsibilities


------------------------------
Payables Manager responsibility
Payables Clerk responsibility

There is one Form for Invoices


------------------------------
Payables Invoice screen

Our requirement
-------------------------------
If the Invoice screen is invoked from Payables Manager Responsibility, then at startup
of the screen we want to provide a "Search Window", so that manager can search for the
invoices to review

If the Invoice screen is invoked from "Payables Clerk Responsibility, then at startup of
the screen we want to provide "Invoice Data Entry window", so that clerk can begin
entering the invoices.

The Form will have following code within it in When-New-Form-Instance Trigger.


IF :Parameter.Invoice_Mode='MANAGER' THEN
GO_BLOCK(Find_Invoices');
ELSIF :Parameter.Invoice_Mode='CLERK' THEN
GO_BLOCK(Invoice_Header';
END IF;

Question: From above example it appears that Form Function will be passing
Parameter named Invoice_Mode to the form?
Answer. Correct in this case.
So that we understand how things hang together.
Invoice form is attached to a Form Function, when defining the Form Function we pass
Parameters to it. Then this Form Function is attached to the Menu, and it is the Menu that
gets attached to responsibility.

Question: Are the Form Functions all about Parameters?


Answer: Parameters is the main feature of Form Functions. But there are others too.
As you know from previous training lessons, each Form will be located in a specific
directory on Unix box. For example, Purchasing Form executables will be in
$PO_TOP/foms/US and Account Payables Form executables will be located in
$AP_TOP/forms/US.

Question: Did you wonder how Oracle will know to look for a Payables Form
executable in AP_TOP and not in PO_TOP?
Answer:Oracle will think like this...hmm user clicked on a Menu, what is the Form
Function for this Menu...hmm it is Invoice Review....ok...what is the Application
assigned to the Form Function...oh...its AP(Account Payables) application...right....what is
the Base path for this Application...right..it is AP_TOP...lets then run the .fmx file from
ap_top/forms/us

Screenshots for examples:


1.Go to Application Developer then click on Menu /Application/Form

2.Define your Form...remember, oracle will expect an executable of .fmx for this name

3.Click on Menu /Application/Function

4. Define your two Functions Invoice Review, Invoice Entry and pass the Parameter
Invoice Mode and set the values as CLERK, MANAGER

Login to Oracle Apps , and select responsibility "Application Developer"

Navigate the menu "Form"


Define the Form as below

Now, lets define the Function


Concurrent Programs in Oracle Apps

Lets first discuss the below scenario

Being a developer, you have just developed a SQL Script or a PL/SQL Package
procedure. The end user wants to be able to run this Script ad-hoc or they wish to
schedule this to run every night.

Question: How can an end-user be given the control to run a Script developed by a
developer, given that an end user will never have access to apps password (and
rightly so)?
Answer: This Script can be attached to a Concurrent Program via a Concurrent Program
Executable. The user will then be given access to this Concurrent Program.

Question: But how will the end user or Oracle Apps make this script run every
10hours daily?
Answer: A Concurrent Program can be Scheduled to run at desired intervals. The
schedule is defined at the time of submission.

Question: What are the different types of Scripts/Programs that can be attached to
Concurrent Programs?
Answer:
1.Sql script
2.Sql*Loader program
3.Java program
4.Oracle report
5.PL/SQL program (or call it a Stored procedure/Package procedure)
6.Host script, like a Unix Shell script
7.Pro*C/Spawned
8.Perl

Question: What are the basic steps when defining a Concurrent Program?
Answer: Broadly speaking there are three steps when developing a Concurrent Program
in Oracle Apps
Step 1. Make Oracle Apps identify the Executable
Step 2. Provide a handle to the Executable by means of defining a Concurrent Program
Step 3. Make this Concurrent Program accesible to selected users via their Responsibility.

Question: Can you describe the above steps in detail?


Answer:
Step 1. Make Oracle Apps identify the Executable
In Oracle Apps we have something called as Concurrent Program executable. Concurrent
Program executable is defined to Register a script or a procedure for its usage within
oracle apps.
Step 2. Provide a handle to the Executable by means of defining a Concurrent Program.
We need to define a Concurrent Program and attach that to the Executable defined in
above step.

Step 3. Make this Concurrent Program accesible to selected users via their Responsibility.
We do this by adding the Concurrent Program to something called as Request Group. The
Request Group is either associated with a Responsibility or is passed in as a Parameter to
the function request Form Function

Question: Please explain the steps for defining a PL/SQL Concurrent Program, with
screenshots and with almost real life example?
Answer:
1. Create a Table and a Stored procedure in pl/sql
CREATE TABLE xx_hello_world_tab
(
message_text VARCHAR2(100) ,
creation_date DATE
);
CREATE OR REPLACE PROCEDURE
xx_register_user_prc(errbuf OUT VARCHAR2,retcode OUT VARCHAR2) IS
BEGIN
INSERT INTO xx_hello_world_tab VALUES ('Hello World' ,SYSDATE);
END xx_register_user_prc;

SELECT * FROM xx_hello_world_tab ;


--Zero records will be returned here

2. Note the two Parameters, namely errbuff and retcode


These Parameters are used for the interaction between the Concurrent Program and the
PL/SQL Program. I suggest to the beginners not to spend much time on these parameters.

3. Define an Executable attached to this Procedure.


This can be done by navigating to the responsibility Application Developer, and
selecting the Menu /Concurrent/Executable
4. Define the Concurrent Program
This can be done by navigating to responsibility Application Developer and then
selecting Menu /Concurrent/Program

5. Attach this program to a Request Group.


Go to System Administrator responsibility, and select
Security/Responsibility/Request
Now, we can navigate to the Receivables Manager responsibility and submit the
Concurrent Request.

After the completion of the request, we check the table


Concurrent Manager in Oracle Apps

Lets discuss the very basics of Concurrent Managers,

Two things are obvious:-


1. Concurrent Manager is related to Concurrent Programs
2. Concurrent Manager manages the concurrent (oops I mean parallel) execution of
Concurrent Programs.

Question: How to run a Concurrent Program?


Answer: In oracle apps you have a Concurrent Program Submission screen. You can
submit the Concurrent Program from that screen.

Question: What happens when you submit a Concurrent Program?


Answer: There is something known as Concurrent Manager that runs in the background
all the time. This background process, called Concurrent Manager ideally will be running
24x7.
As the name suggests, purpose of a Concurrent Manager is to manage the submitted
Concurrent Programs.

Question: When I submit a Concurrent Program (or call it Concurrent Request),


how does Concurrent Manager pick this up?
Answer: Concurrent Manager will be running in the background waiting for a Concurrent
Program to be submitted. As soon as a Concurrent Program is submitted, it then gets put
in an Execution Queue by Concurrent Manager.

Question: Why does the Concurrent Manager put a Concurrent Program into a
Queue? Why doesn't the Manager simply let the Program run?
Answer: Because at any given point in time a Concurrent Manager can run no more than
say 10 programs concurrently. This figure of 10 is Configurable of course. First the
manager puts a submitted Program into a Queue, next the manager checks if there is a Slot
available (i.e. Less than 10 programs are currently running). If a Slot is found available,
theCconcurrent Manager then runs the Program, or else it keeps the Concurrent Program
in a Queue with status Pending.

Question: If we have two Concurrent Programs that must never run in Parallel
(oops I mean Concurrently)....can Concurrent Manager manage such Scenarios?
Answer: Of course it can. When you define a Concurrent Program, you can specify if
there are any Incompatible Programs. If Incompatible Concurrent Programs exist, then
Concurrent Manager will wait for the Incompatible Program to complete.

Question: Is that all what Concurrent Manager does?


Answer: Much more, if interested, then read on.
Concurrent Manager is responsible for below things too..

Managing the Printer:-


An Oracle Report is registered as a Concurrent Program too. During submission or during
the definition of Concurrent Program, we can specify the printer where report gets printed.
Concurrent Manager will send the output of the program to that printer.

Managing the Programs completion status:-


For example a PL/SQL Concurrent Program can set retcode=2 to make a program
complete with warning. Hence Concurrent Manager not just executes the program, but it
manages the completion status of the program too.

Classpath of a Java program:-


A Concurrent Program can be of type Java too. If for this specific Concurrent Program
you wish to use a set of java libraries, then you can specify the path of that library in
Concurrent Program definition. Concurrent Manager will amend the CLASSPATH to
reflect the path of the java library.

Interaction with Host Concurrent Program:-


When running a Host Concurrent Program, the Concurrent Manager passes the apps
password as a parameter to the Unix script

Tracing a Concurrent Program:-


Concurrent Manager enables the session trace for the Concurrent Program, if enable Trace
Checkbox is checked in Program definition. You can then go to User Dump directory and
do tkprof on the file.

Optimization options:-
The Concurrent Program definition provides an option to specify Optimization Mode, like
choose, first rows, all rows, rule based etc. The Concurrent Manager will alter the
optimization mode of the session before the submission of the Program. Obviously this
option has no relevance to Host type Concurrent Program.
Value Set basics in Oracle Apps

Question: What is a Value Set?


Answer: It is a Set of values

Question: Why do we need Value Sets?


Answer: You do not always want a user to enter junk free text into all the fields. Hence,
Oracle Apps uses Value Set to validate that correct data is being entered in the fields in
screen.

Question: Is Value Set attached to all the fields that require validations?
Answer: A big NO

Question: Then where lies the usage of Value Sets?


Answer: Broadly speaking, Value Sets are attached to Segments in Flexfields. You can
argue that Value Sets are also attached to Parameters of Concurrent Program (but in
reality oracle treats Parameters as Descriptive Flexfields)

Question: This is insane, flexfields havent been covered in


http://getappstraining.blogspot.com as yet?
Answer: Agreed, hence lets restrict value set explanation to their usage in concurrent
program parameters.

Question: Any examples?


Answer: For the namesake, lets add a Parameter to the Concurrent Pprogram that we
defined in Concurrent Program Training Lesson. Lets add a Parameter named Cost
Centre, the values to this Parameter must be restricted to one of the three values, i.e. HR,
SEC, IT.

At the time of submission of the Concurrent Program the user should be able to pick a
Cost Centre from a list. This is where Value Set gets used.

Lets now define a simple Value Set as described above

Step 1:- Go to Application Developer responsibility, and select Menu /Validation/Set


Step 2:- Now define a Value Set of type Independent. We will cover the other most
widely used Type Table latter.
Step 3:- Now, lets add three Independent values to the Value Set for this Cost Centre list.
Hence click on menu Values within Validation

Step 4:- Here we add the values for IT, HR, SEC to this independent Value Set.

Press Ctrl S to Save the data

Step 5:- Now let us go back to Concurrent Program that we created in earlier training
lesson and Click on Parameters
Step 6:- Now lets create a Parameter, and attach the Value Set that we created to this
Parameter.
Step 7:-
Now to test this, lets go to Receivables Manager responsibility and click on Requests.

Step 8:-
Click on Submit New Request, and then click on OK.
Step 9:-
Now, we can see the values defined in the value set here.
Lookup Types and Lookup Codes in Oracle Apps

Question: What is a Lookup in Oracle Apps?


Answer: It is a Set of Codes and their Meanings.

Question: Any examples?


Answer: The simplest example is say a Lookup type of Gender.
This will have definitions as below
Code Meaning
------ -------------
M Male
F Female
U Unknown

Question: But where is it used, any examples of its usages?


Answer: Let us say that there is a Table for Employees, and this Table named
PER_PEOPLE_F and has following Columns
----
FIRST_NAME
LAST_NAME
DATE_OF_BIRTH
GENDER

Question: Will the Gender column in above Table hold the value of M or F or U?
Answer: Correct, and the screen that displays people details will in reality display the
meaning of those respective codes (i.e. Male, Female, Unknown etc) instead of displaying
the code of M or F or U

Question: hmmm...so are Lookups used to save the Bytes space on database
machine?
Answer: Noooo. Imagine a situation as below
a. There are 30,000 records in people table of which 2000 records have gender value = U.
In the screen, their Gender is being displayed as "Unknown". Now lets say you want this
to be changed to "Undisclosed". To implement this change, all you have to do is to change
the meaning of the Lookup codes for Lookup type GENDER. Hence it will look like
Code Meaning
------ -------------
M Male
F Female
U Undisclosed

Here lies the beauty of lookups, you do not need to modify 2000 odd records in this case.
Question: Any other usage of lookups?
Answer: Sure, lets take another example. In HRMS, there is a field named Ethnicity.
By default Oracle ERO delivers the below values
Lookup code Lookup meaning
---------------- ---------------------
AS Asian
EU European

Now, if your client wants to track Ethnicity at a granular level, they can amend the
Oracle delivered Lookup definition as below

Lookup code Lookup meaning


---------------- ---------------------
ASI Asian-Indian
ASP Asian-Pakistani
EU European

Hence these values will then be available in the list of values for Ethnicity field.

Question: Are we saying that all the Lookups delivered by Oracle can be Modified?
Answer: It Depends. If oracle has a Lookup called Termination Status, and if based on
the Termination Status Code Oracle has some rules defined within Payroll Engine....!!
Surely Oracle Payroll Engine will not like it if you end date an existing status code or add
a new status code to termination. For this very reason, Oracle flags some Lookups as
System Lookups, and the Lookup Entry screen will not let you modify those Lookup
Codes.

Question: OK, what if I do not wish to modify existing Lookup codes, but only wish
to Add new Lookup codes to an existing Oracle delivered Lookup Type?
Answer: Yes You can do so, provided the Oracle delivered Lookup Type is flagged as
Extensible. Please see the screenshot

Question: Can we add our own new Lookup Types?


Answer: Yes You can, for this you will first define a Lookup type and will then define a
set of Lookup codes against the Lookup Type. In our example above, GENDER is the
LOOKUP_TYPE

Question: Does a LOOKUP_TYPE get attached to a Descriptive Flexfieldjust like


Value Sets?
Answer: Not really. There is no direct relation between Lookup and Descriptive
Flexfield.
Now, the screenshots. Click on the Menu as below to invoke Lookup Screen.

Once in the screen, you can define your Lookup Type and Lookup Codes as below.
Difference between Lookups and Value Sets

Difference 1
Value Sets can be attached to Parameters of a Concurrent Program, whereas Lookups
can't.

Difference 2
Certain types of Lookups are maintainable by the Users too, for example HR Users will
maintain "Ethnic Minority" lookups. Value Sets are almost never maintained by End
users, with the exception of GL Flexfield codes. Value Sets are usually maintained by
System Administrators.

Difference 3
Value Sets can contain values that are a result of an SQL Statement.Hence it is possible to
make Value Set list of values Dynamic.On the contrary, Lookup Codes are Static list of
values.

Here comes the end of another simple article...


Descriptive Flexfield Basics in Oracle Apps

Descriptive flexfields, also refered as DFF

First some basic Question and answers, and then we will do screenshots detailing how
flexfields are configured.

Question: What does DFF mean?


Answer: DFF is a mechanism that lets us create new fields in screens that are delivered
by Oracle.

Question: Oh good, but can these new fields be added without modifying/
customization of the screen?
Answer: Yes, certainly. Only some Setup is needed, but no Programmatic change is
needed to setup DFF.

Question: Why the word Descriptive in Name DFF?


Answer: I think Oracle used this terminology because by means of Setup...you are
describing the structure of these new fields. Or may be Oracle simply used a silly word to
distinguish DFF from KFF (discussed in latter training lesson).

Question: Are these DFF's flexible?


Answer: A little flexible, for example, depending upon the value in a field, we can
make either Field1 or Field2 to appear in DFF.

Question: So we can create New fields in Existing screen, but why the need of doing
so?
Answer: Oracle delivers a standard set of fields for each screen, but different customers
have different needs, hence Oracle lets us create new fields to the screen.

Question: Are these new fields that get created as a result of DFF free text?
I mean, can end user enter any junk into the new fields that are added via DFF?
Answer: If you attach a Value Set to the field (at the time of Setup of DFF), then field
will no longer be free text. The entered value in the field will be validated, also a list of
valid values will be provided in LOV.

Question: Will the values that get entered by the user in DFF fields be updated to
database?
Answer: Indeed, this happens because for each field that you create using DFF will be
mapped to a column in Oracle Applications.

Question: Can I create a DFF on any database column?


Answer: Not really. Oracle delivers a predefined list of columns for each table that are
meant for DFF usage. Only those columns can be mapped to DFF Segments. These
columns are named similar to ATTRIBUTE1, ATTRIBUTE2, ATTRIBUTE3 ETC.
Usually Oracle provides upto 15 columns, but this number can vary.

Question: Can I add hundreds of fields to a given screen?


Answer: This depends on the number of Attribute columns in the table that screen uses.
Also, those columns must be flagged as DFF enabled in DFF Registration screen. Don't
need to worry much about this because all the ATTRIBUTE columns are by default
flagged for their DFF usage.

Question: Hmmm, I can see that DFFs are related to table and columns...
Answer: Yes correct. Each DFF is mapped to one table. And also each Segment (or call it
Field) is mapped to one of the attribute columns in that table.

Question: I want these fields to appear in screen only when certain conditions are
met. Is it possible?
Answer: Yes, we have something known as Context Sensitive Descriptive Flexfields.

In Order to do this, we will follow the below steps (screenshots will follow):-
1. Navigate to the DFF Registration screen in Oracle Apps and query on Table
AP_BANK_BRANCES. Now click on Reference Field
2. Navigate to DFF Segments screen and query on the Title of the Bank Branch and
Unfreeze the Flexfield and add segments as to Section "GLOBAL Data Elements" as
shown in screenshots.

Here are the screenshots......The descriptions are embedded within the screenshots.

We are in "Bank Branches screen" below, that is available in Payables responsibility.


We need to add a new field as below.

Once having noted down the table, we try to find the Title of the DFF for that Table. We
go to Flexfield/Register
Here we pick the Title of the respective DFF

Query on that DFF Title from Descriptive Flexfield Segment Screen


Add a new segment under "Global Data Elements"

The options for making mandatory or enabling validations for the new field.
Once you finalize the changes, you will be prompted to Freeze the DFF definition. Click
on OK

Now, we see the fruits of our configuration


Context Sensitive Descriptive Flexfields

An article on Context Sensitive Descriptive Flexfields, for beginners that follow


http://getappstraining.blogspot.com

A training article on Context Sensitive Descriptive flexfields.


IMPORTANT:- You must read Basics Flexfield article . This article is an extension to the
work that we did for a simple flexfields.

First some basic Question and answers, and then we will do screenshots detailing how
flexfields are configured.

Question: I want these Flex fields to appear in screen only when certain conditions are
met. Is it possible?
Answer: Yes, you can. Lets take an Example. You have a "Bank Branch" screen where
you enter the Bank names and their branches . There is a field named Branch Type in that
screen. You wish to show & capture following new fields:-
a. Banks Country of Origin Field ( regardless of bank branch type, we must show this
new field). As we configured in earlier training chapter.
b. If user entered a value of SWIFT in Branch type, then display a new DFF segment
"SWIFT Partner field".
c. If Branch type CHIPS is selected by the user, then display a DFF segment "Chip ID"
field.

In Order to do this, we will follow the below steps(screenshots will follow) :-


1. Navigate to the DFF Registration screen in Oracle Apps and query on Table
AP_BANK_BRANCES. Now click on Reference Field, and ensure that
BANK_BRANCH_TYPE field can be used as a context switch. In our case we add this
field as a reference field.
2. Navigate to DFF Segments screen and query on the Title of the Bank Branch and
Unfreeze the Flexfield and add segments as in screenshot below. Register the
BANK_BRANCH_TYPE field as a reference item.
3. Create the contexts for each possible value of Bank Branch Type field(for which you
want conditional display of fields)....

Hmmmm not clear yet, see the the screenshots and you will surely understand......
Find out the table name for Bank Branch screen, this will enable us to find the DFF that is
available for Bank Branch

The Bank Branch can have one of the following values.


Given that our DFF will be sensitive to what we enter in Bank Branch, we must find out
name of the field(not the display name). This can be done by using examine as shown

We can see that internal name of the Branch Type is "BANK_BRANCH_TYPE". We


need to ensure that a DFF can be made sensitive to the value in BANK_BRANCH_TYPE
Lets navigate to DFF registration screen, and using the table name, we query DFF for
AP_BANK_BRANCHES.

Alternately you can query using DFF title too.


Now lets add BANK_BRANCH_TYPE as a REFERENCE Field, by clicking on Button
Reference

Now we need to define the new fields(segments). This screen is accessed via
menu /Descriptive/Segments . In this screen, lets make BANK_BRANCH_TYPE as the
context/reference. This means that DFF will become sensitive to values in Branch Type
field
IMPORTANT: If your requirement is not to have any conditiional logic, then no need for
all the "Reference Field" blaaa. All you need to do is to add your segment to Global Data
Elements
When the user selects Type=SWIFT, we see the relevant SWIFT field appear in Flexfield
window
When user selects Type=CHIPS, we see CHIP Id field appearing in Flexfield window.

Here we now see that value entered in DFF field gets stored in the database column,
Key Flexfields Basics

Please find an article on the very basics of Key Flexfields.

Question : We have already covered Descriptive Flexfield in detail in previous article,


should we still bother learning key flexfield?
Answer : Indeed we must learn this. When I myself learnt Oracle Apps, all I had was the
cryptic definitions in Oracle Manual, and it took me weeks to get my head around the
differences between Key Flexfields and Descriptive Flexfields. Now I hope you can learn
this crystal clear in minutes.

Question: Key Flexfields help us capture additional fields, and so does descriptive
flexfield too? What is the deal here?
Answer: Ok, lets assume for a minute that there is no such thing as a key flexfield. All
we have is a descriptive flex (lets assume).
Requirement is this:-
Your client wants to capture values in following additional fields for a purchase order
transaction and invoices...
Company name: GM
Cost Centre: IT
Project: OFP --means Oracle Fusion Project
Expense Type: OCC -- Oracle Consultant Cost

In a DFF ONLY WORLD, when your client raises Purchase Order to IT Consulting
Company, in PO_DISTRIBUTIONS_ALL table record you will store
ATTRIBUTE1 :- GM
ATTRIBUTE2 :- IT
ATTRIBUTE3 :- OFP
ATTRIBUTE4 :- OCC

When an invoice is received from consulting company, the Payables clerk will capture the
Invoice Line accounting as below in AP_INVOICE_DISTRIBUTIONS_ALL
ATTRIBUTE1 :- GM
ATTRIBUTE2 :- IT
ATTRIBUTE3 :- OFP
ATTRIBUTE4 :- OCC
These 4 text values for fields(above) are physically being duplicated in each module, for
the related/unrelated transactions.

Imagine further when this transaction flows to Oracle General Ledger, would you again
expect oracle to physically store the 4 columns into table GL_JE_LINES? If so your table
GL_JE_LINES will have following values in its DFF (Descriptive Flex) columns....
ATTRIBUTE1 :- GM
ATTRIBUTE2 :- IT
ATTRIBUTE3 :- OFP
ATTRIBUTE4 :- OCC

Surely, such design using a descriptive flexfield will be flawed, as it causes duplication of
data at various places.
Now that you understand why Descriptive flexfield does not fit into this design, lets
consider a new scenario.

Consider an alternate approach.( using KFF )


Lets have a table named gl_code_combinations with following columns.
CODE_COMBINATION_ID
SEGMENT1
SEGMENT2
SEGMENT3
SEGMENT4

Lets capture A SINGLE record in this table as below:-


CODE_COMBINATION_ID : 10902
SEGMENT1 : GM
SEGMENT2 : IT
SEGMENT3 : OFP
SEGMENT4 : OCC

Note the above combination of 4 fields can be uniquely identified by


10902(CODE_COMBINATION_ID).

In PO_DISTRIBUTIONS_ALL table, we will have below column with value


CODE_COMBINATION_ID : 10902
NOTE: Now we are not storing all four columns here in PO Dist table, as we store the
Unique ID of the record in Key Flexfield table.

Again, in Account Payables, even though the clerk will enter in screen values for four
columns (four each segment), the database will only store value 10902 in column
CODE_COMBINATION_ID of payables distributions table.
Ditto for the entry in GL_JE_LINES table in oracle general ledger, only the ID that
references those 4 columns will be stored.

Hence all the tables(PO Dist, AP Dist, GL JE Lines) will reference just the
CODE_COMBINATION_ID.

Now some Q & A below

Question: Does this mean, for each key flexfield, there will be a dedicated table? And
such table will hold the unique combination of field values that can be reused?
Answer: correct. For gl accounting key flexfield, there is a table named
gl_code_combinations. Other examples are grades in oracle human resources. A grade can
be defined as a combination of say Clerk + Senior or Clerk + Junior. These combinations
will be stored in per_grades table.

Question: do all the tables which are used for storing key Flexfields have columns named
segment1,segment2...segmentx?
Answer : Correct, it is a standard practice used by oracle. Thee segments columns are
generic columns so that each client can call them by whatever name as they desire.

Question: Does Oracle deliver Key-Flexfields out of the box, which will pop-up a
window with relevant fields, as configured during setup.
Answer : Yes, and if value sets are attached, the fields can be validated too.

Question : Is there a step by step example of setting up key flexfield.


Answer : Have a look at article for Setting up Special Information Types in HRMS using
Key FlexField .
For change in perspective, I have covered a HRMS Key Flexfield, named Special
Information Types.
Special Information Types -SIT in HRMS

In this article, I will explain in steps:- How to create special information types in Oracle
HRMS.

Once you have learnt the fundamentals of SIT, you can then also reference the article on
migrating special information types into Oracle.

Before we dive into the special information type creation example, lets first do some
questions and answers.

Question: What is so special about special information types?


Answer : Nothing is special about SIT !!, it happens to be a Key FlexField, effectively a
combination of segment/field values get attached to a person/hr record. In plain English,
SIT is a mechanism by which you can create new fields, to capture additional information
against an HRMS record.

Question : Why use an SIT when we can enable descriptive flexfields against the person
record.
Answer : Various reasons, as listed below:-
A. Data in Descriptive Flexfield against an employee record will be visible to all the users
that have access to the Employee creation/query screen.
On the contrary, using HR Workflow security, we can make SIT to become visible for the
responsibility that we desire.
B. There is limited number of descriptive flex field columns available.
C. SIT let you logically group similar information together. For example, you may wish to
capture "Medical illness history/details" and also Citizenship/Country Residency History"
of your employees. In this case, you will create two different SIT.

Question : So, can we create multiple Special Information Types?


Answer: Indeed, you can define as many contexts as you desire for special information
type key Flexfield in Oracle Apps.

Question : What are the steps in brief for setting up an SIT


Answer:
Analysis of sit requirement, which includes
A. Find additional fields that are required for your HRMS screen, and can be logically
grouped to be enterable from one window.
B. The validations that will be required against each of the SIT fields. Note: some people
prefer to call them segments instead of fields. Anyway, for these validations you will
need to create value sets, or will have to find an existing value set that can be reused.

Implementation: of special information type


A. Configure the key Flexfield
B. Add segments to the key flex field
C. Assign value sets to segments. Skip this step if you want your key flexfled segment to
be free text. Value sets are attached to each such segment that requires validation.
D. In HRMS Superuser responsibility , enable the key flexfield context in screen "Define
special information type"

Question : Give me the example of the SIT, to which we will migrate values.
Answer : For this training exercise, we will assume following SIT exists in Oracle Apps.
Sit name : "XX Medical History Of Person"
Sit Fields:
Medical Condition
Year of illness
Cured Flag (Yes/No)

Question: Show me the steps visually, using screenshots...


Answer: As below

First, go to Key Flexfield register screen and query to find the title of KFF. No changes
are done in this screen,

Go to application developer responsibility, and click on menu key flexfield segment.


Query on the title in key flexfields segment screen.

Add a new context/structure to this flexfield.


The name of this context is "XX Medical History Of Person" in our example.

Click on segments, to add segments/fields for this special information type.


Add the three segments as below

Freeze the structure (structure ,means combination of these 3 segments)


Also, ensure the Dynamic Inserts are Checked(Turned On)
In HRMS responsibility , go to define special information types and create an entry for the
context.

Now go to person record, by finding for the person that we migrated in earlier article .

Click on button labeled special Info


See the SIT in action here, finally
Install tools for Oracle Apps Development

This article is for setting up the PC for Oracle Apps development, for the readers of
http://getappstraining.blogspot.com

9i/10g Oracle Client


---------------------------
This will install
Workflow Builder
SQL*Plus
Once installed, you must then try to connect to the apps schema of your development
database.

D2K, with forms version 6i


---------------------------
This will install
Oracle Forms
Oracle Reports
Next, you need to upgrade the default version of installed Forms 6i by downloading and
applying patch 3596539 from Metalink.

Once installed, ensure that you can connect to apps schema from Oracle Forms and Oracle
Reports.

A Unix client
---------------------------
A unix shell program like ssh or putty or any others, that
a. Lets you do ftp or sftp with your servers
b. Lets you logon to your middle tier or the database tier to Unix Prompt
Note: I am assuming a Unix install for Oracle Applications.
Oracle jDeveloper for OAF ( Optional:- Only needed if developing extensions to
OAF).
Download patch 4045639 from Metalink. Please note that this patch comes bundled with
jDeveloper and all the Apps related libraries.

Oracle IDE
---------------------------
A rapid pl/sql development tool like TOAD or PL/SQL developer or Golden or
SQL*navigator. Note this is optional, but I suggest you get used to one of these. My
personal favorite is Pl/SQL developer from
http://www.allroundautomations.com/plsqldev.html

Workflows
--------------
I suggest you create a directory similar to c:\oracle\wf
Next you need to ensure that you are able to connect to apps schema from the workflow
builder. Once connected, open workflow named Standard, and save this as WFSTD.wft.

Click on File/Open in Workflows Builder


Connect to database to apps schema
Open workflow Standard and save it as WFSTD.wft. You will require this wft file for
building all new Workflows.

Next we need to do the following:-


1. Ensure that you are able to connect to apps schema from all the above tools.
2. FTP any given Oracle delivered report to your PC. Next you need to ensure that you are
able to open that report. This is equivalent to sanity checking your Reports install, but is
optional step.
3. FTP the following files from your mid tier, to a directory named c:\oracle\forms
TEMPLATE.fmb
APP*.pll
FND*.pll
Note: These files are available on $AU_TOP/forms/US or from $AU_TOP/resource
Add directory c:\oracle\foms to your registry path named FORMS60_PATH. In order to
do this, do windows run, regedit, inside registry follow path
HKEY_LOCAL_MACHINE/SOFTWARE/Oracle.
You will see a variable named FORMS60_PATH.
After setting your registry path, open the forms designer, and see if you can open
template.fmb without any problems. If you are prompted that any specific library is
missing, then ftp that library too into your c:\oracle\forms. In case, when opening the
form, you get an error like "xyz.pll is missing" and if you believe xyz.pll is already there
on your pc, the you should try to open xyz.pll itself.
The error might be related to some other pll being referred indirectly by xyz.pll. In simple
words you need to recursively ftp all the form files, which are needed as foundation for
forms development in apps.

Similarly, you need to add c:\oracle\reports to the REPORTS60_PATH in registry.

You are now ready to roll with your Oracle Apps development tasks..
Steps for your first PL/SQL Concurrent Program in Oracle Apps
I think this topic is already covered partially in one of the previous training lesson[ for concurrent
programs], but I would like to touch base on this again.

Lets revisit some basics first

Question: What are the ingredients for a concurrent program?


Answer: A concurrent executable and a program attached to that executable.

Question: Will executable for a pl/sql concurrent program be a database stored


procedure?
Answer: Yes, but in addition to above you can also register a procedure within a package
as an executable. However, you can't make a Function to become the executable for a
stored procedure.

Question: Does this stored procedure need to have some specific parameters, in order to
become an executable of a concurrent program?
Answer: Yes, such procedure must have at least two parameters
( errbuff out VARCHAR2, retcode out NUMBER)

Question: Can we add additional parameters to such pl/sql procedures that happen to be
Conc Prog Executables?
Answer: Sure you can, but those parameters must be defined after the first two
parameters. Effectively I mean first two parameters must always be errbuff and retcode.
The sequence of the remaining parameters must match with the sequence in which
parameters are registered in define concurrent program-parameters window.

Question: Can those parameters be validated or will these parameters be free text?
Answer: These parameters can be attached to a value set, hence this will avoid users
passing free text values.

Question: What are the possible things that a concurrent pl/sql program can do?
Answer: Firstly your stored procedure would have been created in apps. This concurrent
program will connect to "apps schema" from where access to all the tabes across every
module will be available.
You can do the following:-
1. Insert records in tables(usually interface or temp tables)
2. Update and delete records
3. Initiate workflows
4. Display messages in the output file or the log file of the concurrent program.
5. Make this concurrent program complete with status Error or Warning or Normal.

Question: Please give me an example of a pl/sql concurrent program in Oracle apps in


real life?
Answer: Lets say you have an external application which is integrated with apps. Assume
that it is Siebel application where the new customer records are created. Siebel is
assumingly hosted on a Oracle database from where it has database links to your Oracle
apps database.
In this case, siebel inserts sales order records into your custom staging tables.
You can then develop a concurrent process which will do the following:--------
Loop through the records in that staging table
Check if the customer already exists in Oracle AR TCA
If customer already exists, thencall the api to update existing customer
If this is a new customer, then update existing TCA Customer/Party record

Question: Ok, how do I do the above?


Answer: Find the steps below for doing so
Step 1
Connect xxschema/password
Create table xx_stage_siebel_customers ( customer_Id integer, customer name
varchar2(400));
Grant all on xx_stage_siebel_customers to apps ;
Step 2
Connect apps/apps_password
Create or replace synonym xx_stage_siebel_customers for
xxschema.xx_stage_siebel_customers ;
Step 3 ( again in apps schema)
Create or replace procedure xx_synch_siebel_cust ( errbuff out varchar2, retcode out
varchar2 ) is
n_ctr INTEGER := 0 ;
Begin
for p_rec in ( select * from xx_synch_siebel_cust ) LOOP
Select count(*) into n_ctr from hz_parties where party_number =
p_rec.customer_number;
If n_ctr=0 then
Hz_party_create(pass appropriate parameters here).
Else
Hz_party_update(pass appropriate parameters here);
End if;
END LOOP ;
delete from xx_synch_siebel_cust ;
End xx_synch_siebel_cust
Step 4
Create concurrent program executable ( for example of screenshot, visit link )
Step 5
Create concurrent program for that executable
Step 6
Add this concurrent program to request group

Now your program is ready to roll....


Restart or Bounce Apache in Oracle Apps 11i

I find this script very handy for bouncing the Apache, specially when
working on Self Service Applications.

Please find the two commands that I use for bouncing the Apache

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

Of course this needs to be done in Middle Tier of Oracle Applications.

In case you have modified any java or class file in OAF ( Oracle Applications
Framework ), then Apache bounce becomes mandatory for those changes to take effect.

In case you modify and load the XML Document in Oracle Framework, then
it is noticed, for those XML changes to take effect, complete bounce of Middle
Tier is required in Oracle Apps.

If your client is still stuck with AK Developer, then Apache bounce will be required
after akload has been executed.

Playing with CUSTOM.pll

Please find some commands for CUSTOM.pll

To convert from CUSTOM.pll to CUSTOM.pld


f60gen module_type=LIBRARY module=CUSTOM script=YES userid=apps/apps

To convert back from CUSTOM.pld to CUSTOM.pll ( after having edited the text
pld file )
f60gen module_type=LIBRARY module=CUSTOM parse=YES userid=apps/apps

To convert from CUSTOM.pll to CUSTOM.plx


f60gen module_type=LIBRARY module=CUSTOM userid=apps/apps
Read Only Schema in Oracle APPS 11i

In this article I have discussed how to create and maintain a read only schema for APPS in
Oracle eBusiness Suite.

Whilst in the past I have known clients to implement this using synonyms. However the
approach discussed below is designed without the need of having to create a single
synonym in APPS_QUERYschema.

Step 1
Create the read-only schema, in this case lets call it APPS_QUERY.

Step 2.
Surely, the schema created in above Step 1 will be given read only grants to objects in
apps. There will be cases where the grant command might fail. To monitor such failures
create a table as below
conn xx_g4g/&2 ;
--For APPS_QUERY. This table will capture the exceptions during Grants
PROMPT create table XX_GRANTS_FAIL_APPS_QUERY
create table XX_GRANTS_FAIL_APPS_QUERY (
object_name VARCHAR2(100)
,sqlerrm varchar2(2000)
,creation_date DATE
);

grant all on XX_GRANTS_FAIL_APPS_QUERY to apps with grant option;

grant select on XX_GRANTS_FAIL_APPS_QUERY to apps_query ;

Step 3
In this step we grant select on all the existing views and synonyms in apps schema to
apps_query.

conn apps/&1 ;

PROMPT This can take upto 15-30 minutes


PROMPT Granting SELECT on All synonyms and views to apps_query
DECLARE
--One off script to execute grants to apps_query
v_error VARCHAR2(2000);
BEGIN

FOR p_rec IN (SELECT *


FROM all_objects
WHERE owner = 'APPS'
AND object_type IN ('SYNONYM', 'VIEW')
AND object_name NOT LIKE '%_S')
LOOP
BEGIN
EXECUTE IMMEDIATE 'grant select on ' || p_rec.object_name ||
' to apps_query';
EXCEPTION
WHEN OTHERS THEN
v_error := substr(SQLERRM, 1, 2000);
INSERT INTO bes.XX_GRANTS_FAIL_apps_query
(object_name
,SQLERRM
,creation_date
)
VALUES
(p_rec.object_name
,v_error
,sysdate
);
END;
END LOOP;
COMMIT;
END;
/

Step 4
Write a after logon trigger on apps_query schema. The main purpose of this trigger is to
alter the session to apps schema, such that the CurrentSchema will be set to apps for the
session(whilst retaining apps_query restrictions).In doing so your logon will retain the
permissions of apps_query schema(read_only). Howerver it will be able to reference the
apps objects with exactly the same name as does a direct connection to apps schema.

conn apps/&1 ;
PROMPT CREATE OR REPLACE TRIGGER xx_apps_query_logon_trg
CREATE OR REPLACE TRIGGER xx_apps_query_logon_trg
--16Jun2006 By Anil Passi
--Trigger to toggle schema to apps, but yet retaining apps_query resitrictions
--Also sets the org_id
AFTER logon ON apps_query.SCHEMA
DECLARE
BEGIN
EXECUTE IMMEDIATE
'declare begin ' ||
'dbms_application_info.set_client_info ( 101 ); end;';
EXECUTE IMMEDIATE 'ALTER SESSION SET CURRENT_SCHEMA =APPS';
END;
/

Step 5
Create a Trigger on the apps schema to issue select only grants for all new views and
synonyms. Please note that I am excluding grants for sequences. SELECT grants for
views and synonyms will be provided to apps_query as and when such objects are created
in APPS. Please note that, all the APPS objects (views and synonyms) that existed in
APPS schema prior to the implementation of this design, would have been granted read-
only access to apps_query in Step 2.

conn apps/&1 ;
PROMPT CREATE OR REPLACE TRIGGER xx_grant_apps_query
CREATE OR REPLACE TRIGGER xx_grant_apps_query
--16Jun2006 By Anil Passi
--
AFTER CREATE ON APPS.SCHEMA
DECLARE
l_str VARCHAR2(255);
l_job NUMBER;
BEGIN
IF (ora_dict_obj_type IN ('SYNONYM', 'VIEW'))
AND (ora_dict_obj_name NOT LIKE '%_S')
THEN
l_str := 'execute immediate "grant select on ' || ora_dict_obj_name ||
' to apps_query";';
dbms_job.submit(l_job, REPLACE(l_str, '"', ''''));
END IF;
END;
/

Some notes for this design

Note1
You need to ensure that the schema created in Step 1 has very limited permissions. Most
importantly it must not be given grant for EXECUTE/CREATE ANY PROCEDURE.
You will need to agree with your DBAs upfront for the permissions,

Note 2
Only views and synonyms will be granted access. Objects in your xx_g4g(bespoke)
schema should have their synonyms in apps already in place.

Note 3
If your site has multi org enabled, you will then have to set the org I'd after loggiong on to
apps query schema. In case you have only one single ORG_ID, then would have been set
as in Step 4 above.

Note 4
ALTER SESSION SET CURRENT_SCHEMA =APPS
This facilitates users to run their queries as if they were connected to apps schema.
However, their previliges will be restricted to those of apps_query

Note 5
It is assumed that ALTER SESSION privilege will exist for APPS_QUERY schema.
Create Oracle FND_USER with System Administrator

If you have the Apps Password, its quite easy to create a FND_USER for yourself by
using the API.

I find this script very useful when development environment gets cloned from Production
(that is when i do not have FND_USER in Production.

Please note that:-


1. You will be allocated System Administrator by this script. Hence you can assign
whatever responsibilities that you desire latter, after logging in.
2. The password will be set to oracle
3. You need apps password to run this script. Alternately you need execute permission on
fnd_user_pkg from the user where this script will be run. If using some other user, please
use apps.fnd_user_pkg.createuser
4. You need to do a COMMIT after this script has run. I have not included the commit
within this script.
5. When running this script, you will be prompted to enter a user name.

--------Beging of script--------------
DECLARE
--By: Anil Passi
--When Jun-2001
v_session_id INTEGER := userenv('sessionid');
v_user_name VARCHAR2(30) := upper('&Enter_User_Name');
BEGIN
--Note, can be executed only when you have apps password.
-- Call the procedure to Creaet FND User
fnd_user_pkg.createuser(x_user_name => v_user_name
,x_owner => ''
,x_unencrypted_password => 'oracle'
,x_session_number => v_session_id
,x_start_date => SYSDATE - 10
,x_end_date => SYSDATE + 100
,x_last_logon_date => SYSDATE - 10
,x_description => 'appstechnical.blogspot.com'
,x_password_date => SYSDATE - 10
,x_password_accesses_left => 10000
,x_password_lifespan_accesses => 10000
,x_password_lifespan_days => 10000
,x_employee_id => 30 /*Change this id by running below SQL*/
/*
SELECT person_id
,full_name
FROM per_all_people_f
WHERE upper(full_name) LIKE '%' || upper('<ampersand>full_name') || '%'
GROUP BY person_id
,full_name
*/
,x_email_address => 'appstechnical.blogspot@gmail.com'
,x_fax => ''
,x_customer_id => ''
,x_supplier_id => '');
fnd_user_pkg.addresp(username => v_user_name
,resp_app => 'SYSADMIN'
,resp_key => 'SYSTEM_ADMINISTRATOR'
,security_group => 'STANDARD'
,description => 'Auto Assignment'
,start_date => SYSDATE - 10
,end_date => SYSDATE + 1000);
END;
/
A New Custom Form in
Oracle Apps

In this training article (for the readers of http://getappstraining.blogspot.com ), we will


learn the steps needed to develop a custom Oracle Apps form from the very scratch.

In the previous chapter we learnt "how to customize an existing oracle delivered form"

Question: Why bother teaching this when Oracle fusion is destined to replace oracle
forms by OA Framework?
Answer: Well firstly I am yet to hear an official word from Oracle in this regard, but I
agree it is highly likely that fusion will se demise of Oracle Forms. However more
importantly Oracle will support current tech stack indefinitely, I.e Release 12 will be
supported for foreseen time as per Apps Unlimited statement. Hence, many of the clients
will keep using this technology for decades. Yes, I won't bother my kid learning Oracle
form though.

Question : Ok, what are the steps for building a screen from scratch?
Answer: Below steps in brief
A) Open up TEMPLATE.fmb, and save this as XXHELLOAPPS.fmb
B) Create a new window, by right clicking on Window/new
Name this window as XXHELLOAPPS,and assign it SubClass Type WINDOW from
picklist.
C) Create a new canvas and name it XXHELLOAPPS , ensuring its Sublcass Type is
Content
D) Make the windows property reference canvas XXHELLOAPPS and vice versa make
the canvas reference windows XXHELLOAPPS.
E) Now create a block named XXHELLOAPPS . Lets keep this a control block for
simplicity.
F) go to form level property, and set first navigation block to XXHELLOAPPS.
G) Add a label and a field named Hello_World to this block.
H) Generate the form on PC using Control-T keystrokes. This will ensure that nothing
critical has been missed out.
I) FTP the form file to $XXPO_TOP/forms/US
Surely, this XX will be replaced by the naming convention at your client/company.
J) cd to $XXPO_TOP/forms/US
And f60gen on XXHELLOAPPS.fmb
This will create a file executable as XXHELLOAPPS.fmx
K) Go to Application Developer responsibility
Menu /applicaton/form
Register the form
L) Register the Forms Function
Have you read he article form
functions[http://getappstraining.blogspot.com/2006/10/oracle-forms-functions-menus-
and-their.html] yet?
This forms function must be registered against application "XX Purchasing".
M) Now add a menu item so that this forms function becomes available to specific
responsibility.

Thats it, you will be able to open up this form from the responsibility.

Now some important notes:-


1. If you have a table based block, and if that block has some description type fields, then
try not to fetch them from post query trigger. Instead, develop a view in apps schema and
assign that view as base tale to this block. This has a benefit that users will be able to
query on the description field if need be. Indeed you will need to do dml on the actual
table yourself by overriding on-insert, on-update, on-delete and on-lock triggers.
2. For each block in the screen, create a form level package spec and package body. Your
triggers in the block/block fields will make calls to that package.
3. Try not to do to much pl/sql within the form. Always do such database intensive
operations in a database level package.
4. Try not using global variables, unless really needed. Give preference to the creation of
form package variables.
5. In a multi record block, always add a field for Current Record Indicator.

Please let me know if anything is unclear. Feel free to ask your questions.
Forms Customization Steps in Oracle Applications

This article is for the readers of http://getappstraining.blogspot.com ,listing the steps


required to customize a form in Oracle Applications.
Lets do some Questions and Answers:-

Question: Is it a common practice to modify forms in Oracle Apps?


Answer: Yes and No.
Yes because you often will be called upon to modify the forms, but no because most often
you should modify the screen without actually modifying the underlying forms executable
.

Question: How can I modify screen without modifying the underlying executable ?
Answer: There are two ways, listed in the order of preferences:-
1. Forms Personalizations
2. CUSTOM.pll

Question: How does forms personalization work?


Answer: Oracle forms has triggers that we trap to write our business logic. Oracle has a
standard practice of calling a generic piece of code from each trigger(at form level). In
this generic piece of code Oracle checks in personalizations tables to see if anything extra
needs to be done for the events being executed. For details of example, see the article for
forms personalizations

Question: Fine then, but why is CUSTOM.pLL needed when we already have forms
personalization?
Answer: Well just like any technology, forms personalization has its limitations.

Limitation example 1 of forms personalizations


---------------------------------------------------
For example you wish to prompt a message to user DO YOU WISH TO CREATE THIS
PERSON AS SUPPLIER OR CUSTOMER OR EMPLOYEE. Lets say this message will
prompt three options, create customer , create supplier or create vendor. Depending upon
what user selects, you wish to navigate to one of relevant screens from the current TCA
screen. For this, you have no choice but to use CUSTOM.pll

Limitation example 2 of forms personalizations


---------------------------------------------------
For example you wish to change the record group of a LOV, via changing its query, in a
screen. This can be done by CUSTOM.pll, but not by forms personalization.

Question: What about CUSTOM.pll, what can't be done via custom.pll ?? Hence calling
for forms customization.
Answer: For example, you need to add a complete new section to the screen at a very
specific location, this must be done via forms customization.

Question: Ok, what are the steps for customization of such screen?
Answer: Below steps in brief
A) Identify the form in Oracle Apps that needs to be customized.

B) Go to the specific directory on one of the mid-tiers to get that forms executable. Say
from $AU_TOP/forms/US/POENTRY.fmb.

C) FTP that form and all its dependable form objects & pll files to your PC.

D) Open the form, ensuring that you do not receive any errors pertaining to missing
library or missing form object.

E) Perform a save-as to rename this form on your pc, using your company's naming
conventions.

F) Make the desired modifications to the form.

G) Generate the form on PC using Control-T keystrokes. This will ensure that nothing
critical has been missed out. Surely you will need to connect to apps schema before
generating the form.

H) FTP the form file to $XXPO_TOP/forms/US


Surely, this XX will be replaced by the naming convention at your client/company.

I) cd to $XXPO_TOP/forms/US
And f60gen on XXPOENTRY.fmb
This will create a file executable as XXPOENTRY.fmx

J) Go to Application Developer responsibility


Menu /applicaton/form
Register the form

K) Register the Forms Function


Have you read the article form functions ?
This forms function must be registered against application "XX Purchasing".
L) Now add a menu item so that this forms function becomes available to specific
responsibility.

Question: Well, a question about (A), how to identify the form executable?
Answer: There are two ways.
Method1
Open the form to be customized in Oracle Apps from respective Responsibility/Menu
Next select menu /Help/About Oracle Application.
Here, scroll down within the subwindow and search for fmx. This is the executable that
oracle application runs when specific form is invoked.

Method2
Query the responsibility definition which has the form attached to this. Note down the
Menu which is attached to Responsibility. Go to the menu definition screen and find the
form function attached to this menu. From this form function find the form attached to
this function.

Question: Regarding (I), what is the command for f60gen


Answer:
FORMS60_PATH=$FORMS60_PATH:$AU_TOP/forms/US
export FORMS60_PATH
cd $XXPO_TOP/forms/US
f60gen module=XXPOENTRY.fmb userid=apps/apps module_type=form batch=no
compile_all=special
Customization of Reports in Oracle Apps

Oracle Reports will become a thing of past in Fusion, however it will still demand
resources for the next 5yrs or so.

Hence I decided to write this article to fulfill my commitment towards


http://getappstraining.blogspot.com

We learnt in Forms Customization article that customized executables must be registered


with Custom Application. This rule applies to Oracle Reports too in Oracle Applications.

Important note: Just like Oracle Forms, there is no place for D2K Reports in Fusion.
This will be replaced by XML publisher. I will explain that transition in a latter article
very soon.

Question: I have been asked to customize Invoice Print program which happens to be an
Oracle Report. What will be the steps, that I must follow.
Answer : Follow the steps below.
1. You will be told the name of the existing report that must be customized. Note down
the exact name and query that name in Concurrent Program screen. Click on Copy
Program button selecting checkbox option Copy Parameters. This will help you copy
the current program definition to custom version of the program.
Also note down the name of the executable as it appears in concurrent program definition
screen.

2. In same responsibility i.e. Application Developer, navigate to screen concurrent


executable and query on the field labeled "Executable Short Name".
Note down the application within which it is registered. If the application is Oracle
Receivables, then you must go to the database server and get hold the file named
RAXINV.rdf in $AR_TOP/reports/US.

3. Copy that file to your custom AR Top directory. Basically that is the directory where
custom reports for AR will be deployed..
cd $XXAR_TOP/reports/us
cp $AR_TOP/reports/us/RAXINV.rdf $XXAR_TOP/reports/us

Effectively you have now done the following:-


1. Made the custom version of report registered with XXAR application. If you worked
for say company named EA, then this might have been $EAAR_TOP/reports/US
2. When you run that report, Oracle concurrent manager will search for that report in
$XXAR_TOP/reports/US
The report will be found there, and executed.

Note: We havent made any changes as yet. Also, you need to include the new concurrent
program name in the relevant request group.
Now you can ftp that report to your pc, make modifications for necessary customizations,
and then ftp that piece of rdf back to the server. Run it again, to see it working.

Some important tips:-


1. Avoid writing SQL in format trigger, although in rare cases it becomes necessary to do
so.
2. Learn from Oracle's Report, by reverse engineering them.
3. Do not write a formula column for something which can be achieved by amending the
query in data group itself.
4. Do not hardcode things like Currency Formatting. Have a look at Oracle's Amount
fields, and use the same user exit.
5. srw2.message can be used for minor debugging, as those messages will appear in the
log file of the concurrent program.
6. You can set the trace checkbox against the concurrent program definition, to generate
SQL Trace. This trace will not produce bind variable values though.
7. Join between two queries in data group will always be outerjoined, by default.
8. Avoid filters on Data Group queries. Try to implement that logic within the query itself.
Migration program in Apps. Migrate Customers

This article explains the steps to write programs for data migration in Oracle Apps.

Question : Why this article?


Answer : Because in every Oracle ERP implementation you have some level of data
migration activity. I will try to explain the steps, followed by a real life example of data
migration.

Question : How to do data migration?


Answer :
A. Prepare the source data
B. Design your staging tables and write code
C. Test Test Test....

Question : What is involved in the preparation stage of data migration in oracle apps?
Answer: For the Preparation stage, following must be done.
1. Understand the structure of the data being imported and also its business purpose.
2. Fully understand where the data will end up residing into Oracle Apps.
3 Find out if open interfaces or APIs exist in Oracle Apps to facilitate loading the required
data.
4. Ensure that lookup codes or setup in Oracle apps support the values that are coming
from source system.
5. Think about how the errors will be reported and managed.
6. Also think about how the transactions that fail migration will be re-tried. You may
decide to knock of a simple screen if high volume of transactions needs user intervention
for cleansing.

Question: And how about the development stage during migration?


Answer: Do the following
1. Design the stages in which data will flow.
Traditionally, your legacy/source data will be loaded into some temporary(staging) tables
in a raw(as is) fomat/strucutre . Next you will translate the data into the physical structure
that is similar to structure of Oracle Apps table/API. And then you will call the API or
populate the Open Interface tables.
2. For doing the above, you will first write one-off scripts to create those staging tables
and load data into them using SQL*Loader or some other methodology. If your source
system is Oracle too, then I suggest you create a db link to pull the data into your staging
tables.
All the steps pertaining the transformation can be done via a pl/sql concurrent
Program(unless you are using tools like Warehouse builder)
3. Run the concurrent program that you have would written for transformation of data.
This will either populate your Open Interface Tables or it will perform migration if APIs
are being used.
(Again all this can be done via tools too, but here I am talking about a small migration
activity, hence ignore the tool talk)
4. Ensure that errors are logged into some error logging table.
If the data errors in Oracle's open interface tables, then you could have a database view
that does a union on your error table and also oracle's error logging table.

Question: How about testing?


Answer: You will figure out the following at this stage, from the records that error
1. Missing mapping codes
2. Missing setups in oracle apps.
Testing will most likely be repetitive, until you are able to have a migration run which
leaves behind the records that are very low in volume or non-existent.

Question : If I get a comma delimited file, how will I load that into tables?
Answer : You can use a Sql*Loader, or a java program with a csv parser or a file based
table approach.

Question : In oracle apps during migration, do we usually receive xml data file?
Answer : Keep in mind that you usually migrate data from mainframe or standalone
systems which now stand outdated.
Such systems usually produce comma delimited or tab delimited file.

Question : Ok, once the data from source system has been loaded using sql*loader, what
next?
Answer: The data model of the source data may or may not comply with the data model
in oracle apps. Hence you need a transformation step in most cases. This is explained
below with an example of TCA API to migrate customers/parties.

Question : Should I not ask the legacy system people to transform data as per our
requirements?
Answer : No, don't bother doing so, for below reasons :-
A. Techies of legacy system will not be happy that their system is now being made
redundant. Hence don't expect much value addition from them.
B. There is a possibility that in an attempt to transform data to Oracle's data structure, they
might induce faults/bugs.
If the transformation bugs are encountered at your end in apps, you can fix them yourself.
However if legacy team does transformation for you, then you become dependent on
them for bug fixes. Eventually tired of waiting on them, you might end up doing
transformation yourself anyway.
C. If your design for transformation changes, you should not be dependent upon the
legacy system...just fix it yourself at your own end in apps.

Question : If we end up using interface api's in apps for data migration, then where lies
the difference between migration and interfaces?
Answer : Migration is a one-off activity, even though it uses the same sets of tables/API's
as interfaces do.
Question : Enough explanation, now give me an example.
Answer : Lets assume you get a task to migrate customers from legacy system into TCA
(or call it AR - Receivables for simplicity).
Your file from source is:-
lcust.dat
1000,GE, GE Capital,1000-1
1001,Cisco,Cisco Routers,1001-1
1002,Barclays,Barclays Investments,1001-1
1003,Barclays,Barclays Mortgages,1001-2

The format of data is CustomerId,Cust parent name,customer operating company name,


operating company id

Step 1. FTP this file to your database server and run sql*loader to load the file into a table
named xx_legacy_cust, this table will have four columns, one column for each file in
source.
Step 2. Transform this data...
For this we create two tables...
XX_TRNSFRM_PARTY
--parent_cust_Id
--parent_cust_name
XX_TRNSFRM _CUST_ACCOUNT
--parent_cust_Id
--operating_cust_Id
--operating_cust_name
Now, you can write a pl/sql program to split data from table xx_legacy_cust into the two
tables listed above.

Step 3. Now write the pl/sql program to migrate this data into Oracle.
Create or replace procedure xx_migrate_parties(errbuff out varchar2,retcode out varchar2)
is
Begin
FOR p_party_rec in (select * from XX_TRNSFRM_PARTY )
LOOP
--call api to create party
Hz_Party_Site_V2pub.create_party();

For p_party_rec in (select * from XX_TRNSFRM _CUST_ACCOUNT where


parent_cust_Id = p_party_rec.parent_cust-id)
loop
--now create a customer account
hz_cust_account_v2pub.create_cust_account(..parameters
l_return_status,
l_msg_count,
l_msg_data
);

IF l_msg_count > 1 THEN


FOR i IN 1 .. l_msg_count
LOOP
Fnd_File.put_line (Fnd_File.LOG, i || '. ' || SUBSTR (Fnd_Msg_Pub.get
(p_encoded => Fnd_Api.g_false ), 1, 255 ) );
END LOOP;
END IF;

END LOOP ;
END LOOP ;
END ;

Now some notes:-


1. No two data migrations are exactly the same, hence I have given a pseudo code, and not
th actual code.
2. In some cases the quality of the source data can be so bad that you may need a third
party to cleanse the data before you run migration.
3. The API's used for data migration and for developing open interfaces are the same.
FNDLOAD for Oracle Web ADI

This article is dedicated for usage of FNDLOAD for Web ADI


Question : Does this article cover FNDLOAD in general?
Answer : This article is dedicated to the usage of FNDLOAD for Web ADI. If you wish
to fndload entities other than Web ADI, then kindly visit link Fndload for common
utilities.

Question: Why does one need to use FNDLOAD FOR WEB ADI?
Answer : In any implementation that uses Web ADI, the setup for formatting letters and
docments can be overwhelming. More importantly, once configured on a development
environment you would not like to repeat the tedious setup on test, crp or other
environment. Using FNDLOAD you can migrate 99% of your setup.

Question : What are the man steps when using FNDLOAD for Web ADI?
Answer :
First step
Identify the pieces that must be moved across using fndload. These can be:-
Integrators
Layouts
Mappings
Contents
This article covers the above listed components one by one.

Second step
Download the above web adi attributes into various ldt files. Basically we will create one
ldt file for each of the above four web adi entities.

Third step
Upload those ldt files into the new environment. For this we will run the fndload in upload
mode.

Question: How do I execute Step 1, given that FNDLOAD requires the internal names of
these entities, these internal names are not visible from the Web ADI screens?
Answer: In this example,I will demonstrate using scripts how to recognize the web adi
components Names for fndload. SQL will be provided to identify the internal names.

Question : Please demo how to FNDLOAD Integrators in Web ADI


Answer :
To identify the integrator codes, run the below SQL.

SELECT integrator_code, application_id


FROM bne_integrators_vl vl
WHERE user_name IN
('XX Request for further references', 'XX Sorry Interview did not work') ;

This will return two internal codes, both in application PER (Application ID 800). Lets
say the two internal codes are HR_101_INTG & HR_41_INTG.

Now download these as below:-


FNDLOAD apps/$APPS_PASSWORD 0 Y DOWNLOAD
$BNE_TOP/admin/import/bneint.lct XX_HR_101_INTG.ldt BNE_INTEGRATORS
INTEGRATOR_ASN="PER" INTEGRATOR_CODE="HR_101_INTG"

FNDLOAD apps/$APPS_PASSWORD 0 Y DOWNLOAD


$BNE_TOP/admin/import/bneint.lct XX_HR_41_INTG.ldt BNE_INTEGRATORS
INTEGRATOR_ASN="PER" INTEGRATOR_CODE="HR_41_INTG"

In order to upload these


FNDLOAD apps/$APPS_PASSWORD 0 Y UPLOAD
$BNE_TOP/admin/import/bneint.lct XX_HR_101_INTG.ldt

FNDLOAD apps/$APPS_PASSWORD 0 Y UPLOAD


$BNE_TOP/admin/import/bneint.lct XX_HR_41_INTG.ldt

Question : Please demo how to FNDLOAD Layouts in Web ADI


Answer : To identify the layout codes codes, run the below SQL.

=====Find the Layouts from layout names=====


SELECT LAYOUT_CODE
FROM bne_layouts_vl vl
WHERE user_name IN ('Offer Letter for Job', 'Denial of Job')
==============
Above SQL can return values say XX_C_O_F_T & XX_CODE
To download these layouts
FNDLOAD apps/$APPS_PASSWORD 0 Y DOWNLOAD
$BNE_TOP/admin/import/bnelay.lct XX_C_O_F_T.ldt BNE_LAYOUTS
LAYOUT_ASN="PER" LAYOUT_CODE="XX_C_O_F_T"

FNDLOAD apps/$APPS_PASSWORD 0 Y DOWNLOAD


$BNE_TOP/admin/import/bnelay.lct XX_CODE.ldt BNE_LAYOUTS
LAYOUT_ASN="PER" LAYOUT_CODE="XX_CODE"

Now in order to upload these into new environment, use below commands
FNDLOAD apps/$APPS_PASSWORD 0 Y UPLOAD
$BNE_TOP/admin/import/bnelay.lct XX_C_O_F_T.ldt

FNDLOAD apps/$APPS_PASSWORD 0 Y UPLOAD


$BNE_TOP/admin/import/bnelay.lct XX_CODE.ldt
Question : Please demo how to FNDLOAD mappings in Web ADI
Answer : To identify the mapping codes, run the below SQL.

=====Find the MAPPING CODES from integrator names==


SELECT mapping_code, integrator_code
FROM bne_mappings_vl
WHERE integrator_code IN
(SELECT integrator_code
FROM bne_integrators_vl vl
WHERE application_id = 800
AND user_name IN ('XX HR Reference letter', 'XX HR Sorry Cant offer'))
ORDER BY last_update_date DESC;
Lets say this SQL returns HR_101_MAP & HR_86_MAP

--Now do the download


FNDLOAD apps/$APPS_PASSWORD 0 Y DOWNLOAD
$BNE_TOP/admin/import/bnemap.lct XX_HR_101_MAP.ldt BNE_MAPPINGS
MAPPING_ASN="PER" MAPPING_CODE="HR_101_MAP"

FNDLOAD apps/$APPS_PASSWORD 0 Y DOWNLOAD


$BNE_TOP/admin/import/bnemap.lct XX_HR_86_MAP.ldt BNE_MAPPINGS
MAPPING_ASN="PER" MAPPING_CODE="HR_86_MAP"

To upload these files into a new environment, ftp the ldt files and run below commands on
the new environment

FNDLOAD apps/$APPS_PASSWORD 0 Y UPLOAD


$BNE_TOP/admin/import/bnemap.lct XX_HR_101_MAP.ldt

FNDLOAD apps/$APPS_PASSWORD 0 Y UPLOAD


$BNE_TOP/admin/import/bnemap.lct XX_HR_86_MAP.ldt

Question : Is FNDLOAD of Web ADI contents similar to above?


Answer : Its slightly different, as to recognize the contents I had to use the date range to
pick all the content codes configured in Web ADI during the past 90 days.
=====================
SELECT CONTENT_CODE
FROM bne_content_cols_vl
WHERE last_update_date > SYSDATE - 90
group by CONTENT_CODE ;
=====================
CONTENT_CODE
--------------
HR_101_CNT
HR_41_CNT

For each content code returned by SQL above, we will now do FNDLOAD as below

FNDLOAD apps/$APPS_PASSWORD 0 Y DOWNLOAD


$BNE_TOP/admin/import/bnecont.lct XX_HR_101_CNT.ldt BNE_CONTENTS
CONTENT_ASN="PER" CONTENT_CODE="HR_101_CNT"

FNDLOAD apps/$APPS_PASSWORD 0 Y DOWNLOAD


$BNE_TOP/admin/import/bnecont.lct XX_HR_41_CNT.ldt BNE_CONTENTS
CONTENT_ASN="PER" CONTENT_CODE="HR_41_CNT"

Obviously to upload Web ADI contents, use the below commands

FNDLOAD apps/$APPS_PASSWORD 0 Y UPLOAD


$BNE_TOP/admin/import/bnecont.lct XX_HR_101_CNT.ldt

FNDLOAD apps/$APPS_PASSWORD 0 Y UPLOAD


$BNE_TOP/admin/import/bnecont.lct XX_HR_41_CNT.ldt
API to Update FND_USER and Add Responsibility

This article explains how you can reset the passwords and add responsibilities in APPS
using scripts. This was tried and tested on 11.5.10 environment.

My client: Hey Anil, we need a script to do the following:-


A. Update fnd_user records for some 1000 users, to reset their passwords?
B: To assign all these 1000 users with a new responsibility, which happens to be a new
HRMS Self Service responsibility.
C. We must not reset passwords of the employees which are active on that test
environment.

Myself: Why do we need this done?


My Client: Well, we need to load test the system by simulating 1000 concurrent self
service HR users...

That's the end of our talk. Now let me give you some background.
Self Service HRMS kicks off a workflow each time a user logs onto system to either view
or update their personal information.
The reason for this approach is that SSHR uses workflow to manage the state of its
transaction.

Question: Why does Oracle Self Service HR use workflow to manage its state?
Answer: Because SSHR was developed before OAF was invented by Oracle. Using OA
Framework, it is possible to manage the state of a web based applications via something
known as AM(Application Module).

Question : Are you saying that Self Service HR in Oracle does not use OA Framework
Answer: Not saying that. In fact Oracle has re-written most of its SSHR to use the OAF,
but for some reasons(which I believe are legacy), the underlying workflow has been
retained. I am not saying that this is bad design, but yet this begs to be load tested before
goLive.

Question: Why is my client so concerned about load testing self service HR?
Answer: Workflows have their overheads, but beyond that SSHR uses some staging
tables to capture before and after state of the personal information, while the user is
updating the same. This alongwith workflow overhead may hit the system hard, hence the
need for load test.

Question: OK, how do you go about reseting 1000 passwords.


Answer: Well, we not only have to reset passwords of fnd_user, but also need to assign
each of those users a Self Service HR responsibility. This is how we do it:-
Scripts steps:-
Loop for latest employee records in fnd_user, excluding the recently logged in UAT users.
...inside the loop call fnd_user_pkg.updateuser
....again inside the loop call fnd_user_resp_groups_api.insert_assignment (to assign new
SSHR Responsibility)
----within the loop, handle exception in case the user already has that responsibility

Question: How do you write that code?


Answer: Here you go....

After the script has completed, you can spool the data from temp table ....
NOTE: DO NOT RUN THIS ON PRODUCTION

DECLARE
duplicate_responsibility EXCEPTION;
PRAGMA EXCEPTION_INIT(duplicate_responsibility
,-20001);
i INTEGER := 0;
no_action_required EXCEPTION;

CURSOR c_get IS
SELECT *
FROM fnd_responsibility_vl
WHERE responsibility_name = 'XX HR Employee Self Service';

p_get c_get%ROWTYPE;
BEGIN
OPEN c_get;
FETCH c_get
INTO p_get;
CLOSE c_get;

DELETE xxschema.fu_4_which_pwd_reset;
FOR p_rec IN (SELECT user_name, user_id
FROM fnd_user
WHERE user_name NOT IN (SELECT fu.user_name
FROM fnd_user fu, fnd_logins fl
WHERE fl.start_time > SYSDATE - 40
AND fu.user_id = fl.user_id
GROUP BY fu.user_name, fu.user_id
)
AND user_name NOT LIKE '00%'
AND end_date IS NULL
AND employee_id > 0
ORDER BY user_id DESC)
LOOP
i := i + 1;
--First 1000 users only
IF i = 1001
THEN
RAISE no_action_required;
END IF;
fnd_user_pkg.updateuser(x_user_name => p_rec.user_name
,x_owner => 'SEED'
,x_unencrypted_password => 'abcd0123'
,x_password_date => SYSDATE + 500);

BEGIN
fnd_user_resp_groups_api.insert_assignment(user_id => p_rec.user_id
,responsibility_id => p_get.responsibility_id
,responsibility_application_id => p_get.application_id
,security_group_id => 0
,start_date => SYSDATE - 1
,end_date => NULL
,description => 'Load testing SSHR on Test
environment');
EXCEPTION
WHEN duplicate_responsibility THEN
fnd_user_resp_groups_api.update_assignment(user_id =>
p_rec.user_id
,responsibility_id => p_get.responsibility_id
,responsibility_application_id => p_get.application_id
,security_group_id => 0
,start_date => SYSDATE - 1
,end_date => NULL
,description => 'Access Reinstated via Load
testing SSHR on Test environment');
END;
INSERT INTO xxschema.fu_4_which_pwd_reset
(user_id
,user_name)
VALUES
(p_rec.user_id
,p_rec.user_name);
END LOOP;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
COMMIT;
END;
Forms Personalization in Oracle HRMS

For quite some time I was thinking about publishing an article about forms
personalization in Oracle HRMS.

The Metalink note on Forms Personalization is helpful, but what it lacks is a pictorial
approach to implementing
Forms Personalizations. I am a visual animal, so I like to explain in that manner too.

My first article in the series of Forms Personalization is in response to a question raised in


Oracle Forum under Oracle Human Resources (HRMS ). As per the Oracle forum request,
If the Person Type is Employee, their clients wants Person Title field to become
Mandatory ( lets assume it is the title field for now). When the Person Type field changes
to a value that is anything but Employee, the person title field should then toggle back to
become optional.

Please note that when Person type Employee is selected, value in field
PERSON.D_PTU_USER_PERSON_TYPE is assigned a value of Employee

Now the requirement is that for Employee field PERSON.D_TITLE must be made
mandatory.

There are two possible ways the Person Type can change.
Either by picking a dropdown list of Action (e.g. Create Employee) or by directly picking
up a value from LOV on field Person Type for Action. Whenever the person type
changes, WHEN-NEW-ITEM-INSTANCE is fired for one for the below fields(depending
upon how its changed). Hence forms personalization must check conditions for below
three fields
PERWSHRG.PERSON.PTU_ACTION_TYPE
PERWSHRG.PERSON.D_PTU_USER_PERSON_TYPE
PERWSHRG.PERSON.SHOW_NUMBER

The demo below contains conditional check on WHEN-NEW-ITEM-INSTANCE of


PERSON.PTU_ACTION_TYPE

When implementing this, you will have to replicate the steps in the demo for WNII on
both PERWSHRG.PERSON.D_PTU_USER_PERSON_TYPE &
PERWSHRG.PERSON.SHOW_NUMBER

I have tested the steps below myself, and they appear to work.

OK, here we go.....

STEP 1
Create Personalization as below( to make Title field mandatory)
Sequence: 50
Description: Make Person Title Mandatory when Person Type is Employee.
Trigger Event: WHEN-NEW-ITEM-INSTANCE
Trigger Object: PERSON.PTU_ACTION_TYPE
Condition: ${item.person.d_ptu_user_person_type.value} = 'Employee

Check if Person Type is Employee in When New Item Instance

Action Sequence: 10
Action Type: Property
Action Object Type: Item
Action Target Object: PERSON.D_TITLE
Action Property Name: REQUIRED
Action Value: TRUE

Make Title mandatory when Person Type is Employee


STEP 2
Create another Personalization as below ( to make Title field Optional)
Sequence: 51
Description: Make Person Title Mandatory when Person Type is Employee.
Trigger Event: WHEN-NEW-ITEM-INSTANCE
Trigger Object: PERSON.PTU_ACTION_TYPE
Condition: NVL(${item.person.d_ptu_user_person_type.value},'xxyyzz') != 'Employee'

Check if Person Type is anything other than Employee in When New Item Instance

Action Sequence: 10
Action Type: Property
Action Object Type: Item
Action Target Object: PERSON.D_TITLE
Action Property Name: REQUIRED
Action Value: FALSE

Make Title option when Person Type is not Employee

Forms Personalizations
In this article, I would like to explain different possibilities of Forms Personalizations.
Surely before explaining what can be done, first we will touch base upon what exactly it
is.

Why was forms personalization introduced by Oracle in 11.5.10?


1. CUSTOM.pll is a programmatic methodology for extending Oracle Forms, even for
trivial tasks.
2. Multiple developers working on same CUSTOM.pll could cause version related
headaches

Does Forms Personalization replace CUSTOM.pll?


Not really, however it does provide an alternative to most common activities for which
earlier one would use CUSTOM.pll
Forms personalization is driven by the same set of events as that for CUSTOM.pll.
Keep in mind that Oracle Forms Libraries first invoke the Forms Personalization, and then
the CUSTOM.pll too for the same set of events.

How do I enable Forms Personalizations?


Enable the personalizations using the Help/Diagnostics menu.
What are the various components of Forms Personalizations?
Different components of Oracle Forms Personalizations are listed below. You begin with
recognizing which Triggers/Events that you wish to trap and under what conditions. The
condition can be entered using the syntax as defined in the picture below.
What does the Action Tab do?
Here you will either change form property, or display messages or enable menu etc.
Can I modify SQL Query behind the LOV using Forms Personalizations?
Of course you can. In the below example I am restricting the LOV to less than 3records
by introducing where rownum <3 in record group query.
Step 1. Create a new record group
Step 2. Attach the newly created record group to existing LOV in EBS Form.
Can I call a PL/SQL Stored procedure passing it form field variables?
Yes, using the syntax below.
Note: You can also invoke FORMS_DDL built-in to perform DDL.

Can I call BuiltIn's?


Indeed, as shown below, you can pick from all the form built-in's as below.
You can also call a form function and pass it parameters using Forms
Personalizations

Processing can be aborted if validation were to fail

You can invoke equivalent to app_item_property.set_property.


I am displaying the Required property below, however you can use this option for all
supportable properties of app_item_property
You can initialize a global variable. Initialization code is executed if and only if the
global variable does not already exist.
Use global variables for passing variables back and forth between two forms.
Please do not use Global Variables if your logic is restricted to a Single form itself.

You can assign values to form fields using global variable.


Using forms personalizations, you can set the Default where clause of the BLOCK too.
Note: Don't forget to reset this clause after your desired operation has been finished. This
will facilitate the form to run in standalone mode too.

Ditto for Order by Clause on block.

For displaying messages, you can either enter a plain text, or your message can be
displayed from the result of a SQL Statement.
Local variables can be defined and they will be active for throughout the session of the
current form.
Use global variables if you wish to share the variable between multiple forms.
Below, just for demo, I am setting the local variable to 0.

In the below picture, I am checking if local variable is 0 then display a message.


You can enable SPECIAL1-15 or MENU1-15, to create new menu entries under the Tool
menu.

As seen below, the above two setups have instantiated the new Menu Items

SPECIAL16-30 will create entries under Reports menu


SPECIAL31-45 will create entries under Actions menu

You can capture the click on those newly created menu items by trapping event MENU1
or SPECIAL1 [or whatever you defined]
Oracle Fusion Development Tools

The roadmap for Oracle Fusion strategy is becoming clearer, thanks to most recent article
by Steven Chan.

So the question is, what will be the development skills required by Oracle Fusion
Developer?

In order to answer this, lets have a look at current skillsets required for Oracle Apps, and
then map those to Oracle Fusion.

Oracle Apps : SQL


Oracle Fusion : Future is bright for SQL.

Oracle Apps : PL/SQL


Oracle Fusion : Oracle's current stance is that pl/sql will be integrated part of their
Fusion Product.

Oracle Apps : XML Gateway


In Oracle Apps, you can post XML Documents to XML gateway using protocols such as
HTTP, HTTPS, JMS & SMTP. For example Payables Invoices can be posted to XML
Gateway by your trading partners. XML Gateway can also be used for outbound XML
messages, by extracting data from Views/Tables.
Oracle Fusion : BPEL
BPEL supports all the above protocols. Hence I see no reason why BPEL will nor replace
XML Gateway Product.

Oracle Apps : Oracle Forms


In Oracle Apps most of the Core data entry screens and many of the inquiry screens were
built using D2k Forms. Oracle Forms can't run in the browser directly, hence this
limitation was overcome by developing Applet called JInitiator.
Oracle Fusion : ADF with Faces[JSF] appears to be winning the race. Have a look at
http://www.jsfcentral.com

Oracle Apps : Oracle Reports


Thousands of reports have been written using Oracle Reports uptill Release 12.
Not a single one of these will be carried forward to Oracle Fusion.
Oracle Fusion : XMLP
Yes, no surprises here. It is indeed XML Publisher.
Oracle Report is proprietry tool that works just with Oracle Database. Also, Oracle would
like their reporting tools to converge into a single reporting tool for Peoplesoft, JD
Edwards & Oracle Apps.
XML Publisher will hopefully become as powerfull as Oracle Reports by the time Oracle
Fusion is released.

Oracle Apps : OA Framework


Oracle Fusion : The answer is same as that for Oracle Forms above. However one must
continue to learn OA Framework, as its concepts like Personalizations, Extensions will be
carried forward to ADF. Both are MVC based topologies.

Oracle Apps : Oracle Discoverer


Oracle Fusion : I think this will remain, as Discoverer is a part of Oracle Fusion
Middleware. At the end of the day, XMLP is not a business intelligence tool.

Oracle Apps : Oracle Web ADI


Oracle Fusion : XMLP. I wonder why Web ADI will be needed, as letter can be printed
off using XML Publisher itself.

Oracle Apps : Oracle Workflows


Oracle Fusion : This will certainly be replaced by BPEL too.

Clearly the future is :-


Web Services with BPEL
Java/J2EE
XML/CSS/XSL/JavaScript/ADF
SQL & PL/SQL
FND Debug Log - Debugging Oracle Apps code

There was a time when every individual Oracle Applications module used its own
debugging technique.

But this is changing now, thanks to FND Logging. I have been using FND Logging for
over one year now, ever since 11.5.10 was released, hence I would like to share
knowledge on this topic.

What is the use of FND Debug Log?


1. It helps you pinpoint the cause of error in standard Oracle Code, by making debug
messages to appear in a centralized table named FND_LOG_MESSAGES.
2. You can design and build your custom extensions in a manner that can easily be
debugged. This can be done by calling Oracle delivered APIs in your custom code.

Where is the debug message stored, once the logging is turned on?
Debug messages are stored in a table called FND_LOG_MESSAGES
A program written in any technology, either form, or report, or pl/sql or java concurrent
program or OAFall their debug messages will be stored in fnd_log_messages.

How to debug the issue being faced in Oracle Application?


Step 1 Set the following profile options at your user level(your fnd_user)
FND: Debug Log Level
Following possible values are available, but I suggest you set this to "Statement" level
when debugging code.
LEVEL_UNEXPECTED : Internal Level Id is 6
LEVEL_ERROR : Internal Level Id is 5
LEVEL_EXCEPTION : Internal Level Id is 4
LEVEL_EVENT : Internal Level Id is 3
LEVEL_PROCEDURE : Internal Level Id is 2
LEVEL_STATEMENT : Internal Level Id is 1
FND: Debug Log Enabled
Set this profile to Yes

FND: Debug Log Module


Set this to %

Step 2
Login to the application and reproduce the problem.

Step 3
SELECT *
FROM fnd_log_messages
WHERE user_id = 209122 /*your FND_USER user_id here*/
AND TIMESTAMP > SYSDATE - .3
ORDER BY log_sequence DESC /*note the order by clause here*/

The result of this select statement will provide the list of all the debug messages, on top
will appear the most recent debug messages..

Why should I setup the module name to %, in profile option?


You can set this to po%, if you know for sure that the error was caused by code written in
po module. However po code might be internally calling hr code which might inturn be
calling fnd code.
Hence its best to set this profile value as %.
You may also use comma delimited values i.e po%,hr%,fnd%

Why must I bother debugging Oracle's Standard code when I can quickly raise a
tar.
If the issue is with Standard Oracle Code, first thing you must do is to search into
Metalink. However having the debug information on error helps your searching ability
further. Uploading the debug messages upfront during Tar creation will also help Oracle
speedily understand and fix your issues.

Why to set the profile option to statement level?


This profile option has following main levels.-
Error
Warning
Procedure
Statement

I like setting this to "Statement" level as it extracts debug messages at all levels, in one
glance. You can latter filter those debug messages by using below SQL for example
select * from fnd_log_messages where user_id = 111 and LOG_LEVEL =5

What if the piece of code causing the error is not appearing in fnd_log_messages?
This is very much possible. The fnd_log_messages might have helped you get close to the
culprit piece of code , but may not be able to pinpoint the error as there may not be
enough debug messages implanted by Oracle.

You can do one of the below:-


A. Run the database sql trace for the session with bind variables and see the last
meaningful SQL statement in the raw trace file.
Please note that PL/SQL statements will not appear in trace, only the SQL Statements will
appear, hence you may consider option (b) below
B. Add your own debug messages to the pl/sql code that was delivered by oracle, which
you suspect is causing problem. This is a temporary change, and must only be done on
development environment, NEVER DO THIS CHANGE ON PRODUCTION.

The size of table FND_LOG_MESSAGES will keep on increasing?


You can run concurrent program Purge Debug Log and System Alerts.

I have written a pl/sql concurrent process to interface Purchase Orders from 3rd
Party System. How will add debug messages?
fnd_log.STRING(log_level => fnd_log.level_statement
,module => 'xxpo.packagename.procedurename'
,message => 'debug message here');

Will the above debug command create an entry into fnd_log_messages ?


Debug records will be created in fnd_log_messages if and only if you run the interface
program after setting the profile options as suggested above.

What if a rollback occurs due to unhandled exception. Will the inserts done to
fnd_log_messages be lost?
fnd_log.string eventually calls procedure
FND_LOG.STRING_UNCHECKED_INTERNAL2. This procedure uses pragma
AUTONOMOUS_TRANSACTION with a commit.
Hence your debug messages will not be lost despite a rollback in parent session.

What if an exception is incurred within the Debug Logging API itself?


Oracle takes well care of this by handling the WHEN OTHERS exception.
It is evident from below Oracle Code for debug API
PROCEDURE STRING(LOG_LEVEL IN NUMBER,
MODULE IN VARCHAR2,
MESSAGE IN VARCHAR2) is

begin
/* Short circuit if logging not turned on at this level */
if (LOG_LEVEL < G_CURRENT_RUNTIME_LEVEL) then
return;
end if;

if FND_LOG_REPOSITORY.CHECK_ACCESS_INTERNAL (MODULE,
LOG_LEVEL) then
FND_LOG_REPOSITORY.STR_UNCHKED_INT_WITH_CONTEXT(
LOG_LEVEL => LOG_LEVEL,
MODULE => MODULE,
MESSAGE_TEXT => MESSAGE);
end if;

exception
when others then
NULL; /* supress the exception */
end;
XML Publisher Concurrent Program - XMLP

In this article I have listed a step by step demo of XML Publisher as a Concurrent
Program in Oracle Apps.

I think it is very important that you get a feel of XML Publisher, as this will become the
reporting tool in Fusion [assuming XMLP can become as powerful as Oracle Report in
the given time].

Before I explain the steps in details with screenshots, let me brief them:-
a. Create a report and register it as Concurrent Program of type XML
b. Build a Data Definition & XML Template using XML Publisher.
c. Create a relation between XML Template & Concurrent Program.

Sounds simple, it is indeed, but devil lies in detail. Hence read the below carefully.
I have provided the source code with installation instructions for you to try this. Please
note to try this you need 11.5.10 environment.

Now lets get into the details.Step by Step..


1. Create a table xx_emp_demo and insert two records into it.
create table xx_managers ( manager_no integer, manager_name varchar2(200) ) ;
insert into xx_managers ( manager_no, manager_name ) values ( 1000, 'Anil Passi') ;
insert into xx_managers ( manager_no, manager_name ) values ( 1001, 'Martin') ;
commit;

2. Next you need a concurrent program that spit out an XML file to the output of the
concurrent program. Such concurrent program can be of type SQL or PL/SQL or Oracle
Report or any other supportable type, provided it can produce a XML output.
Hence in this case, we will develop a Report that has all the columns from table
xx_managers
Create a plain default Oracle Report using wizard in Oracle Reports 6i.
This can be done using wizard with SQL select * from xx_managers
Above picture shows the report output in Reports 6i preview

Do not change anything in DESFORMAT, as Concurrent Manager will take care of


passing XML to this. Hence XML Publisher will be fed an XML output by the concurrent
manager itself.

3. Add three user parameters P_CONC_REQUEST_ID, P_RESPONSIBILITY_ID,


P_USER_ID

These parameters will make it possible to run a report as concurrent program.


Save the above RDF as XX_MANAGERS.rdf

4. FTP XX_MANAGERS.rdf to $AR_TOP/reports/US


Silly it is, but for demo I will use standard Application [forgive me, but I am making it
easier for you to run the source code].

5. Create Concurrent program executable for XMLP report, as if it is a normal report


6. Create a concurrent program for the executable. Note that I have kept the shortname
and the program name both as XX_MANAGERS.
IMPORTANT:- Note that format is XML

7. Register this program with Receivables request group.


DECLARE
BEGIN
FND_PROGRAM.add_to_group
(
PROGRAM_SHORT_NAME =>'XX_MANAGERS'
,PROGRAM_APPLICATION =>'AR'
,REQUEST_GROUP => 'Receivables All'
,GROUP_APPLICATION =>'AR'
);
commit;
exception
when others then
dbms_output.put_line('Object already exists');
END ;
/

8. Run the report and you will see an xml output appearing. Save the output as
XX_MANAGERS_241106.xml on your computer. You will need to use
menu /Tool/Copy to open this XML output in browser, and then save it as
XX_MANAGERS_241106.xml on your PC.

NOW THE TIME TO DO XML PUBLISHER BIT

9. Install this XML Publisher Desktop software on your pc, ensuring that you have MS-
Word installed(for this demo)
The XML Builder Desktop Patch for Word is Patch Number: 4561835
This software can be downloaded from
http://updates.oracle.com/download/4561835.html

This is a tool given by Oracle[Desktop XML Publisher] that will read any XML file, will
create the fields automatically.

10. Open MS Word after installing as per step 9, and you will now see something similar
to below in Microsoft Word
Now in MS Word, click on Load XML Data and select file
XX_MANAGERS_241106.xml that was created in Step 8.

11. Now, click on Insert/Table Form


And then drag and drop List G Manager No within the template section and click on
OK.

Effectively by doing these steps, you have just created a Layout for the report in XML
Publisher. The layout will look like this [as below].

Save this MSWord file as MANAGER_XML_TEMPLATE.rtf


By clicking on Preview, you will see the output as below

12. Now, lets do the real bit in attaching the Concurrent Program definition to XML
Publisher. Logon to responsibility XML Publisher Administrator.

Click on Data Definition menu as aboveso that we can create the XMLs source data
Definition. Effectively we are saying that output of the Concurrent program becomes the
data definition for XMLP.

Lets define the value in below fields


Name : XX_MANAGERS
Application : Receivables
Code : XX_MANAGERS [Note: This is the short name of the Concurrent program]
Start Date : Leave it to default Sysdate
Click on Apply
13. Now lets define a template as below for XML Publisher.

For doing so, click on Templates Tab. We need to create a Template for the data-
definition of previous step.

Name : XX_MANAGERS [this is the name of the template]


Code : XX_MANAGERS [short name of conc program]
Application : Receivables
Data Definition : XX_MANAGERS [the one that we created in prior step 12]
Start Date: : Leave this default.
Type : RTF
Click on browse and select the RTF file[MANAGER_XML_TEMPLATE.rtf] that you
had saved in Step 11.
xmlp_A_14

Click on Apply, and you will get the below record.

14. Navigate to Receivables Manager and submit report XX_MANAGERS.


Click on Output button to see the report as pasted below.
Audit Trail in Oracle Apps - EBS

Oracle Apps provides an Out of the Box Audit Trail Functionality that works like a
charm.

I never had thought about writing an Article on Audit Trail feature, until Kartikey pinged
me to write an article on this subject. You can achieve Auditing[as explained in Step by
Step example below] without writing a single piece of Code in Oracle Apps. It can be
argued that CDC [change data capture] might be used, but I think the design of CDC is
more friendly for Warehousing purposes, rather than Audit Reporting.

Lets say that we wish to create a audit trail on a table named FND_LOOKUP_VALUES.

Step 1: Find the name of Application for table to be Audited


Lets first find the application name of this Oracle Apps table.
SELECT application_name
FROM fnd_application_vl fav, fnd_tables ft
WHERE ft.table_name = 'FND_LOOKUP_VALUES'
AND ft.application_id = fav.application_id

The above SQL returns Application Object Library.

Step 2: Ensure that Audit on the Application is Enabled


Navigate to System Administrator Menu Security/AuditTrail/Install

The owner of table FND_LOOKUP_VALUES is APPLSYS. Hence query on APPLSYS


to ensure that Audit is enabled for this Application.

Step 3: Create Audit Group


Navigate to System Administrator Menu Security/AuditTrail/Groups

Application Name: Application Object Library


Audit Group: XX Audit Lookup Values
Group State: Enabled

Now, add audit tables to this group[you can add as many tables]
User Table Name: FND_LOOKUP_VALUES

Step 4: Run Concurrent program AuditTrail Update Tables


This process can be run from System Administrator responsibility. It has no parameter.
Running this process will create the Audit tables and the triggers that manage Audit data.

Step 5: Ensure that Audit Tables have been created as expected


SELECT object_name, object_type
FROM all_objects
WHERE object_name LIKE 'FND_LOOKUP_VALUES_A%'

OBJECT_NAME OBJECT_TYPE
-------------------------- --------------------------
FND_LOOKUP_VALUES_A TABLE
FND_LOOKUP_VALUES_A SYNONYM
FND_LOOKUP_VALUES_AC TRIGGER
FND_LOOKUP_VALUES_AC1 VIEW
FND_LOOKUP_VALUES_AD TRIGGER
FND_LOOKUP_VALUES_ADP PROCEDURE
FND_LOOKUP_VALUES_AH TRIGGER
FND_LOOKUP_VALUES_AI TRIGGER
FND_LOOKUP_VALUES_AIP PROCEDURE
FND_LOOKUP_VALUES_AT TRIGGER
FND_LOOKUP_VALUES_AU TRIGGER
FND_LOOKUP_VALUES_AUP PROCEDURE
FND_LOOKUP_VALUES_AV1 VIEW

Fine, this proves that the concurrent program in Step 4 did its job.
Optionally, you may run concurrent process AuditTrail Report for Audit Group
Validation to validate the success of Audit Table/Trigger creation.

Step 6: Now create a new lookup type to test Audit Trail


Navigate to Application Developer responsibility and create a lookup type and Lookup
codes as below.

Step 7: Now see the results of the Audit Trail


Now run the query below, you can see the Audit information has been generated.
SELECT audit_transaction_type
,audit_user_name
,audit_sequence_id
,lookup_code
,lookup_type
FROM fnd_lookup_values_a
Step 8: Add further columns for Audit Trail
By default Oracle will Audit Trail on all columns that are a part of first available Unique
Index on FND_LOOKUP_VALUES.
However further columns can be added to the Audit Trail. Lets say you wish to Audit
Trail on Column Meaning too.
Navigate to System Administrator Menu Security/AuditTrail/Tables

You can add additional columns to audit trail and re-execute Step 4.
Please note that adding columns for Audit could have been done immediately after Step 3.

This explains how you can Audit trail changes to Data in Oracle Applications, without
writing a single line of code
Hierarchy Profile Options

This article is an attempt to explain the Hierarchy Profile Options with examples.

Can all the profile options be set at Organization Level and Server level?
You need to set Hierarchy Type field in Profile Option definition to enable that profile
to be eligible for Hierarchy Level. This functionality was introduced in 11.5.9

How to find from SQL*Plus whether a Profile Option is Hierarchy Enabled?


SELECT HIERARCHY_TYPE FROM fnd_profile_options_vl where
profile_option_name = 'profile option short name' ;
If the above SQL returns SERVER, then the profile is enabled at Server Level.
If the above SQL returns ORG, then the profile is enabled for Organization Level.
If the above SQL returns SERVRESP, then the profile is enabled for both Server and
Responsibility Level.

Why the need of Organization Level profile option?


For example multiple responsibilities can be attached to same Operating Unit. In such
event, it can get tedious to attach the same profile option to each such responsibility.
By attaching an Organization Level Profile Option to an Operating Unit implies that all
such responsibilities inherit Org Level Profile value.

Will Organization Level Profile override the Responsibility Level Profile?


Yes

Give me some example usages of Server Level Profiles


Managing Timezones
In a single Global DB Instance implementation, you may desire to display different time
in UI screen, depending upon the local timezone. If you have a separate Middle Tier
Server for each timezone, then timezone profile options [Enable Timezone Conversions,
Client Timezone, Server Timezone] can be set at Server Level.

External WWW Facing Mid Tiers


It is possible that for security reasons, you may desire to change the functionality of
Application when its accessed from External WWW facing mid-tier. Such security
profiles can be assigned at server level.
For example, profile option Node Trust Level can be set to a value of external against a
server to flag the specific mid-tier server as External. See Link for details.

Give me some example usages of Organization Level Profiles


Managing Timezones
In a single Global DB Instance implementation, you may desire to display different time
in UI screen, depending upon the local timezone. If you cant afford to have a separate
Middle Tier Server for each timezone, then timezone profile options [Enable Timezone
Conversions, Client Timezone, Server Timezone] can be set at Organization Level, as
each Organization assumingly will be in a specific timezone.

Setting Org Level Profile Option in HRMS


A HRMS Business Group can be assigned to various Oracle HRMS Responsibilities.
Keeping a track of profiles against all such responsibilities, which belong to a specific
Business Group can be tedious. Hence you may simplify this by simply assigning the
profile to Business Group Organisation.

What is the order of precedence for Profiles?


Security Profiles: Site Level >> Application Level >> Resp Level >> User Level
Server Profiles: Site Level >> Server Level >> User Level
Organization Profiles : Site Level >> Organization Level >> User Level
Find Request Group for
Concurrent Programs

In this article, I would like to give you a quick trick to find "which request group should the concurrent
program be added to"? Many a times, we create a new concurrent program following which we try to
make that program available from a specific Menu under a specific responsibility.

I have created a concurrent program, and I now wish to know which request group must this program be
added to?

Step 1. Ensure that profile option "Utilities:Diagnostics" is set to Yes at your user level.

Note:- This step can be skipped in case you have the apps password.

Step 2. Navigate to the responsibility from where you will submit the concurrent program.

Step 3. Navigate to the "Submit New Request" screen, where you will enter the name of the concurrent program to
run.

Step 4. Now you must do examine using the help menu as shown below.

Step 5. In the block field, enter PARAMETER, and in the field name enter REQUEST_GROUP_CODE
Note down this value
Step 6. Now in the value field enter REQUEST_GROUP_APPL_SHORT_NAME
Note down the two values from Step 5 and Step 6.

These will indicate the request group to which you must add your concurrent program.

Question: In the submit request screen, REQUEST_GROUP_CODE is blank??

In this case use the Request group specified in "Define Responsibility Screen"

The rule is :-

If request group code is being passed in as parameter to Submit Request form function, then use that request
group. Or else use the request group at responsibility level.

NOTES:-

Why do I need both the request group code and the request group application?

Request group name and its application is a composite primary key, hence you need the application name. For
example "All Reports" request group can be found under every possible application.

Where does this request group parameter come from?

This request group name and application are defined as parameters to the form functions.

Is this form function attached to submit request form?

Correct

If at the time of defining form function, we do not pass request group parameter, then request group from
responsibility is used?

Correct, because request group specified against responsibility is the default request group.
Smart Descriptive Flexfields

In this article, I would like to explain some tricks with context sensitive Descriptive
Flexfields. To begin with lets consider some scenarios as below.

Scenario 1. Depending upon the responsibility user has logged into, you wish to either
show two flexfield segemts or three segments. This is a fairly common requirement.
Scenario 2. There are two different oracle screens, both based on same table but different
functionality. Hence the share the same descriptiveflexfields. You wish to use
notation :block.fieldname in the value set. But this will work in one screen and error in
another.

Can't we simply use context sensitive flexfields?


You certainly can. However, what if you do not want to make your user select the value in
context field manually? In this case you need to take your design a step further.
In fact, before you proceed further with this article, you must read this link Basic
Concepts of Context Sensitive Descriptive Flexfields.
In case you do not know much about profile options, you must also read link basic
concepts of Profile Options

What are the options at hand for solutions to Scenatio 1 and Scenario 2?
Option 1. Use profile option as the context
Option 2. Use a system global variable as the context.

How does this work?


In case of using profile option, value in Context Reference Field of the descriptive
flexfield will be the profile option[see picture below].
Lets say for Responsibility-1 this profile is set to XX, and for Responsibility-2 this profile
is set to YY, and for a special user this profile is set to value ZZ.

You can then define three different contexts, as below.


Context XX
Uses attribute1 and attribute2, using value sets vs1 and vs2
Context YY
Uses attribute 1, using value set vs3
Context ZZ
Uses attribute2 with value set vs4 , making this descriptive flexfield segment mandatory.
Depending upon which responsibility user logs into, and also depending upon which user
logs into the screen, they will see different flexfield segments popping up.

Ah, what if same user in a single responsibility has access to different screens that
share same DFF?
In this scenario, you can design your descriptive flexfield on a System variable context.
Hence your context will be :SYSTEM.CURRENT_FORM. Depending upon which form
the user has navigated to, they will see different segments.

Note: Use Examine utility to find out the Current Form Name

Sounds good, but what are the pitfalls?


1. :blockname.fieldname convention does not works for OA Framework screens.
2. There is only one context reference field available per Descriptive Flexfield. If you
choose to have your DFF context sensitive on a profile option, then you will have to live
with it forever(ah should I say fusion-when D2K forms are gone). However this limitation
can be overcome by using fnd_profile.put api, to alter the profile option value at runtime
for forms session. Effectively you can modify the context[by changing profile option
value pragmatically], using forms personalizations.
How about OA Framework? Do we need these design methodology in OA
Framework too?
Not really, because in OA Framework, you can use personalizations to decide which
Context + Attribute combination must be displayed. Personalizations can be performed at
responsibility level to get the desired result as discussed in example above.
XML Publisher - Developing reports printed on Pre-Printed Stationary

I am pleased to introduce to you Mr Darshan Bhavsar. Darshan is a Senior Technical


Oracle Applications Consultant and amongst many things, he specializes in XML
Publisher.

In this article, he will explain the steps to implement XML Publisher reports for Pre-
Printed Stationary in Oracle eBusiness Suite.
Many thanks to Darshan for sharing this knowledge.
This article from Darshan will help a lot of technical consultants in implementing similar
solutions for their respective clients.

The article below is from Mr Darshan Bhavsar.

The Sample Template and Data file can be downloaded from the end of this article.

Abstract

I was inspired to come up with this because I feel that lots of people want this solution
and they are struggling to implement this.

In this whitepaper, I am going to explain the approach which I used for developing pre-
printed stationary reports by XML publishers RTF method. This approach I used for 2
customers and it works absolutely fine. They are very happy. Example Pre-Printed
stationary reports which I worked on are following AP Check Printing(Bank) ,AR invoice
Printing,PO purchase Order Printing . etc.

Background

I have a customer who wants to convert their 40+ Oracle Apps reports to XML publisher
Reports. These reports are fall in categories of AR invoice report, check printing report
and PO print report which they are printing on pre-printed (pre-defined) stationary.

Just a little background of pre-printed stationary reports layout where there is a fix
Header section and fix Detail Section Table. Detail section table should always have fix
table height, in the sense it should always have fix number of rows in the table no matter
how many rows returned by actual report run. For example Invoice stationary has fix 30
rows in line detail table, and Actual report run is returning only 5 rows then rest 25 blank
rows should be generatedprogrammatically.

So far there are solutions available which are talking about fixing table height for
the 1st pages onwards not for the first page itself, i.e. where actual report run is
returning lines which are less than lines_fixed_per_page. For example Invoice run
is returning only 5 rows where as pre-printed stationary has fixed 30 lines per
page.I struggled a lot to get this solution and now I got this and sharing it in this
whitepaper.

So far it has not been discovered because of the limitation of for-loop in XSL-FO (XML
Technology).Limitation I mean is ,we can not write loop like for (i=10;i<15;i++) in XML.
In XML for loop will always iterate till it gets data, if we want to go beyond that then we
can not go. I mean we can write for loop based on data value.

To overcome this problem, I have used Sub-template concept which I am calling


recursively.

Detail Solution

I am giving this solution for Standard Check Printing Report. Tree structure of data
(Sample XML data is as follow).

<LIST_G_CHECKS>

<G_CHECKS> -- Top Most root -- Header

<C_CHECK_NUMBER>21897</C_CHECK_NUMBER>

<C_VENDOR_NUMBER>2205</C_VENDOR_NUMBER>

<LIST_G_INVOICES>

<G_INVOICES> -- Inner loop - Line Section

<C_PAYMENT_NUMBER>1</C_PAYMENT_NUMBER>

<C_INVOICE_NUMBER>ERS-20-SEP-06-243</C_INVOICE_NUMBER>

</G_INVOICES>

<G_INVOICES> -- Inner loop - Line Section

<C_PAYMENT_NUMBER>2</C_PAYMENT_NUMBER>

<C_INVOICE_NUMBER>ERS-20-SEP-06-244</C_INVOICE_NUMBER>

</G_INVOICES>

</LIST_G_INVOICES>

</G_CHECKS>

</LIST_G_CHECKS>
Below is the step-step guide which I follow.

1) Open the Outermost for loop -- G_CHECKS

<?for-each@section:G_CHECKS?>

2) Declare Global Variable called no_of_lines_per_page -- In this case I have fixed 40


lines per page.

<xsl:variable name="no_of_lines_per_page" select="number(40)"/>

3) Declare incontext variable for inner group (G_INVOICES), variable is called


inner_group

<xsl:variable xdofo:ctx="incontext" name="inner_group select=".//G_INVOICES"/>

4) Open the Inner Loop

<?for-each:$inner_group?>

5) Before putting any elements with the help of current record pointer 'position(), I am
checking if the current position is modulizing with the no_of_lines_per_page equals zero
or not. If it reaches the first record after modulizing then I will create local variable
'first_rec' and initialize it with '0'.

<?if:(position()-1) mod $no_of_lines_per_page=0?><xsl:variable name="first_rec"


xdofo:ctx="incontext" select="position()"/>

Note : -- Above 3 steps ( 3,4,5) are created under V_inner_group_And_V_First_rec


form-field. Here there is limitation of Microsoft-word. We can enter upto 138 characters
only in Status field of Add help text button.If you want to add more , you can do this by
clicking on Help Key which is adjacent to Status tab.
6) If above condition holds true then we will iterate the inner loop.

<?for-each:$inner_group?>

7) I will check with the help of current record pointer 'position()' that the current record
position is either greater than 'first_rec' i.e. the first record or less the
'no_of_lines_per_page' value set up earlier. If it is then show the record otherwise not
otherwise it will not go in loop.

<?if:position()>=$first_rec and position()<$first_rec+$no_of_lines_per_page?>

8) Here I am closing the inner for loop and if condition

<?end if?><?end for-each?>

9) Here I am checking if no_of_lines of invoice is modulizing with the


no_of_lines_per_page equals to zero or not ,and the same time I am checking if
$first_rec+$no_of_lines_per_page is greater than no_of_lines of invoice or not.
This is important step for filling the blank rows.

<?if:not(count($inner_group) mod $no_of_lines_per_page=0) and ($first_rec+


$no_of_lines_per_page>count($inner_group))?>

10) Now I am calling sub-template recursively for filling the blank rows. While
calling this template I am passing one parameter which is having value of
no_of_rows to fill. Sub-template will have just one row table.

<xsl:call-template xdofo:ctx="inline" name="countdown"><xsl:with-param


name="countdown" select="$no_of_lines_per_page - (count($inner_group) mod
$no_of_lines_per_page)"/></xsl:call-template>

11) Sub-template declaration

<xsl:template name="countdown">
<xsl:param name="countdown"/><xsl:if test="$countdown"><xsl:call-template

name="countdown"><xsl:with-param name="countdown" select="$countdown - 1"/>

</xsl:call-template></xsl:if>

</xsl:template>

12) I have created page break after the fixed number of rows have been displayed.

<xsl:if xdofo:ctx="inblock" test="$first_rec+


$no_of_lines_per_page<=count($inner_group)">

<xsl:attribute name="break-before">page</xsl:attribute>

</xsl:if>

13) Finally closing outer if and inner for loop and outer for loop.

<?end if?><?end for-each?><?end for-each?>


Procure to Pay - Order to Cash - End to End Cycle Functional
Documents

Written by Sivakumar Ganesan


Sunday, 15 April 2007
I am pleased to introduce to you Mr. Sivakumar Ganesan. Siva is an Ex-Oracle Employee,
and he has vast knowledge in Order Management, P2P[Procure to Pay], Manufacturing
and Order to Cash. Please find a set of three wonderful articles from him that cover end
to end implementation steps for P2P, Order to Cash and much more. If your aim is to
become a Functional Consultant in Oracle Financials, then simply follow his step by step
instructions on a Vision Environment. My sincere thanks to Siva for sharing with us the
wealth of knowledge that he has.
This document will help you to understand the complete Business Flow of Oracle
Application including the accounting flow of Transactions in a Make to Stock Business
Scenario

This document covers the following

A. Business Case

1) Creation of Items

2) Setting up Selling Price for an Item

3) Define Customer

4) Creation of Sales Order

5) Enter Item Costs

6) Define Resources

7) Define Departments

8) Define Routing (CPU Sub assembly)

9) Define Bill of Materials (BOM) CPU Sub assembly

10) Define Routing (Dell Computer)

11) Define Bill of Materials (BOM) (Dell Computer)

12) Define Suppliers


13) Enter Purchase Requisitions

14) Create Purchase Orders

15) Enter Receipts (Inventory Receipt)

16) Auto-create Supplier Invoice

17) Create, View Invoices and Make Payments in Payables

18) Payments Reconciliation

19) Create, Release, Complete, Close Discrete Job for CPU Subassembly

20) Create, Release, Complete, Close Discrete Job for Dell Computer

21) Sales Order Booking, Releasing, Ship Confirm the Finished Goods

22) Run Auto invoice

23) View Sales Invoice, Create Receipt, Remittance and view Account Balances

24) Receipt Reconciliation

This Document has been broken to three parts owing to the size of the document is very
huge. Hence readers are requested to read the Document Links in the following Sequence
to understand the complete flow of Transactions

a) Business Case Study and Set up in Oracle Applications I

b) Procure to Pay and Manufacturing Cycle II

c) Order to Cash Cycle III


Which FND_USER is locking that table

This is a quick note to share a SQL that will tell you the FND_USER.USER_NAME of
the person that has locked a given table in Oracle APPS.

The column named "module" will tell you the name of the Form Function or the
Concurrent Program Short name which has aquired a lock onto that table.

SELECT c.owner
,c.object_name
,c.object_type
,fu.user_name locking_fnd_user_name
,fl.start_time locking_fnd_user_login_time
,vs.module
,vs.machine
,vs.osuser
,vlocked.oracle_username
,vs.sid
,vp.pid
,vp.spid AS os_process
,vs.serial#
,vs.status
,vs.saddr
,vs.audsid
,vs.process
FROM fnd_logins fl
,fnd_user fu
,v$locked_object vlocked
,v$process vp
,v$session vs
,dba_objects c
WHERE vs.sid = vlocked.session_id
AND vlocked.object_id = c.object_id
AND vs.paddr = vp.addr
AND vp.spid = fl.process_spid(+)
AND vp.pid = fl.pid(+)
AND fl.user_id = fu.user_id(+)
AND c.object_name LIKE '%' || upper('&tab_name_leaveblank4all') || '%'
AND nvl(vs.status
,'XX') != 'KILLED';
Another usage of Java Concurrent Programs

Written by Anil Passi


Friday, 09 February 2007
This article gives another practical example of Java Concurrent Program usage. I had
developed this solution for a big Financial Services client 4 years ago [2002]. My client
had over 400 bank accounts and there was a need to monitor cash balances across all
their bank accounts globally. They wanted to get up-to-date current total cash levels
across all their bank accounts [with a 15minutes lag period].

Did we connect to all those 400 bank accounts using Java Concurrent Program?
Not really. We used a third party named Biveroni[link]. Biveroni used to collect SWIFT
messages for all our 400+ bank accounts. SWIFT message, if nothing but an
message/instruction in specific format, that tells how much moneyhas been transacted on
a given bank account number.

So Biveroni received all the SWIFT messages, and java concurrent program was
used to get those messages from Biveroni?
Correct.

What happened next?


Following steps happened:-
1. The Java concurrent program FTP'ed the all the SWIFT messages from Biveroni to our
server.
2. After FTP'ing the messages, the same Java Concurrent Program parsed the messages
[using string tokenizer]
3. Using JDBC connection object within Java Concurrent Program, the messages were
loaded into our staging tables.
4. After validations, data was transferred to Cash Management Interface tables.
Validations on staging tables were performed via PL/SQL API.
The key is that all this happened within one single Java Concurrent Program. This is
where lies the strength of using Java Concurrent program, you can do it all within one go.
Imagine how this would have worked if using PL/SQL Concurrent program coupled with
Host Concurrent Programs.

How did we update the cash positions every 15minutes?


Simple, all we did was to schedule the Java Concurrent Program to run every 15minutes.

For the complete java technical design, please click on the link Java Bank Poller- Using
Java Concurrent Program.
I primarily used JDeveloper 9.0.2 for this development then, although Eclipse was
partially used as well for its code generation features.
Switch off CUSTOM.pll programatically

Yesterday someone asked me a very interesting question. The question was, how to turn
off CUSTOM.pll programatically based on some condition. The idea behind this article is
not only to provide solution to this question, but also to discuss another major limitation
of forms personalization.

What is the requirement?


Lets say you do not want CUSTOM.pll to be invoked when a specific profile option "XX
Disable Custom.pll" is set to Yes.
Effectively we need to be able to programatically switch of CUSTOM.pll

How do I programatically disable CUSTOM.pll ?


CUSTOM.pll gets called from APP_STANDARD package [in APPCORE.pll].
APP_STANDARD is effectively called from all the Oracle Apps Form Triggers. If you
open appcore.pll, you will notice that within package app_standard, reference to global
variable APP_CUSTOM_MODE made. If global variable APP_CUSTOM_MODE is set to
OFF, then CUSTOM.pll does not get called.

How do I doublecheck that above holds true?


Use examine, in normal mode you will notice the value of this global variable as
NORMAL

Turn custom code off using help menu, and then you will notice the value of global
variable changing.
What are the two options to disable CUSTOM.pll programatically?
Option 1:- Use Forms Personalization

Note: The limitation of Forms personalization, is that you will need to implement this
change for each and every FORM/Function separately
This limitation does not exist in CUSTOM.pll as we will see below.

Option 2:- Use CUSTOM.pll [yes CUSTOM.pll to turn off CUSTOM.pll conditionally]
IF event_name = 'WHEN-NEW-FORM-INSTANCE' THEN
IF fnd_profile.value( 'GL_SET_OF_BKS_ID' ) = 999 THEN
copy ( 'OFF' , 'GLOBAL.APP_CUSTOM_MODE' ) ;
ELSE
copy ( 'NORMAL' , 'GLOBAL.APP_CUSTOM_MODE' ) ;
END IF ;
END IF ;

So, CUSTOM.pll still rules in certain cases, as in this case whereby you wish to implement a logic spanning
multiple forms with few lines of code.
Some Scripts commonly used in Oracle E-Business Suite

Written by Ahmad
Sunday, 03 June 2007
Ahmad Bilal has thankfully decided to share some of the commonly used scripts that he
uses.
Please find these scripts below.

Note: - all queries are executed on RDBMS: 9.2.0.6.0 Oracle Applications: 11.5.10.2 by using
Toad for Oracle version 8.5.0.50

1. Responsibilities Listing

Purpose To get list of responsibilities.

Description Query useful when user wants to get application wise responsibility list

Parameters None

Query

SELECT (SELECT application_short_name

FROM fnd_application fa

WHERE fa.application_id = frt.application_id) application,

frt.responsibility_id, frt.responsibility_name

FROM apps.fnd_responsibility_tl frt;


1. Menus Listing
Purpose To get Menus Associated with responsibility

Description User to check menu attached with a reponsilblity

Parameters responsibility_id Which user can get from query of section


Responsibilities Listing

Query

SELECT DISTINCT a.responsibility_name, c.user_menu_name

FROM apps.fnd_responsibility_tl a,

apps.fnd_responsibility b,

apps.fnd_menus_tl c,

apps.fnd_menus d,

apps.fnd_application_tl e,

apps.fnd_application f

WHERE a.responsibility_id(+) = b.responsibility_id

AND a.responsibility_id = 20538

AND b.menu_id = c.menu_id

AND b.menu_id = d.menu_id

AND e.application_id = f.application_id

AND f.application_id = b.application_id

AND a.LANGUAGE = 'US';


1. Submenu And Function Listing
Purpose To get submenus and Function attached to this Main menu.

Description By using this query user can check function and submenus attached to that
specific menu

Parameters User_menu_name Which user can get from query of section Menu
Listing

Query

SELECT c.prompt, c.description

FROM apps.fnd_menus_tl a, fnd_menu_entries_tl c

WHERE a.menu_id = c.menu_id AND a.user_menu_name = 'F4 UK PAY


Navigator';
1. User And Assigned Responsibility Listing
Purpose To get assigned responsibility to a user.

Description User wants to check responsibility attached to a specific user

Parameters None

Query

SELECT UNIQUE u.user_id, SUBSTR (u.user_name, 1, 30) user_name,

SUBSTR (r.responsibility_name, 1, 60) responsiblity,

SUBSTR (a.application_name, 1, 50) application

FROM fnd_user u,

fnd_user_resp_groups g,

fnd_application_tl a,

fnd_responsibility_tl r

WHERE g.user_id(+) = u.user_id

AND g.responsibility_application_id = a.application_id

AND a.application_id = r.application_id

AND g.responsibility_id = r.responsibility_id

ORDER BY SUBSTR (user_name, 1, 30),

SUBSTR (a.application_name, 1, 50),

SUBSTR (r.responsibility_name, 1, 60);


1. Responsibility And Assigned Request Group Listing
Purpose To get responsibility and attached request groups.

Description Every responsibility contains a request group(request group is basis of


submitting requests)

Parameters None

Query

SELECT responsibility_name responsibility, request_group_name,


frg.description

FROM fnd_request_groups frg, fnd_responsibility_vl frv

WHERE frv.request_group_id = frg.request_group_id

ORDER BY responsibility_name
1. Profile Option With Modification Date and User
Purpose To get modified profile options.

Description Query used for audit point of view i.e. when a profile is changed and by whom
user

Parameters None

Query SELECT t.user_profile_option_name, profile_option_value, v.creation_date

v.last_update_date,

v.creation_date - v.last_update_date "Change Date",

(SELECT UNIQUE user_name

FROM fnd_user

WHERE user_id = v.created_by) "Created By",

(SELECT user_name

FROM fnd_user

WHERE user_id = v.last_updated_by) "Last Update By"

FROM fnd_profile_options o,

fnd_profile_option_values v,

fnd_profile_options_tl t

WHERE o.profile_option_id = v.profile_option_id

AND o.application_id = v.application_id

AND start_date_active <= SYSDATE

AND NVL (end_date_active, SYSDATE) >= SYSDATE

AND o.profile_option_name = t.profile_option_name

AND level_id = 10001

AND t.LANGUAGE IN (SELECT language_code

FROM fnd_languages
GL Interface API to Import Journals

Please find below an API for creating Journals in Oracle General Ledger ( GL ) . I had
developed this API in year 2002, and I have used this for three of my clients.

The idea behind this API is that you do not need to program for:-
1. Inserts to GL Interface ( GL_INTERFACE )
2. The validations required for Oracle GL Import
3. Submission of GL Import

Features of this Oracle GL Interface API are:-


1. It will ensure that the credit equals debit
2. It will submit GL Import when parameter p_submit_gl_interface is Y

For the source code for these API's click on the links below:-
GL Import API Package Header
GL Import API Package Body

Usage of this API


DECLARE
BEGIN
xx_import_xfer_gl_iface_api.transfer_to_gl
(p_sob_id => --Set of Books Id
,p_batch_header_id => --header id of your feed
,p_trx_header_id => --sub header id of your feed
--or leave this to be the same as above
,p_trx_line_id => --line id of your feed
,p_date => --effective date of the journal
,p_currency_code => --currency code of the journal
,p_amount => --journal line amount
,p_dr_account => --GL CCID of account to be credited
,p_cr_account => --GL CCID of account to be debited
,p_journal_name => --Journal Name to be created
,p_header_description => --Journal Description to be created
,p_line_description => --Journal Line descriptionn
,p_success_flag => b_success_flag--boolean returned to show if errored
,p_first_record_in_batch => v_first_record_in_batch --pass Y for First Record in batch
,p_submit_gl_interface => v_is_last_trx_line --Pass Y submit for last line of batch
--when Y it will submit the GL Import
,p_gl_user_je_source_name => --user_je_source_name
,p_gl_user_je_category_name => --user_je_category_name
,p_trx_number => --trx_number
);
END;
Oracle API for GL Interface Package Header:

CREATE OR REPLACE PACKAGE xx_import_xfer_gl_iface_api


/* $Header: XXXXXXXX.pkh, Version 1.0, 07-FEB-2002 UKEXPI $
***********************************************************************
**
* History Log *
**
***********************************************************************
**
* App/Release : Oracle e-Business Suite RXXX *
* Oracle App : SHORTNAME - FULL_NAME *
* Module : SHORTNAME - DESCRIPTION *
* Author : Anil Passi(Go 4 Gold) *
* Version : 1.0 *
* Created : 11-OCT-2002 *
* Description : This package gives API for GL interface calls *
**
* Change History Log *
* ================== *
**
* Version Date Author Change *
* ======= =========== ============
================================*
**
* 1.0 11-OCT-2002 A. Passi Initial Version *
**
* Parameters : *
**
**********************************************************************/
AUTHID CURRENT_USER IS
PROCEDURE set_sob_id(p_sob_id IN INTEGER);

PROCEDURE set_source_name(p_source_name IN VARCHAR2);

PROCEDURE populate_interface_control(p_user_je_source_name IN VARCHAR2


,p_group_id IN OUT NUMBER
,p_set_of_books_id NUMBER
,p_interface_run_id IN OUT NUMBER);

TYPE g_gl_int_type_rec IS RECORD(


reference_date DATE
,attribute20 VARCHAR2(150)
,CONTEXT VARCHAR2(150)
,context2 VARCHAR2(150)
,invoice_date DATE
,tax_code VARCHAR2(15)
,invoice_identifier VARCHAR2(20)
,invoice_amount NUMBER
,context3 VARCHAR2(150)
,ussgl_transaction_code VARCHAR2(30)
,descr_flex_error_message VARCHAR2(240)
,jgzz_recon_ref VARCHAR2(240)
,segment23 VARCHAR2(25)
,segment24 VARCHAR2(25)
,segment25 VARCHAR2(25)
,segment26 VARCHAR2(25)
,segment27 VARCHAR2(25)
,segment28 VARCHAR2(25)
,segment29 VARCHAR2(25)
,segment30 VARCHAR2(25)
,entered_dr NUMBER
,entered_cr NUMBER
,accounted_dr NUMBER
,accounted_cr NUMBER
,transaction_date DATE
,reference1 VARCHAR2(100)
,reference2 VARCHAR2(240)
,reference3 VARCHAR2(100)
,reference4 VARCHAR2(100)
,reference5 VARCHAR2(240)
,reference6 VARCHAR2(100)
,reference7 VARCHAR2(100)
,reference8 VARCHAR2(100)
,reference9 VARCHAR2(100)
,reference10 VARCHAR2(240)
,reference11 VARCHAR2(100)
,reference12 VARCHAR2(100)
,reference13 VARCHAR2(100)
,reference14 VARCHAR2(100)
,reference15 VARCHAR2(100)
,reference16 VARCHAR2(100)
,reference17 VARCHAR2(100)
,reference18 VARCHAR2(100)
,reference19 VARCHAR2(100)
,reference20 VARCHAR2(100)
,reference21 VARCHAR2(240)
,reference22 VARCHAR2(240)
,reference23 VARCHAR2(240)
,reference24 VARCHAR2(240)
,reference25 VARCHAR2(240)
,reference26 VARCHAR2(240)
,reference27 VARCHAR2(240)
,reference28 VARCHAR2(240)
,reference29 VARCHAR2(240)
,reference30 VARCHAR2(240)
,je_batch_id NUMBER
,period_name VARCHAR2(15)
,je_header_id NUMBER
,je_line_num NUMBER
,chart_of_accounts_id NUMBER
,functional_currency_code VARCHAR2(15)
,code_combination_id NUMBER
,date_created_in_gl DATE
,warning_code VARCHAR2(4)
,status_description VARCHAR2(240)
,stat_amount NUMBER
,group_id NUMBER
,request_id NUMBER
,subledger_doc_sequence_id NUMBER
,subledger_doc_sequence_value NUMBER
,attribute1 VARCHAR2(150)
,attribute2 VARCHAR2(150)
,gl_sl_link_id NUMBER
,gl_sl_link_table VARCHAR2(30)
,attribute3 VARCHAR2(150)
,attribute4 VARCHAR2(150)
,attribute5 VARCHAR2(150)
,attribute6 VARCHAR2(150)
,attribute7 VARCHAR2(150)
,attribute8 VARCHAR2(150)
,attribute9 VARCHAR2(150)
,attribute10 VARCHAR2(150)
,attribute11 VARCHAR2(150)
,attribute12 VARCHAR2(150)
,attribute13 VARCHAR2(150)
,attribute14 VARCHAR2(150)
,attribute15 VARCHAR2(150)
,attribute16 VARCHAR2(150)
,attribute17 VARCHAR2(150)
,attribute18 VARCHAR2(150)
,attribute19 VARCHAR2(150)
,status VARCHAR2(50)
,set_of_books_id NUMBER
,accounting_date DATE
,currency_code VARCHAR2(15)
,date_created DATE
,created_by NUMBER
,actual_flag VARCHAR2(1)
,user_je_category_name VARCHAR2(25)
,user_je_source_name VARCHAR2(25)
,currency_conversion_date DATE
,encumbrance_type_id NUMBER
,budget_version_id NUMBER
,user_currency_conversion_type VARCHAR2(30)
,currency_conversion_rate NUMBER
,average_journal_flag VARCHAR2(1)
,originating_bal_seg_value VARCHAR2(25)
,segment1 VARCHAR2(25)
,segment2 VARCHAR2(25)
,segment3 VARCHAR2(25)
,segment4 VARCHAR2(25)
,segment5 VARCHAR2(25)
,segment6 VARCHAR2(25)
,segment7 VARCHAR2(25)
,segment8 VARCHAR2(25)
,segment9 VARCHAR2(25)
,segment10 VARCHAR2(25)
,segment11 VARCHAR2(25)
,segment12 VARCHAR2(25)
,segment13 VARCHAR2(25)
,segment14 VARCHAR2(25)
,segment15 VARCHAR2(25)
,segment16 VARCHAR2(25)
,segment17 VARCHAR2(25)
,segment18 VARCHAR2(25)
,segment19 VARCHAR2(25)
,segment20 VARCHAR2(25)
,segment21 VARCHAR2(25)
,segment22 VARCHAR2(25));

PROCEDURE insert_statement(p_gl_int_rec IN OUT NOCOPY g_gl_int_type_rec);

PROCEDURE transfer_to_gl(p_sob_id IN INTEGER


,p_batch_header_id IN INTEGER
,p_trx_header_id IN INTEGER
,p_trx_line_id IN INTEGER
,p_date IN OUT DATE
,p_currency_code IN VARCHAR2
,p_amount IN NUMBER
,p_dr_account IN INTEGER
,p_cr_account IN INTEGER
,p_journal_name IN VARCHAR2
,p_header_description IN VARCHAR2
,p_line_description IN VARCHAR2
,p_success_flag OUT BOOLEAN
,p_first_record_in_batch IN VARCHAR2
,p_submit_gl_interface IN VARCHAR2
,p_gl_user_je_source_name IN VARCHAR2
,p_gl_user_je_category_name IN VARCHAR2
,p_trx_number IN VARCHAR2);
PROCEDURE new_gl_interface_batch;

FUNCTION get_gl_je_reference1(p_batch_header_id IN INTEGER


,p_trx_number IN VARCHAR2)
RETURN VARCHAR2;

FUNCTION get_gl_application_id(p_appl_name IN VARCHAR2) RETURN


INTEGER;

END xx_import_xfer_gl_iface_api;
Oracle API for GL Interface Package Body:

CREATE OR REPLACE PACKAGE BODY xx_import_xfer_gl_iface_api IS


/* $Header: XXXXXXXX.pkh, Version 1.0, 07-FEB-2003 UKEXPI $
***********************************************************************
**
* History Log *
**
***********************************************************************
**
* App/Release : Oracle e-Business Suite RXXX *
* Oracle App : SHORTNAME - FULL_NAME *
* Module : SHORTNAME - DESCRIPTION *
* Author : Anil Passi(Go 4 Gold), *
* Version : 1.0 *
* Revised : 11-SEP-2005 *
* Description : This package delivers GL interface API *
**
* Change History Log *
* ================== *
**
* Version Date Author Change *
* ======= =========== ============
================================*
*
* 1.0 10-OCT-2002 A. Passi Initial Version
* 1.2 12-OCT-2002 A. Passi Added ability to "transfer_to_gl" such that
both the credit and debit can either happen
in single API call, or multiple calls(when an
amount is distributed).
* 1.3 24-Jan-2006 A. Passi Add the trx_number to the batch details.
This is so because the recurring journal will
have incremental trx_number for each period,
with the batch number remaining the same.
* 1.4 08-Sep-2005 A. Passi Move the journal to next
period if current period is closed
**********************************************************************/

g_sob_id INTEGER := fnd_profile.VALUE('GL_SET_OF_BKS_ID');


g_source_name gl_je_headers.je_source%TYPE;
g_error_flag VARCHAR2(1) := NULL;

g_xx_transaction_source CONSTANT VARCHAR2(80) := 'XX_COST_XFER';


--move these three into the config screen.
--$?$
g_gl_user_je_source_name CONSTANT VARCHAR2(30) :=
nvl(fnd_profile.VALUE('XX_OVERRIDE_GL_JE_SOURCE_NAME')
,'Manual');
--$?$
g_gl_user_je_category_name CONSTANT VARCHAR2(30) :=
nvl(fnd_profile.VALUE('XX_OVERRIDE_JE_CATEGORY_NAME')
,'Miscellaneous Transaction');
--$?$
g_conversion_type VARCHAR2(30) :=
nvl(fnd_profile.VALUE('XX_OVERRIDE_GL_RATE_CONVERSION_TYPE')
,'Corporate');

g_gl_batch_prefix VARCHAR2(30) :=
nvl(fnd_profile.VALUE('XX_OVERRIDE_GL_BATCH_PREFIX')
,'XX_GL_FEED_NAME:');

g_gl_appl_name CONSTANT VARCHAR2(30) := 'SQLGL';


g_conversion_type_code VARCHAR2(30);

g_debug_procedure_context VARCHAR2(30);
g_debug_header_context CONSTANT VARCHAR2(80) :=
'xx_gl_feed.plsql.xx_import_xfer_gl_iface_api.';

--Programming variables
--g_group_id and g_interface_run_id will be set each time separately for a batch
g_group_id NUMBER;
g_interface_run_id NUMBER;

PROCEDURE new_gl_interface_batch IS
BEGIN
g_group_id := NULL;
g_interface_run_id := NULL;
END new_gl_interface_batch;

PROCEDURE debug_stmt(p_msg IN VARCHAR2) IS


BEGIN
fnd_log.STRING(log_level => fnd_log.level_statement
,module => g_debug_header_context ||
g_debug_procedure_context
,message => p_msg);
IF fnd_global.conc_request_id > 0 AND
fnd_profile.VALUE('AFLOG_ENABLED') = 'Y'
THEN
fnd_file.put_line(which => fnd_file.log
,buff => p_msg);
END IF;

END debug_stmt;

PROCEDURE debug_begin_procedure IS
BEGIN
fnd_log.STRING(log_level => fnd_log.level_statement
,module => g_debug_header_context ||
g_debug_procedure_context
,message => 'Begin ' || g_debug_procedure_context);
END debug_begin_procedure;

PROCEDURE debug_end_procedure IS
BEGIN
fnd_log.STRING(log_level => fnd_log.level_statement
,module => g_debug_header_context ||
g_debug_procedure_context
,message => 'End ' || g_debug_procedure_context);
END debug_end_procedure;

PROCEDURE set_debug_context(p_procedure_name IN VARCHAR2) IS


BEGIN
g_debug_procedure_context := p_procedure_name;
debug_begin_procedure;
END set_debug_context;

PROCEDURE log_error(p_batch_header_id IN INTEGER


,p_trx_header_id IN INTEGER
,p_error_message IN VARCHAR2) IS
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
IF fnd_global.conc_request_id > 0
THEN
fnd_file.put_line(fnd_file.output
,'ERROR::' || p_error_message);
g_error_flag := 'Y';
END IF;
--log error into your error logging table
/* INSERT INTO xx_gl_api_error_logs
(error_log_id
,batch_header_id
,trx_header_id
,error_message
,creation_date
,fnd_request_id)
VALUES
(xx_error_log_s.NEXTVAL -- x_error_log_id
,p_batch_header_id
,p_trx_header_id
,substr(p_error_message, 1, 2000)
,SYSDATE --creation_date
,fnd_global.conc_request_id --fnd_request_id
);
*/
debug_stmt('ERROR: ' || p_error_message);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
debug_stmt('ERROR: in Log_error');
ROLLBACK;
END log_error;

FUNCTION get_sob_id RETURN INTEGER IS


BEGIN
set_debug_context('get_sob_id');
debug_stmt('get_sob_id() Returning g_sob_id=>' || g_sob_id);
RETURN g_sob_id;
debug_end_procedure;
END get_sob_id;

PROCEDURE set_sob_id(p_sob_id IN INTEGER) IS


BEGIN
set_debug_context('set_sob_id');

g_sob_id := p_sob_id;
debug_stmt('set_sob_id() Setting g_sob_id=>' || g_sob_id);
debug_end_procedure;
END set_sob_id;

PROCEDURE set_source_name(p_source_name IN VARCHAR2) IS


BEGIN
set_debug_context('set_source_name');

g_source_name := p_source_name;
debug_stmt('set_source_name() Setting g_source_name=>' ||
g_source_name);
debug_end_procedure;
END set_source_name;

FUNCTION get_source_name RETURN VARCHAR2 IS


BEGIN
RETURN g_source_name;
END get_source_name;

FUNCTION get_xx_transaction_source RETURN VARCHAR2 IS


BEGIN
RETURN g_xx_transaction_source;
END get_xx_transaction_source;

PROCEDURE populate_interface_control(p_user_je_source_name IN VARCHAR2


,p_group_id IN OUT NUMBER
,p_set_of_books_id NUMBER
,p_interface_run_id IN OUT NUMBER) IS
re_use_gl_interface_control EXCEPTION;
BEGIN
set_debug_context('populate_interface_control');

IF g_group_id IS NOT NULL AND g_interface_run_id IS NOT NULL


THEN
p_group_id := g_group_id;
p_interface_run_id := g_interface_run_id;
RAISE re_use_gl_interface_control;
END IF;
gl_journal_import_pkg.populate_interface_control(user_je_source_name =>
p_user_je_source_name
,group_id => p_group_id
,set_of_books_id => p_set_of_books_id
,interface_run_id => p_interface_run_id);

g_group_id := p_group_id;
g_interface_run_id := p_interface_run_id;

debug_stmt('Returning New Group p_group_id=>' || p_group_id ||


' p_interface_run_id=>' || p_interface_run_id);

debug_end_procedure;
EXCEPTION
WHEN re_use_gl_interface_control THEN
debug_stmt('Returning Global Group g_group_id=>' || g_group_id ||
' g_interface_run_id=>' || g_interface_run_id);
debug_end_procedure;
END populate_interface_control;

PROCEDURE interface_record IS
n_group_id INTEGER;
n_sob_id INTEGER;
n_interface_run_id INTEGER;
BEGIN
set_debug_context('interface_record');

n_sob_id := get_sob_id;
populate_interface_control(p_user_je_source_name => g_source_name
,p_group_id => n_group_id
,p_set_of_books_id => n_sob_id
,p_interface_run_id => n_interface_run_id);
debug_end_procedure;
END interface_record;

PROCEDURE insert_statement(p_gl_int_rec IN OUT NOCOPY g_gl_int_type_rec) IS


BEGIN
set_debug_context('insert_statement');

INSERT INTO gl_interface


(reference_date
,attribute20
,CONTEXT
,context2
,invoice_date
,tax_code
,invoice_identifier
,invoice_amount
,context3
,ussgl_transaction_code
,descr_flex_error_message
,jgzz_recon_ref
,segment23
,segment24
,segment25
,segment26
,segment27
,segment28
,segment29
,segment30
,entered_dr
,entered_cr
,accounted_dr
,accounted_cr
,transaction_date
,reference1
,reference2
,reference3
,reference4
,reference5
,reference6
,reference7
,reference8
,reference9
,reference10
,reference11
,reference12
,reference13
,reference14
,reference15
,reference16
,reference17
,reference18
,reference19
,reference20
,reference21
,reference22
,reference23
,reference24
,reference25
,reference26
,reference27
,reference28
,reference29
,reference30
,je_batch_id
,period_name
,je_header_id
,je_line_num
,chart_of_accounts_id
,functional_currency_code
,code_combination_id
,date_created_in_gl
,warning_code
,status_description
,stat_amount
,group_id
,request_id
,subledger_doc_sequence_id
,subledger_doc_sequence_value
,attribute1
,attribute2
,gl_sl_link_id
,gl_sl_link_table
,attribute3
,attribute4
,attribute5
,attribute6
,attribute7
,attribute8
,attribute9
,attribute10
,attribute11
,attribute12
,attribute13
,attribute14
,attribute15
,attribute16
,attribute17
,attribute18
,attribute19
,status
,set_of_books_id
,accounting_date
,currency_code
,date_created
,created_by
,actual_flag
,user_je_category_name
,user_je_source_name
,currency_conversion_date
,encumbrance_type_id
,budget_version_id
,user_currency_conversion_type
,currency_conversion_rate
,average_journal_flag
,originating_bal_seg_value
,segment1
,segment2
,segment3
,segment4
,segment5
,segment6
,segment7
,segment8
,segment9
,segment10
,segment11
,segment12
,segment13
,segment14
,segment15
,segment16
,segment17
,segment18
,segment19
,segment20
,segment21
,segment22)
VALUES
(p_gl_int_rec.reference_date -- reference_date
,p_gl_int_rec.attribute20 -- attribute20
,p_gl_int_rec.CONTEXT -- context
,p_gl_int_rec.context2 -- context2
,p_gl_int_rec.invoice_date -- invoice_date
,p_gl_int_rec.tax_code -- tax_code
,p_gl_int_rec.invoice_identifier -- invoice_identifier
,p_gl_int_rec.invoice_amount -- invoice_amount
,p_gl_int_rec.context3 -- context3
,p_gl_int_rec.ussgl_transaction_code -- ussgl_transaction_code
,p_gl_int_rec.descr_flex_error_message -- descr_flex_error_message
,p_gl_int_rec.jgzz_recon_ref -- jgzz_recon_ref
,p_gl_int_rec.segment23 -- segment23
,p_gl_int_rec.segment24 -- segment24
,p_gl_int_rec.segment25 -- segment25
,p_gl_int_rec.segment26 -- segment26
,p_gl_int_rec.segment27 -- segment27
,p_gl_int_rec.segment28 -- segment28
,p_gl_int_rec.segment29 -- segment29
,p_gl_int_rec.segment30 -- segment30
,p_gl_int_rec.entered_dr -- entered_dr
,p_gl_int_rec.entered_cr -- entered_cr
,p_gl_int_rec.accounted_dr -- accounted_dr
,p_gl_int_rec.accounted_cr -- accounted_cr
,p_gl_int_rec.transaction_date -- transaction_date
,p_gl_int_rec.reference1 -- reference1
,p_gl_int_rec.reference2 -- reference2
,p_gl_int_rec.reference3 -- reference3
,p_gl_int_rec.reference4 -- reference4
,p_gl_int_rec.reference5 -- reference5
,p_gl_int_rec.reference6 -- reference6
,p_gl_int_rec.reference7 -- reference7
,p_gl_int_rec.reference8 -- reference8
,p_gl_int_rec.reference9 -- reference9
,p_gl_int_rec.reference10 -- reference10
,p_gl_int_rec.reference11 -- reference11
,p_gl_int_rec.reference12 -- reference12
,p_gl_int_rec.reference13 -- reference13
,p_gl_int_rec.reference14 -- reference14
,p_gl_int_rec.reference15 -- reference15
,p_gl_int_rec.reference16 -- reference16
,p_gl_int_rec.reference17 -- reference17
,p_gl_int_rec.reference18 -- reference18
,p_gl_int_rec.reference19 -- reference19
,p_gl_int_rec.reference20 -- reference20
,p_gl_int_rec.reference21 -- reference21
,p_gl_int_rec.reference22 -- reference22
,p_gl_int_rec.reference23 -- reference23
,p_gl_int_rec.reference24 -- reference24
,p_gl_int_rec.reference25 -- reference25
,p_gl_int_rec.reference26 -- reference26
,p_gl_int_rec.reference27 -- reference27
,p_gl_int_rec.reference28 -- reference28
,p_gl_int_rec.reference29 -- reference29
,p_gl_int_rec.reference30 -- reference30
,p_gl_int_rec.je_batch_id -- je_batch_id
,p_gl_int_rec.period_name -- period_name
,p_gl_int_rec.je_header_id -- je_header_id
,p_gl_int_rec.je_line_num -- je_line_num
,p_gl_int_rec.chart_of_accounts_id -- chart_of_accounts_id
,p_gl_int_rec.functional_currency_code -- functional_currency_code
,p_gl_int_rec.code_combination_id -- code_combination_id
,p_gl_int_rec.date_created_in_gl -- date_created_in_gl
,p_gl_int_rec.warning_code -- warning_code
,p_gl_int_rec.status_description -- status_description
,p_gl_int_rec.stat_amount -- stat_amount
,p_gl_int_rec.group_id -- group_id
,p_gl_int_rec.request_id -- request_id
,p_gl_int_rec.subledger_doc_sequence_id
-- subledger_doc_sequence_id
,p_gl_int_rec.subledger_doc_sequence_value
-- subledger_doc_sequence_value
,p_gl_int_rec.attribute1 -- attribute1
,p_gl_int_rec.attribute2 -- attribute2
,p_gl_int_rec.gl_sl_link_id -- gl_sl_link_id
,p_gl_int_rec.gl_sl_link_table -- gl_sl_link_table
,p_gl_int_rec.attribute3 -- attribute3
,p_gl_int_rec.attribute4 -- attribute4
,p_gl_int_rec.attribute5 -- attribute5
,p_gl_int_rec.attribute6 -- attribute6
,p_gl_int_rec.attribute7 -- attribute7
,p_gl_int_rec.attribute8 -- attribute8
,p_gl_int_rec.attribute9 -- attribute9
,p_gl_int_rec.attribute10 -- attribute10
,p_gl_int_rec.attribute11 -- attribute11
,p_gl_int_rec.attribute12 -- attribute12
,p_gl_int_rec.attribute13 -- attribute13
,p_gl_int_rec.attribute14 -- attribute14
,p_gl_int_rec.attribute15 -- attribute15
,p_gl_int_rec.attribute16 -- attribute16
,p_gl_int_rec.attribute17 -- attribute17
,p_gl_int_rec.attribute18 -- attribute18
,p_gl_int_rec.attribute19 -- attribute19
,p_gl_int_rec.status -- status
,p_gl_int_rec.set_of_books_id -- set_of_books_id
,p_gl_int_rec.accounting_date -- accounting_date
,p_gl_int_rec.currency_code -- currency_code
,p_gl_int_rec.date_created -- date_created
,p_gl_int_rec.created_by -- created_by
,p_gl_int_rec.actual_flag -- actual_flag
,p_gl_int_rec.user_je_category_name -- user_je_category_name
,p_gl_int_rec.user_je_source_name -- user_je_source_name
,p_gl_int_rec.currency_conversion_date -- currency_conversion_date
,p_gl_int_rec.encumbrance_type_id -- encumbrance_type_id
,p_gl_int_rec.budget_version_id -- budget_version_id
,p_gl_int_rec.user_currency_conversion_type
-- user_currency_conversion_type
,p_gl_int_rec.currency_conversion_rate -- currency_conversion_rate
,p_gl_int_rec.average_journal_flag -- average_journal_flag
,p_gl_int_rec.originating_bal_seg_value
-- originating_bal_seg_value
,p_gl_int_rec.segment1 -- segment1
,p_gl_int_rec.segment2 -- segment2
,p_gl_int_rec.segment3 -- segment3
,p_gl_int_rec.segment4 -- segment4
,p_gl_int_rec.segment5 -- segment5
,p_gl_int_rec.segment6 -- segment6
,p_gl_int_rec.segment7 -- segment7
,p_gl_int_rec.segment8 -- segment8
,p_gl_int_rec.segment9 -- segment9
,p_gl_int_rec.segment10 -- segment10
,p_gl_int_rec.segment11 -- segment11
,p_gl_int_rec.segment12 -- segment12
,p_gl_int_rec.segment13 -- segment13
,p_gl_int_rec.segment14 -- segment14
,p_gl_int_rec.segment15 -- segment15
,p_gl_int_rec.segment16 -- segment16
,p_gl_int_rec.segment17 -- segment17
,p_gl_int_rec.segment18 -- segment18
,p_gl_int_rec.segment19 -- segment19
,p_gl_int_rec.segment20 -- segment20
,p_gl_int_rec.segment21 -- segment21
,p_gl_int_rec.segment22 -- segment22
);
debug_stmt(SQL%ROWCOUNT || ' records inserted into GL_INTERFACE');
debug_end_procedure;
END insert_statement;

FUNCTION check_ccid(p_sob_id IN INTEGER


,p_ccid IN INTEGER) RETURN BOOLEAN IS
CURSOR c_check IS
SELECT 'x'
FROM gl_code_combinations gcc, gl_sets_of_books gsob
WHERE gsob.set_of_books_id = p_sob_id
AND gcc.code_combination_id = p_ccid
AND gcc.chart_of_accounts_id = gsob.chart_of_accounts_id
AND gcc.enabled_flag = 'Y';

p_check c_check%ROWTYPE;
BEGIN
set_debug_context('check_ccid');
debug_stmt('p_sob_id=>' || p_sob_id || ' p_ccid=>' || p_ccid);
OPEN c_check;
FETCH c_check
INTO p_check;

IF c_check%NOTFOUND
THEN
CLOSE c_check;
debug_stmt('check_ccid() RETURNED FALSE;');
RETURN FALSE;
END IF;

CLOSE c_check;
debug_stmt('check_ccid() RETURNED TRUE;');
RETURN TRUE;
debug_end_procedure;
END check_ccid;

FUNCTION get_gl_application_id(p_appl_name IN VARCHAR2) RETURN INTEGER


IS
CURSOR c_check IS
SELECT application_id
FROM fnd_application_vl
WHERE application_short_name = p_appl_name;
p_check c_check%ROWTYPE;
BEGIN
OPEN c_check;
FETCH c_check
INTO p_check;
CLOSE c_check;
RETURN p_check.application_id;
END get_gl_application_id;

FUNCTION check_conversion_type RETURN BOOLEAN IS


CURSOR c_check IS
SELECT 'x'
FROM gl_daily_conversion_types
WHERE user_conversion_type = g_conversion_type;

p_check c_check%ROWTYPE;
BEGIN
set_debug_context('check_conversion_type');

debug_stmt('g_conversion_type=>' || g_conversion_type);
OPEN c_check;
FETCH c_check
INTO p_check;

IF c_check%NOTFOUND
THEN
CLOSE c_check;
debug_stmt('check_conversion_type() RETURNED FALSE;');
RETURN FALSE;
END IF;

CLOSE c_check;
debug_stmt('check_conversion_type() RETURNED TRUE;');
RETURN TRUE;
END check_conversion_type;

FUNCTION check_gl_source(p_gl_user_je_source_name IN VARCHAR2)


RETURN BOOLEAN IS
CURSOR c_check IS
SELECT 'x'
FROM gl_je_sources
WHERE user_je_source_name =
nvl(p_gl_user_je_source_name
,g_gl_user_je_source_name);
p_check c_check%ROWTYPE;
BEGIN
set_debug_context('check_gl_source');
debug_stmt('g_gms_cost_xfer_source=>' || g_gl_user_je_source_name);
OPEN c_check;
FETCH c_check
INTO p_check;

IF c_check%NOTFOUND
THEN
CLOSE c_check;
debug_stmt('check_gl_source() RETURNED FALSE;');
RETURN FALSE;
END IF;

CLOSE c_check;
debug_stmt('check_gl_source() RETURNED TRUE;');
RETURN TRUE;
END check_gl_source;

FUNCTION get_next_available_open_date(p_accounting_date IN DATE


,p_gl_appl_id IN NUMBER
,p_sob_id IN NUMBER)
RETURN DATE IS
CURSOR c_get IS
SELECT gps.start_date
FROM gl_period_statuses gps
WHERE gps.application_id = p_gl_appl_id
AND gps.set_of_books_id = p_sob_id
AND gps.closing_status IN ('O', 'F')
AND trunc(gps.start_date) > p_accounting_date
ORDER BY trunc(gps.start_date);
p_get c_get%ROWTYPE;
BEGIN
OPEN c_get;
FETCH c_get
INTO p_get;
CLOSE c_get;
RETURN p_get.start_date;
END get_next_available_open_date;

FUNCTION validate_accounting_date(p_accounting_date IN OUT DATE


,p_gl_appl_id IN NUMBER
,p_sob_id IN NUMBER
,p_batch_header_id IN NUMBER
,p_trx_header_id IN NUMBER)
RETURN BOOLEAN IS
v_count NUMBER := 0;
v_accounting_date DATE;
BEGIN
set_debug_context('validate_accounting_date');
v_accounting_date := p_accounting_date;
debug_stmt('p_accounting_date=>' || p_accounting_date ||
' p_gl_appl_id=>' || p_gl_appl_id || ' p_sob_id=>' ||
p_sob_id);
SELECT COUNT(*)
INTO v_count
FROM gl_period_statuses gps
WHERE gps.application_id = p_gl_appl_id
AND gps.set_of_books_id = p_sob_id
AND gps.closing_status IN ('O', 'F')
AND trunc(p_accounting_date) BETWEEN
nvl(trunc(gps.start_date)
,trunc(p_accounting_date)) AND
nvl(trunc(gps.end_date)
,trunc(p_accounting_date));

IF v_count > 0
THEN
debug_stmt('validate_accounting_date() RETURNED TRUE');
RETURN TRUE;
ELSE
debug_stmt('validate_accounting_date() Cant find open Period for ' ||
p_accounting_date);
--try to find next available date now
p_accounting_date := get_next_available_open_date(p_accounting_date =>
v_accounting_date
,p_gl_appl_id => p_gl_appl_id
,p_sob_id => p_sob_id);
IF p_accounting_date IS NULL
THEN
log_error(p_batch_header_id => p_batch_header_id
,p_trx_header_id => p_trx_header_id
,p_error_message => 'Accounting Date ' ||
to_char(v_accounting_date
,'DD-MON-YYYY') ||
' does not belong to a Open Period');

/* --!!!!!Abort the process here


raise_application_error(-20001
,v_accounting_date ||
' Can not find open/future period for this date. Batch Number ' ||
p_batch_header_id
||
' . There must be at least one future/open period for this process to run'
);
*/
RETURN FALSE;
ELSE
debug_stmt('validate_accounting_date() Using next available open date ' ||
p_accounting_date);
RETURN TRUE;
END IF;
END IF;

END validate_accounting_date;

-- Function to validate currency code


FUNCTION validate_currency(p_currency_code IN VARCHAR2
,p_accounting_date IN DATE) RETURN BOOLEAN IS
v_count NUMBER := 0;
BEGIN
set_debug_context('validate_currency');
SELECT COUNT(*)
INTO v_count
FROM fnd_currencies fc
WHERE fc.currency_code = p_currency_code
AND enabled_flag = 'Y'
AND p_accounting_date BETWEEN
nvl(start_date_active
,p_accounting_date) AND
nvl(end_date_active
,p_accounting_date);

IF v_count > 0
THEN
debug_stmt('validate_currency() RETURNED TRUE');
RETURN TRUE;
ELSE
debug_stmt('validate_currency() RETURNED FLASE');
RETURN FALSE;
END IF;
END validate_currency;

PROCEDURE set_conversion_type_code IS
CURSOR c_get IS
SELECT conversion_type
FROM gl_daily_conversion_types
WHERE user_conversion_type = g_conversion_type;
BEGIN
set_debug_context('set_conversion_type_code');
debug_stmt('g_conversion_type=>' || g_conversion_type);
OPEN c_get;
FETCH c_get
INTO g_conversion_type_code;
CLOSE c_get;
debug_stmt('g_conversion_type_code=>' || g_conversion_type_code);
debug_end_procedure;
END set_conversion_type_code;

FUNCTION get_batch_employee_number(p_batch_header_id IN INTEGER)


RETURN VARCHAR2 IS
CURSOR c_get IS
SELECT ppx.employee_number
FROM per_people_x ppx
--,"your own table here for the feed " bhdr
--WHERE ppx.person_id = bhdr.employee_id
;
p_get c_get%ROWTYPE;
BEGIN
--change this function as per your need
--i am returning a constant value
RETURN '101010';
OPEN c_get;
FETCH c_get
INTO p_get;
CLOSE c_get;
RETURN p_get.employee_number;
END get_batch_employee_number;

FUNCTION get_gl_je_reference1(p_batch_header_id IN INTEGER


,p_trx_number IN VARCHAR2)
RETURN VARCHAR2 IS
BEGIN
RETURN g_gl_batch_prefix || p_batch_header_id || '-' || p_trx_number || ':' ||
get_batch_employee_number(p_batch_header_id) || ':';
END get_gl_je_reference1;

FUNCTION get_sob_currency(p_sob_id IN INTEGER) RETURN VARCHAR2 IS


CURSOR c_check IS
SELECT currency_code
FROM gl_sets_of_books
WHERE set_of_books_id = p_sob_id;
p_check c_check%ROWTYPE;
BEGIN
OPEN c_check;
FETCH c_check
INTO p_check;
CLOSE c_check;
RETURN p_check.currency_code;
END get_sob_currency;

/**************************************************
Main code for gms_cost_xfer GL Interface begins here
**************************************************/
PROCEDURE transfer_to_gl(p_sob_id IN INTEGER
,p_batch_header_id IN INTEGER
,p_trx_header_id IN INTEGER
,p_trx_line_id IN INTEGER
,p_date IN OUT DATE
,p_currency_code IN VARCHAR2
,p_amount IN NUMBER
,p_dr_account IN INTEGER
,p_cr_account IN INTEGER
,p_journal_name IN VARCHAR2
,p_header_description IN VARCHAR2
,p_line_description IN VARCHAR2
,p_success_flag OUT BOOLEAN
,p_first_record_in_batch IN VARCHAR2
,p_submit_gl_interface IN VARCHAR2
,p_gl_user_je_source_name IN VARCHAR2
,p_gl_user_je_category_name IN VARCHAR2
,p_trx_number IN VARCHAR2) IS
v_gl_appl_id NUMBER;
l_gl_int_type_rec g_gl_int_type_rec;
v_conc_id INTEGER;
conversion_rate_does_not_exist EXCEPTION;
invalid_conversion_type EXCEPTION;
invalid_dr_ccid EXCEPTION;
invalid_cr_ccid EXCEPTION;
invalid_currency_code EXCEPTION;
not_in_open_period EXCEPTION;
invalid_gl_source EXCEPTION;
v_func_curr VARCHAR2(30);
v_group_id NUMBER;
v_interface_run_id NUMBER;

v_ret_val BOOLEAN;
v_request_id INTEGER;
phase VARCHAR2(100);
status VARCHAR2(100);
dev_phase VARCHAR2(100);
dev_status VARCHAR2(100);
v_message VARCHAR2(100);
v_bool BOOLEAN;
v_old_status VARCHAR2(30);

BEGIN
set_debug_context('transfer_to_gl');

SAVEPOINT gms_cost_xfer_gl_int;

set_conversion_type_code;

/* Get the GL Application ID */


v_gl_appl_id := get_gl_application_id(p_appl_name => g_gl_appl_name);

IF p_first_record_in_batch = 'Y'
THEN
debug_stmt('p_first_record_in_batch is Y. Hence will reset global variables to initiate
new batch');
new_gl_interface_batch;
ELSE
debug_stmt('Not being the first record, accumulating this line to existing batch.');
END IF;
/* May be GL team forgets to create source for gms_cost_xfer, lets see...*/
IF NOT check_gl_source(p_gl_user_je_source_name)
THEN
RAISE invalid_gl_source;
END IF;

/* During the design phase in Swiss Re the conversion type has already been changed
once
Lets not take any chances and check is this is a valid conversion type */
IF NOT check_conversion_type
THEN
RAISE invalid_conversion_type;
END IF;

/* Lets validate the accounting date.


Although gms_cost_xfer almost always passes the current date.
But still this is a good to have validation. */
IF NOT validate_accounting_date(p_accounting_date => p_date
,p_gl_appl_id => v_gl_appl_id
,p_sob_id => p_sob_id
,p_batch_header_id => p_batch_header_id
,p_trx_header_id => p_trx_header_id)
THEN
RAISE not_in_open_period;
END IF;

/* Lets validate the currency code.


Although gms_cost_xfer will certainly pass correct curr code*/
IF NOT validate_currency(p_accounting_date => p_date
,p_currency_code => p_currency_code)
THEN
RAISE invalid_currency_code;
END IF;

v_func_curr := get_sob_currency(p_sob_id);

IF nvl(v_func_curr
,'XX') != nvl(p_currency_code
,'XX')
THEN
IF 'N' =
gl_currency_api.rate_exists(x_from_currency => p_currency_code
,x_to_currency => v_func_curr
,x_conversion_date => p_date
,x_conversion_type => g_conversion_type_code)
THEN
RAISE conversion_rate_does_not_exist;
ELSE
l_gl_int_type_rec.user_currency_conversion_type := g_conversion_type;
l_gl_int_type_rec.currency_conversion_date := p_date;
END IF;
END IF;

set_sob_id(p_sob_id => p_sob_id);


set_source_name(p_source_name => nvl(p_gl_user_je_source_name
,g_gl_user_je_source_name));
populate_interface_control(p_user_je_source_name => nvl(p_gl_user_je_source_name
,g_gl_user_je_source_name)
,p_group_id => v_group_id
,p_set_of_books_id => p_sob_id
,p_interface_run_id => v_interface_run_id);

--batch name; part of the je batch name


l_gl_int_type_rec.reference1 := get_gl_je_reference1(p_batch_header_id =>
p_batch_header_id
,p_trx_number => p_trx_number);
--je batch description
l_gl_int_type_rec.reference2 := p_batch_header_id || ': ' ||
p_header_description || '-' ||
p_trx_number;

--part of the je header name


l_gl_int_type_rec.reference4 := p_journal_name || '-' || p_trx_number;

--je header description will be the description of the gms_cost_xfer receipt


l_gl_int_type_rec.reference5 := p_batch_header_id || ': ' ||
nvl(p_header_description
,p_journal_name) || '-' ||
p_trx_number;
--if the description is left blank, then use the Journal Name instead

--je lines description will be the description of the gms_cost_xfer receipt


l_gl_int_type_rec.reference10 := p_line_description;

l_gl_int_type_rec.reference_date := p_date;
l_gl_int_type_rec.reference21 := p_header_description;
l_gl_int_type_rec.group_id := v_group_id;
l_gl_int_type_rec.set_of_books_id := p_sob_id;
l_gl_int_type_rec.user_je_source_name := nvl(p_gl_user_je_source_name
,g_gl_user_je_source_name);
l_gl_int_type_rec.user_je_category_name := nvl(p_gl_user_je_category_name
,g_gl_user_je_category_name);
l_gl_int_type_rec.accounting_date := p_date;
l_gl_int_type_rec.transaction_date := p_date;
l_gl_int_type_rec.currency_code := p_currency_code;
l_gl_int_type_rec.date_created := p_date;
l_gl_int_type_rec.created_by := fnd_global.user_id;
l_gl_int_type_rec.actual_flag := 'A';
l_gl_int_type_rec.status := 'S';
l_gl_int_type_rec.attribute1 := p_trx_header_id;
l_gl_int_type_rec.attribute2 := p_trx_line_id;
l_gl_int_type_rec.attribute3 := p_trx_number;
l_gl_int_type_rec.attribute4 := get_xx_transaction_source;
l_gl_int_type_rec.attribute5 := p_batch_header_id;
IF p_dr_account IS NOT NULL AND
(NOT check_ccid(p_sob_id => p_sob_id
,p_ccid => p_dr_account))
THEN
RAISE invalid_dr_ccid;
END IF;
IF p_cr_account IS NOT NULL AND
(NOT check_ccid(p_sob_id => p_sob_id
,p_ccid => p_cr_account))
THEN
RAISE invalid_cr_ccid;
END IF;

/* First the gms_cost_xfer Debit Line */


l_gl_int_type_rec.entered_dr := p_amount;
l_gl_int_type_rec.entered_cr := NULL;
l_gl_int_type_rec.code_combination_id := p_dr_account;
debug_stmt('p_dr_account ' || l_gl_int_type_rec.code_combination_id);

IF p_dr_account IS NOT NULL


THEN
insert_statement(p_gl_int_rec => l_gl_int_type_rec);
END IF;
l_gl_int_type_rec.entered_dr := NULL;
l_gl_int_type_rec.entered_cr := p_amount;
l_gl_int_type_rec.code_combination_id := p_cr_account;
IF p_cr_account IS NOT NULL
THEN
insert_statement(p_gl_int_rec => l_gl_int_type_rec);
debug_stmt('p_cr_account ' || l_gl_int_type_rec.code_combination_id);
END IF;

IF p_submit_gl_interface = 'Y'
THEN
debug_stmt('p_submit_gl_interface=>' || p_submit_gl_interface);
/* After inset, submit the request*/
COMMIT;
v_conc_id := fnd_request.submit_request(application => 'SQLGL'
,program => 'GLLEZL'
,description => NULL
,start_time => SYSDATE
,sub_request => FALSE
,argument1 => v_interface_run_id
,argument2 => p_sob_id
,argument3 => 'N'
,argument4 => NULL
,argument5 => NULL
,argument6 => 'N'
,argument7 => 'W');

SELECT status_code
INTO v_old_status
FROM fnd_concurrent_requests
WHERE request_id = fnd_global.conc_request_id;

UPDATE fnd_concurrent_requests
SET status_code = 'W'
WHERE request_id = fnd_global.conc_request_id;

COMMIT;
v_bool := fnd_concurrent.wait_for_request(v_conc_id
,5
,1000
,phase
,status
,dev_phase
,dev_status
,v_message);
UPDATE fnd_concurrent_requests
SET status_code = v_old_status
WHERE request_id = fnd_global.conc_request_id;
COMMIT;

debug_stmt('Request id is ' || v_conc_id);

IF (v_conc_id = 0)
THEN
/* If request not submitted, return false */
ROLLBACK TO gms_cost_xfer_gl_int;
p_success_flag := FALSE;
debug_stmt(' Returning false as request could not be submitted');
RETURN;
END IF;
END IF;
p_success_flag := TRUE;
EXCEPTION
WHEN conversion_rate_does_not_exist THEN
ROLLBACK TO gms_cost_xfer_gl_int;
p_success_flag := FALSE;
fnd_message.set_name('XTR'
,'XTR_2207');
fnd_message.set_token('CURR1'
,v_func_curr);
fnd_message.set_token('CURR2'
,p_currency_code);
fnd_message.set_token('XCHG_DATE'
,to_char(p_date));
fnd_message.set_token('C_TYPE'
,g_conversion_type);
WHEN invalid_currency_code THEN
ROLLBACK TO gms_cost_xfer_gl_int;
p_success_flag := FALSE;
fnd_message.set_name('SQLGL'
,'R_PPOS0026');
WHEN invalid_gl_source THEN
ROLLBACK TO gms_cost_xfer_gl_int;
p_success_flag := FALSE;
fnd_message.set_name('SQLGL'
,'SHRD0152');
WHEN invalid_conversion_type THEN
ROLLBACK TO gms_cost_xfer_gl_int;
p_success_flag := FALSE;
fnd_message.set_name('SQLGL'
,'GL_JE_INVALID_CONVERSION_TYPE');
WHEN not_in_open_period THEN
ROLLBACK TO gms_cost_xfer_gl_int;
p_success_flag := FALSE;
fnd_message.set_name('SQLGL'
,'GL_JE_NOT_OPEN_OR_FUTURE_ENT');
WHEN invalid_cr_ccid THEN
ROLLBACK TO gms_cost_xfer_gl_int;
p_success_flag := FALSE;
fnd_message.set_name('AR'
,'AR_AAPI_INVALID_CCID');
fnd_message.set_token('CCID'
,p_cr_account);
WHEN invalid_dr_ccid THEN
ROLLBACK TO gms_cost_xfer_gl_int;
p_success_flag := FALSE;
fnd_message.set_name('AR'
,'AR_AAPI_INVALID_CCID');
fnd_message.set_token('CCID'
,p_dr_account);
WHEN OTHERS THEN
ROLLBACK TO gms_cost_xfer_gl_int;
p_success_flag := FALSE;
fnd_message.set_name('FND'
,'FS-UNKNOWN');
fnd_message.set_token('ERROR'
,SQLERRM);
END transfer_to_gl;

END xx_import_xfer_gl_iface_api;
Splitting the instance into different Set Of Books

In response to a question on Orkut..Seperating Set of Books/Companies ???

Someone raised a very interesting question on orkut.

His question:-
Well, we are working on 11.5.4 with Oracle Financials.
My question is...

We have two companies with two SEPERATE set of books in our setup.
Now we want to seperate both the companies on two seperate Setups (Apps + DB) ....

Is this possible if YES, How ?

A very interesting question this is, but the solution is unbelievably simple....
They wish to split their ERP install base into two different independent instances of
database.

Clone your current instance(A) to another evironment say "Instance B".

In instance A, you will close all periods for SOB 2. And disable all the responsibilities
that have their profile options pointing to SOB2.

In instance B, do vice versa, i.e. close all periods for SOB 1. And disable all the
responsibilities that have their profile options pointing to SOB1.

By doing the above, Instance A will be used for SOB 1, whereas Instance B will be used
for SOB 2.
Calling a PL/SQL Concurrent Program in Real-Time

Lets say there is an Oracle Delivered concurrent program of type PL/SQL.

Your requirement is such that you wish to call that PL/SQL Executable [attached to
concurrent program] directly from some other process, in real-time mode, in the same
session as that of the parent Oracle session[forms or report or some other plsql ]. In order
to call that pl/sql program within the same session, your challenge may be that the
concurrent program could be writing into log/output file using fnd_file API which you
want to display to the user somehow.
To get a handle to the log/output of the API [which is executable of Conc Program], we
need to do the following:-
1. Call fnd_global.initialize ensuring you pass it two parameters in bold below
declare
...your variables here
v_session_id INTEGER := userenv('sessionid');
v_trace VARCHAR2(2000) := fnd_trace.get_trace_filename;
n_conc_request_id INTEGER ;
begin
//optionally trace the API Call with bind variable values
execute immediate 'alter session set events=''10046 trace name context forever, level
12''' ;
//the trace file details will be in variable v_trace

//Now call fnd_global.initialize ensuring you pass it two parameters in bold below

fnd_global.initialize
(
session_id => v_session_id
,user_id => 18594 //or pass the current
fnd_global.user_id itself
,resp_id => 4650126 //or pass the current
fnd_global.resp_id itself
,resp_appl_id => 8405 //or pass the current
fnd_global.resp_appl_id itself
,security_group_id => 0
,site_id => NULL
,login_id => 3115003
,conc_login_id => NULL
,prog_appl_id => NULL
,conc_program_id => 229233 //The program id of concurrent
request
,conc_request_id => n_conc_request_id //From
fnd_concurrent_requests_s.nextval
,conc_priority_request => NULL
);
//Lets assume the nextval from sequence is 14633154
//now call the API, i have arbitrarily typed in just any API
ar_process_trx.place_hold( v_errbuf, v_retcode, v_trx_id ) ;
end ;

2. Run the SQL on fnd_temp_files, as below, using the fictional request_id generated
from sequence [ in variable n_conc_request_id ]

3. In order to read those files, ensure that the directory [/usr/tmp in this case] is listed in v
$parameter utl_file_dir

In this approach, no change is made to the Original concurrent program. Hence, if need
be, users can continue to run the concurrent process as usual from SRS.

Trace file with bind variables


This approach also makes it easy to trace a concurrent program with bind variables. The
location of the trace will can be determined by using API fnd_trace.get_trace_filename.
The beauty of this API construct is that it takes care of different platforms like Linux, NT,
HP,AIX etc , when constructing the name and full path of the trace file for Concurrent
Program
Open Interfaces in APPS EBS - Best Practices

This article discusses the best practices & strategies for developing Interface Programs in
Oracle Financials / APPS/ EBS.

This article assumes that you have already read the article on data migration, if not the
click here.

What is common between Data Migration and interfaces?


Both essentially use API or open interface tables. See Data Migration Article

What is the difference between data migration and conversion?


These are essentially the same.

What is the difference between data migration and interfaces?


Data Migration is a one-time activity however interfaces are ongoing processes that run
regularly. Hence error handling must be well thought when designing interfaces.

Best practices for interfaces?


1. Usually an interface must have well defined error reporting mechanism.
2. Data errors must be fixed at the source once the transaction gets rejected.
3. If your support team is often modifying transactions in interface tables using sql, then
your interface design is flawed.
4. If you log support issues with any interface on a relatively regular basis, then its time to
re-visit your design.
5. Interfaces must be designed in a manner such that, once the original errors are fixed,
those transactions must get re-processed during the next run (or on demand)
6. If possible an interface mechanism/infrastructure must be in place, so that all interfaces
are written in similar manner.
7. There must not be any hard coding for mapping from source system data to EBS. You
can either use oracle's lookup screen to define mappings, or use a custom mapping screen.
8. In some cases you will have a generic screen which facilitates one-to-one, one-to-many,
many-to-one, many-to-many mappings.
9. There must exist a simple mechanism to identify the duplicate processing of any
transaction must exist. One way this can either be achieved is by making your source
system specify a unique identifier for each record.
10. Do not store references to rowid in any part of your interfaces.
11. Think upfront, design and write your interface in such a manner that once it goes to
production, you never receive an email to fix any stuck records. If at all you do receive
data fixing requests, then ensure that interface program is changed in a manner it gets
handled without programmers intervention in future.
12. Have proper debugging. You could add a parameter for debug flag, so that debug
messages arent generated unnecessarily. Surely, don't forget to use FND Logging, which
is delivered out of the box by Oracle.
13. Make the concurrent program end with warning in case of errors. This can be done by
passing retcode=1. Use the out-of-the-box concurrent program notification facility can be
used to inform end users of the errors encountered during processing.
By doing so, you can make the monitoring automatic, i.e. when submitting/scheduling
interface concurrent program, you can attach a workflow role.

What tools can I use for point to point interfaces?


Point to Point interface methodology is not ideal for a large Organization. However to
keep the costs low, when number of interfaces are very low, then Point to Point Interface
approach could be justified. However please note that Organizations do grow in size ,
specially after implementing Oracle ERP. Hence Point 2 Point Interfaces can not be a long
term strategy.

Please find p2p interface approach listed:-


1. File tables..
--You can map the structure of an ASCII file to table structure.
2. XML Gateway
--You can use XML Gateway and XML Message designer if you have too many
interfaces having XML source. Although keep in mind that there may not be any future
for XML Gateway in Fusion applications.
3. Sql*loader
--Avoid for interfaces as error reporting is not user friendly. Use this for data migration
as SQL*Loader is very efficient.
4. DB link for intra company different Oracle systems
--DBA's often raise questions regarding security of database links. However security
concerns can be minimized by making them non-public and make them connect to not
specific schemas with minimum privileges.
5. Java concurrent program with jdbc
If your source system is in a database like SQL*Server, or DB2 or any other database
which supports JDBC, this approach could be ideal.
The source system can create a specialized schema and expose the necessary views or
tables/synonyms, such that you can pull the data from that system, load it into your system
using API. All this can happen seamlessly, all within one program.
6. Java concurrent program with FTP, csv parser
All the above steps can be done within one single program.

Usual bad practices:-


1. Each developer writing their own mapping tables and screens.
2. Hard coding in interface
3. No thoughtful process for Error Reporting and Error Correction(deviation from fix at
source philosophy)
4. Calling SQL*Plus sessions from Host programs, without due considerations for APPS
Password Security
5. No debugging
6. Each interface program using its own File Dequeue mechanism.

Long term interface strategy using Oracle EBS Delivered tools


Oracle Warehouse Builder [Preferably 10g Version]
This strategy means that you move away from point to point interface design. I think a
simple tool like Warehouse builder can be used as a simple single point interface control.
Some powerful features of Warehouse builder means that you can do mappings,
transformation of data structures without writing your own code. Warehouse Builder
appears to be a part of Fusion strategy, hence it is a good investment. Warehouse builder
can be used to pull the data from various sources using ODBC, JDBC, DB Links etc.
Hence you can leverage a Warehouse Builder interface design run interface end-to-end
that includes submission of the Interface API.
Limitation:- This is a batch mechanism, and not messaging based.

XML Gateway
If you want an Oracle delivered tool to implement interfaces using messaging, you can
use XML Gateway with Message Maps. But investment in this tool may be lost when you
move to BPEL based architecture.

Web Services
Wait for Fusion that integrates BPEL, unless you wish to manage Web Services in a
standalone manner.
Migration program in Apps. Migrate Customers

This article explains the steps to write programs for data migration in Oracle Apps.

Question : Why this article?


Answer : Because in every Oracle ERP implementation you have some level of data
migration activity. I will try to explain the steps, followed by a real life example of data
migration.

Question : How to do data migration?


Answer :
A. Prepare the source data
B. Design your staging tables and write code
C. Test Test Test....

Question : What is involved in the preparation stage of data migration in oracle apps?
Answer: For the Preparation stage, following must be done.
1. Understand the structure of the data being imported and also its business purpose.
2. Fully understand where the data will end up residing into Oracle Apps.
3 Find out if open interfaces or APIs exist in Oracle Apps to facilitate loading the required
data.
4. Ensure that lookup codes or setup in Oracle apps support the values that are coming
from source system.
5. Think about how the errors will be reported and managed.
6. Also think about how the transactions that fail migration will be re-tried. You may
decide to knock of a simple screen if high volume of transactions needs user intervention
for cleansing.

Question: And how about the development stage during migration?


Answer: Do the following
1. Design the stages in which data will flow.
Traditionally, your legacy/source data will be loaded into some temporary(staging) tables
in a raw(as is) fomat/strucutre . Next you will translate the data into the physical structure
that is similar to structure of Oracle Apps table/API. And then you will call the API or
populate the Open Interface tables.
2. For doing the above, you will first write one-off scripts to create those staging tables
and load data into them using SQL*Loader or some other methodology. If your source
system is Oracle too, then I suggest you create a db link to pull the data into your staging
tables.
All the steps pertaining the transformation can be done via a pl/sql concurrent
Program(unless you are using tools like Warehouse builder)
3. Run the concurrent program that you have would written for transformation of data.
This will either populate your Open Interface Tables or it will perform migration if APIs
are being used.
(Again all this can be done via tools too, but here I am talking about a small migration
activity, hence ignore the tool talk)
4. Ensure that errors are logged into some error logging table.
If the data errors in Oracle's open interface tables, then you could have a database view
that does a union on your error table and also oracle's error logging table.

Question: How about testing?


Answer: You will figure out the following at this stage, from the records that error
1. Missing mapping codes
2. Missing setups in oracle apps.
Testing will most likely be repetitive, until you are able to have a migration run which
leaves behind the records that are very low in volume or non-existent.

Question : If I get a comma delimited file, how will I load that into tables?
Answer : You can use a Sql*Loader, or a java program with a csv parser or a file based
table approach.

Question : In oracle apps during migration, do we usually receive xml data file?
Answer : Keep in mind that you usually migrate data from mainframe or standalone
systems which now stand outdated.
Such systems usually produce comma delimited or tab delimited file.

Question : Ok, once the data from source system has been loaded using sql*loader, what
next?
Answer: The data model of the source data may or may not comply with the data model
in oracle apps. Hence you need a transformation step in most cases. This is explained
below with an example of TCA API to migrate customers/parties.

Question : Should I not ask the legacy system people to transform data as per our
requirements?
Answer : No, don't bother doing so, for below reasons :-
A. Techies of legacy system will not be happy that their system is now being made
redundant. Hence don't expect much value addition from them.
B. There is a possibility that in an attempt to transform data to Oracle's data structure, they
might induce faults/bugs.
If the transformation bugs are encountered at your end in apps, you can fix them yourself.
However if legacy team does transformation for you, then you become dependent on
them for bug fixes. Eventually tired of waiting on them, you might end up doing
transformation yourself anyway.
C. If your design for transformation changes, you should not be dependent upon the
legacy system...just fix it yourself at your own end in apps.

Question : If we end up using interface api's in apps for data migration, then where lies
the difference between migration and interfaces?
Answer : Migration is a one-off activity, even though it uses the same sets of tables/API's
as interfaces do.
Question : Enough explanation, now give me an example.
Answer : Lets assume you get a task to migrate customers from legacy system into TCA
(or call it AR - Receivables for simplicity).
Your file from source is:-
lcust.dat
1000,GE, GE Capital,1000-1
1001,Cisco,Cisco Routers,1001-1
1002,Barclays,Barclays Investments,1001-1
1003,Barclays,Barclays Mortgages,1001-2

The format of data is CustomerId,Cust parent name,customer operating company name,


operating company id

Step 1. FTP this file to your database server and run sql*loader to load the file into a table
named xx_legacy_cust, this table will have four columns, one column for each file in
source.
Step 2. Transform this data...
For this we create two tables...
XX_TRNSFRM_PARTY
--parent_cust_Id
--parent_cust_name
XX_TRNSFRM _CUST_ACCOUNT
--parent_cust_Id
--operating_cust_Id
--operating_cust_name
Now, you can write a pl/sql program to split data from table xx_legacy_cust into the two
tables listed above.

Step 3. Now write the pl/sql program to migrate this data into Oracle.
Create or replace procedure xx_migrate_parties(errbuff out varchar2,retcode out varchar2)
is
Begin
FOR p_party_rec in (select * from XX_TRNSFRM_PARTY )
LOOP
--call api to create party
Hz_Party_Site_V2pub.create_party();

For p_party_rec in (select * from XX_TRNSFRM _CUST_ACCOUNT where


parent_cust_Id = p_party_rec.parent_cust-id)
loop
--now create a customer account
hz_cust_account_v2pub.create_cust_account(..parameters
l_return_status,
l_msg_count,
l_msg_data
);
IF l_msg_count > 1 THEN
FOR i IN 1 .. l_msg_count
LOOP
Fnd_File.put_line (Fnd_File.LOG, i || '. ' || SUBSTR (Fnd_Msg_Pub.get
(p_encoded => Fnd_Api.g_false ), 1, 255 ) );
END LOOP;
END IF;

END LOOP ;
END LOOP ;
END ;

Now some notes:-


1. No two data migrations are exactly the same, hence I have given a pseudo code, and not
th actual code.
2. In some cases the quality of the source data can be so bad that you may need a third
party to cleanse the data before you run migration.
3. The API's used for data migration and for developing open interfaces are the same.