PROCEDURE mutl_supplier_updation
IS
l_vendor_rec ap_vendor_pub_pkg.r_vendor_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_payment_priority NUMBER;
l_supplier_name VARCHAR2 (255);
l_error_message VARCHAR2 (100);
l_msg_index_out NUMBER;
err_code NUMBER;
err_msg VARCHAR2 (1000);
CURSOR cur_payment
IS
SELECT supplier_name, vendor_id, payment_priority
FROM xx_supplier1 where status is null;
BEGIN
FOR supplier_rec IN cur_payment
LOOP
l_supplier_name := supplier_rec.supplier_name;
l_vendor_id := supplier_rec.vendor_id;
l_payment_priority := supplier_rec.payment_priority;
DBMS_OUTPUT.put_line ('supplier_name' || l_supplier_name);
DBMS_OUTPUT.put_line ('vendor_id' || l_vendor_id);
DBMS_OUTPUT.put_line ('payment_priority' || l_payment_priority);
--update vendor payment priority value
l_vendor_rec.vendor_id := l_vendor_id;
l_vendor_rec.payment_priority := l_payment_priority;
ap_vendor_pub_pkg.update_vendor_public
(p_api_version => 1,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
p_vendor_rec => l_vendor_rec,
p_vendor_id => l_vendor_rec.vendor_id
);
DBMS_OUTPUT.put_line ('return_status: ' || l_return_status);
DBMS_OUTPUT.put_line ('msg_data: ' || l_msg_data);
--program successful then update the status 'S'
IF l_return_status = fnd_api.g_ret_sts_success
THEN
UPDATE xx_supplier1
SET status = 'S'
WHERE vendor_id = l_vendor_id;
DBMS_OUTPUT.put_line ('success');
ELSE
IF l_msg_count > 0
THEN
FOR i IN 1 .. l_msg_count
LOOP
apps.fnd_msg_pub.get (p_msg_index => i,
p_encoded => fnd_api.g_false,
p_data => l_msg_data,
p_msg_index_out => l_msg_index_out
);
---Find Error Message
IF l_error_message IS NULL
THEN
l_error_message := SUBSTR (l_msg_data, 1, 250);
ELSE
l_error_message :=
l_error_message || ' /'
|| SUBSTR (l_msg_data, 1, 250);
END IF;
DBMS_OUTPUT.put_line
('*****************************************');
DBMS_OUTPUT.put_line ('API Error: ' || l_error_message);
DBMS_OUTPUT.put_line
('*****************************************');
END LOOP;
---update status and error message
UPDATE xx_supplier1
SET error_message = l_error_message,
status = l_return_status
WHERE vendor_id = l_vendor_id;
END IF;
END IF;
END LOOP;
---Find the error message and error code
EXCEPTION
WHEN OTHERS
THEN
err_code := SQLCODE;
err_msg := SUBSTR (SQLERRM, 1, 200);
DBMS_OUTPUT.put_line ( 'Error code'
|| err_code
|| ':'
|| 'Error message'
|| err_msg
);
END mutl_supplier_updation;
IS
l_vendor_rec ap_vendor_pub_pkg.r_vendor_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_payment_priority NUMBER;
l_supplier_name VARCHAR2 (255);
l_error_message VARCHAR2 (100);
l_msg_index_out NUMBER;
err_code NUMBER;
err_msg VARCHAR2 (1000);
CURSOR cur_payment
IS
SELECT supplier_name, vendor_id, payment_priority
FROM xx_supplier1 where status is null;
BEGIN
FOR supplier_rec IN cur_payment
LOOP
l_supplier_name := supplier_rec.supplier_name;
l_vendor_id := supplier_rec.vendor_id;
l_payment_priority := supplier_rec.payment_priority;
DBMS_OUTPUT.put_line ('supplier_name' || l_supplier_name);
DBMS_OUTPUT.put_line ('vendor_id' || l_vendor_id);
DBMS_OUTPUT.put_line ('payment_priority' || l_payment_priority);
--update vendor payment priority value
l_vendor_rec.vendor_id := l_vendor_id;
l_vendor_rec.payment_priority := l_payment_priority;
ap_vendor_pub_pkg.update_vendor_public
(p_api_version => 1,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
p_vendor_rec => l_vendor_rec,
p_vendor_id => l_vendor_rec.vendor_id
);
DBMS_OUTPUT.put_line ('return_status: ' || l_return_status);
DBMS_OUTPUT.put_line ('msg_data: ' || l_msg_data);
--program successful then update the status 'S'
IF l_return_status = fnd_api.g_ret_sts_success
THEN
UPDATE xx_supplier1
SET status = 'S'
WHERE vendor_id = l_vendor_id;
DBMS_OUTPUT.put_line ('success');
ELSE
IF l_msg_count > 0
THEN
FOR i IN 1 .. l_msg_count
LOOP
apps.fnd_msg_pub.get (p_msg_index => i,
p_encoded => fnd_api.g_false,
p_data => l_msg_data,
p_msg_index_out => l_msg_index_out
);
---Find Error Message
IF l_error_message IS NULL
THEN
l_error_message := SUBSTR (l_msg_data, 1, 250);
ELSE
l_error_message :=
l_error_message || ' /'
|| SUBSTR (l_msg_data, 1, 250);
END IF;
DBMS_OUTPUT.put_line
('*****************************************');
DBMS_OUTPUT.put_line ('API Error: ' || l_error_message);
DBMS_OUTPUT.put_line
('*****************************************');
END LOOP;
---update status and error message
UPDATE xx_supplier1
SET error_message = l_error_message,
status = l_return_status
WHERE vendor_id = l_vendor_id;
END IF;
END IF;
END LOOP;
---Find the error message and error code
EXCEPTION
WHEN OTHERS
THEN
err_code := SQLCODE;
err_msg := SUBSTR (SQLERRM, 1, 200);
DBMS_OUTPUT.put_line ( 'Error code'
|| err_code
|| ':'
|| 'Error message'
|| err_msg
);
END mutl_supplier_updation;
No comments:
Post a Comment