Using OKS_IMPORT_HEADER_PUB.update_contract_header to update Description, Comments, Start Date and End Date of Service Contract
Use the below code to change the Description, Comments, Start Date and End Date of Service Contract
SELECT id,start_date,end_date FROM OKC_K_HEADERS_ALL_B WHERE contract_number='112348'; select short_description,--Description on header comments,--Comments in "Security/Text" tab description,--Long Description in "Security/Text" tab cognomen --PO Number on header from okc_k_headers_tl where id='2698262';
DECLARE lv_return_status VARCHAR2(1); ln_msg_count NUMBER; lv_msg_data VARCHAR2(4000); l_msg_data VARCHAR2(4000); l_contract_rec oks_import_header_pub.Update_rec_type; lx_contract_rec oks_import_header_pub.Update_rec_type; ln_okc_id NUMBER; BEGIN
fnd_global.apps_initialize(user_id => 263915 , --FND_USER.USER_ID resp_id => 56785, --OM Service Contracts resp_appl_id => 515 --OKS );SELECT okc.id INTO ln_okc_id FROM okc_k_headers_all_b okc WHERE 1=1 AND okc.contract_number = '112348'; --Set the org context for okc OKC_CONTEXT.set_okc_org_context(p_chr_id => ln_okc_id); l_contract_rec.ID := ln_okc_id; l_contract_rec.description := 'Test description'; l_contract_rec.comments := 'Test comments'; l_contract_rec.start_date := to_date('05-JUN-2021','DD-MON-RRRR'); l_contract_rec.end_date := to_date('04-JUN-2023','DD-MON-RRRR'); OKS_IMPORT_HEADER_PUB.update_contract_header( p_api_version => 1.0, --IN p_init_msg_list => OKC_API.G_TRUE, --IN x_return_status => lv_return_status, --OUT x_msg_count => ln_msg_count, --OUT x_msg_data => lv_msg_data, --OUT p_contract_rec => l_contract_rec, --IN x_Contract_rec => lx_contract_rec --OUT ); DBMS_OUTPUT.put_line(' lv_return_status : '|| lv_return_status ); DBMS_OUTPUT.put_line(' ln_msg_count: '|| ln_msg_count ); DBMS_OUTPUT.put_line(' lv_msg_data: '|| replace(lv_msg_data,chr(0),' ' )); DBMS_OUTPUT.put_line(' fnd_msg_pub.count_msg: '|| fnd_msg_pub.count_msg ); IF lv_return_status='S' THEN COMMIT; ELSE FOR i IN 1..fnd_msg_pub.count_msg LOOP l_msg_data := FND_MSG_PUB.Get(i, p_encoded => FND_API.G_FALSE); DBMS_OUTPUT.put_line(l_msg_data); END LOOP; END IF; END;
Comments
Post a Comment