Wednesday, July 22, 2015

Query for Lot Expired

select ood.organization_code,
       ood.organization_name,
       kfv.concatenated_segments,
       kfv.description,
       lot.lot_number,
 trunc(lot.expiration_date),
 trunc(lot.origination_date),
(trunc(lot.expiration_date) -  trunc(sysdate)) days_to_expire
from mtl_lot_numbers lot,
mtl_system_items_kfv kfv,
mtl_onhand_quantities_detail moqd,
org_organization_definitions ood
where lot.inventory_item_id=kfv.inventory_item_id
and lot.organization_id=kfv.organization_id
and lot.inventory_item_id=moqd.inventory_item_id
and lot.organization_id=moqd.organization_id
and lot.lot_number =moqd.lot_number
and ood.organization_id = moqd.organization_id
and kfv.concatenated_segments like '3%'----------Item segments
and (trunc(lot.expiration_date) -  trunc(sysdate)) >= nvl(:p_more_days, (trunc(lot.expiration_date) -  trunc(sysdate)))
and (trunc(lot.expiration_date) -  trunc(sysdate)) <= nvl(:p_less_days, (trunc(lot.expiration_date) -  trunc(sysdate)))
and ood.operating_unit=:p_org_id
order by ood.organization_code,(trunc(lot.expiration_date) -  trunc(sysdate))

No comments:

Post a Comment

Clear BNE Cache for WebADI Changes

It Sometime happens that WebAdi Changes doesn't reflect once migrated in controlled instances. Here are the quick steps(Generally perfor...