Use this query / script to find the link between a internal requisition and internal sales order.
Please note that a internal sales order which is created from internal requisition may not always have sales order type as “INTERNAL” or “INTERCOMPANY”. Sales order type can also me “MIXED” or any other custom type so do not filter based on Sales order type.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
SELECT OOH.ORDER_NUMBER SO, PRH.SEGMENT1 REQ FROM OE_ORDER_HEADERS_ALL OOH, PO_REQUISITION_HEADERS_ALL PRH, PO_REQUISITION_LINES_ALL PRL WHERE 1 = 1 AND PRH.REQUISITION_HEADER_ID = PRL.REQUISITION_HEADER_ID –AND PRH.SEGMENT1 = OOH.ORIG_SYS_DOCUMENT_REF AND PRH.REQUISITION_HEADER_ID = OOH.SOURCE_DOCUMENT_ID AND ORDER_NUMBER = ‘66534’ –Sales Order Number AND PRH.SEGMENT1 = ‘14375’ — Requisition Number AND PRH.TYPE_LOOKUP_CODE = ‘INTERNAL’ ; |