At times there is need to Finally close only requisition lines but not header.
Below API can be used to fulfill the requirement. Test API thoroughly before using it in further instances as this is a ripped version from Requisition Header close api.
DECLARE
v_returned BOOLEAN;
v_return_code_h VARCHAR2(1);
lc_return_status VARCHAR2(50);
lc_exception_msg VARCHAR2(4000);
lc_return_code VARCHAR2(50);
ln_online_report_id NUMBER;
v_error_code VARCHAR2(4000);
lc_req_control_error VARCHAR2(4000);
BEGIN
fnd_global.Apps_initialize (user_id,resp_id, 201);
mo_global.Set_policy_context('S',org_id);
FOR po_req IN
(
SELECT *
FROM req_closed_tbl opc; )
LOOP
v_error_code := NULL;
po_req_dist_sv.Update_reqs_distributions (x_req_header_id => po_req.requisition_header_id ,
x_req_line_id => po_req.requisition_line_id,
x_req_control_action => 'FINALLY CLOSE' ,
x_req_action_date => SYSDATE,
x_req_control_error_rc => v_error_code);
IF v_error_code IS NULL THEN
po_reqs_control_sv.Maintain_supply (x_supply_action => 'Remove_Req_Line_Supply',
x_supply_id => po_req.requisition_line_id,
x_req_control_error_rc => v_error_code);
IF v_error_code IS NULL THEN
po_req_lines_sv.update_reqs_lines_status (x_req_header_id => po_req.requisition_header_id ,
x_req_line_id => po_req.requisition_line_id ,
x_req_control_action => 'FINALLY CLOSE' ,
x_req_control_reason => 'Put Reason here' ,
x_req_action_date => SYSDATE,
x_oe_installed_flag => 'Y',
x_req_control_error_rc => v_error_code);
END IF;
END IF;
IF v_error_code IS NOT NULL THEN
-- Put logic here
END IF;
COMMIT;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(' Exception closing Requisition lines using po_reqs_control_sv.update_reqs_lines_status '||SQLERRM);
END;
No comments:
Post a Comment