Use the below Code to update Service Contract Line's Start and End Date
DECLARE --Local variable l_contract_id NUMBER; lx_return_status VARCHAR2(1); lx_msg_count NUMBER; lx_msg_data VARCHAR2(4000); l_msg_data VARCHAR2(4000); lp_line_tbl OKS_IMPORT_LINE_PUB.line_tbl_type; lx_line_tbl OKS_IMPORT_LINE_PUB.line_tbl_type; 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 l_contract_id --2698262 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 => l_contract_id); /* select * from okc_k_lines_b where dnz_chr_id = l_contract_id and chr_id=l_contract_id; */ lp_line_tbl(1).contract_line_id :='295520844472982192095195610780854432106'; lp_line_tbl(1).contract_id :=l_contract_id; lp_line_tbl(1).start_date := to_date('05-JUN-2022','DD-MON-RRRR'); lp_line_tbl(1).end_date := to_date('04-JUN-2023','DD-MON-RRRR'); lp_line_tbl(2).contract_line_id :='295520844473003952759948674105999143274'; lp_line_tbl(2).contract_id :=l_contract_id; lp_line_tbl(2).start_date := to_date('05-JUN-2021','DD-MON-RRRR'); lp_line_tbl(2).end_date := to_date('04-JUN-2022','DD-MON-RRRR'); OKS_IMPORT_LINE_PUB.update_contract_line( p_api_version => 1.0, --IN p_init_msg_list => OKC_API.G_TRUE, --IN x_return_status => lx_return_status, --OUT x_msg_count => lx_msg_count, --OUT x_msg_data => lx_msg_data, --OUT p_line_tbl => lp_line_tbl, --IN x_line_tbl => lx_line_tbl --OUT ); DBMS_OUTPUT.put_line(' lx_return_status : '|| lx_return_status ); DBMS_OUTPUT.put_line(' lx_msg_count: '|| lx_msg_count ); DBMS_OUTPUT.put_line(' lx_msg_data: '|| replace(lx_msg_data,chr(0),' ' )); DBMS_OUTPUT.put_line(' fnd_msg_pub.count_msg: '|| fnd_msg_pub.count_msg ); IF lx_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