Wednesday, 24 October 2018

Query to fetch IR/ISO details

Query to fetch IR  (Internal Requisition) and ISO (Internal Sales Order) details:


SELECT OOH.*, PRH.*
  FROM APPS.OE_ORDER_HEADERS_ALL        OOH,
       APPS.OE_ORDER_LINES_ALL          OOL,
       APPS.OE_ORDER_SOURCES            OOS,
       APPS.PO_REQUISITION_LINES_ALL    PRL,
       APPS.PO_REQUISITION_HEADERS_ALL  PRH
 WHERE     1 = 1
       -- Order conditions
       AND OOH.ORG_ID = OOL.ORG_ID
       AND OOH.HEADER_ID = OOL.HEADER_ID
       AND OOL.CANCELLED_FLAG = 'N'
       AND OOL.ORDER_SOURCE_ID = OOS.ORDER_SOURCE_ID
       AND UPPER (OOS.NAME) = 'INTERNAL'
       -- AND OOH.ORDER_NUMBER = :P_ORDER_NUMBER -- Input your ISO number
       -- Link between Internal Sales Order and Internal Requisition
       AND OOL.SOURCE_DOCUMENT_LINE_ID = PRL.REQUISITION_LINE_ID
       AND OOL.SOURCE_DOCUMENT_ID = PRH.REQUISITION_HEADER_ID
       AND OOH.ORIG_SYS_DOCUMENT_REF = PRH.SEGMENT1 -- You can input Requisition number
       -- Requisition conditions
       AND PRH.REQUISITION_HEADER_ID = PRL.REQUISITION_HEADER_ID
       AND PRH.TYPE_LOOKUP_CODE = 'INTERNAL'

No comments:

Post a Comment