Monday, 29 August 2011

Single Insert Scripts for Suppliers in 11i Applications


This Document provides the guidance to the user with the necessary information for creating Suppliers,Supplier Sites and Supplier Contacts through Single Insert in an accurate way.
The Interface tables used here are :
    1. AP_SUPPLIERS_INT
    1. AP_SUPPLIER_SITES_INT

    1. AP_SUP_SITE_CONTACT_INT



Insertion steps

Create Suppliers :

Following are the steps that must be followed, in order, to perform the Single insertions for Creating Suppliers :
<><><><>
Execution Step
Description
Step 1
select user_id created_by from fnd_user where user_name = ‘SAYYADEVARA’
Step 2
The value of vendor_interface_id can be passed through sequence ap_suppliers_int_s.NEXTVAL.
Step 3

select * from
po_vendors
where vendor_name = 'TEST_VENDOR'
If no rows returned from the above query,take this vendor name and pass it to the interface table ap_suppliers_int.

Step 4
Vendor Type Look Up Code must be passed as Vendor.
Step 5
select term_id,name from
ap_terms

Any term_id and name can be taken from the above query and pass it to the interface table ap_suppliers_int.Here,we passed terms_id as 10112 and name as GR_NET15.
Step 6
Pass ‘Y’ for all the flags such as always_take_disc_flag,inspection_required_flag, receipt_required_flag, auto_tax_calc_flag, federal_reportable_flag and create_debit_memo_flag in the interface table ap_suppliers_int.
Step 7
Pass set_of_books_id as 1 and invoice_currency_code and payment_currency_code as ‘USD’ to the interface table ap_suppliers_int.
Step 8
The values payment_method_lookup_code and terms_date_basis must be passed as per the requirement.Here,we are passing payment_method_lookup_code as ‘CHECK’ and terms_date_basis as ‘Invoice’ to the interface table ap_suppliers_int.
Step 9
Pass qty_rcv_tolerance as 0,
qty_rcv_exception_code as ‘WARNING’
enforce_ship_to_location_code as ‘NONE’
and receipt_days_exception_code as ‘WARNING’ to the interface table ap_suppliers_int.
Step 10
The values pay_date_basis_lookup_code and payment_priority must be passed as per the requirement.Here,we are passing pay_date_basis_lookup_code as ‘DISCOUNT ’and payment_priority
as 99 to the interface table ap_suppliers_int.
Step 11
Pass the Who columns created_by, last_updated_by as user_id.
and creation_date,last_update_date and the value for start_date_active can be passed as SYSDATE.
The remaining leftout values in the interface table ap_suppliers_int can be passed as NULL.
Step 12
  • To insert the data into the suppliers interface table

INSERT INTO ap_suppliers_int
(vendor_interface_id, last_update_date,
last_updated_by, vendor_name,
creation_date, created_by,
vendor_type_lookup_code,
terms_id,
terms_name,
set_of_books_id,
always_take_disc_flag,
pay_date_basis_lookup_code,
payment_priority,
invoice_currency_code,
payment_currency_code,
num_1099,
type_1099, start_date_active,
payment_method_lookup_code,
terms_date_basis,
inspection_required_flag,
receipt_required_flag,
qty_rcv_tolerance,
qty_rcv_exception_code,
enforce_ship_to_location_code,
receipt_days_exception_code,
auto_tax_calc_flag,
federal_reportable_flag,
match_option,
create_debit_memo_flag
)
VALUES (ap_suppliers_int_s.NEXTVAL, --vendor_interface_id
SYSDATE, --last_update_date
1007910, --last_updated_by
'TEST_VENDOR',--vendor_name
SYSDATE, --creation_date
1007910,--created_by
'VENDOR',--vendor_type_lookup_code
10112,--terms_id
'GR_NET15',--terms_name
1, --set_of_books_id
'Y', --always_take_disc_flag
'DISCOUNT',--pay_date_basis_lookup_code
99,--payment_priority
'USD',--invoice_currency_code
'USD',--payment_currency_code
NULL,--num_1099
NULL, --type_1099
SYSDATE,--start_date_active
'CHECK', --payment_method_lookup_code
'Invoice',--terms_date_basis
'Y',--inspection_required_flag
'Y', --receipt_required_flag
0, --qty_rcv_tolerance
'WARNING',--qty_rcv_exception_code
'NONE', --enforce_ship_to_location_code
'WARNING',--receipt_days_exception_code
'Y',--auto_tax_calc_flag
'Y',--federal_reportable_flag
NULL,--match_option
'Y'--create_debit_memo_flag
);



