Loading

Thursday, May 28, 2015

API to create Supplier Contacts in Oracle Apps R12(ap_vendor_pub_pkg.create_vendor_contact)














Script:
DECLARE
  p_api_version       NUMBER;
  p_init_msg_list     VARCHAR2(200);
  p_commit            VARCHAR2(200);
  p_validation_level  NUMBER;
  x_return_status     VARCHAR2(200);
  x_msg_count         NUMBER;
  x_msg_data          VARCHAR2(200);
  lr_vend_cont        apps.ap_vendor_pub_pkg.r_vendor_contact_rec_type;
  x_vendor_contact_id NUMBER;
  x_per_party_id      NUMBER;
  x_rel_party_id      NUMBER;
  x_rel_id            NUMBER;
  x_org_contact_id    NUMBER;
  x_party_site_id     NUMBER;
  l_msg               VARCHAR2(200);
BEGIN
  -- Initialize apps session
  fnd_global.apps_initialize(1119, 50833, 200);
  mo_global.init('SQLAP');
  fnd_client_info.set_org_context(101);
  -- Assign Basic Values
  p_api_version      := 1.0;
  p_init_msg_list    := fnd_api.g_true;
  p_commit           := fnd_api.g_true;
  p_validation_level := fnd_api.g_valid_level_full;
  -- Assign Contact Details
  lr_vend_cont.vendor_id                   := 6261;
  lr_vend_cont.vendor_contact_id           := NULL;
  lr_vend_cont.vendor_site_id              := 658789;
  lr_vend_cont.vendor_id                   := 6261;
  lr_vend_cont.per_party_id                := NULL;
  lr_vend_cont.relationship_id             := NULL;
  lr_vend_cont.rel_party_id                := NULL;
  lr_vend_cont.party_site_id               := '17144';
  lr_vend_cont.org_contact_id              := NULL;
  lr_vend_cont.org_party_site_id           := NULL;
  lr_vend_cont.person_first_name           := 'test';
  lr_vend_cont.person_middle_name          := NULL;
  lr_vend_cont.person_last_name            := 'oracle2';
  lr_vend_cont.person_title                := 'Mr.';
  lr_vend_cont.organization_name_phonetic  := NULL;
  lr_vend_cont.person_first_name_phonetic  := NULL;
  lr_vend_cont.person_last_name_phonetic   := NULL;
  lr_vend_cont.inactive_date               := NULL;
  lr_vend_cont.url                         := 'www.test.com';
  lr_vend_cont.email_address               := 'contact@test.com';
  lr_vend_cont.vendor_contact_interface_id := NULL;
  lr_vend_cont.vendor_interface_id         := NULL;
  lr_vend_cont.vendor_site_code            := NULL;
  lr_vend_cont.org_id                      := 101;
  lr_vend_cont.operating_unit_name         := NULL;
  lr_vend_cont.prefix                      := NULL;
  lr_vend_cont.contact_name_phonetic       := 'Test contact';
  ap_vendor_pub_pkg.create_vendor_contact(p_api_version        => p_api_version,
                                          p_init_msg_list      => p_init_msg_list,
                                          p_commit             => p_commit,
                                          p_validation_level   => p_validation_level,
                                          x_return_status      => x_return_status,
                                          x_msg_count          => x_msg_count,
                                          x_msg_data           => x_msg_data,
                                          p_vendor_contact_rec => lr_vend_cont,
                                          x_vendor_contact_id  => x_vendor_contact_id,
                                          x_per_party_id       => x_per_party_id,
                                          x_rel_party_id       => x_rel_party_id,
                                          x_rel_id             => x_rel_id,
                                          x_org_contact_id     => x_org_contact_id,
                                          x_party_site_id      => x_party_site_id);
  DBMS_OUTPUT.put_line('X_RETURN_STATUS = ' || x_return_status);
  DBMS_OUTPUT.put_line('X_MSG_COUNT = ' || x_msg_count);
  DBMS_OUTPUT.put_line('X_MSG_DATA = ' || x_msg_data);
  DBMS_OUTPUT.put_line('X_VENDOR_CONTACT_ID = ' || x_vendor_contact_id);
  DBMS_OUTPUT.put_line('X_PER_PARTY_ID = ' || x_per_party_id);
  DBMS_OUTPUT.put_line('X_REL_PARTY_ID = ' || x_rel_party_id);
  DBMS_OUTPUT.put_line('X_REL_ID = ' || x_rel_id);
  DBMS_OUTPUT.put_line('X_ORG_CONTACT_ID = ' || x_org_contact_id);
  DBMS_OUTPUT.put_line('X_PARTY_SITE_ID = ' || x_party_site_id);

  IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
    FOR i IN 1 .. fnd_msg_pub.count_msg LOOP
      l_msg := fnd_msg_pub.get(p_msg_index => i,
                               p_encoded   => fnd_api.g_false);
      DBMS_OUTPUT.put_line('The API call failed with error ' || l_msg);
    END LOOP;
  ELSE
    DBMS_OUTPUT.put_line('The API call ended with SUCESSS status');
  END IF;
END;


TestResults:


1 Responses to “API to create Supplier Contacts in Oracle Apps R12(ap_vendor_pub_pkg.create_vendor_contact)”

Sridevi K said...
October 8, 2016 at 12:48 AM

Regards
Sridevi Koduru (Senior Oracle Apps Trainer Oracleappstechnical.com)
LinkedIn profile - https://in.linkedin.com/in/sridevi-koduru-9b876a8b
Please Contact for One to One Online Training on Oracle Apps Technical, Financials, SCM, SQL, PL/SQL, D2K at training@oracleappstechnical.com | +91 - 9581017828.


Post a Comment

Disclaimer

The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.