SUPPLIER ADDITIONAL INFORMATION
There is no interface tables to upload supplier additional information. Only we can do is directly migrate data into addinfo tables.
Two tables are there in vendor additional info
a) JA_IN_PO_VENDOR_SITES
b) JA_IN_VENDOR_TDS_INFO_HDR
When we create addinfo for vendors, we have to create one null site information for every vendors. To migrate data into vendor addinfo pls follow the following steps
Steps
------
1. Data Template for AddInfo :-
VENDOR_NAME
VENDOR_SITE
EXCISE_DUTY_RANGE
EXCISE_DUTY_DIVISION
EXCISE_DUTY_REG_NO
CST_REG_NO
ST_REG_NO
VAT_REG_NO
SERVICE_TAX_REGNO
PAN_NO TDS_TAX_NAME
TDS_SECTION
TDS_VENDOR_TYPE
VERIFY_FLAG
ERROR_MESSAGE
NVL_SITE_VERIFY_FLAG
2. Create staging table :-
CREATE TABLE XXX_VENDOR_ADDINFO_STG
(
VENDOR_NAME VARCHAR2(100),
VENDOR_SITE VARCHAR2(15),
EXCISE_DUTY_RANGE VARCHAR2(50),
EXCISE_DUTY_DIVISION VARCHAR2(50),
EXCISE_DUTY_REG_NO VARCHAR2(50),
CST_REG_NO VARCHAR2(50),
ST_REG_NO VARCHAR2(50),
VAT_REG_NO VARCHAR2(50),
SERVICE_TAX_REGNO VARCHAR2(50),
PAN_NO VARCHAR2(30),
TDS_TAX_NAME VARCHAR2(150),
TDS_SECTION VARCHAR2(50),
TDS_VENDOR_TYPE VARCHAR2(50),
VERIFY_FLAG CHAR(1),
ERROR_MESSAGE VARCHAR2(2500),
NVL_SITE_VERIFY_FLAG CHAR(1)
)
3. Upload data from excel to staging table by Toad, Sql Loder
4. Run the following script to migrate data from staging table to base tables
/* Formatted on 5/9/2014 6:47:39 PM (QP5 v5.115.810.9015) */
CREATE OR REPLACE PROCEDURE xxx_vendor_addinfo_prc
AS
l_verify_flag CHAR (1);
l_error_message VARCHAR2 (2500);
l_vendor_id NUMBER (10);
l_vendor_site_id NUMBER (10);
l_org_id NUMBER (10);
l_user_id NUMBER (10);
l_vendor_type VARCHAR2 (50);
l_tax_id NUMBER (10);
l_section_type VARCHAR2 (25);
l_section_code VARCHAR2 (30);
l_tds_vendor_type VARCHAR2 (50);
l_cnt_nvl_site NUMBER (3);
l_cnt_site NUMBER (3);
CURSOR c_addinfo
IS
SELECT *
FROM xxx_vendor_addinfo_stg
WHERE verify_flag = 'N';
BEGIN
FOR c1 IN c_addinfo
LOOP
l_verify_flag := 'Y';
l_error_message := NULL;
l_cnt_nvl_site := 0;
l_cnt_site := 0;
BEGIN
SELECT organization_id
INTO l_org_id
FROM hr_operating_units
WHERE name LIKE 'xxx Operating Unit';
EXCEPTION
WHEN OTHERS
THEN
l_verify_flag := 'N';
l_error_message :=
l_error_message || 'Operating Unit is not valid...';
END;
BEGIN
SELECT user_id
INTO l_user_id
FROM fnd_user
WHERE user_name = 'KPMG';
EXCEPTION
WHEN OTHERS
THEN
l_verify_flag := 'N';
l_error_message := l_error_message || 'User Name is not Valid...';
END;
BEGIN
SELECT vendor_id, vendor_type_lookup_code
INTO l_vendor_id, l_vendor_type
FROM po_vendors
WHERE UPPER (vendor_name) = TRIM (UPPER (c1.vendor_name));
EXCEPTION
WHEN OTHERS
THEN
l_verify_flag := 'N';
l_error_message :=
l_error_message || 'Vendor Name is not valid...';
END;
BEGIN
SELECT vendor_site_id
INTO l_vendor_site_id
FROM po_vendor_sites_all
WHERE UPPER (vendor_site_code) = TRIM (UPPER (c1.vendor_site))
AND vendor_id = l_vendor_id
AND org_id = l_org_id;
EXCEPTION
WHEN OTHERS
THEN
l_verify_flag := 'N';
l_error_message := l_error_message || 'Vendor Site not valid...';
END;
BEGIN
SELECT tax_id
INTO l_tax_id
FROM ja_in_tax_codes
WHERE UPPER (tax_name) = TRIM (UPPER (c1.tds_tax_name))
AND org_id = l_org_id
AND NVL (end_date, SYSDATE) >= SYSDATE;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN OTHERS
THEN
l_verify_flag := 'N';
l_error_message := l_error_message || 'TDS Tax is not Valid...';
END;
BEGIN
SELECT DISTINCT
section_type, section_code, vendor_type_lookup_code
INTO l_section_type, l_section_code, l_tds_vendor_type
FROM JAI_AP_TDS_THHOLD_HDRS
WHERE UPPER (section_code) = UPPER (TRIM (c1.tds_section))
AND UPPER (vendor_type_lookup_code) =
UPPER (TRIM (c1.tds_vendor_type))
AND exception_setup_flag = 'N';
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN OTHERS
THEN
l_verify_flag := 'N';
l_error_message :=
l_error_message
|| 'Tds Section or TDS Vendor Type is not valid...';
END;
BEGIN
SELECT COUNT ( * )
INTO l_cnt_site
FROM JA_IN_PO_VENDOR_SITES
WHERE vendor_site_id = l_vendor_site_id
AND vendor_id = l_vendor_id;
IF l_cnt_site > 0
THEN
l_verify_flag := 'N';
l_error_message :=
l_error_message
|| 'Site already existing in JA_IN_PO_VENDOR_SITES...';
l_cnt_site := 0;
END IF;
EXCEPTION
WHEN OTHERS
THEN
l_cnt_site := 0;
END;
BEGIN
SELECT COUNT ( * )
INTO l_cnt_site
FROM JA_IN_VENDOR_TDS_INFO_HDR
WHERE vendor_site_id = l_vendor_site_id
AND vendor_id = l_vendor_id;
IF l_cnt_site > 0
THEN
l_verify_flag := 'N';
l_error_message :=
l_error_message
|| 'Site already existing in JA_IN_VENDOR_TDS_INFO_HDR...';
END IF;
EXCEPTION
WHEN OTHERS
THEN
l_cnt_site := 0;
END;
IF l_verify_flag <> 'N'
THEN
BEGIN
SELECT COUNT ( * )
INTO l_cnt_nvl_site
FROM JA_IN_PO_VENDOR_SITES
WHERE vendor_site_id = 0 AND vendor_id = l_vendor_id;
EXCEPTION
WHEN OTHERS
THEN
l_cnt_nvl_site := 0;
END;
IF l_cnt_nvl_site = 0
THEN
BEGIN
INSERT INTO JA_IN_PO_VENDOR_SITES (vendor_id,
vendor_site_id,
creation_date,
created_by,
last_update_date,
last_updated_by,
last_update_login,
approved_invoice_flag,
excise_duty_range,
excise_duty_division,
excise_duty_reg_no,
cst_reg_no,
st_reg_no,
vat_reg_no,
service_tax_regno)
VALUES (l_vendor_id,
0,
SYSDATE,
l_user_id,
SYSDATE,
l_user_id,
-1,
'Y',
TRIM (c1.excise_duty_range),
TRIM (c1.excise_duty_division),
TRIM (c1.excise_duty_reg_no),
TRIM (c1.cst_reg_no),
TRIM (c1.st_reg_no),
TRIM (c1.vat_reg_no),
TRIM (c1.service_tax_regno));
UPDATE xxx_vendor_addinfo_stg
SET nvl_site_verify_flag = 'Y'
WHERE vendor_name = c1.vendor_name
AND vendor_site = c1.vendor_site;
EXCEPTION
WHEN OTHERS
THEN
l_error_message := SQLERRM;
l_verify_flag := 'N';
UPDATE xxx_vendor_addinfo_stg
SET nvl_site_verify_flag = 'N',
error_message = l_error_message
WHERE vendor_name = c1.vendor_name
AND vendor_site = c1.vendor_site;
END;
IF l_verify_flag <> 'N'
THEN
BEGIN
INSERT INTO JA_IN_VENDOR_TDS_INFO_HDR (
vendor_id,
vendor_site_id,
pan_no,
creation_date,
created_by,
last_update_date,
last_updated_by,
last_update_login,
section_type,
section_code,
confirm_pan_flag,
tds_vendor_type_lookup_code
)
VALUES (l_vendor_id,
0,
TRIM (c1.pan_no),
SYSDATE,
l_user_id,
SYSDATE,
l_user_id,
-1,
'',
'',
'Y',
l_tds_vendor_type);
UPDATE xxx_vendor_addinfo_stg
SET nvl_site_verify_flag = 'Y'
WHERE vendor_name = c1.vendor_name
AND vendor_site = c1.vendor_site;
EXCEPTION
WHEN OTHERS
THEN
l_error_message := SQLERRM;
l_verify_flag := 'N';
UPDATE xxx_vendor_addinfo_stg
SET nvl_site_verify_flag = 'N',
error_message = l_error_message
WHERE vendor_name = c1.vendor_name
AND vendor_site = c1.vendor_site;
END;
END IF;
END IF;
BEGIN
INSERT INTO JA_IN_PO_VENDOR_SITES (vendor_id,
vendor_site_id,
creation_date,
created_by,
last_update_date,
last_updated_by,
last_update_login,
approved_invoice_flag,
excise_duty_range,
excise_duty_division,
excise_duty_reg_no,
cst_reg_no,
st_reg_no,
vat_reg_no,
service_tax_regno)
VALUES (l_vendor_id,
l_vendor_site_id,
SYSDATE,
l_user_id,
SYSDATE,
l_user_id,
-1,
'Y',
TRIM (c1.excise_duty_range),
TRIM (c1.excise_duty_division),
TRIM (c1.excise_duty_reg_no),
TRIM (c1.cst_reg_no),
TRIM (c1.st_reg_no),
TRIM (c1.vat_reg_no),
TRIM (c1.service_tax_regno));
UPDATE xxx_vendor_addinfo_stg
SET verify_flag = 'Y'
WHERE vendor_name = c1.vendor_name
AND vendor_site = c1.vendor_site;
EXCEPTION
WHEN OTHERS
THEN
l_error_message := SQLERRM;
l_verify_flag := 'N';
UPDATE xxx_vendor_addinfo_stg
SET verify_flag = 'N', error_message = l_error_message
WHERE vendor_name = c1.vendor_name
AND vendor_site = c1.vendor_site;
END;
BEGIN
INSERT INTO JA_IN_VENDOR_TDS_INFO_HDR (
tax_id,
vendor_id,
vendor_site_id,
pan_no,
creation_date,
created_by,
last_update_date,
last_updated_by,
last_update_login,
section_type,
section_code,
confirm_pan_flag,
tds_vendor_type_lookup_code
)
VALUES (l_tax_id,
l_vendor_id,
l_vendor_site_id,
TRIM (c1.pan_no),
SYSDATE,
l_user_id,
SYSDATE,
l_user_id,
-1,
l_section_type,
l_section_code,
'Y',
l_tds_vendor_type);
UPDATE xxx_vendor_addinfo_stg
SET verify_flag = 'Y'
WHERE vendor_name = c1.vendor_name
AND vendor_site = c1.vendor_site;
EXCEPTION
WHEN OTHERS
THEN
l_error_message := SQLERRM;
l_verify_flag := 'N';
UPDATE xxx_vendor_addinfo_stg
SET verify_flag = 'N', error_message = l_error_message
WHERE vendor_name = c1.vendor_name
AND vendor_site = c1.vendor_site;
END;
ELSE
UPDATE xxx_vendor_addinfo_stg
SET verify_flag = 'N', error_message = l_error_message
WHERE vendor_name = c1.vendor_name
AND vendor_site = c1.vendor_site;
END IF;
COMMIT;
END LOOP;
END xxx_vendor_addinfo_prc;
/
No comments:
Post a Comment