Step 13
Run Import Program for Suppliers through the following navigation :

Responsibility : Payables Manager
Navigation : Other -> Requests -> Run
Program Name : Supplier Open Interface Import


Step 15
Once the import program is successful, please check the following query in the interface table :

select * from
ap_suppliers_int
Where trunc(creation_date) = trunc(sysdate)

On successful import,the record remains in the interface table ap_suppliers_int itself with the status as ‘PROCESSED’.





Then, once we observe that the status is PROCESSED in the interface table ap_suppliers_int, query the following base table as follows :

select * from
po_vendors
Where trunc(creation_date) = trunc(sysdate)




Create Supplier Sites :

Following are the steps that must be followed, in order, to perform the Single insertions for Creating Supplier Sites for the above supplier :
<><><><>
Execution Step
Description
Step 1
select user_id created_by from fnd_user where user_name = ‘SAYYADEVARA’
Step 2
Take vendor_id from the po_vendors table which we get once the supplier is created.This can be taken from the following query and can be passed to the interface table ap_supplier_sites_int.

select vendor_id from
po_vendors
Where trunc(creation_date) = trunc(sysdate)



Step 3

Vendor_Site_Code must be passed in such a way that the value passed is unique.Here,we are passing it as ‘MAR-SANJOSE27’.
Note : Before passing the value for vendor_site_code,please check the values in po_vendor_sites_all whether the value being passed already exists.
Step 4
Address Values such as AddressLine1,AddressLine2 and AddressLine3 and Phone Number,FaxNumber etc..can be passed any.But see that atleast one of them is passed to the interface table ap_supplier_sites_int.
The values for city,state and postal code must be relevant to each other and must be valid.Please take the appropriate values from Vertex tables and pass them to the interface table ap_supplier_sites_int.
Step 5
The values for ship_to_location_id,ship_to_location_code and bill_to_location_id,bill_to_location_code can be passed on taking the location_id and location_code combination from hr_locations table.
Here,we have taken (ship_to_location_id,ship_to_location_code) -> (20494, CSP10121)
and (bill_to_location_id,bill_to_location_code) -> (20549, CSP10140) to the interface table ap_supplier_sites_int.
Step 6
The value for freight_terms_lookup_code must be passed as per the requirement.Here,we are passing it as ‘Due’. The value payment_method_lookup_code must be passed as per the requirement.Here,we are passing payment_method_lookup_code as ‘CHECK’ to the interface table ap_supplier_sites_int.
Step 7
The value for pay_group_lookup_code must be passed from any of the values extracted from the following query :

select lookup_code from
po_lookup_codes
where lookup_type = 'PAY GROUP'
Here,we are considering DOMESTIC.
Step 8
The values pay_date_basis_lookup_code and payment_priority must be passed as per the requirement.Here,we are passing pay_date_basis_lookup_code as ‘DISCOUNT ’and payment_priority
as 99 to the interface table ap_supplier_sites_int.
Step 9
select term_id,name from
ap_terms

Any term_id and name can be taken from the above query and pass it to the interface table ap_supplier_sites_int.Here,we passed terms_id as 10112 and name as GR_NET15.
Step 10
The flags primary_pay_site_flag and auto_tax_calc_flag must be passed as ‘N’ and the flags always_take_disc_flag and create_debit_memo_flag must be passed as ‘Y’ to the interface table ap_supplier_sites_int.
Step 11
The value for supplier_notif_method must be passed as per the requirement.Here,we are passing it as EMAIL.

