Sie sind auf Seite 1von 23

DOCUMENT ON

Application programming Interface (API)

Prepared By
Mantha NV Deekshitulu
Technical Consultant,
Chain-Sys (India) Pvt Ltd.,
Chennai

On
August 04, 2007.

Page 1 of 23
INDEX

INTRODUCTION TO API........................................................................................................3
DIFFERENCE BETWEEN OPEN INTERFACE AND INTERFACE USING API................4
OPEN INTERFACE.........................................................................................................4
Open Interface Diagram....................................................................................................5
ORACLE API...................................................................................................................5
Open Application Programmatic Interface(API) diagram................................................5
FEATURES OF API..................................................................................................................6
Exception Handling and Results Messages......................................................................6
Return Status.....................................................................................................................6
Messages...........................................................................................................................6
Setting Applications Context............................................................................................7
TYPES OF APIs........................................................................................................................7
API COMPONENTS.................................................................................................................7
STANDARD PARAMETERS AND MISSING ATTRIBUTES (PL/SQL API).....................7
Parameter Specifications...................................................................................................7
Standard IN Parameters....................................................................................................8
Standard OUT Parameters................................................................................................8
Parameter Validations.......................................................................................................9
Invalid Parameters............................................................................................................9
Missing Parameter Attributes............................................................................................9
Parameter Size................................................................................................................10
Nested Record Types......................................................................................................10
Primary Key....................................................................................................................10
STATUS MESSAGES.............................................................................................................10
LOCATION OF API................................................................................................................11
VERSION INFORMATION....................................................................................................11
IDENTIFICATION OF THE PACKAGE NAME AND VERSION OF AN API...................11
UPLOADING DATA USING API...........................................................................................11
EXAMPLES ON HOW TO USE THE API............................................................................12
EXAMPLE ON RUNNING TCA API...........................................................................12
EXAMPLE ON HOW TO CREATE CUSTOMER USING TCA API..........................12
EXAMPLE OF BOM OPEN INTERFACE API............................................................12

Page 2 of 23
INTRODUCTION TO API

 Application Programming Interface (API) is a PL/SQL packaged procedure which can be used
as an alternative to traditional Application online form.

 APIs are packages built by Oracle and supplied along with the Oracle Applications ERP
package. These API packages contain procedures which perform some task.

 Using APIs give users an advantage of adding data to the system is that user can enter new
information or alter existing data without entering information manually into the application.

 APIs insures the integrity of the interrelationship of Oracle Applications tables. User can
modify application information without being aware of every feature of the database
structure. It also depends on the API to update all the interrelated tables.

 Continuous utilization of APIs helps to protect customer-specific data from database structural
changes.

 As the table structures changes, the APIs can be modified to those same structural changes
so that data can continue to be modified without any error or need to update coding.

For Example--
The APIs available in Oracle Receivables have been written to fulfil business needs like Create
Customer, Update Customer Contact etc. and can be used in many other ways like:

 Data Uploads - Bulk transfer of data from an existing system into Oracle Receivables.

 Interfacing - Regular interface from, for example, a Third party Personnel system into
Oracle Receivables.

 Spreadsheets - Uploading data via ADE(Application Data Exchange - Mainly used for
pumping data into Apps). For more information on ADE please visit the website
http://metalink.oracle.com

 Forms - standard interface, standard or web forms.

DIFFERENCE BETWEEN OPEN INTERFACE AND INTERFACE USING API

OPEN INTERFACE
Open Interface is a custom program (i.e. a PL/SQL construct) which is used to populate Interface
tables (Oracle Interface Tables). In Open Interface , you populate interface tables and run a Oracle
program which validates and uploads them into standard oracle tables

Example:
To import a item definition through import program, first populate Interface table available to import
item definition i.e. MTL_SYSTEM_ITEMS_INTERFACE.
So, here to populate item information into this interface table, write a custom program which
validates the item information and will populate information into MTL_SYSTEM_ITEMS_INTERFACE
table. From the interface table transfer the data into the base tables using standard import programs.

Page 3 of 23
Open Interface Diagram

ORACLE API
Oracle API is proprietary of Oracle Installation program comes through installation of specific module.
In API's you pass a complete set of record. The APIs validates the record and directly inserts into
standard tables. This is relatively faster way to insert records in Oracle Apps. Also, you will know of all
the errors immediately.

