Tuesday, 4 June 2013

Supplier Contact Creation Using API

CREATE OR REPLACE PROCEDURE xxaj_supplier_contact_creation
l_vendor_contact_rec   ap_vendor_pub_pkg.r_vendor_contact_rec_type;
l_return_status     VARCHAR2(10);
l_msg_count     NUMBER;
l_msg_data  VARCHAR2(1000);
l_vendor_id NUMBER;
l_party_id  NUMBER;
l_vendor_contact_id NUMBER;
l_per_party_id      NUMBER;
l_rel_party_id      NUMBER;
l_rel_id            NUMBER;
l_org_contact_id    NUMBER;
l_party_site_id     NUMBER;

BEGIN
fnd_global.apps_initialize(user_id => fnd_global.USER_ID,resp_id => fnd_global.RESP_ID,resp_appl_id => fnd_global.RESP_APPL_ID);
fnd_global.apps_initialize(0,20707,200);
--Query to get Vendor Id
    SELECT vendor_id
    INTO l_vendor_contact_rec.vendor_id
    FROM pos_po_vendors_v
    WHERE vendor_name = 'SIVA L ERP';  --Vendor Name
    dbms_output.put_line('Vendor id is :'||l_vendor_contact_rec.vendor_id);
--Query to get Party Site Id
    SELECT party_site_id
    INTO   l_vendor_contact_rec.org_party_site_id
    FROM ap_supplier_sites_all
    WHERE vendor_site_code = 'ERP_SITE'
    AND vendor_id = l_vendor_contact_rec.vendor_id ;
    dbms_output.put_line('Party site id is :'||l_vendor_contact_rec.org_party_site_id);
--l_vendor_contact_rec.org_party_site_id := 175402;     --Party Site ID
l_vendor_contact_rec.org_id := 204;                --Org Id
l_vendor_contact_rec.PERSON_FIRST_NAME:= 'Amar';  --First Name
l_vendor_contact_rec.PERSON_LAST_NAME := 'Alam';   --Last Name

l_vendor_contact_rec.phone := 9966410696;                 --Phone Number
l_vendor_contact_rec.email_address := 'test@gmail.com' ;         --Email Address

pos_vendor_pub_pkg.create_vendor_contact
( p_vendor_contact_rec  => l_vendor_contact_rec,
  x_return_status       => l_return_status,
  x_msg_count           => l_msg_count,
  x_msg_data            => l_msg_data,
  x_vendor_contact_id   => l_vendor_contact_id,
  x_per_party_id        => l_per_party_id,
  x_rel_party_id        => l_rel_party_id,
  x_rel_id              => l_rel_id,
  x_org_contact_id      => l_org_contact_id,
  x_party_site_id       => l_party_site_id
 );
 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 => 'F'),1,255));
    END LOOP;
ELSE
 DBMS_OUTPUT.put_line('API ERROR :'||x_msg_data);
END IF;

 COMMIT;
  dbms_output.put_line('return_status: '||l_return_status);
  dbms_output.put_line('msg_data: '||l_msg_data);
  dbms_output.put_line('msg_data_count: '||l_msg_count);
  dbms_output.put_line('vendor Contact Id: '||l_vendor_contact_id);
  dbms_output.put_line('per_party_id: '||l_per_party_id);
  dbms_output.put_line('rel_party_id: '||l_rel_party_id);
  dbms_output.put_line('rel_id: '||l_rel_id);
  dbms_output.put_line('org_contact_id: '||l_org_contact_id);
  dbms_output.put_line('party_site_id: '||l_party_site_id);
End xxaj_supplier_contact_creation;


Exec xxaj_supplier_contact_creation;


Ur's
AmarAlam

3 comments:

Sree said...

How to convert existing organization contact to supplier contact?

Ryan said...

Mas amar, Untuk EBS R12, jika kita membuat API contact vendor itu tersimpannya di po_vendor_contacts ya??bukan di AP_supplier_contact?
Terimakasih..

James jones said...

It’s nearly impossible to find knowledgeable folks on this topic, but the truth is could be seen as do you know what you are dealing with! Thanks Vietnam Quality Control Company

Post a Comment