Step 12
The values for invoice_currency_code and payment_currency_code as ‘USD’ to the interface table ap_supplier_sites_int.
The values for fax and fax_area_code can be any.
Step 13
The value being passed for vendor_site_code_alt must be the vendor name which we give during create suppliers stage.
Step 14
The values being passed for org_id and operating_unit_name must be any of the values from the following query :
select organization_id,name from hr_operating_units
Here,we are considering org_id as 204 and operating_unit_name as Vision Operations.


Step 15
The who column creation_date must be passed as SYSDATE.
The remaining leftout values in the interface table ap_supplier_sites_int can be passed as NULL.
Step 16
  • -insert into the supplier sites table
INSERT INTO ap_supplier_sites_int
(vendor_id,
vendor_site_code,
purchasing_site_flag,
pay_site_flag,
address_line1,
address_line2,
address_line3,
city,
state,
zip,
country,
area_code,
phone,
ship_to_location_id,
ship_to_location_code,
bill_to_location_id,
bill_to_location_code,
--ship_via_lookup_code,
freight_terms_lookup_code,
fob_lookup_code,
fax,
fax_area_code,
payment_method_lookup_code,
accts_pay_code_combination_id,
prepay_code_combination_id,
pay_group_lookup_code,
payment_priority,
terms_name,
terms_id,
pay_date_basis_lookup_code,
always_take_disc_flag,
invoice_currency_code,
payment_currency_code,
tax_reporting_site_flag,
org_id,
operating_unit_name,
address_line4,
vendor_site_code_alt,
auto_tax_calc_flag,
match_option,
create_debit_memo_flag,
supplier_notif_method,
primary_pay_site_flag,
attribute13,
creation_date
)
VALUES (34925,--vendor_id
LTRIM (RTRIM ('MAR-SANJOSE27')),--vendor_site_code
LTRIM
(RTRIM ('Y')
), --purchasing_site_flag
LTRIM (RTRIM ('Y')),--pay_site_flag
LTRIM (RTRIM ('ABCDE NEW ADDR')),--address_line1
NULL,--address_line2
NULL,--address_line3
LTRIM (RTRIM ('SAN JOSE')),--city
LTRIM (RTRIM ('CA')),--state
LTRIM (RTRIM ('95126')),--zip
LTRIM (RTRIM ('US')),--country
LTRIM (RTRIM ('800')),--area_code
LTRIM (RTRIM (8002238565)),--phone
LTRIM (RTRIM (20494)),--ship_to_location_id
LTRIM (RTRIM ('CSP10121')),--ship_to_location_code
LTRIM (RTRIM (20549)),--bill_to_location_id
LTRIM (RTRIM ('CSP10140')),--bill_to_location_code
--LTRIM (RTRIM ('WAT')),
LTRIM
(RTRIM ('Due')
),--freight_terms_lookup_code
NULL,--fob_lookup_code
LTRIM (RTRIM (7708185548)),--fax
LTRIM (RTRIM ('770')),--fax_area_code
'CHECK',--payment_method_lookup_code
NULL,--accts_pay_code_combination_id
NULL,--prepay_code_combination_id
'DOMESTIC',--pay_group_lookup_code
99,--payment_priority
'GR_NET15',--terms_name
10112,--terms_id
'DISCOUNT',--pay_date_basis_lookup_code
'Y',--always_take_disc_flag
'USD',--invoice_currency_code
'USD',--payment_currency_code
NULL,--tax_reporting_site_flag
204,--org_id
'Vision Operations',--operating_unit_name
NULL,--address_line4
LTRIM (RTRIM ('TEST_VENDOR')),--vendor_site_code_alt
'N',--auto_tax_calc_flag
NULL,--match_option
'Y',--create_debit_memo_flag
'EMAIL',--supplier_notif_method
'N',--primary_pay_site_flag
NULL,--attribute13
SYSDATE --creation_date
);

Step 17
Run Import Program for Supplier Sites through the following navigation :

Responsibility : Payables Manager
Navigation : Other -> Requests -> Run
Program Name : Supplier Sites Open Interface Import

Step 18
Once the import program is successful, please check the following query in the interface table :

select * from
ap_supplier_sites_int
Where trunc(creation_date) = trunc(sysdate)