Open Application Programmatic Interface(API) diagram

Page 4 of 23
FEATURES OF API

Exception Handling and Results Messages


The APIs provide an extensive set of error-handling and error-reporting mechanisms. The errors that
are encountered in the different phases of the API execution are reported and put on the message
stack. The calling program has the option of displaying all the error messages or the first error
message on the stack. If there is only one error in the message stack, the error is displayed as one of
the output parameters of the API routine. User need not fetch that message from the stack.

There are three types of information that the TCA APIs provide to their calling programs:
 Overall status
 Messages describing the operations performed or errors encountered by the API
 Output values that the program making the call to the API might need to use

Return Status
The return status (x_return_status) of the API informs the caller about the result of the operation or
operations performed by the API. The return status values are:
Success
FND_API. G_RET_STS_SUCCESS (PL/SQL API)

A success return status indicates that the API performed all the operations requested by its caller. A
success return status can be accompanied by informative messages in the API message list.

Failure
FND_API. G_RET_STS_ERROR (PL/SQL API)

An error return status indicates that the API failed to perform some or all the operations requested by
its caller. An error return status is usually accompanied by messages describing any errors and how
to resolve them.
In most cases, user should be able to correct normal, expected errors such as missing attributes or
invalid date ranges.

Unexpected Error
FND_API. G_RET_STS_UNEXP_ERROR (PL/SQL API)

An unexpected error status indicates that the API encounteres an unexpected error condition that it
could not handle. In this case, the API cannot continue its regular processing. Examples of such
errors are irrecoverable data inconsistency errors, memory errors and programming errors such as
attempting to divide by zero.
In most cases, an end user is unable to correct unexpected errors. These errors usually require
resolution by a system administrator or an application developer.

Messages
The APIs put result messages into a message list. Programs calling these APIs can then get the
messages from the list and process those messages by issuing them, loading them into a database
table, or writing them to a log file.
The APIs store messages in an encoded format so that the API callers can use standard functions
provided by the message dictionary to find message names. With the message dictionary, users can
store these messages in database tables and generate reports from these tables in different
languages.

The API message list must be initialized every time a program calls an API. API callers can either call
the message list utility function, FND_MSG_PUB.Initialize, or request that the API do the initialization
by setting the p_init_msg_list parameter to T (TRUE).

Page 5 of 23
The program calling the API can retrieve messages from the message stack using the existing FND
API functions FND_MSG_PUB.Count_Msg (or standard output parameter x_msg_count) and
FND_MSG_PUB.Get.

Setting Applications Context


 You must set the Applications Context in a database session, before calling any
application programming interfaces (API). The APIs rely on global variables and
profiles that are part of this Applications Context

TYPES OF APIs

The Oracle e-Business Suite contains the following types of APIs:

 Private APIs are for internal, development use only. Details are not provided to anyone
outside of the immediate development environment, nor are they intended for use by anyone
outside of the e-Business Suite development environment.

 Public APIs are designed for customers and Oracle consultants to integrate non-Oracle
systems into Oracle e-Business Suite or to extend the functionality of the base products.
Oracle does not support public APIs unless they are published in a reference manual such as
this one. The user accepts all risk and responsibility for working with non-published public
APIs.

 Public, published APIs are guaranteed by Oracle to remain valid from release to release
and that patches will not alter the API behavior. Public, published APIs are supported by
Oracle to the same extent as released software.

 For non-published APIs, Oracle expressly does not provide any guarantees regarding
consistency of naming, usage, or behavior of any API (public or private) between releases. It
is also possible that a patch could alter any characteristic of any non-published e-Business
Suite API. As such, those who choose to use these APIs do so at their own risk. However,
Oracle does attempt to minimize all changes to public APIs, even if not published.

API COMPONENTS

 API category
 PL/SQL package
 PL/SQL record structure
 PL/SQL procedure
 Parameter description
 Validations

STANDARD PARAMETERS AND MISSING ATTRIBUTES (PL/SQL API)

The parameters below are common to all of the APIs. Brief descriptions are provided for some of the
important features of the API.

