Join the OracleApps88 Telegram group @OracleApps88to get more information on Oracle EBS R12/Oracle Fusion applications.

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.

Monday, November 19, 2018

AP_VENDOR_PUB_PKG.UPDATE_VENDOR - API Script To Update Supplier Details

DECLARE
  p_vendor_id                NUMBER           := 1436;
  p_api_version              NUMBER            := 1.0;
  p_init_msg_list            VARCHAR2(200)     := fnd_api.g_true;
  p_commit                   VARCHAR2(200)    := fnd_api.g_true;
  p_validation_level         NUMBER            := fnd_api.g_valid_level_full;
  x_return_status            VARCHAR2(200);
  x_msg_count                NUMBER;
  x_msg_data                 VARCHAR2(200);
  lc_vendor_rec              ap_vendor_pub_pkg.r_vendor_rec_type;
  lr_vendor_rec             ap_suppliers%ROWTYPE;
  l_msg                      VARCHAR2(200);
 
BEGIN
  -->Initialize apps session
  FND_GLOBAL.APPS_INITIALIZE(1318,50554,200);
  MO_GLOBAL.INIT('SQLAP');
  FND_CLIENT_INFO.SET_ORG_CONTEXT(101);

  -->Vendor details
  BEGIN
    SELECT *
      INTO lr_vendor_rec
      FROM ap_suppliers asa
     WHERE asa.vendor_id = p_vendor_id;
  EXCEPTION
    WHEN OTHERS THEN
      DBMS_OUTPUT.put_line('Invalid vendor id:' ||p_vendor_id);
  END;

  -->Update Vendor
  lc_vendor_rec.vendor_id          := lr_vendor_rec.vendor_id;
  lc_vendor_rec.vendor_name       := lr_vendor_rec.vendor_name||'_001';
  lc_vendor_rec.end_date_active     := SYSDATE;
  lc_vendor_rec.enabled_flag        := 'N';

  AP_VENDOR_PUB_PKG.UPDATE_VENDOR
                (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_rec       => lc_vendor_rec,
                 p_vendor_id        => p_vendor_id
                );
                                
  DBMS_OUTPUT.put_line('API Status ' || x_return_status);
  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('Successfully Updated the Supplier details');
    COMMIT;
  END IF;
END;

/

2 comments:

Anonymous said...

HOW TO UPDATE MULTIPLE VENDORS AT ONE TIME , IN THE ABOVE API WE CAN ONLY CHANGE ONE VENDOR

Anonymous said...

use cursor and pass vendor_id from the loop it will update all the respective vendor_id from the delect statement

Post a Comment

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.
Best Blogger TipsGet Flower Effect