On successful import,the record remains in the interface table ap_supplier_sites_int itself with the status as ‘PROCESSED’.

Then, once we observe that the status is PROCESSED in the interface table ap_supplier_sites_int, query the following base table as follows :

select * from
po_vendor_sites_all
Where trunc(creation_date) = trunc(sysdate)






Creating Supplier Contacts :
Following are the steps that must be followed, in order, to perform the Single insertions for Creating Supplier Contacts :
<><><><>
Execution Step
Description
Step 1
select user_id created_by from fnd_user where user_name = ‘SAYYADEVARA’
Step 2
The values being passed for org_id and operating_unit_name must be any of the values from the following query :
select organization_id,name from hr_operating_units
Here,we are considering org_id as 204 and operating_unit_name as Vision Operations.
Step 3

The value for vendor_site_id must be passed on extracting the vendor_site_id for the supplier created during create supplier stage.It can be taken and passed to the interface table ap_sup_site_contact_int using the following query :

select vendor_site_id from
po_vendor_sites_all
Where trunc(creation_date) = trunc(sysdate)



Step 4
The values first_name and last_name must be passed to the interface table ap_sup_site_contact_int such that they are unique for that supplier.Check in the base table po_vendor_contacts with the value being passed for the first name and last name.

Step 5
The values for area_code,fax,phone,fax_area_code,email_address and url can be passed any.The who column creation_date must be passed as SYSDATE.
Step 6
  • insert into the supplier contacts table
INSERT INTO ap_sup_site_contact_int
(
vendor_site_id,
vendor_site_code,
first_name,
last_name,
area_code, phone,
org_id, fax,
fax_area_code, email_address,
url,
operating_unit_name, creation_date
)
VALUES (
5217,--vendor_site_id
'MAR-SANJOSE27',--vendor_site_code
'First',--first_name
'Second',--last_name
'800', --area_code
8002238565,--phone
204, --org_id
7708185548,--fax
'770', --fax_area_code
'www.yahoo.com',--url
'Vision Operations', --operating_unit_name
SYSDATE --creation_date
);

Step 7
Run Import Program for Supplier Contacts through the following navigation :

Responsibility : Payables Manager
Navigation : Other -> Requests -> Run
Program Name : Supplier Site Contacts Open Interface Import

Step 8
Once the import program is successful, please check the following query in the interface table :

select * from
ap_sup_site_contact_int
Where trunc(creation_date) = trunc(sysdate)

On successful import,the record remains in the interface table ap_sup_site_contact_int itself with the status as ‘PROCESSED’.

Then, once we observe that the status is PROCESSED in the interface table ap_sup_site_contact_int, query the following base table as follows :

select * from
po_vendor_contacts
Where trunc(creation_date) = trunc(sysdate)

Supplier information can be checked from front-end through the following navigation :

Responsibility : Payables Manager
Navigation : Suppliers -> Entry
Query with the Supplier or Vendor Created.
Here,We can query with TEST_VENDOR.






Pre-Requisites


<><><><>
Execution Step
Description
Step 1
There must not be any existing supplier or supplier site with the same supplier name or site which we are creating.Supplier and Supplier Site must be unique.
Step 2
The contact details such as first name and last name must be unique for the supplier created.





Single Insertion scripts for Approved Supplier List (ASL).

This Document provides the guidance to the user with the necessary information for creating the approved supplier lists through API approach.

The API's used here are:


1.po_asl_ths.insert_row
 

2.po_asl_attributes_ths.insert_row


3. po_asl_documents_ths.insert_row



Mandatory Columns


The following tables describes only the most commonly used fields used in the API. There are other

fields available in the API/PUB.



po_asl_ths.insert_row:



<><>
COLUMN_NAMEDATATYPEREQUIREDCOMMENTS
inventory_item_id
NUMBERYItem
Vendor_id
NUMBERY
Supplier
Vendor_site_id
NUMBERYSupplier Site
using_organization_id
NUMBERYShip-to organization using this record
owning_organization_id
NUMBERYOrganization that created the record initially
vendor_business_type
VARCHAR2YBusiness type of Distributor, Direct, or Manufacturer.
Default to 'DIRECT'
asl_status_id
NUMBERY
Approval/certification status. Default to ‘Approved’ (2)
primary_vendor_item
VARCHAR2YSupplier item
last_update_dateDATEYDefault to 'SYSDATE'
last_updated_byNUMBERYStandard Who Column
creation_dateDATEYDefault to 'SYSDATE'
created_byNUMBERYStandard Who Column