Parameter Specifications
The specifications for the public APIs provided by the Oracle Common Application
Components define four categories of parameters:
 Standard IN
 Standard OUT
 Procedure specific IN
 Procedure specific OUT

Page 6 of 23
Standard IN Parameters
The following table describes standard IN parameters, which are common to all public APIs provided
by Oracle Common Application Components.

Table 1–1 Standard IN Parameters

Parameter Data Type Required Description


p_api_version NUMBER Yes This must match the version number of the
API. An unexpected error is returned if the
calling program version number is
incompatible with the current API version
number.

p_init_msg_list VARCHAR2 Yes The valid values for this parameter are :

 True = FND_API.G_TRUE
 False = FND_API.G_FALSE
 Default = FND_API.G_FALSE

If set to true then, the API makes a call to


fnd_msg_pub.initialize to initialize the
message stack. To set to true, use the
value, “T”.
If set to false then the calling program must
initialize the message stack. This action is
required to be performed only once, even in
the case when more than one API is called.
To set to false, use the value, “F”.

p_commit VARCHAR(1) No The valid values for this parameter are :

 True = FND_API.G_TRUE
 False = FND_API.G_FALSE
 Default = FND_API.G_FALSE

If set to true, then the API commits before


returning to the calling program. To set to
true, use the value, "T".

If set to false, then it is the calling


program’s responsibility to commit the
transaction. To set to false, use the value,
"F".

Standard OUT Parameters


The following table describes standard OUT parameters, which are common to all public APIs
provided by Oracle Common Application Components.
-----------------------------------------------------------------
Note: All standard OUT parameters are required.
-----------------------------------------------------------------

Page 7 of 23
Table 1–2 Standard OUT Parameters
Parameter Data Type Description
x_return_status VARCHAR2(1) Indicates the return status of the API. The values
returned are one of the following:

 FND_API.G_RET_STS_SUCCESS
Success: Indicates the API call was successful
 FND_API.G_RET_STS_ERROR
Expected Error: There is a validation error, or
missing data error.
 FND_API.G_RET_STS_UNEXP_ERROR
Unexpected Error: The calling program can not
correct the error.
x_msg_count NUMBER Holds the number of messages in the message list.
x_msg_data VARCHAR2(2000) Holds the encoded message if x_msg_count is equal to
one.

Parameter Validations
The following types of parameters are always validated during the API call:
 Standard IN
 Standard OUT
 Mandatory procedure specific IN
 Procedure specific OUT

Invalid Parameters
If the API encounters any invalid parameters during the API call, then one of the
following actions will occur:
 An exception is raised.
 An error message identifying the invalid parameter is generated.
 All API actions are cancelled.

Missing Parameter Attributes


Optional IN parameters do not have default values. An attribute value that is not passed in is
assumed to have a default of null for a Create API. For an Update API, if a particular attribute value is
not passed into the API, then the database retains the existing value. In order to set a database value
to null, the calling program must explicitly set the attribute value to one of the following constants,
based on the data type of the attribute.
 FND_API.G_MISS_NUM for NUMBER type.
 FND_API.G_MISS_CHAR for VARCHAR2 type.
 FND_API.G_MISS_DATE for DATE type.

The following table describes optional IN parameters which are initialized to pre-defined values
representing missing constants. These constants are defined for the common PL/SQL data types and
should be used in the initialization of the API formal parameters.

These constants are defined in the package FND_API in the file fndpapis.pls. All columns in a record
definition are set to the G_MISS_X constant as defined for the data type.

Page 8 of 23
Parameter Size
Verify the size of the column from the base table for that column when passing a parameter of a
specific length. For example, if you pass a NUMBER value, first query to find the exact value to pass.
An incorrect value can cause the API call to fail.

Nested Record Types


PL/SQL record types have been used in all of the create and update APIs. In some cases, nested
record types have been used as well.

For example, in the Create_Person API, the p_person_rec input parameter is of the person_rec_type
record type. The person_rec_type has party_rec as one of its elements, which itself is of
party_rec_type record type.
The reason for doing this is that the attributes of the Person party type include attributes of a party,
because Person is a subtype of Party.

Primary Key
The Create APIs handle both sequence-generated and manually-passed primary keys, which can be
generated on a device from an Oracle Mobile application. In order to prevent duplicate primary keys,
the Create APIs handle exceptions to the unique key violation.

