Sunday 15 December 2019

Script to check for Move Order lines with missing Move Order headers

SELECT mtrl.header_id,
                   wdd.organization_id,
                   wsp.enforce_ship_set_and_smc,
                   wpb.pick_grouping_rule_id,
                   wpb.NAME
              FROM wsh_delivery_details     wdd,
                   wsh_shipping_parameters  wsp,
                   mtl_txn_request_lines    mtrl,
                   wsh_picking_batches      wpb
             WHERE     mtrl.line_id = wdd.move_order_line_id
                   AND wdd.source_code = 'OE'
                   AND wdd.move_order_line_id IS NOT NULL
                   AND wsp.organization_id = wdd.organization_id
                   AND wdd.batch_id = wpb.batch_id
                   AND wdd.released_status = 'S'
                   AND NOT EXISTS
                           (SELECT 1
                              FROM mtl_txn_request_headers mtrh
                             WHERE mtrh.header_id = mtrl.header_id);

No comments:

Post a Comment