Friday 24 January 2014

Open purchase order report

SELECT hp.party_name customer_name,
       hcaa.account_number,
       ooha.order_number,
       ottt.name order_type,
       ooha.creation_date orderd_date,
       msib.segment1 item,
       msib.description,
       oola.order_quantity_uom uom,
       oola.request_date,
       oola.return_reason_code return_reason,
       oola.shipped_quantity return_qty
  FROM HZ_PARTIES HP,
       HZ_CUST_ACCOUNTS_ALL hcaa,
       OE_ORDER_HEADERS_ALL ooha,
       OE_TRANSACTION_TYPES_TL ottt,
       MTL_SYSTEM_ITEMS_B msib,
       OE_ORDER_LINES_ALL oola
 WHERE hp.party_id = hcaa.party_id
   AND hcaa.cust_account_id = ooha.sold_to_org_id
   AND ooha.order_type_id = ottt.transaction_type_id
   AND ottt.LANGUAGE = USERENV('LANG')
   AND msib.inventory_item_id = oola.inventory_item_id
   AND msib.organization_id = oola.ship_from_org_id
   AND ooha.header_id = oola.header_id
   AND oola.line_category_code = 'RETURN'
   AND oola.shipped_quantity > 0
   --AND OOHA.ORDER_NUMBER = '66683'
   AND TRUNC(OOHA.CREATION_DATE) BETWEEN :P_FROM_DATE AND :P_TO_DATE

No comments:

Post a Comment