STATUS MESSAGES

Every API must return one of the following states as parameter x_return_status after the API is called:
 S(Success)
 E(Error)
 U(Unexpected Error)

Each state can be associated with a status message. The following table describes each state.

Warning and Information Messages


In addition to these three types of possible status messages, you can also code the following
additional message types:
 Warnings
 Information

Page 9 of 23
To create a warning message, perform the following steps:
1. Create a global variable to be used to signal a warning condition. For example, this could be similar
to the following:
G_RET_STS_WARNING:= 'W’
This global variable is not part of the FND_API package.

LOCATION OF API
For Oracle release 10.7, the APIs are located in the operating system directories:
$MODULE_TOP/patchsc/107/sql.

For Oracle release 11 and release 11i, the APIs are located in the operating system directories:
$MODULE_TOP/patch/xxx/sql, where xxx represents the release 110 or 115.

VERSION INFORMATION
It is mandatory that every API call pass a version number for that API as its first
parameter (p_api_version).
This version number must match the internal version number of that API. An
unexpected error is returned if the calling program version number is incompatible
with the current API version number.

------------------ ---------------------------------------------------------------------------------------------------------------------------------------
Warning: The currently supported version at this time is 1.0. Use only this for the API version number .
----------------------------------------------------------------------------------------------------------------------------------------------------------
In addition, the object version number must be input for all update and delete APIs.
 If the object_version_number passed by the API matches that of the object in the
database, then the update is completed.
 If the object_version_number passed by the API does not match that of the object
in the database, then an error condition is generated.

IDENTIFICATION OF THE PACKAGE NAME AND VERSION OF AN API


To identify the package name of an API as compiled into the Oracle database, in SQL*Plus enter the
following select statement (logged in as APPS)

sql>SELECT text FROM all_source


WHERE name like '%user_api_name%' (example:
HZ_CUSTOMER_ACCOUNT_PUB API)
AND text like '%Header%';

A header line of the package and package body showing the package name and version number is
returned.
To compare the version of the API package in user’s operating system directory to the one compiled
in user’s database, execute the following from the command line from the API directory:
Prompt>strings -a packagename | grep Header
All occurrences of the package, package body, and the version number of the file. Version numbers
should match what is compiled in the database.

UPLOADING DATA USING API


While the API package contains many procedures to insert, modify, or delete application data, the API
is not executed on its own. The API must be called, or executed, by other PL/SQL modules, by a
direct SQL*Plus call, or through a front end such as the Data Pump.

The API package should never be modified for specific custom use. If modified, Oracle will not be
able to support them. If user need additional functionality, APIs can be used as building blocks, to be
called within a more extensive package that user may build to address the unique functionality
desired.

Page 10 of 23
EXAMPLES ON HOW TO USE THE API

EXAMPLE ON RUNNING TCA API

Create Organization API.txt


Double click here 

EXAMPLE ON HOW TO CREATE CUSTOMER USING TCA API

How To Create A Customer Via TCA API.txt


Double click here 

EXAMPLE OF BOM OPEN INTERFACE API

A. Introduction:-

* For better under standing let us take a simple example from our real life. Let us
consider that
we have to manufacture a bike. Let us define an Item named…

+ JoCyn Pulsar 150cc

* To manufacture a Pulsar bike, we need components. (like raw materials)


all components should be created in the Inventory as an Item. (for example)

+ JoCyn Puls – Wheels


+ JoCyn Puls – Seat
+ JoCyn Puls – Mirrors
+ JoCyn Puls – Indicators
+ JoCyn Puls – Engine

B. Base Tables

* Bill Header - BOM_BILL_OF_MATERIALS


* Revisions - MTL_ITEM_REVISIONS
* Revised Components - BOM_INVENTORY_COMPONENTS
* Substitute Components - BOM_SUBSTITUTE_COMPONENTS
* Reference Designators - BOM_REFERENCE_DESIGNATORS

C. Interface Tables

* BOM_BILL_OF_MTLS_INTERFACE
* BOM_INVENTORY_COMPS_INTERFACE
* BOM_ASSY_COMMENTS_INTERFACE
* BOM_REF_DESGS_INTERFACE
* BOM_SUB_COMPS_INTERFACE
* MTL_ITEM_REVISIONS_INTERFACE

