API to update the terms and Condition details in PO from back end
Introduction:
API to update the terms and Condition details in PO from back end.
Cause of the issue:
In PO Migration from one unit to another unit the data of terms and condition are not migrated to new units. To update the same then we can use the below API to achieve it.
How do we solve:
The below is the API to update the terms and conditions for the PO from Back end.
Script:
DECLARE
x_return_status VARCHAR2 (10);
x_msg_data VARCHAR2 (2000);
x_msg_count NUMBER;
g_template_miss_rec okc_terms_templates_pvt.template_rec_type;
l_document_type okc_bus_doc_types_b.document_type%TYPE
:= ‘PO_STANDARD’;
l_document_id okc_template_usages.document_id%TYPE := 739623; — Po_header_id
BEGIN
g_template_miss_rec.template_id := 2004; — Template ID
okc_terms_copy_pvt.copy_tc
(p_api_version => 1,
p_init_msg_list => fnd_api.g_false,
p_commit => fnd_api.g_true,
p_source_doc_type => okc_terms_util_grp.g_tmpl_doc_type,
p_source_doc_id => 2004,
p_target_doc_type => l_document_type,
p_target_doc_id => l_document_id,
p_document_number => ‘201901204763’, –PO Number
p_keep_version => ‘N’,
p_article_effective_date => SYSDATE,
–p_article_effective_date,
p_target_template_rec => g_template_miss_rec,
p_retain_deliverable => NULL,
x_return_status => x_return_status,
x_msg_data => x_msg_data,
x_msg_count => x_msg_count,
p_contract_admin_id => NULL,
p_legal_contact_id => NULL,
p_retain_clauses => NULL
);
COMMIT;
DBMS_OUTPUT.put_line (‘x_return_status:’ || x_return_status);
END;