callcybercop
Programmer
THE FOLLOWING CODE RETURNS DATES ONLY BEFORE MAY 26TH, 2005 EVEN IF U PASS PARAMETERS THAT ARE LATER THAN MAY 26 LIKE 30-JUN-2005, TTHE REPORT GENERATES RECEIPTS ONLY BEFOR MAY 26TH. THIS PROBLEM HAS BEEN IDENTIFIED BY THE USER HIMSELF SO I AM ASSUMING THE PROBLEM IS IN THE SQL STATEMENT.PLZ HELP
SELECT
TO_SUBINVENTORY A_WHSE,
VENDOR_NAME A_VENDOR,
VENDOR_SITE_CODE A_VENDOR_SITE,
I.SEGMENT1 A_ITEM,
RECEIPT_NUM A_RECV_NO,
TRUNC(TRANSACTION_DATE) A_TRANS_DATE,
SUM(RT.QUANTITY) A_RECV_QTY
FROM
RCV_TRANSACTIONS RT,RCV_SHIPMENT_HEADERS SH, RCV_SHIPMENT_LINES SD, MTL_SYSTEM_ITEMS I,
PO_LINES_ALL PL, IC_WHSE_MST W,PO_VENDOR_SITES_ALL VS, PO_VENDORS V,
IMRSAD.RECEIPT_LINES RL, IMRSAD.RECEIPT_HEADERS RH,
(SELECT DISTINCT LINE_ID,LOT_ID FROM IC_TRAN_PND WHERE DOC_TYPE = 'PORC' ) X,
(SELECT SHIPMENT_HEADER_ID, SUM(QUANTITY) RCV_QTY
FROM RCV_TRANSACTIONS WHERE DESTINATION_TYPE_CODE = 'INVENTORY'
GROUP BY SHIPMENT_HEADER_ID) RQ
WHERE SD.ITEM_ID = I.INVENTORY_ITEM_ID
AND I.ORGANIZATION_ID = 0
AND SH.SHIPMENT_HEADER_ID = SD.SHIPMENT_HEADER_ID
AND SD.SHIPMENT_LINE_ID = RT.SHIPMENT_LINE_ID
AND RT.DESTINATION_TYPE_CODE = 'INVENTORY'
AND SD.PO_LINE_ID = PL.PO_LINE_ID
AND X.LINE_ID = RT.TRANSACTION_ID
AND RT.SHIPMENT_LINE_ID = SD.SHIPMENT_LINE_ID
AND SH.SHIPMENT_HEADER_ID = RQ.SHIPMENT_HEADER_ID
AND TO_SUBINVENTORY = W.WHSE_CODE
AND W.WHSE_CLASS = 'TOLLING'
AND SH.VENDOR_SITE_ID = VS.VENDOR_SITE_ID
AND SH.VENDOR_ID = V.VENDOR_ID
AND SD.ATTRIBUTE1 = RL.RECV_LINE_ID
AND RL.RECV_HDR_ID = RH.RECV_HDR_ID
AND STATUS_CODE_ID < 4
AND NOT EXISTS ( SELECT 1
FROM IC_LOCT_INV LI
WHERE LI.LOT_ID = X.LOT_ID)
AND RH.ORGN_CODE = _ORGN_CODE
AND VENDOR_NAME = NVLP_VENDOR,VENDOR_NAME)
AND VENDOR_SITE_CODE = NVLP_VEND_SITE,VENDOR_SITE_CODE)
GROUP BY TO_SUBINVENTORY,RECEIPT_NUM,RT.DESTINATION_TYPE_CODE,
VENDOR_SITE_CODE,TRUNC(TRANSACTION_DATE),VENDOR_NAME,
I.SEGMENT1
ORDER BY 1,2,3,4,5
SELECT
TO_SUBINVENTORY A_WHSE,
VENDOR_NAME A_VENDOR,
VENDOR_SITE_CODE A_VENDOR_SITE,
I.SEGMENT1 A_ITEM,
RECEIPT_NUM A_RECV_NO,
TRUNC(TRANSACTION_DATE) A_TRANS_DATE,
SUM(RT.QUANTITY) A_RECV_QTY
FROM
RCV_TRANSACTIONS RT,RCV_SHIPMENT_HEADERS SH, RCV_SHIPMENT_LINES SD, MTL_SYSTEM_ITEMS I,
PO_LINES_ALL PL, IC_WHSE_MST W,PO_VENDOR_SITES_ALL VS, PO_VENDORS V,
IMRSAD.RECEIPT_LINES RL, IMRSAD.RECEIPT_HEADERS RH,
(SELECT DISTINCT LINE_ID,LOT_ID FROM IC_TRAN_PND WHERE DOC_TYPE = 'PORC' ) X,
(SELECT SHIPMENT_HEADER_ID, SUM(QUANTITY) RCV_QTY
FROM RCV_TRANSACTIONS WHERE DESTINATION_TYPE_CODE = 'INVENTORY'
GROUP BY SHIPMENT_HEADER_ID) RQ
WHERE SD.ITEM_ID = I.INVENTORY_ITEM_ID
AND I.ORGANIZATION_ID = 0
AND SH.SHIPMENT_HEADER_ID = SD.SHIPMENT_HEADER_ID
AND SD.SHIPMENT_LINE_ID = RT.SHIPMENT_LINE_ID
AND RT.DESTINATION_TYPE_CODE = 'INVENTORY'
AND SD.PO_LINE_ID = PL.PO_LINE_ID
AND X.LINE_ID = RT.TRANSACTION_ID
AND RT.SHIPMENT_LINE_ID = SD.SHIPMENT_LINE_ID
AND SH.SHIPMENT_HEADER_ID = RQ.SHIPMENT_HEADER_ID
AND TO_SUBINVENTORY = W.WHSE_CODE
AND W.WHSE_CLASS = 'TOLLING'
AND SH.VENDOR_SITE_ID = VS.VENDOR_SITE_ID
AND SH.VENDOR_ID = V.VENDOR_ID
AND SD.ATTRIBUTE1 = RL.RECV_LINE_ID
AND RL.RECV_HDR_ID = RH.RECV_HDR_ID
AND STATUS_CODE_ID < 4
AND NOT EXISTS ( SELECT 1
FROM IC_LOCT_INV LI
WHERE LI.LOT_ID = X.LOT_ID)
AND RH.ORGN_CODE = _ORGN_CODE
AND VENDOR_NAME = NVLP_VENDOR,VENDOR_NAME)
AND VENDOR_SITE_CODE = NVLP_VEND_SITE,VENDOR_SITE_CODE)
GROUP BY TO_SUBINVENTORY,RECEIPT_NUM,RT.DESTINATION_TYPE_CODE,
VENDOR_SITE_CODE,TRUNC(TRANSACTION_DATE),VENDOR_NAME,
I.SEGMENT1
ORDER BY 1,2,3,4,5