Page 11 of 23
D. Entity Diagram

BOM_BILL_OF_MATERIALS
Bill Header

Revisions Revised Components


MTL_ITEM_REVISIONS

BOM_INVENTORY_COMPONENTS

Substitute Components Reference Designators

BOM_SUBSTITUTE_COMPONENTS
BOM_REFERENCE_DESIGNATORS

E. First of all we should create an Item in Inventory. The following steps are…

Page 12 of 23
F. This is the first item, we create in Inventory…

Page 13 of 23
G. After that we should assign a template for these Items… those procedures as follows…

Page 14 of 23
After we applied the Template, the item will be classified like…

 Inventory Item, Stackable, Transactable, Reservable.


 BOM Allowed
 Purchased, Purchasable, Allow Description Update
 Etc…

Page 15 of 23
H. After creating an item, we should assign that to another organization. The following figure
shows that…

Page 16 of 23
I. We should create other Items as follows… (For Components)

J. Same procedures will be followed for the other items also…

+ JoCyn Puls – Wheels


+ JoCyn Puls – Mirrors
+ JoCyn Puls – Indicators
+ JoCyn Puls – Engine

K. Reference from Metalink and also from 115mfgapi PDF

https://metalink.oracle.com/metalink/plsql/f?
p=130:14:2191587131804220796::::p14_database_id,p14_docid,p14_show_header,p14_show_help,
p14_black_frame,p14_font:NOT,136099.1,1,1,1,helvetica

Page 17 of 23
https://metalink.oracle.com/metalink/plsql/f?
p=130:14:2191587131804220796::::p14_database_id,p14_docid,p14_show_header,p14_show_help,
p14_black_frame,p14_font:NOT,136095.1,1,1,1,helvetica

L. The following are the interface tables; we are going to use the mandatory columns as
follows…

# BOM_BILL_OF_MTLS_INTERFACE

+ ASSEMBLY_ITEM_ID
+ ORGANIZATION_ID
+ ASSEMBLY_TYPE
+ PROCESS_FLAG
+ TRANSACTION_TYPE

+ ASSEMBLY_TYPE 1 – Manufacturing
2 – Engineering

+ PROCESS_FLAG 1 – Pending
2 – Assigned Succeeded
3 – Assign/Validation Failed
4 – Import Failed
7 – Import Succeeded

+ TRANSACTION_TYPE ‘CREATE’
‘UPDATE’
‘DELETE’

# BOM_INVENTORY_COMPS_INTERFACE

+ PROCESS_FLAG
+ COMPONENT_ITEM_ID
+ COMPONENT_SEQUENCE_ID
+ OPERATION_SEQ_NUM
+ EFFECTIVITY_DATE
+ BILL_SEQUENCE_ID

SELECT * FROM BOM_BILL_OF_MATERIALS

SELECT * FROM MTL_ITEM_REVISIONS

SELECT * FROM BOM_INVENTORY_COMPONENTS

SELECT * FROM BOM_SUBSTITUTE_COMPONENTS

SELECT * FROM BOM_REFERENCE_DESIGNATORS

BOM_BO_PUB -- Package

SELECT DISTINCT a.inventory_item_id,


b.assembly_item_id
FROM mtl_system_items_b a,
bom_bill_of_materials b
WHERE a.inventory_item_id=b.assembly_item_id

Page 18 of 23
M. Here MTL_SYSTEM_ITEMS_B.INVENTORY_ITEM_ID should be equal to
BOM_BILL_OF_MTLS_INTERFACE.ASSEMBLY_ITEM_ID
AND
BOM_INVENTORY_COMPS_INTERFACE.COMPONENT_ITEM_ID should be equal to
BOM_SUB_COMPS_INTERFACE.SUBSTITUTE_COMPONENT_ID

N. The following Procedure is available in APPS Schema. That interface name called
BOM_OPEN_INTERFACE_API.

