OM Queries

 OM Queries

1) Move order line details

SELECT wnd.delivery_id,                                                            
       wnd.name  delivery_name,                                                            
       wnd.initial_pickup_location_id,
       mtrh.request_number mo_number,                                                              
       mtrl.line_number mo_line_number,
       mtrl.line_id mo_line_id,                  
       mtrl.from_subinventory_code,
       mtrl.to_subinventory_code,
       mtrl.lot_number,
       mtrl.serial_number_start,
       mtrl.serial_number_end,
       mtrl.uom_code,
       mtrl.quantity,
       mtrl.quantity_delivered,
       mtrl.quantity_detailed,                                                
       wdd.source_header_number so_order_number,                                                                  
       oola.line_number so_line_number,
       wdd.source_header_id so_header_id,                                        
       wdd.source_line_id so_line_id,                                            
       wdd.shipping_instructions,                                                                
       wdd.inventory_item_id,                                                                    
       wdd.requested_quantity_uom,  
       msi.description item_description,  
       msi.revision_qty_control_code  ,                                                
       wdd.ship_method_code carrier,
       wdd.shipment_priority_code priority,
       wdd.organization_id,
       wdd.released_status,                        
       wdd.source_code
  FROM  mtl_system_items_vl msi,
       oe_order_lines_all oola,
       mtl_txn_request_lines mtrl,                                                          
       mtl_txn_request_headers mtrh,
       wsh_delivery_details wdd,
       wsh_delivery_assignments wda,                                                          
       wsh_new_deliveries wnd
WHERE wnd.delivery_id =3777372
   AND wda.delivery_id = wnd.delivery_id(+)                          
   AND wdd.delivery_detail_id = wda.delivery_detail_id                
   AND wdd.move_order_line_id = mtrl.line_id                                      
   AND  mtrl.header_id = mtrh.header_id
   AND wdd.inventory_item_id = msi.inventory_item_id(+)                                        
   AND wdd.organization_id = msi.organization_id(+)                                              
   AND wdd.source_line_id = oola.line_id                              
  AND wdd.source_header_id = oola.header_id;

2) shipper detail info

SELECT wnd.delivery_id,
       wnd.name  delivery_name,
       wdd.source_header_number so_order_number,
       oola.line_number so_line_number,
       wdd.source_header_id so_header_id,
       wdd.source_line_id so_line_id,
       wdd.shipping_instructions,
       wdd.inventory_item_id,
       wdd.requested_quantity_uom,
       msi.description item_description,
       msi.revision_qty_control_code  ,
       wdd.ship_method_code carrier,
       wdd.shipment_priority_code priority,
       wdd.organization_id,
       wnd.initial_pickup_location_id,
       wdd.released_status,
       wdd.source_code
FROM  mtl_system_items_vl msi,
       oe_order_lines_all oola,
       wsh_delivery_details wdd,
       wsh_delivery_assignments wda,
       wsh_new_deliveries wnd
WHERE wnd.delivery_id = 3777372
   AND wda.delivery_id = wnd.delivery_id(+)
   AND wdd.delivery_detail_id = wda.delivery_detail_id
   AND wdd.inventory_item_id = msi.inventory_item_id(+)
   AND wdd.organization_id = msi.organization_id(+)
   AND wdd.source_line_id = oola.line_id
   AND wdd.source_header_id = oola.header_id;

3) Shipper Info

SELECT  wnd.delivery_id delivery_id                                                                     ,
        substrb(hp.party_name,1,50) customer                                                            ,
        wpb.name batch_name                                                                             ,
        wsh_util_core.get_location_description( wnd.INITIAL_PICKUP_LOCATION_ID, 'NEW UI CODE') ship_from,
        wsh_util_core.get_location_description( wnd.ULTIMATE_DROPOFF_LOCATION_ID, 'NEW UI CODE') ship_to,
        wnd.INITIAL_PICKUP_DATE pickup_date                                                             ,
        wnd.ULTIMATE_DROPOFF_DATE dropoff_date                                                          ,
        lv.meaning ship_method                                                                          ,
        wnd.WAYBILL waybill                                                                             ,
        wnd.GROSS_WEIGHT gross_weight                                                                   ,
        wnd.WEIGHT_UOM_CODE uom                                                                         ,
        wnd.status_code                                                                                 ,
        we.message
  FROM  wsh_new_deliveries wnd,
        wsh_picking_batches wpb     ,
        wsh_exceptions we           ,
        fnd_lookup_values_vl lv     ,
        hz_cust_accounts hca        ,
        hz_parties hp
WHERE  wnd.delivery_id             = 3777372
   AND wpb.batch_id                 = wnd.batch_id
   AND we.delivery_id(+)            = wnd.delivery_id
   AND we.exception_name(+)         = 'WSH_BATCH_MESSAGE'
   AND lv.lookup_code(+)            = wpb.ship_method_code
   AND lv.lookup_type(+)            = 'SHIP_METHOD'
   AND lv.view_application_id(+)    = 3
   AND hca.cust_account_id (+)      = wnd.customer_id
   AND hp.party_id(+)               = hca.party_id;

0 comments:

Post a Comment