Thursday 24 March 2011

Finally Close PO in ORACLA APPS

DECLARE
x_action constant varchar2(20) := 'FINALLY CLOSE'; -- Change this parameter as per requirement
x_calling_mode constant varchar2(2) := 'PO';
x_conc_flag constant varchar2(1) := 'N';
x_return_code_h varchar2(100);
x_auto_close constant varchar2(1) := 'N';
x_origin_doc_id number;
x_returned boolean:=null;

begin
apps.fnd_client_info.set_org_context(204);
fnd_global.apps_initialize(1318,50578,201);
DBMS_OUTPUT.PUT_LINE ('Calling PO_Actions.close_po for Closing/Finally Closing PO =>' );
x_returned :=
po_actions.close_po(
p_docid => 110386,
p_doctyp => 'PO',
p_docsubtyp => 'STANDARD',
p_lineid => null,
p_shipid => null,--Line_Location_ID.
p_action => x_action,
p_reason => NULL,
p_calling_mode => x_calling_mode,
p_conc_flag => x_conc_flag,
p_return_code => x_return_code_h,
p_auto_close => x_auto_close,
p_action_date => SYSDATE,
p_origin_doc_id => NULL);
COMMIT;
IF x_returned = TRUE THEN
DBMS_OUTPUT.PUT_LINE ('Purchase Order which just got Closed/Finally Closed is ' );
dbms_output.put_line(x_return_code_h);
--dbms_output.put_line(x_returned);

ELSE
DBMS_OUTPUT.PUT_LINE ('API Failed to Close/Finally Close the Purchase Order');
--dbms_output.put_line('return codeis:'||X_RETURNED);
END IF;
END;

1 comment:

  1. Hi, Thanks for the post. It was really helpful.

    Currently we are using the PO_ACTIONS.CLOSE_PO to close blanket releases.

    l_close_status :=
    PO_ACTIONS.CLOSE_PO (p_docid => po_rec.po_header_id,
    p_doctyp => 'PA',
    p_docsubtyp => 'BLANKET',
    p_lineid => NULL,
    p_shipid => NULL,
    p_action => 'FINALLY CLOSE',
    p_return_code => l_return_code,
    p_auto_close => 'N',
    p_action_date => SYSDATE);

    The above program final closes the Blanket PO (‘Finally Closed’) at the header level and all the releases are in ‘Closed’ status. Is it possible to have the release status to ‘Finally Closed’ instead of ‘Closed’ status?

    ReplyDelete