Wednesday, June 6, 2012

SQL Query for WIP JOBS associated to a sales order

Query1:
--------
SELECT


ooh.order_number

,msib.segment1

,mr.reservation_quantity

, we.wip_entity_name wip_job_name

, wdj.scheduled_start_date wip_start_date

, wdj.scheduled_completion_date wip_completion_date

, wdj.attribute10 job_type

FROM oe_order_headers_all ooh

, oe_order_lines_all ool

, mtl_reservations mr

, wip_discrete_jobs wdj

, wip_entities we

,mtl_system_items_b msib

WHERE ooh.header_id = ool.header_id

AND ooh.org_id = 160

-- AND ool.item_type_code IN ('CONFIG', 'STANDARD')

AND mr.demand_source_line_id = ool.line_id

AND mr.supply_source_type_id = 5

AND mr.supply_source_header_id = we.wip_entity_id

AND we.wip_entity_id = wdj.wip_entity_id

AND ool.ship_from_org_id = we.organization_id

AND ool.ship_from_org_id=msib.organization_id

AND mr.inventory_item_id=msib.inventory_item_id

AND we.organization_id = wdj.organization_id

1 comment:

VMR Naidu Dudala said...

Hi,
Could you please let me know the pub or interface tables to crate WIP job by validating Sales order deatils from .csv file.

i need to split the lines depends on quantity also.

your help is highly appreciated.