Thursday, November 30, 2023

Query to get item on hand by org wise

 Hello Below is the query to get the on hand by org wise.

Sample Output: 


-----------------------------------------------------------------------------------------------------------------------------

SELECT iop.organization_code,
esi.item_number,
sum(ioqd.TRANSACTION_QUANTITY) on_hand,
esi.description,
ESI.PRIMARY_UOM_CODE UOM
FROM egp_system_items_vl esi,
inv_org_parameters IOP,
inv_onhand_quantities_detail ioqd
WHERE 1 = 1
AND ESI.organization_id = IOP.organization_id
AND ioqd.inventory_item_id = esi.INVENTORY_ITEM_ID
AND ioqd.ORGANIZATION_ID = esi.ORGANIZATION_ID
AND esi.item_number = nvl(:p_item, esi.item_number)
AND iop.organization_code = nvl(:p_org, iop.organization_code)
GROUP BY iop.organization_code,
esi.item_number,
esi.description,
ESI.PRIMARY_UOM_CODE  
ORDER BY iop.organization_code,
esi.item_number

-----------------------------------------------------------------------------------------------------------------------------

                                                                    ** Thank You **

No comments:

Post a Comment