Wednesday 6 November 2013

API For Import/Create Supplier Site/Vendor Site In Oracle EBS

We can use the POS_VENDOR_PUB_PKG.Create_Vendor_Site API for creating a Supplier in EBS Purchasing.

DECLARE
p_vendor_site_rec apps.AP_VENDOR_PUB_PKG.r_vendor_site_rec_type;
x_return_status    VARCHAR2(8);
x_msg_count        NUMBER;
x_msg_data         VARCHAR2(4000);
x_vendor_site_id   NUMBER;
x_party_site_id NUMBER;
x_location_id NUMBER;
V_TERRITORY_CODE VARCHAR2(10);
V_VENDOR_ID NUMBER;

BEGIN

SELECT VENDOR_ID INTO V_VENDOR_ID FROM APPS.PO_VENDORS WHERE VENDOR_NAME='TestSupplier';
SELECT TERRITORY_CODE INTO V_TERRITORY_CODE FROM APPS.FND_TERRITORIES_TL WHERE               UPPER(TERRITORY_SHORT_NAME)= UPPER('IN');

        p_vendor_site_rec.vendor_site_code := 'TestSupplierSite1'; -- Name of supplier site
        p_vendor_site_rec.vendor_id        := V_VENDOR_ID;
        P_VENDOR_SITE_REC.ADDRESS_LINE1    :='Pimpiri';
        P_VENDOR_SITE_REC.ADDRESS_LINE2    := 'Pune' ;
        p_vendor_site_rec.country          := V_TERRITORY_CODE;
        p_vendor_site_rec.org_id           := 204;
        P_VENDOR_SITE_REC.PURCHASING_SITE_FLAG:='Y';
        p_vendor_site_rec.pay_site_flag :='Y';

 APPS.MO_GLOBAL.INIT ('PO');
 APPS.MO_GLOBAL.SET_POLICY_CONTEXT ('S', 204);
 APPS.FND_GLOBAL.APPS_INITIALIZE ( USER_ID => 1318, RESP_ID => 50578, RESP_APPL_ID => 201 );
       
     apps.POS_VENDOR_PUB_PKG.Create_Vendor_Site
        ( p_vendor_site_rec,
          x_return_status,
          x_msg_count,
          x_msg_data,
          x_vendor_site_id,
          x_party_site_id,
          x_location_id 
        );

       IF (x_return_status= 'S') THEN
            dbms_output.put_line('Supplier Site Created Successfully In EBS');
       ELSE
            dbms_output.put_line('Error In Creating Supplier Site '||x_msg_data);

       END IF;
END;

No comments:

Post a Comment