Friday, November 2, 2018

Internal Requsition and Internal Sales Order Link

Internal Requsition and Internal Sales Order Link

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.
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'
;

No comments:

Post a Comment

SQL Important Queries

  How to delete rows with no where clause The following example deletes  all rows  from the  Person.Person  the table in the AdventureWork...