PROCEDURE Process_Bom
( p_bo_identifier IN VARCHAR2 := 'BOM'
, p_api_version_number IN NUMBER := 1.0
, p_init_msg_list IN BOOLEAN := FALSE
, p_bom_header_rec IN Bom_Bo_Pub.Bom_Head_Rec_Type :=
Bom_Bo_Pub.G_MISS_BOM_HEADER_REC
, p_bom_revision_tbl IN Bom_Bo_Pub.Bom_Revision_Tbl_Type :=
Bom_Bo_Pub.G_MISS_BOM_REVISION_TBL
, p_bom_component_tbl IN Bom_Bo_Pub.Bom_Comps_Tbl_Type :=
Bom_Bo_Pub.G_MISS_BOM_COMPONENT_TBL
, p_bom_ref_designator_tbl IN Bom_Bo_Pub.Bom_Ref_Designator_Tbl_type :=
Bom_Bo_Pub.G_MISS_BOM_REF_DESIGNATOR_TBL
, p_bom_sub_component_tbl IN Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type :=
Bom_Bo_Pub.G_MISS_BOM_SUB_COMPONENT_TBL
, x_bom_header_rec IN OUT NOCOPY Bom_Bo_Pub.bom_Head_Rec_Type
, x_bom_revision_tbl IN OUT NOCOPY Bom_Bo_Pub.Bom_Revision_Tbl_Type
, x_bom_component_tbl IN OUT NOCOPY Bom_Bo_pub.Bom_Comps_Tbl_Type
, x_bom_ref_designator_tbl IN OUT NOCOPY Bom_Bo_Pub.Bom_Ref_Designator_Tbl_Type
, x_bom_sub_component_tbl IN OUT NOCOPY Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type
, x_return_status IN OUT NOCOPY VARCHAR2
, x_msg_count IN OUT NOCOPY NUMBER
, p_debug IN VARCHAR2 := 'N'
, p_output_dir IN VARCHAR2 := NULL
, p_debug_filename IN VARCHAR2 := 'BOM_BO_debug.log'
, p_write_err_to_inttable IN VARCHAR2 := 'N'
, p_write_err_to_conclog IN VARCHAR2 := 'N'
, p_write_err_to_debugfile IN VARCHAR2 := 'N'
)
IS
x_bom_comp_ops_tbl Bom_Bo_Pub.Bom_Comp_Ops_Tbl_Type;
BEGIN
Process_Bom
( p_bo_identifier => p_bo_identifier
, p_api_version_number => p_api_version_number
, p_init_msg_list => p_init_msg_list
, p_bom_header_rec => p_bom_header_rec
, p_bom_revision_tbl => p_bom_revision_tbl
, p_bom_component_tbl => p_bom_component_tbl
, p_bom_ref_designator_tbl => p_bom_ref_designator_tbl
, p_bom_sub_component_tbl => p_bom_sub_component_tbl
, p_bom_comp_ops_tbl => Bom_Bo_Pub.G_MISS_BOM_COMP_OPS_TBL
, x_bom_header_rec => x_bom_header_rec
, x_bom_revision_tbl => x_bom_revision_tbl
, x_bom_component_tbl => x_bom_component_tbl
, x_bom_ref_designator_tbl => x_bom_ref_designator_tbl
, x_bom_sub_component_tbl => x_bom_sub_component_tbl
, x_bom_comp_ops_tbl => x_bom_comp_ops_tbl

Page 19 of 23
, x_return_status => x_return_status
, x_msg_count => x_msg_count
, p_debug => p_debug
, p_output_dir => p_output_dir
, p_debug_filename => p_debug_filename
, p_write_err_to_inttable => p_write_err_to_inttable
, p_write_err_to_conclog => p_write_err_to_conclog
, p_write_err_to_debugfile => p_write_err_to_debugfile
);
END;

O. These RECORD TYPES are attached into the TABLE TYPE. As follows…

# Bom_Bo_Pub.Bom_Head_Rec_Type
# Bom_Bo_Pub.Bom_Revision_Tbl_Type
# Bom_Bo_Pub.Bom_Comps_Tbl_Type
# Bom_Bo_Pub.Bom_Ref_Designator_Tbl_type
# Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type

P. The following procedure is the final stage of our BOM_OPEN_INTERFACE_API. Once we run this
Procedure then the data’s are automatically go to the BILL_OF_MATERIAL (BOM). This is
possible only When you run the following API procedure.

