DECLARE
l_vendor_rec ap_vendor_pub_pkg.r_vendor_rec_type;
l_return_status VARCHAR2(10);
l_msg_count NUMBER;
l_msg_data VARCHAR2(1000);
l_vendor_id NUMBER;
l_party_id NUMBER;
cursor c1 is select * from xx_sup_stage;
BEGIN
-- --------------
-- Required
-- --------------
for i in c1 loop
l_vendor_rec.VENDOR_ID:= i.VENDOR_ID;
l_vendor_rec.VENDOR_NAME:= i.VENDOR_NAME;
l_vendor_rec.VENDOR_NAME_ALT:=i.VENDOR_NAME_ALT;
l_vendor_rec.SEGMENT1:= i.SEGMENT1;
l_vendor_rec.SUMMARY_FLAG:=i.SUMMARY_FLAG;
l_vendor_rec.ENABLED_FLAG:=i.ENABLED_FLAG;
l_vendor_rec.TERMS_ID:=i.TERMS_ID;
l_vendor_rec.PAY_DATE_BASIS_LOOKUP_CODE:=i.PAY_DATE_BASIS_LOOKUP_CODE;
l_vendor_rec.PAY_GROUP_LOOKUP_CODE:=i.PAY_GROUP_LOOKUP_CODE;
l_vendor_rec.INVOICE_CURRENCY_CODE:=i.INVOICE_CURRENCY_CODE;
l_vendor_rec.PAYMENT_CURRENCY_CODE:=i.PAYMENT_CURRENCY_CODE;
l_vendor_rec.START_DATE_ACTIVE:=i.START_DATE_ACTIVE;
-- -------------
-- Optional
-- --------------
l_vendor_rec.match_option :='R';
pos_vendor_pub_pkg.create_vendor
( -- -------------------------
-- Input Parameters
-- -------------------------
p_vendor_rec => l_vendor_rec,
-- ----------------------------
-- Output Parameters
-- ----------------------------
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
x_vendor_id => l_vendor_id,
x_party_id => l_party_id
);
IF l_return_status ='S' THEN
-- Update vendor id in stage tables through autonomus prrogram.
ELSE
-- Update vendor id in stage tables through autonomus prrogram.
End if;
end loop;
commit;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;
/
No comments:
Post a Comment