Search This Blog

Sunday, November 21, 2010

Internal Requisitions That Do Not Have An Associated Internal Sales Order

SELECT
,RQH.SEGMENT1
,RQL.LINE_NUM
,RQL.REQUISITION_HEADER_ID
,RQL.REQUISITION_LINE_ID
,RQL.ITEM_ID
,RQL.UNIT_MEAS_LOOKUP_CODE
,RQL.UNIT_PRICE
,RQL.QUANTITY
,RQL.QUANTITY_CANCELLED
,RQL.QUANTITY_DELIVERED
,RQL.CANCEL_FLAG
,RQL.SOURCE_TYPE_CODE
,RQL.SOURCE_ORGANIZATION_ID
,RQL.DESTINATION_ORGANIZATION_ID
,RQH.TRANSFERRED_TO_OE_FLAG
FROM
,PO_REQUISITION_LINES_ALL RQL
,PO_REQUISITION_HEADERS_ALL RQH
WHERE
RQL.REQUISITION_HEADER_ID = RQH.REQUISITION_HEADER_ID and
RQL.SOURCE_TYPE_CODE = 'INVENTORY' and
RQL.SOURCE_ORGANIZATION_ID is not null and not exists
(select 'existing internal order'from OE_ORDER_LINES_ALL LIN where LIN.SOURCE_DOCUMENT_LINE_ID = RQL.REQUISITION_LINE_ID and LIN.SOURCE_DOCUMENT_TYPE_ID = 10)
ORDER BY RQH.REQUISITION_HEADER_ID, RQL.LINE_NUM

No comments:

Post a Comment