Declare

v_EntityType varchar2(30);
v_ItemName varchar2(30);
v_AssemblyName varchar2(30);
v_OrganizationCode varchar2(30);
v_NumberOfComps number;
v_QtyPerAssy number;

l_bom_header_rec Bom_Bo_Pub.Bom_Head_Rec_Type:=
Bom_Bo_Pub.G_MISS_BOM_HEADER_REC;
l_bom_revision_tbl Bom_Bo_Pub.Bom_Revision_Tbl_Type:=
Bom_Bo_Pub.G_MISS_BOM_REVISION_TBL;
l_bom_component_tbl Bom_Bo_Pub.Bom_Comps_Tbl_Type:=
Bom_Bo_Pub.G_MISS_BOM_COMPONENT_TBL;

l_bom_ref_designator_tbl Bom_Bo_Pub.Bom_Ref_Designator_Tbl_type :=
Bom_Bo_Pub.G_MISS_BOM_REF_DESIGNATOR_TBL;
l_bom_sub_component_tbl Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type :=
Bom_Bo_Pub.G_MISS_BOM_SUB_COMPONENT_TBL;
l_error_message_list Error_handler.error_tbl_type;

l_x_bom_header_rec Bom_Bo_Pub.bom_Head_Rec_Type;
l_x_bom_revision_tbl Bom_Bo_Pub.Bom_Revision_Tbl_Type;
l_x_bom_component_tbl Bom_Bo_pub.Bom_Comps_Tbl_Type;
l_x_bom_ref_designator_tbl Bom_Bo_Pub.Bom_Ref_Designator_Tbl_Type;
l_x_bom_sub_component_tbl Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type;

l_x_return_status VARCHAR2(4000);
l_x_msg_count NUMBER;

i NUMBER := 1;

Begin

Page 20 of 23
FND_GLOBAL.apps_initialize (1001255, 50326, 700, 0); -------------- @Note 136098.1

l_bom_header_rec.Assembly_item_name := 'JoCyn Pulsar 150cc';


l_bom_header_rec.Organization_code := 'V1';
l_bom_header_rec.Assembly_type := 1; -- 1 -> is for Manufacturing
l_bom_header_rec.Transaction_Type := 'CREATE';
l_Bom_Header_Rec.Return_Status := NULL;
For i in 1..5 loop
l_bom_component_tbl(i).Start_effective_date := sysdate;
l_bom_component_tbl(i).Alternate_bom_code := NULL;
l_bom_component_tbl(i).projected_yield := NULL;
l_bom_component_tbl(i).planning_percent := NULL;
l_bom_component_tbl(i).quantity_related := NULL;
l_bom_component_tbl(i).check_atp := NULL;
l_bom_component_tbl(i).Include_In_Cost_Rollup := NULL;
l_bom_component_tbl(i).Wip_Supply_Type := NULL;
l_bom_component_tbl(i).So_Basis := NULL;
l_bom_component_tbl(i).Optional := NULL;
l_bom_component_tbl(i).Mutually_Exclusive := NULL;
l_bom_component_tbl(i).Shipping_Allowed := NULL;
l_bom_component_tbl(i).Required_To_Ship := NULL;
l_bom_component_tbl(i).Required_For_Revenue := NULL;
l_bom_component_tbl(i).Include_On_Ship_Docs := NULL;
l_bom_component_tbl(i).Supply_Subinventory := NULL;
l_bom_component_tbl(i).Location_Name := NULL;
l_bom_component_tbl(i).Minimum_Allowed_Quantity := NULL;
l_bom_component_tbl(i).Maximum_Allowed_Quantity := NULL;
l_bom_component_tbl(i).Comments := NULL;
l_bom_component_tbl(i).from_end_item_unit_number := NULL;
l_bom_component_tbl(i).to_end_item_unit_number := NULL;
l_bom_component_tbl(i).Transaction_Type := 'CREATE';
l_bom_component_tbl(i).return_status := NULL;
l_bom_component_tbl(i).Organization_CODE := 'V1';
if i = 1 then
l_bom_component_tbl(i).Assembly_Item_name := 'JoCyn Pulsar 150cc';
l_bom_component_tbl(i).Quantity_Per_Assembly := 2;
l_bom_component_tbl(i).Item_Sequence_Number := 10; -- We should give
sequential number here.

