The PO Header Total Amount is sum of line amount. It will not include the amount for cancelled lines. If its still picks from the cancelled lines check whether the lines are partially cancelled.
You can check this in the shipments.
For cancelled lines the CLOSED_CODE will be 'CLOSED' and the CANCEL_FLAG will be 'Y'.
If the line got fully cancelled then the QUANTITY will become zero.
,pl.cancel_flag,pl.unit_price,pl.quantity , ( pl.unit_price*pl.quantity) line_amount , sum(( pl.unit_price*pl.quantity)) over(partition by ph.po_header_id) total_amount
,pd.quantity_cancelled,pd.quantity_billed,sum(( pl.unit_price*pd.quantity_billed)) over(partition by ph.po_header_id) matched_amount
No comments:
Post a Comment