To change the Status of Service Contract Header (OKC_K_HEADERS_ALL_B.STS_CODE) use the below code
DECLARE --Local variable l_contract_id NUMBER; lx_msg_data VARCHAR2(4000); l_msg_data VARCHAR2(4000); lx_return_status VARCHAR2(1); lx_msg_count NUMBER; BEGIN fnd_global.apps_initialize( user_id => 263915 , --FND_USER.USER_ID resp_id => 56785, --OM Service Contracts resp_appl_id => 515 --OKS ); l_contract_id := '2698262'; /* SELECT id FROM OKC_K_HEADERS_ALL_B WHERE contract_number='112348' */ /* REASON CODE : select lookup_code from fnd_lookup_values where lookup_type='OKC_STS_CHG_REASON' */ --Set the org context for okc OKC_CONTEXT.set_okc_org_context(p_chr_id => l_contract_id); OKS_STATUS_CHANGE_PUB.change_status( p_contract_id => l_contract_id, p_line_id => NULL, p_subline_id => NULL, p_reason_code => 'SUBMIT_AR', p_comments => 'Changed via Update Program at '|| to_char(sysdate,'DD-MON-RRRR HH24.MI.SS'), p_new_status_code => 'AR_REVIEW', x_msg_data => lx_msg_data, x_msg_count => lx_msg_count, x_return_status => lx_return_status ); 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