This below script used for Roll out project & creating supplier site in new OU for which details avail and copied from existing OU.
======================================================================
CREATE TABLE APPS.XXEEC_SUPPLIER_SITE_API_ECIHC
(
VENDOR_ID NUMBER NOT NULL,
VENDOR_SITE_CODE VARCHAR2(15 BYTE) NOT NULL,
ADDRESS_LINE1 VARCHAR2(240 BYTE),
ADDRESS_LINE2 VARCHAR2(240 BYTE),
ADDRESS_LINE3 VARCHAR2(240 BYTE),
CITY VARCHAR2(60 BYTE),
STATE VARCHAR2(150 BYTE),
ZIP VARCHAR2(60 BYTE),
PROVINCE VARCHAR2(150 BYTE),
COUNTRY VARCHAR2(60 BYTE),
ACCTS_PAY_CODE_COMBINATION_ID NUMBER,
PURCHASING_SITE_FLAG VARCHAR2(1 BYTE),
PAY_SITE_FLAG VARCHAR2(1 BYTE),
RFQ_ONLY_SITE_FLAG VARCHAR2(1 BYTE),
"Supplier Num" VARCHAR2(30 BYTE) NOT NULL,
"Supplier Name" VARCHAR2(240 BYTE),
SEGMENT1 VARCHAR2(30 BYTE) NOT NULL,
CREATION_DATE DATE NOT NULL,
SITE_CREATION_DATE DATE NOT NULL,
CREATION_STATUS VARCHAR2(150 BYTE),
ERROR_MESSAGE VARCHAR2(150 BYTE),
ORG NUMBER
)
--========================================================================================
DECLARE
p_api_version NUMBER;
p_init_msg_list VARCHAR2 (200);
p_commit VARCHAR2 (200);
p_validation_level NUMBER;
x_return_status VARCHAR2 (200);
x_msg_count NUMBER;
x_msg_data VARCHAR2 (200);
p_vendor_site_rec apps.ap_vendor_pub_pkg.r_vendor_site_rec_type;
x_vendor_site_id NUMBER;
x_party_site_id NUMBER;
x_location_id NUMBER;
v_msg_index_out NUMBER;
cursor c1 is
--select * from xxeec_supplier_site_api where CREATION_STATUS='N'; --and vendor_id in(2019); --and rownum=1;
select * from xxeec_supplier_site_api_ecihc where CREATION_STATUS='Y'-- and vendor_id in(6,8)
order by segment1; --and rownum=1; --This table contains below query data only
/*select
asp.VENDOR_ID
,aspa.VENDOR_SITE_CODE
,nvl(aspa.ADDRESS_LINE1,'ECIHC')ADDRESS_LINE1
,aspa.ADDRESS_LINE2
,aspa.ADDRESS_LINE3
,aspa.city
,aspa.state
,aspa.zip
,aspa.PROVINCE
,nvl(aspa.COUNTRY,'SA')COUNTRY
,aspa.ACCTS_PAY_CODE_COMBINATION_ID
,aspa.purchasing_site_flag
,aspa.pay_site_flag
,aspa.rfq_only_site_flag
,asp.segment1 "Supplier Num"
,asp.vendor_name "Supplier Name"
,asp.segment1
,asp.CREATION_DATE
,asp.last_update_date "SITE_CREATION_DATE"
,asp.ATTRIBUTE1"CREATION_STATUS"
,asp.ATTRIBUTE2"ERROR_MESSAGE"
,aspa.ORG_ID"ORG"
--,asp.VENDOR_TYPE_LOOKUP_CODE
FROM ap_suppliers asp
,ap_supplier_sites_all aspa where 1=1
and asp.vendor_id = aspa.vendor_id
--and asp.vendor_id=2
and org_id =102
and asp.VENDOR_TYPE_LOOKUP_CODE='VENDOR'*/
BEGIN
for rec in c1
loop
p_api_version := 1.0;
p_init_msg_list := FND_API.G_TRUE;
p_commit := FND_API.G_TRUE;
p_validation_level := FND_API.G_VALID_LEVEL_FULL;
x_return_status := NULL;
x_msg_count := NULL;
x_msg_data := NULL;
P_VENDOR_SITE_REC.AREA_CODE := '';
P_VENDOR_SITE_REC.PHONE := '';
P_VENDOR_SITE_REC.FAX_AREA_CODE := '';
P_VENDOR_SITE_REC.FAX := '';
P_VENDOR_SITE_REC.VENDOR_ID :=rec.vendor_id;
P_VENDOR_SITE_REC.VENDOR_SITE_CODE := rec.VENDOR_SITE_CODE; --'HOME';
--P_VENDOR_SITE_REC.ORG_ID := 204;
P_VENDOR_SITE_REC.address_line1 := nvl(rec.address_line1,'ECIHC'); --'Ammam Kovil Street';
P_VENDOR_SITE_REC.address_line2 :=rec.address_line2; --'Vadapalani';
P_VENDOR_SITE_REC.address_line3 := rec.address_line3; --'Chennai';
-- P_VENDOR_SITE_REC.org_name := 'Vision Operations';
P_VENDOR_SITE_REC.org_id := 861;
P_VENDOR_SITE_REC.country := nvl(rec.country,'SA');
P_VENDOR_SITE_REC.purchasing_site_flag :=rec.purchasing_site_flag;
P_VENDOR_SITE_REC.pay_site_flag :=rec.pay_site_flag;
P_VENDOR_SITE_REC.rfq_only_site_flag :=rec.rfq_only_site_flag;
x_vendor_site_id := NULL;
x_party_site_id := NULL;
x_location_id := NULL;
apps.ap_vendor_pub_pkg.create_vendor_site (p_api_version,
p_init_msg_list,
p_commit,
p_validation_level,
x_return_status,
x_msg_count,
x_msg_data,
p_vendor_site_rec,
x_vendor_site_id,
x_party_site_id,
x_location_id
);
DBMS_OUTPUT.put_line ('X_RETURN_STATUS = ' || x_return_status);
DBMS_OUTPUT.put_line ('X_MSG_COUNT = ' || TO_CHAR (x_msg_count));
DBMS_OUTPUT.put_line ('X_MSG_DATA = ' || x_msg_data);
DBMS_OUTPUT.put_line ('X_VENDOR_SITE_ID = ' || TO_CHAR (x_vendor_site_id));
DBMS_OUTPUT.put_line ('X_PARTY_SITE_ID = ' || TO_CHAR (x_party_site_id));
DBMS_OUTPUT.put_line ('X_LOCATION_ID = ' || TO_CHAR (x_location_id));
DBMS_OUTPUT.put_line ('');
COMMIT;
IF x_return_status = 'S' THEN
UPDATE
--xxeec_supplier_site_api
xxeec_supplier_site_api_ecihc
SET creation_status = 'Y',
error_message = rec.vendor_id ||'---Supplier Site Created',
site_creation_date=sysdate
WHERE vendor_id = rec.vendor_id;
COMMIT;
ELSE
ROLLBACK;
END IF;
IF x_msg_count > 0 THEN
FOR v_index IN 1 .. x_msg_count
LOOP
fnd_msg_pub.get (p_msg_index => v_index, p_encoded => 'F', p_data => x_msg_data, p_msg_index_out => v_msg_index_out);
x_msg_data := SUBSTR (x_msg_data, 1, 100);
DBMS_OUTPUT.put_line (rec.vendor_id||'--'||x_msg_data);
UPDATE
--xxeec_supplier_site_api
xxeec_supplier_site_api_ecihc
SET creation_status = 'N',
error_message = rec.vendor_id ||'-'||x_msg_data||'---Supplier Site NOT AT ALL Created',
site_creation_date=sysdate
WHERE vendor_id = rec.vendor_id;
END LOOP;
END IF;
end loop;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.put_line ('SQL Error' || SQLERRM);
END;
======================================================================
CREATE TABLE APPS.XXEEC_SUPPLIER_SITE_API_ECIHC
(
VENDOR_ID NUMBER NOT NULL,
VENDOR_SITE_CODE VARCHAR2(15 BYTE) NOT NULL,
ADDRESS_LINE1 VARCHAR2(240 BYTE),
ADDRESS_LINE2 VARCHAR2(240 BYTE),
ADDRESS_LINE3 VARCHAR2(240 BYTE),
CITY VARCHAR2(60 BYTE),
STATE VARCHAR2(150 BYTE),
ZIP VARCHAR2(60 BYTE),
PROVINCE VARCHAR2(150 BYTE),
COUNTRY VARCHAR2(60 BYTE),
ACCTS_PAY_CODE_COMBINATION_ID NUMBER,
PURCHASING_SITE_FLAG VARCHAR2(1 BYTE),
PAY_SITE_FLAG VARCHAR2(1 BYTE),
RFQ_ONLY_SITE_FLAG VARCHAR2(1 BYTE),
"Supplier Num" VARCHAR2(30 BYTE) NOT NULL,
"Supplier Name" VARCHAR2(240 BYTE),
SEGMENT1 VARCHAR2(30 BYTE) NOT NULL,
CREATION_DATE DATE NOT NULL,
SITE_CREATION_DATE DATE NOT NULL,
CREATION_STATUS VARCHAR2(150 BYTE),
ERROR_MESSAGE VARCHAR2(150 BYTE),
ORG NUMBER
)
--========================================================================================
DECLARE
p_api_version NUMBER;
p_init_msg_list VARCHAR2 (200);
p_commit VARCHAR2 (200);
p_validation_level NUMBER;
x_return_status VARCHAR2 (200);
x_msg_count NUMBER;
x_msg_data VARCHAR2 (200);
p_vendor_site_rec apps.ap_vendor_pub_pkg.r_vendor_site_rec_type;
x_vendor_site_id NUMBER;
x_party_site_id NUMBER;
x_location_id NUMBER;
v_msg_index_out NUMBER;
cursor c1 is
--select * from xxeec_supplier_site_api where CREATION_STATUS='N'; --and vendor_id in(2019); --and rownum=1;
select * from xxeec_supplier_site_api_ecihc where CREATION_STATUS='Y'-- and vendor_id in(6,8)
order by segment1; --and rownum=1; --This table contains below query data only
/*select
asp.VENDOR_ID
,aspa.VENDOR_SITE_CODE
,nvl(aspa.ADDRESS_LINE1,'ECIHC')ADDRESS_LINE1
,aspa.ADDRESS_LINE2
,aspa.ADDRESS_LINE3
,aspa.city
,aspa.state
,aspa.zip
,aspa.PROVINCE
,nvl(aspa.COUNTRY,'SA')COUNTRY
,aspa.ACCTS_PAY_CODE_COMBINATION_ID
,aspa.purchasing_site_flag
,aspa.pay_site_flag
,aspa.rfq_only_site_flag
,asp.segment1 "Supplier Num"
,asp.vendor_name "Supplier Name"
,asp.segment1
,asp.CREATION_DATE
,asp.last_update_date "SITE_CREATION_DATE"
,asp.ATTRIBUTE1"CREATION_STATUS"
,asp.ATTRIBUTE2"ERROR_MESSAGE"
,aspa.ORG_ID"ORG"
--,asp.VENDOR_TYPE_LOOKUP_CODE
FROM ap_suppliers asp
,ap_supplier_sites_all aspa where 1=1
and asp.vendor_id = aspa.vendor_id
--and asp.vendor_id=2
and org_id =102
and asp.VENDOR_TYPE_LOOKUP_CODE='VENDOR'*/
BEGIN
for rec in c1
loop
p_api_version := 1.0;
p_init_msg_list := FND_API.G_TRUE;
p_commit := FND_API.G_TRUE;
p_validation_level := FND_API.G_VALID_LEVEL_FULL;
x_return_status := NULL;
x_msg_count := NULL;
x_msg_data := NULL;
P_VENDOR_SITE_REC.AREA_CODE := '';
P_VENDOR_SITE_REC.PHONE := '';
P_VENDOR_SITE_REC.FAX_AREA_CODE := '';
P_VENDOR_SITE_REC.FAX := '';
P_VENDOR_SITE_REC.VENDOR_ID :=rec.vendor_id;
P_VENDOR_SITE_REC.VENDOR_SITE_CODE := rec.VENDOR_SITE_CODE; --'HOME';
--P_VENDOR_SITE_REC.ORG_ID := 204;
P_VENDOR_SITE_REC.address_line1 := nvl(rec.address_line1,'ECIHC'); --'Ammam Kovil Street';
P_VENDOR_SITE_REC.address_line2 :=rec.address_line2; --'Vadapalani';
P_VENDOR_SITE_REC.address_line3 := rec.address_line3; --'Chennai';
-- P_VENDOR_SITE_REC.org_name := 'Vision Operations';
P_VENDOR_SITE_REC.org_id := 861;
P_VENDOR_SITE_REC.country := nvl(rec.country,'SA');
P_VENDOR_SITE_REC.purchasing_site_flag :=rec.purchasing_site_flag;
P_VENDOR_SITE_REC.pay_site_flag :=rec.pay_site_flag;
P_VENDOR_SITE_REC.rfq_only_site_flag :=rec.rfq_only_site_flag;
x_vendor_site_id := NULL;
x_party_site_id := NULL;
x_location_id := NULL;
apps.ap_vendor_pub_pkg.create_vendor_site (p_api_version,
p_init_msg_list,
p_commit,
p_validation_level,
x_return_status,
x_msg_count,
x_msg_data,
p_vendor_site_rec,
x_vendor_site_id,
x_party_site_id,
x_location_id
);
DBMS_OUTPUT.put_line ('X_RETURN_STATUS = ' || x_return_status);
DBMS_OUTPUT.put_line ('X_MSG_COUNT = ' || TO_CHAR (x_msg_count));
DBMS_OUTPUT.put_line ('X_MSG_DATA = ' || x_msg_data);
DBMS_OUTPUT.put_line ('X_VENDOR_SITE_ID = ' || TO_CHAR (x_vendor_site_id));
DBMS_OUTPUT.put_line ('X_PARTY_SITE_ID = ' || TO_CHAR (x_party_site_id));
DBMS_OUTPUT.put_line ('X_LOCATION_ID = ' || TO_CHAR (x_location_id));
DBMS_OUTPUT.put_line ('');
COMMIT;
IF x_return_status = 'S' THEN
UPDATE
--xxeec_supplier_site_api
xxeec_supplier_site_api_ecihc
SET creation_status = 'Y',
error_message = rec.vendor_id ||'---Supplier Site Created',
site_creation_date=sysdate
WHERE vendor_id = rec.vendor_id;
COMMIT;
ELSE
ROLLBACK;
END IF;
IF x_msg_count > 0 THEN
FOR v_index IN 1 .. x_msg_count
LOOP
fnd_msg_pub.get (p_msg_index => v_index, p_encoded => 'F', p_data => x_msg_data, p_msg_index_out => v_msg_index_out);
x_msg_data := SUBSTR (x_msg_data, 1, 100);
DBMS_OUTPUT.put_line (rec.vendor_id||'--'||x_msg_data);
UPDATE
--xxeec_supplier_site_api
xxeec_supplier_site_api_ecihc
SET creation_status = 'N',
error_message = rec.vendor_id ||'-'||x_msg_data||'---Supplier Site NOT AT ALL Created',
site_creation_date=sysdate
WHERE vendor_id = rec.vendor_id;
END LOOP;
END IF;
end loop;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.put_line ('SQL Error' || SQLERRM);
END;