po_asl_attributes_ths.insert_row:

<><>
COLUMN_NAMEDATATYPEREQUIREDCOMMENTS
asl_id
NUMBERYASL unique identifier
inventory_item_id
NUMBERYItem
Vendor_id
NUMBERY
Supplier
Vendor_site_id
NUMBERYSupplier Site
using_organization_id
NUMBERYShip-to organization using this record
Document_sourcing_methodVARCHAR2YDefault to 'ASL'
Release_generation_methodVARCHAR2YAutomatic release method
Default to 'CREATE_AND_APPROVE'
attribute_categoryVARCHAR2YDescriptive flex field segment
attribute1(state)VARCHAR2YDescriptive flex field segment
country_of_origin_codeVARCHAR2YCode for the item's country of manufacture
last_update_dateDATEYDefault to 'SYSDATE'
last_updated_byNUMBERYStandard Who Column
creation_dateDATEYDefault to 'SYSDATE'
created_byNUMBERYStandard Who Column

po_asl_documents_ths.insert_row:

<><>
COLUMN_NAMEDATATYPEREQUIREDCOMMENTS
asl_id
NUMBERYASL unique identifier
using_organization_id
NUMBERYShip-to organization using this record
sequence_numberNUMBERYDocument ranking
Default to '1'
document_type_codeVARCHAR2YDocument type
Default to 'QUOTATION'
document_header_idNUMBERYDocument header unique identifier
document_line_idNUMBERYDocument line unique identifier
last_update_dateDATEYDefault to 'SYSDATE'
last_updated_byNUMBERYStandard Who Column
creation_dateDATEYDefault to 'SYSDATE'
created_byNUMBERYStandard Who Column

Insertion steps

Following are the steps that must be followed, in order, to perform the Single insertions for approved supplier lists in 11.5.10

<><>
Execution Step
Description
Step 1

Default the using organization id and owning organization id to the value of organization that created the record initially


Step 2

Identify the vendor id and his corresponding vendor site id.

SELECT vendor_id
FROM po_vendors
WHERE vendor_name = 'Dispomedica GmbH';

With the above vendor_id get the vendor_site_id .

SELECT vendor_site_id
FROM po_vendor_sites_all
WHERE vendor_id = 313557;

Step 3
Choose one of the values for the vendor_business_type column.
Business type of Distributor : Company sells products made by manufacturers.
Direct : Company sells their products directly to you.
Manufacturer : Company manufactures and sells through distributors

Default the status_id to '2'.


Step 4

Since, it is an API approach we directly insert the date into the base tables using the standard oracle API procedures.

Creating a record by inserting the data into the base table po_approved_supplier_list through apps.po_asl_ths.insert_row procedure.

DECLARE

x_row_id VARCHAR2(20);
x_asl_id NUMBER;

BEGIN

apps.po_asl_ths.insert_row
(x_row_id,
x_asl_id,
2489, --using_organization_id
2489, --owning_organization_id,
'DIRECT', --vendor_business_type,
2, --status_id,
SYSDATE, --last_updated_date
10907, --last_updated_by,
SYSDATE, --creation_date,
10907, --created_by,
NULL,
313557, --vendor_id,
589535, --inventory_item_id,
NULL,
24180, --vendor_site_id,
'01.3307', --primary_vendor_item,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL);
COMMIT;
END;
Step 5

Choose the code for the item's country of manufacture and the state.
Step 6


Default the asl_id to '75310' derived from the step 4.

Default the document_sourcing_method to 'ASL'.

Default the release_generation_method to 'Automatic_release' I .e, 'create_and_approve' .

Default the attribute_category to '2476'

Step 7

