Wednesday, March 30, 2016

SQL- UOM MAX conversion Rate

SELECT * --UOM_CODE maxuom        
           FROM MTL_UOM_CONVERSIONS M1
          WHERE     conversion_rate =
                       (SELECT MAX (CONVERSION_RATE)
                          FROM MTL_UOM_CONVERSIONS M2
                         WHERE M2.INVENTORY_ITEM_ID = M1.INVENTORY_ITEM_ID)
                --AND M1.INVENTORY_ITEM_ID = 39548;

   SELECT primary_uom_code
           FROM mtl_system_items_b msi,
                mtl_parameters mpa
          WHERE inventory_item_id     = p_inventory_item_id
            AND msi.organization_id   = mpa.organization_id
            AND mpa.organization_code = 'MAS';


api - qty conversion
inv_convert.inv_um_conversion(:cp_rpt_uom,:cp_prim_uom,:cp_item_id,x_rate);

No comments: