Sunday, September 7, 2014

API to Create AP Supplier Site

Example --

 -- API to Create Supplier Site
DECLARE  l_vendor_site_rec      ap_vendor_pub_pkg.r_vendor_site_rec_type;
 lc_return_status         VARCHAR2(10);
 ln_msg_count            NUMBER;
 lc_msg_data               VARCHAR2(1000);
 ln_vendor_site_id     NUMBER;
 ln_party_site_id         NUMBER;
 ln_location_id            NUMBER; 

BEGIN          -- ---------------
         -- Required
         -- --------------- 
        l_vendor_site_rec.vendor_id               := 40169;
        l_vendor_site_rec.vendor_site_code  := 'Supplier_Site';
        l_vendor_site_rec.address_line1         := '05 Main Street';
        l_vendor_site_rec.city                           := 'New York';
        l_vendor_site_rec.country                    := 'US';
        l_vendor_site_rec.org_id                      := 202;

        -- --------------
        -- Optional
        -- -------------- 
        l_vendor_site_rec.purchasing_site_flag  :='N';
        l_vendor_site_rec.pay_site_flag                :='N';
        l_vendor_site_rec.rfq_only_site_flag       :='N';

        pos_vendor_pub_pkg.create_vendor_site
        (  
              -- ------------------------------
              -- Input data elements
              -- ------------------------------ 
              p_vendor_site_rec    => l_vendor_site_rec,
              -- ---------------------------------
              -- Output data elements
              -- --------------------------------- 
              x_return_status         => lc_return_status,
              x_msg_count             => ln_msg_count,
              x_msg_data                => lc_msg_data,
              x_vendor_site_id      => ln_vendor_site_id,
              x_party_site_id         => ln_party_site_id,
              x_location_id            => ln_location_id
        ); 
        COMMIT; 
 EXCEPTION          WHEN OTHERS THEN                         ROLLBACK;
                       DBMS_OUTPUT.PUT_LINE(SQLERRM); 
END;
/
SHOW ERR;