API to update PO

 API's to update Purchase Order in R12

For all these API context needs to be set.

=====API to Update Requestor

              PO_Mass_Update_PO_GRP.Update_Persons
                                    ('DELIVER TO'    ,      --p_update_person
                                     G_OLD_PERSON_ID,       --p_old_personid     ,
                                     L_NEW_PERSON_ID,       --p_new_personid     ,
                                     NULL,                  --p_document_type    ,
                                     p_po_number,           --p_document_no_from ,
                                     p_po_number,           --p_document_no_to   ,
                                     NULL,                  --p_date_from        ,
                                     NULL,                  --p_date_to          ,
                                     NULL,                  --p_supplier_id      ,
                                     'N',                   --p_include_close_po ,
                                     NULL,                  --p_commit_interval  ,
                                     p_msg_data         ,
                                     p_msg_count        ,
                                     p_return_status    );

=====API to update Need by date , Promise date, qty, price

        l_result := po_change_api1_s.update_po(
                    x_po_number             => i.po_number,         --Enter the PO Number
                    x_release_number        => NULL,                --Enter the Release Num as NULL as it is Standard PO
                    x_revision_number       => l_revision_num,      --Enter the current Revision Number
                    x_line_number           => i.line_num,          --Enter the Line Number to update
                    x_shipment_number       => i.shipment_num,      --Enter the Shipment Number to update
                    new_quantity            => NULL,
                    new_price               => NULL,                    
                    new_promised_date       => l_need_by_date,      --populate promise date same as need by date 
                    new_need_by_date        => l_need_by_date,      --Enter the new need by date to be updated 
                    launch_approvals_flag   => 'N',
                    update_source           => NULL,
                    version                 => '1.0',
                    x_override_date         => NULL,
                    x_api_errors            => l_api_errors,
                    p_buyer_name            => NULL,
                    p_secondary_quantity    => NULL,
                    p_preferred_grade       => NULL,
                    p_org_id                => i.org_id
                );    

=====API to Close API

Note: 

1.This is not public API.

2.This API cannot close with Holds on PO - will produce results like API PO_ACTIONS.CLOSE_PO failed to close po with p_return_code value as SUBMISSION_FAILED and the lv_result value as TRUE

                         PO_ACTIONS.CLOSE_PO(
                                          P_DOCID => po_details_rec.po_header_id,
                                          P_DOCTYP => 'PO',
                                          P_DOCSUBTYP => 'STANDARD',    -- Can be STANDARD, BLANKET,RELEASE
                                          P_LINEID => NULL,--po_details_rec.po_line_id,      -- If want to close Line
                                          P_SHIPID => NULL,--po_details_rec.LINE_LOCATION_ID,-- If want to close Shipment
                                          P_ACTION => 'FINALLY CLOSE',                --CLOSE',
                                          P_REASON => p_reason,          --'Close Purchase Order ',
                                          P_CALLING_MODE => po_details_rec.document_type_code,
                                          P_CONC_FLAG => 'N',
                                          P_RETURN_CODE => l_return_code,
                                          P_AUTO_CLOSE => 'N',
                                          P_ACTION_DATE => sysdate,
                                          P_ORIGIN_DOC_ID => NULL );

Comments

Popular posts from this blog

PO & Receipt Query

Supplier SQL query

Sales Order SQL