Creating a record by inserting the data into the base table po_asl_attributes through apps.po_asl_attributes_ths .insert_row procedure.

DECLARE
x_row_id VARCHAR2(20);

BEGIN
apps.po_asl_attributes_ths.insert_row
(x_row_id,
75310, --asl_id
2489, --using_organization_id,
SYSDATE, --last_updated_date
10907, --last_updated_by,
SYSDATE, --creation_date
10907, --created_by,
'ASL', --document_sourcing_method
'CREATE_AND_APPROVE', --release_generation_method
NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,
313557, --vendor_id,
24180, --vendor_site_id,
589535, --inventory_item_id,
NULL,
'2476', --attribute_category
'09', --state(attribute1),
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,
'DE', --country_of_origin_code,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL);

COMMIT;
END;
Step 8
Identify the document_header_ id and document_line_id of the type_look_up code 'QUOTATION'.

SELECT po_header_id
FROM apps.po_headers_all
WHERE segment1 = 70253
AND type_lookup_code = 'QUOTATION'
AND org_id = 2476;

Similarly deriving document_line_id:

SELECT po_line_id
FROM apps.po_lines_all
WHERE po_header_id = 106717
AND item_id = 589535
AND ROWNUM = 1;
Step 9
Choose the following values for the document_type_code column
STANDARDOne time purchase orders
BLANKETCover a specific date range and used when not sure of the exact quantity is not known prior.
QUOTATIONQuotation in response to the RFQ generated by the organization.

Default the asl_id to '75310' derived from the step 4.

Default the sequence_number to '1'. Sequence_number is the document ranking.

Step 10

Creating a record by inserting the data into the base table po_asl_documents through apps.po_asl_documents_ths .insert_row procedure.

DECLARE

x_row_id VARCHAR2(20);

BEGIN
apps.po_asl_documents_ths.insert_row
(x_row_id,
75310, --asl_id
2489, --using_organization_id,
1, --sequence_number,
'QUOTATION', --document_type_code
106717, --document_header_id,
343765, --document_line_id,
SYSDATE, --last_updated_date
10907, --last_updated_by,
SYSDATE, --creation_date
10907, --created_by,
NULL,NULL,NULL,NULL,
NULL,NULL,NULL,
NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,
NULL,NULL);
COMMIT;
END;
Step 11

Check the Base tables and their respective columns effected.
Below listed are the important columns in each table.
  1. PO_APPROVED_SUPPLIER_LIST
USING_ORGANIZATION_ID
OWNING_ORGANIZATION_ID
VENDOR_BUSINESS_TYPE
ASL_STATUS_ID
LAST_UPDATE_DATE
LAST_UPDATE_BY
CREATION_DATE
CREATION_BY
VENDOR_ID
ITEM_ID
VENDOR_SITE_ID
PRIMARY_VENDOR_ITEM

  1. PO_ASL_ATTRIBUTES:
ASL_ID
USING_ORGANIZATION_ID
LAST_UPDATE_DATE
LAST_UPDATE_BY
CREATION_DATE
CREATION_BY
DOCUMENT_SORCING_METHOD
RELEASE_GENERATION_METHOD
VENDOR_ID
VENDOR_SITE_ID
ITEM_ID
ATTRIBUTE_CATEGORY
ATTRIBUTE1
COUNTRY_OF_ORIGIN_CODE

  1. PO_ASL_DOCUMENTS:
ASL_ID
USING_ORGANIZATION_ID
SEQUENCE_NUM
DOCUMENT_TYPE_CODE
DOCUMENT_HEADER_ID
DOCUMENT_LINE_ID
LAST_UPDATE_DATE
LAST_UPDATE_BY
CREATION_DATE
CREATION_BY






Pre-Requisitions

Below mentioned are the list of tasks which need to be setup,before creating a record for approved supplier list.


<><>
Execution Step
Description
Step 1

The item being used must exist in MTL_SYSTEM_ITEMS_B.
Step 2

The supplier being used must exist in PO_VENDORS.
Step 3

The supplier site being used must exist in PO_VENDOR_SITES_ALL.
Step 4
The quotation number being used must exist in PO_HEADERS_ALL.