This blog has the script to update the supplier details using API AP_VENDOR_PUB_PKG.UPDATE_VENDOR.

 

Cause of the issue: Some of the fields are not visible and don’t have option to update from front end. So in this case update can be done using API call.

How do we solve:
With the help of appropriate API we could solve the issue.

 

API Script To Update Supplier Details – AP_VENDOR_PUB_PKG.UPDATE_VENDOR

DECLARE
ln_api_version                    NUMBER := 1.0;
lv_init_msg_list                  VARCHAR2(200) := fnd_api.g_true;
lv_commit                         VARCHAR2(200) := fnd_api.g_true;
ln_validation_level               NUMBER := fnd_api.g_valid_level_full;
ln_vendor_id                      NUMBER := 28765946;
lv_msg                            VARCHAR2(200);
x_msg_count                       NUMBER;
x_msg_data                        VARCHAR2(200);
x_return_status                   VARCHAR2(200);
lrt_vendor_rec                    ap_vendor_pub_pkg.r_vendor_rec_type;
lrw_vendor_rec                    ap_suppliers%ROWTYPE;


BEGIN
MO_GLOBAL.INIT(‘SQLAP’);
FND_GLOBAL.APPS_INITIALIZE(1318,50554,200);
FND_CLIENT_INFO.SET_ORG_CONTEXT(101);

BEGIN
SELECT *
INTO lr_vendor_rec
FROM ap_suppliers asa
WHERE asa.vendor_id = ln_vendor_id;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.put_line(‘Inside Exception, invalid vendor id:’ ||ln_vendor_id);
END;

lrt_vendor_rec.vendor_id := lr_vendor_rec.vendor_id;
lrt_vendor_rec.vendor_name := lr_vendor_rec.vendor_name||’_001′;
lrt_vendor_rec.end_date_active := SYSDATE;
lrt_vendor_rec.enabled_flag := ‘N’;

AP_VENDOR_PUB_PKG.UPDATE_VENDOR(p_api_version         => ln_api_version,
p_init_msg_list      => lv_init_msg_list,
p_commit                 => lv_commit,
p_validation_level  => ln_validation_level,
x_return_status     => x_return_status,
x_msg_count          => x_msg_count,
x_msg_data            => x_msg_data,
p_vendor_rec         => lrt_vendor_rec,
p_vendor_id           => ln_vendor_id
);


DBMS_OUTPUT.put_line(‘API Status ‘ || x_return_status);
FND_FILE.PUT_LINE(FND_FILE.LOG, ‘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
lv_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 ‘ || lv_msg);
FND_FILE.PUT_LINE(FND_FILE.LOG, ‘The API call failed with error ‘ || lv_msg);
END LOOP;

ELSE
DBMS_OUTPUT.put_line(‘Successfully Updated the Supplier details’);
FND_FILE.PUT_LINE(FND_FILE.LOG, ‘Successfully Updated the Supplier details’);
COMMIT;
END IF;

END;

Recent Posts

Start typing and press Enter to search