Query Field Mapping

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Request: Reid has requested one PSQuery that will give him below details on item expiration that

will
give him details about availability of lot controlled items that are going to expire. This query will help
warehouses in utilizing the items first that are going to expire and will save cost.

Below are the fields requested with record field mapping details.

S.NO Field Name Database Field Record Name


.
1 Item# INV_ITEM_ID LOT_CONTROL_INV
2 Description DESCR60 MASTER_ITEM_TBL
3 Min REORDER_POINT BU_ITEMS_INV
4 Max QTY_MAXIMUM BU_ITEMS_INV
5 Lot id INV_LOT_ID LOT_CONTROL_INV
6 Lot Expiration Date EXPIRATION_DATE LOT_CONTROL_INV
7 Quantity due to expire QTY_ONHAND LOT_CONTROL_INV
8 Bin Location STORAGE_AREA, PHYSICAL_INV
STOR_LEVEL_1,
STOR_LEVEL_2,
STOR_LEVEL_3,
STOR_LEVEL_4,
9 Unit Of Measure STD_PACK_UOM BU_ITEMS_INV
10 Unit Cost DFLT_ACTUAL_COST BU_ITEMS_INV
11 Value due to expire QTY_ONHAND * LOT_CONTROL_INV,
DFLT_ACTUAL_COST BU_ITEMS_INV
12 Average monthly issue quantity
13 Estimate of quantity that will expire
before usage
14 Value of estimated quantity to expire

SELECT L.INV_ITEM_ID, M.DESCR60, B.REORDER_POINT, B.QTY_MAXIMUM, L.INV_LOT_ID,


L.EXPIRATION_DATE, L.QTY_ONHAND, P.STORAGE_AREA, P.STOR_LEVEL_1, P.STOR_LEVEL_2,
P.STOR_LEVEL_3, P.STOR_LEVEL_4, B.STD_PACK_UOM, B.DFLT_ACTUAL_COST, (L.QTY_ONHAND *
B.DFLT_ACTUAL_COST) As Value_due_to_expire

FROM PS_LOT_CONTROL_INV L, PS_MASTER_ITEM_TBL M, PS_BU_ITEMS_INV B, PS_PHYSICAL_INV P

WHERE L.BUSINESS_UNIT = B.BUSINESS_UNIT

AND L.INV_ITEM_ID = B.INV_ITEM_ID

AND L.INV_ITEM_ID = M.INV_ITEM_ID

AND M.SETID = 'SHARE'

AND L.BUSINESS_UNIT = P.BUSINESS_UNIT


AND L.INV_ITEM_ID = P.INV_ITEM_ID

AND L.QTY_ONHAND = P.QTY

AND L.BUSINESS_UNIT = '36001'

AND L.INV_ITEM_ID = 'L00000000000000929'

AND L.QTY_ONHAND <> 0

WITH UR;

SELECT (SUM(QTY_BASE)/12) FROM PS_TRANSACTION_INV WHERE BUSINESS_UNIT = '36001' AND


INV_ITEM_ID = 'L00000000000000929' AND TRANSACTION_GROUP = '030' AND TRANSACTION_DATE <=
CURRENT_DATE AND TRANSACTION_DATE >= CURRENT_DATE - 360 DAYS WITH UR;

You might also like