API – Supplier & Supplier Site Creation
l_vendor_rec AP_VENDOR_PUB_PKG.r_vendor_rec_type;
l_vendor_site_rec AP_VENDOR_PUB_PKG.r_vendor_site_rec_type;
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
l_upd number := 0;
x_vendor_id number;
x_party_id number;
x_vendor_site_id number;
x_party_site_id number;
x_location_id number;
l_party_site_id number;
l_organization_id number;
begin
–mo_global.set_policy_context(‘S’,1650);
l_vendor_rec.SEGMENT1 := ‘1234577’;
l_vendor_rec.VENDOR_NAME := ‘TESTSUPPLIER’;
l_vendor_rec.SUMMARY_FLAG := ‘N’;
l_vendor_rec.ENABLED_FLAG := ‘Y’;
AP_VENDOR_PUB_PKG.Create_Vendor
( p_api_version => 1,
x_return_status => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data,
p_vendor_rec => l_vendor_rec,
x_vendor_id => x_vendor_id,
x_party_id => x_party_id
);
if (x_return_status <> ‘S’) then
dbms_output.put_line(‘Encountered ERROR in supplier creation!!!’);
dbms_output.put_line(‘————————————–‘);
dbms_output.put_line(x_msg_data);
IF x_msg_count > 1 THEN
FOR i IN 1..x_msg_count LOOP
dbms_output.put_line(substr(FND_MSG_PUB.Get( p_encoded => FND_API.G_FALSE ),1,255));
END LOOP;
END IF;
else
l_vendor_site_rec.vendor_id := x_vendor_id;
l_vendor_site_rec.VENDOR_SITE_CODE := ‘HOME’;
l_vendor_site_rec.org_id := 1650;
l_vendor_site_rec.COUNTRY := ‘AE’;
l_vendor_site_rec.ADDRESS_LINE1 :=’Abu Dhabi’;
l_vendor_site_rec.PURCHASING_SITE_FLAG := ‘Y’;
l_vendor_site_rec.PAY_SITE_FLAG := ‘Y’;
AP_VENDOR_PUB_PKG.Create_Vendor_Site
( p_api_version => 1,
x_return_status => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data,
p_vendor_site_rec => l_vendor_site_rec,
x_vendor_site_id => x_vendor_site_id,
x_party_site_id => x_party_site_id,
x_location_id => x_location_id
);
if (x_return_status <> ‘S’) then
dbms_output.put_line(‘Encountered ERROR in supplier site creation!!!’);
dbms_output.put_line(‘————————————–‘);
dbms_output.put_line(x_msg_data);
IF x_msg_count > 1 THEN
FOR i IN 1..x_msg_count LOOP
dbms_output.put_line(substr(FND_MSG_PUB.Get( p_encoded => FND_API.G_FALSE ),1,255));
END LOOP;
END IF;
ELSE
dbms_output.put_line(‘Supplier Site Created!!!’);
end if;
end if;
end;
Leave a Reply
Want to join the discussion?Feel free to contribute!