l_bom_component_tbl(i).operation_Sequence_Number := 1; -- We should give 1 for


here, it is default.
l_bom_component_tbl(i).Component_Item_Name := 'JoCyn Puls - Wheels';
elsif i = 2 then
l_bom_component_tbl(i).Assembly_Item_name := 'JoCyn Pulsar 150cc';
l_bom_component_tbl(i).Quantity_Per_Assembly := 2;
l_bom_component_tbl(i).Item_Sequence_Number := 20;
l_bom_component_tbl(i).operation_Sequence_Number := 1;
l_bom_component_tbl(i).Component_Item_Name := 'JoCyn Puls - Mirrors';
elsif i = 3 then
l_bom_component_tbl(i).Assembly_Item_name := 'JoCyn Pulsar 150cc';
l_bom_component_tbl(i).Quantity_Per_Assembly := 2;
l_bom_component_tbl(i).Item_Sequence_Number := 30;
l_bom_component_tbl(i).operation_Sequence_Number := 1;
l_bom_component_tbl(i).Component_Item_Name := 'JoCyn Puls - Indicators';
elsif i = 4 then
l_bom_component_tbl(i).Assembly_Item_name := 'JoCyn Pulsar 150cc';
l_bom_component_tbl(i).Quantity_Per_Assembly := 1;
l_bom_component_tbl(i).Item_Sequence_Number := 40;

Page 21 of 23
l_bom_component_tbl(i).operation_Sequence_Number := 1;
l_bom_component_tbl(i).Component_Item_Name := 'JoCyn Puls - Seat';
elsif i = 5 then
l_bom_component_tbl(i).Assembly_Item_name := 'JoCyn Pulsar 150cc';
l_bom_component_tbl(i).Quantity_Per_Assembly := 1;
l_bom_component_tbl(i).Item_Sequence_Number := 50;
l_bom_component_tbl(i).operation_Sequence_Number := 1;
l_bom_component_tbl(i).Component_Item_Name := 'JoCyn Puls - Engine';
end if;
end loop;
bom_bo_pub.Process_Bom
( p_bo_identifier => 'BOM'
, p_api_version_number => 1.0
, p_init_msg_list => TRUE
, p_bom_header_rec => l_bom_header_rec
, p_bom_revision_tbl => l_bom_revision_tbl
, p_bom_component_tbl => l_bom_component_tbl
, p_bom_ref_designator_tbl => l_bom_ref_designator_tbl
, p_bom_sub_component_tbl => l_bom_sub_component_tbl
, x_bom_header_rec => l_x_bom_header_rec
, x_bom_revision_tbl => l_x_bom_revision_tbl
, x_bom_component_tbl => l_x_bom_component_tbl
, x_bom_ref_designator_tbl => l_x_bom_ref_designator_tbl
, x_bom_sub_component_tbl => l_x_bom_sub_component_tbl
, x_return_status => l_x_return_status
, x_msg_count => l_x_msg_count
, p_debug => 'N'
, p_output_dir => ''
, p_debug_filename => ''
);

dbms_output.put_line('Return Status = '||l_x_return_status);


dbms_output.put_line('Message Count = '||l_x_msg_count);

/**** Error messages ****/

Error_Handler.Get_message_list(l_error_message_list);

if l_x_return_status <> 'S' then


-- Error Processing
for i in 1..l_x_msg_count loop
dbms_output.put_line(TO_CHAR(i)||' MESSAGE TEXT
'||SUBSTR(l_error_message_list(i).message_text,1,120));
dbms_output.put_line(TO_CHAR(i)||' MESSAGE TYPE
'||l_error_message_list(i).message_type);
end loop;
rollback;
else
commit;
end if;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(TO_CHAR(i)||' MESSAGE TEXT
'||SUBSTR(l_error_message_list(i).message_text,1,120));
dbms_output.put_line(TO_CHAR(i)||' MESSAGE TYPE
'||l_error_message_list(i).message_type);

end;

Page 22 of 23
/

Q. After we execute the above procedure the data’s are loaded automatically. The following
screen shot shows
The assembly item and component items clearly…

Page 23 of 23