Wednesday, October 9, 2013

How to get a Total Amount on a Standard Purchase Order

Oracle provides couple of API's to get the Total Amount on a Standard Purchase Order. Using this API, you don't have to worry about the calculation of the Quantity x Unit Price and what needs to be excluded from the calculation.

To get the Total Amount of the current revision of the Standard Purchase Order
##########################################################
DECLARE
  l_total  NUMBER := 0;
BEGIN
  l_total := po_core_s.get_total('H', :p_po_header_id);
  dbms_output.put_line('PO Total Amount:'||l_total);
END;
##########################################################

To get the Total Amount of any previous revisions of the Standard Purchase Order, use the following API.

##########################################################
DECLARE
  l_total   NUMBER := 0;
BEGIN
l_total := po_core_s.get_archive_total_for_any_rev
                     (:p_po_header_id,-- PO Header Id


                      'H',            -- Standard Header
                      'PO',           -- Document Type
                      'STANDARD',     -- Document Sub Type
                      0,              -- Revision Num
                      'Y');           -- Base Currency

dbms_output.put_line('PO Total Amount:'||l_total);
END;
###########################################################

1 comment: