DBA Data[Home] [Help]

APPS.WMS_TASK_DISPATCH_GEN SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 107

  PROCEDURE insert_task(
    p_org_id        IN            NUMBER
  , p_user_id       IN            NUMBER
  , p_eqp_ins       IN            VARCHAR2
  , p_temp_id       IN            NUMBER
  , x_return_status OUT NOCOPY    VARCHAR2
  ) IS
    l_org_id        NUMBER;
Line: 134

    /*   SELECT resource_id INTO l_mac_res_id
         FROM bom_resource_equipments
         WHERE organization_id=l_org_id
         AND inventory_item_id=l_eqp_id;
Line: 140

       SELECT resource_id INTO l_per_res_id
         FROM bom_resource_employees
         WHERE organization_id=l_org_id
         AND person_id=l_emp_id;
Line: 145

    SELECT wms_dispatched_tasks_s.NEXTVAL
      INTO l_task_id
      FROM DUAL;
Line: 149

    INSERT INTO wms_dispatched_tasks
                (
                 task_id
               , transaction_temp_id
               , organization_id
               , user_task_type
               , person_id
               , effective_start_date
               , effective_end_date
               , equipment_id
               , equipment_instance
               , person_resource_id
               , machine_resource_id
               , status
               , dispatched_time
               , last_update_date
               , last_updated_by
               , creation_date
               , created_by
               , task_type
               , priority
               , operation_plan_id
               , move_order_line_id
                )
      (SELECT l_task_id
            , transaction_temp_id
            , organization_id
            , NVL(standard_operation_id, 2)
            , l_person_id
            , SYSDATE
            , SYSDATE
            , l_eqp_id
            , l_eqp_ins
            , l_per_res_id
            , l_mac_res_id
            , 4
            , SYSDATE
            , SYSDATE
            , l_person_id
            , SYSDATE
            , l_person_id
            , NVL(wms_task_type, 1)
            , task_priority
            , operation_plan_id
            , move_order_line_id
         FROM mtl_material_transactions_temp
        WHERE transaction_temp_id = l_temp_id);
Line: 201

      fnd_message.set_name('WMS', 'WMS_TD_INSERT_TASK');
Line: 203

  END insert_task;
Line: 261

      SELECT   wdat.device_id
             , wdat.assignment_temp_id
             , wdb.subinventory_code
          FROM wms_device_assignment_temp wdat, wms_devices_b wdb
         WHERE wdat.assignment_temp_id >= p_current_device_temp_id
           AND wdat.employee_id = p_emp_id
           AND wdat.device_id = wdb.device_id
      ORDER BY wdat.assignment_temp_id;
Line: 271

      SELECT   wdat.device_id
             , wdat.assignment_temp_id
             , wdb.subinventory_code
          FROM wms_device_assignment_temp wdat, wms_devices_b wdb
         WHERE wdat.assignment_temp_id < p_current_device_temp_id
           AND wdat.employee_id = p_emp_id
           AND wdat.device_id = wdb.device_id
      ORDER BY wdat.assignment_temp_id;
Line: 336

      SELECT COUNT(*) tsk
        INTO l_tsks
        FROM wms_dispatched_tasks wdt
       WHERE wdt.person_id = l_user_id
         AND wdt.organization_id = l_org_id
         AND wdt.task_type IN(1, 3, 4, 5, 6)
         AND wms_express_pick_task.is_express_pick_task(task_id) = 'S'
         AND wdt.status <= 3
   AND    ((wdt.task_type = 3
            AND exists
             (SELECT NVL(cycle_count_entry_id,-1)
              --Bug 3808770- Added the table mtl_cycle_count_headers in the from clause
              FROM   mtl_cycle_count_entries mcce,mtl_cycle_count_headers mcch
              WHERE  mcce.cycle_count_entry_id = wdt.transaction_temp_id
         AND    mcce.organization_id = wdt.organization_id
         AND    mcce.subinventory  = nvl(p_sign_on_zone,mcce.subinventory) --Added bug3771517
         AND    mcce.entry_status_code in (1,3)
         --Bug 3808770 Added the following conditions to select only those tasks whose cycle count is not disabled.
         AND mcce.cycle_count_header_id = mcch.cycle_count_header_id
                   AND NVL(mcch.disable_date,sysdate+1)> sysdate
         --End of fix for Bug 3808770
         )
            )
      OR (wdt.task_type IN (1, 4, 5, 6)
          AND EXISTS
          (SELECT Nvl(mmtt.transaction_temp_id, -1)
           FROM   mtl_material_transactions_temp mmtt
           WHERE  mmtt.transaction_temp_id = wdt.transaction_temp_id
           AND    mmtt.subinventory_code  = nvl(p_sign_on_zone,mmtt.subinventory_code) --Added bug3771517
           AND    mmtt.organization_id = wdt.organization_id))
           );
Line: 370

      SELECT count(*) TSK
   INTO   l_tsks
   FROM   wms_dispatched_tasks wdt
   WHERE  wdt.person_id = l_user_id
   AND    wdt.organization_id = l_org_id
   AND    wdt.task_type IN (1, 3, 4, 5, 6)
   AND    wdt.status <= 3
   AND    ((wdt.task_type = 3
            AND exists
        (SELECT NVL(cycle_count_entry_id,-1)
         FROM   mtl_cycle_count_entries mcce ,mtl_cycle_count_headers mcch
         WHERE  mcce.cycle_count_entry_id = wdt.transaction_temp_id
         AND    mcce.subinventory  = nvl(p_sign_on_zone,mcce.subinventory) --Added bug3771517
         AND    mcce.organization_id = wdt.organization_id
         and    mcce.entry_status_code in (1,3)
         --Bug 3808770 Added the following conditions to select only those tasks whose cycle count is not disabled.
           AND mcce.cycle_count_header_id = mcch.cycle_count_header_id
           AND NVL(mcch.disable_date,sysdate+1)> sysdate
         --End of fix for Bug 3808770
        )
            )
      OR (wdt.task_type IN (1, 4, 5, 6)
          AND EXISTS
          (SELECT Nvl(mmtt.transaction_temp_id, -1)
           FROM   mtl_material_transactions_temp mmtt
           WHERE  mmtt.transaction_temp_id = wdt.transaction_temp_id
           AND    mmtt.subinventory_code  = nvl(p_sign_on_zone,mmtt.subinventory_code) --Added bug3771517
           AND    mmtt.organization_id = wdt.organization_id))
           );
Line: 418

       SELECT wt.task_type
       INTO   x_task_type
       FROM   (SELECT wdt.task_type
           , wdt.priority
                     , wdt.task_id       task_id
                     , sub.picking_order sub_picking_order
                     , loc.picking_order loc_picking_order
                FROM mtl_material_transactions_temp mmtt, wms_dispatched_tasks wdt, mtl_item_locations loc, mtl_secondary_inventories sub
                WHERE wdt.person_id = l_user_id
                  AND wdt.organization_id = l_org_id
                  AND wdt.status <= 3
                  AND wdt.task_type IN (1, 4, 5, 6)
                  AND WMS_EXPRESS_PICK_TASK.IS_EXPRESS_PICK_TASK(wdt.TASK_ID) = 'S'
                  AND wdt.transaction_temp_id = mmtt.transaction_temp_id
        AND mmtt.subinventory_code  = nvl(p_sign_on_zone,mmtt.subinventory_code) --Added bug3771517
                  AND sub.organization_id = mmtt.organization_id
                  AND sub.secondary_inventory_name = mmtt.subinventory_code
                  AND loc.organization_id = mmtt.organization_id
                  AND loc.inventory_location_id = mmtt.locator_id
      UNION
                SELECT wdt.task_type
           , wdt.priority
                     , wdt.task_id       task_id
                     , sub.picking_order sub_picking_order
                     , loc.picking_order loc_picking_order
                --Bug 3808770 -Added the table mtl_cycle_count_headers in the FROM clause
                FROM mtl_cycle_count_entries mcce, wms_dispatched_tasks wdt, mtl_item_locations loc, mtl_secondary_inventories sub
                     ,mtl_cycle_count_headers mcch
                WHERE wdt.person_id = l_user_id
                  AND wdt.organization_id = l_org_id
                  AND wdt.status <= 3
                  AND wdt.task_type = 3
                  AND WMS_EXPRESS_PICK_TASK.IS_EXPRESS_PICK_TASK(wdt.TASK_ID) = 'S'
                  AND wdt.transaction_temp_id = mcce.cycle_count_entry_id
                  AND sub.organization_id = mcce.organization_id
        AND mcce.subinventory  = nvl(p_sign_on_zone,mcce.subinventory) --Added bug3771517
                  AND sub.secondary_inventory_name = mcce.subinventory
                  AND loc.organization_id = mcce.organization_id
                  AND loc.inventory_location_id = mcce.locator_id
                  --Bug 3808770 Added the following conditions to select only those tasks whose cycle count is not disabled.
        AND mcce.cycle_count_header_id = mcch.cycle_count_header_id
        AND NVL(mcch.disable_date,sysdate+1)> sysdate ) wt
        --End of fix for Bug 3808770
         WHERE ROWNUM = 1
         order by wt.priority,wt.sub_picking_order, wt.loc_picking_order, wt.task_id ;
Line: 465

       SELECT wt.task_type
       INTO   x_task_type
       FROM   (SELECT wdt.task_type
           , wdt.priority
                     , wdt.task_id       task_id
                     , sub.picking_order sub_picking_order
                     , loc.picking_order loc_picking_order
                FROM mtl_material_transactions_temp mmtt, wms_dispatched_tasks wdt, mtl_item_locations loc, mtl_secondary_inventories sub
                WHERE wdt.person_id = l_user_id
                  AND wdt.organization_id = l_org_id
                  AND wdt.status <= 3
                  AND wdt.task_type IN (1, 4, 5, 6)
                  AND wdt.transaction_temp_id = mmtt.transaction_temp_id
                  AND sub.organization_id = mmtt.organization_id
                  AND sub.secondary_inventory_name = mmtt.subinventory_code
        AND mmtt.subinventory_code  = nvl(p_sign_on_zone,mmtt.subinventory_code) --Added bug3771517
                  AND loc.organization_id = mmtt.organization_id
                  AND loc.inventory_location_id = mmtt.locator_id
      UNION
                SELECT wdt.task_type
           , wdt.priority
                     , wdt.task_id       task_id
                     , sub.picking_order sub_picking_order
                     , loc.picking_order loc_picking_order
                --Bug 3808770 -Added the table mtl_cycle_count_headers in the FROM clause
                FROM mtl_cycle_count_entries mcce, wms_dispatched_tasks wdt, mtl_item_locations loc, mtl_secondary_inventories sub
                   , mtl_cycle_count_headers mcch
                WHERE wdt.person_id = l_user_id
                  AND wdt.organization_id = l_org_id
                  AND wdt.status <= 3
                  AND wdt.task_type = 3
                  AND wdt.transaction_temp_id = mcce.cycle_count_entry_id
                  AND sub.organization_id = mcce.organization_id
        AND mcce.subinventory  = nvl(p_sign_on_zone,mcce.subinventory) --Added bug3771517
                  AND sub.secondary_inventory_name = mcce.subinventory
                  AND loc.organization_id = mcce.organization_id
                  AND loc.inventory_location_id = mcce.locator_id
                 --Bug 3808770 Added the following conditions to select only those tasks whose cycle count is not disabled.
        AND mcce.cycle_count_header_id = mcch.cycle_count_header_id
        AND NVL(mcch.disable_date,sysdate+1)> sysdate )wt
        --End of fix for Bug 3808770
         WHERE ROWNUM = 1
         order by wt.priority,wt.sub_picking_order, wt.loc_picking_order, wt.task_id;
Line: 526

        SELECT wdat.assignment_temp_id
             , wd.subinventory_code
          INTO l_assignment_temp_id
             , l_zone
          FROM wms_device_assignment_temp wdat, wms_devices_vl wd
         WHERE wdat.device_id = l_device_id
           AND wdat.device_id = wd.device_id
           AND employee_id = l_emp_id;
Line: 580

              SELECT   transaction_temp_id
                     , task_type
                     , device_invoked
                  INTO l_task_id
                     , l_task_type_n
                     , l_device_invoked
                  FROM wms_dispatched_tasks
                 WHERE person_id = l_user_id
                   AND organization_id = l_org_id
                   AND device_id = l_temp_device_id
                   AND task_type IN(1, 3, 4, 5, 6)
                   AND status <= 3
                   AND ROWNUM = 1
              ORDER BY 1;
Line: 615

                UPDATE wms_dispatched_tasks
                   SET device_invoked = 'Y'
                     , device_request_id = l_request_id
                 WHERE transaction_temp_id = l_task_id;
Line: 704

              SELECT bremp.resource_id role_id
                   , t.wms_task_type
                   , t.standard_operation_id
                   , t.operation_plan_id
                   , t.move_order_line_id
                INTO l_per_res_id
                   , l_wms_task_type
                   , l_std_op_id
                   , l_operation_plan_id
                   , l_move_order_line_id
                FROM mtl_material_transactions_temp t, bom_std_op_resources bsor, bom_resources bremp
               WHERE t.transaction_temp_id = task_rec.task_id
                 AND t.standard_operation_id = bsor.standard_operation_id
                 AND bsor.resource_id = bremp.resource_id
                 AND bremp.resource_type = 2
                 AND ROWNUM < 2;
Line: 722

              SELECT bremp.resource_id role_id
                   , 3
                   , mcce.standard_operation_id
                INTO l_per_res_id
                   , l_wms_task_type
                   , l_std_op_id
                --Bug 3808770- Added the table mtl_cycle_count_headers in the FROM clause
                FROM mtl_cycle_count_entries mcce, bom_std_op_resources bsor, bom_resources bremp,mtl_cycle_count_headers mcch
               WHERE mcce.cycle_count_entry_id = task_rec.task_id
                 AND mcce.standard_operation_id = bsor.standard_operation_id
                 AND bsor.resource_id = bremp.resource_id
                 AND bremp.resource_type = 2
                 AND ROWNUM < 2
                 AND mcce.cycle_count_header_id = mcch.cycle_count_header_id
                 AND NVL(mcch.disable_date,sysdate+1)> sysdate;
Line: 746

              SELECT resource_id
                INTO l_mac_res_id
                FROM bom_resource_equipments
               WHERE inventory_item_id = l_eqp_id
                 AND ROWNUM < 2;
Line: 764

            SELECT mtl_material_transactions_s.NEXTVAL txnhdrid
              INTO l_txn_hdr_id
              FROM DUAL;
Line: 768

            UPDATE mtl_material_transactions_temp
               SET transaction_header_id = l_txn_hdr_id
             WHERE transaction_temp_id = task_rec.task_id;
Line: 774

            SELECT wms_dispatched_tasks_s.NEXTVAL
              INTO l_next_task_id
              FROM DUAL;
Line: 778

            INSERT INTO wms_dispatched_tasks
                        (
                         task_id
                       , transaction_temp_id
                       , organization_id
                       , user_task_type
                       , person_id
                       , effective_start_date
                       , effective_end_date
                       , equipment_id
                       , equipment_instance
                       , person_resource_id
                       , machine_resource_id
                       , status
                       , dispatched_time
                       , last_update_date
                       , last_updated_by
                       , creation_date
                       , created_by
                       , task_type
                       , priority
                       , operation_plan_id
                       , move_order_line_id
                        )
                 VALUES (
                         l_next_task_id
                       , task_rec.task_id
                       , l_org_id
                       , NVL(l_std_op_id, 2)
                       , l_user_id
                       , SYSDATE
                       , SYSDATE
                       , l_eqp_id
                       , l_eqp_ins
                       , l_per_res_id
                       , l_mac_res_id
                       , 3
                       , SYSDATE
                       , SYSDATE
                       , l_emp_id
                       , SYSDATE
                       , l_emp_id
                       , l_wms_task_type
                       , task_rec.task_priority
                       , l_operation_plan_id
                       , l_move_order_line_id
                        );
Line: 827

              mydebug('next_task: After Insert into WMSDT');
Line: 850

              UPDATE wms_dispatched_tasks
                 SET device_id = l_temp_device_id
                   , device_invoked = 'N'
               WHERE task_id = l_next_task_id;
Line: 872

                UPDATE wms_dispatched_tasks
                   SET device_invoked = 'Y'
                     , device_request_id = l_request_id
                 WHERE task_id = l_next_task_id;
Line: 893

          DELETE FROM wms_skip_task_exceptions
                WHERE task_id = task_rec.task_id
                  AND task_id IN(
                       SELECT wste.task_id
                         FROM wms_skip_task_exceptions wste, mtl_parameters mp
                        WHERE ABS((SYSDATE - wste.creation_date) * 24 * 60) > mp.skip_task_waiting_minutes
                          AND wste.task_id = task_rec.task_id
                          AND wste.organization_id = mp.organization_id);
Line: 939

        SELECT task_type
          INTO x_task_type
          FROM wms_dispatched_tasks
         WHERE device_id = x_avail_device_id
           AND device_invoked = 'Y'
           AND person_id = l_user_id
           AND status <= 3
           AND task_type IN(1, 3, 4, 5, 6);
Line: 1032

      SELECT   wdat.device_id
             , wdat.assignment_temp_id
             , wdb.subinventory_code
          FROM wms_device_assignment_temp wdat, wms_devices_b wdb
         WHERE wdat.assignment_temp_id >= p_current_device_temp_id
           AND wdat.employee_id = p_emp_id
           AND wdat.device_id = wdb.device_id
      ORDER BY wdat.assignment_temp_id;
Line: 1042

      SELECT   wdat.device_id
             , wdat.assignment_temp_id
             , wdb.subinventory_code
          FROM wms_device_assignment_temp wdat, wms_devices_b wdb
         WHERE wdat.assignment_temp_id < p_current_device_temp_id
           AND wdat.employee_id = p_emp_id
           AND wdat.device_id = wdb.device_id
      ORDER BY wdat.assignment_temp_id;
Line: 1113

      SELECT wdat.assignment_temp_id
           , wd.subinventory_code
        INTO l_assignment_temp_id
           , l_zone
        FROM wms_device_assignment_temp wdat, wms_devices_vl wd
       WHERE wdat.device_id = l_device_id
         AND wdat.device_id = wd.device_id
         AND employee_id = l_emp_id;
Line: 1155

            SELECT   transaction_temp_id
                   , task_type
                   , device_invoked
                INTO l_task_id
                   , l_task_type_n
                   , l_device_invoked
                FROM wms_dispatched_tasks
               WHERE person_id = l_user_id
                 AND organization_id = l_org_id
                 AND device_id = l_temp_device_id
                 AND task_type IN(1, 3, 4, 5, 6)
                 AND status <= 3
                 AND ROWNUM = 1
            ORDER BY 1;
Line: 1190

              UPDATE wms_dispatched_tasks
                 SET device_invoked = 'Y'
                   , device_request_id = l_request_id
               WHERE transaction_temp_id = l_task_id;
Line: 1270

            SELECT bremp.resource_id role_id
                 , t.wms_task_type
                 , t.standard_operation_id
                 , t.operation_plan_id
                 , t.move_order_line_id
              INTO l_per_res_id
                 , l_wms_task_type
                 , l_std_op_id
                 , l_operation_plan_id
                 , l_move_order_line_id
              FROM mtl_material_transactions_temp t, bom_std_op_resources bsor, bom_resources bremp
             WHERE t.transaction_temp_id = task_rec.task_id
               AND t.standard_operation_id = bsor.standard_operation_id
               AND bsor.resource_id = bremp.resource_id
               AND bremp.resource_type = 2
               AND ROWNUM < 2;
Line: 1288

            SELECT
        bremp.resource_id role_id,
        3,
        mcce.standard_operation_id
        INTO
        l_per_res_id,
        l_wms_task_type,
        l_std_op_id
        FROM
        mtl_cycle_count_entries mcce,
        bom_std_op_resources bsor,
        bom_resources bremp
        where mcce.cycle_count_entry_id = task_rec.task_id
        and mcce.standard_operation_id = bsor.standard_operation_id
        and bsor.resource_id = bremp.resource_id
        and bremp.resource_type = 2
        and rownum<2;
Line: 1313

            SELECT resource_id
              INTO l_mac_res_id
              FROM bom_resource_equipments
             WHERE inventory_item_id = l_eqp_id
               AND ROWNUM < 2;
Line: 1320

          SELECT mtl_material_transactions_s.NEXTVAL txnhdrid
            INTO l_txn_hdr_id
            FROM DUAL;
Line: 1324

          UPDATE mtl_material_transactions_temp
             SET transaction_header_id = l_txn_hdr_id
           WHERE transaction_temp_id = task_rec.task_id;
Line: 1329

          SELECT wms_dispatched_tasks_s.NEXTVAL
            INTO l_next_task_id
            FROM DUAL;
Line: 1333

          INSERT INTO wms_dispatched_tasks
                      (
                       task_id
                     , transaction_temp_id
                     , organization_id
                     , user_task_type
                     , person_id
                     , effective_start_date
                     , effective_end_date
                     , equipment_id
                     , equipment_instance
                     , person_resource_id
                     , machine_resource_id
                     , status
                     , dispatched_time
                     , last_update_date
                     , last_updated_by
                     , creation_date
                     , created_by
                     , task_type
                     , priority
                     , operation_plan_id
                     , move_order_line_id
                      )
               VALUES (
                       l_next_task_id
                     , task_rec.task_id
                     , l_org_id
                     , NVL(l_std_op_id, 2)
                     , l_user_id
                     , SYSDATE
                     , SYSDATE
                     , l_eqp_id
                     , l_eqp_ins
                     , l_per_res_id
                     , l_mac_res_id
                     , 3
                     , SYSDATE
                     , SYSDATE
                     , l_emp_id
                     , SYSDATE
                     , l_emp_id
                     , l_wms_task_type
                     , task_rec.task_priority
                     , l_operation_plan_id
                     , l_move_order_line_id
                      );
Line: 1382

            mydebug('next_CP_task: After Insert into WMSDT');
Line: 1405

            UPDATE wms_dispatched_tasks
               SET device_id = l_temp_device_id
                 , device_invoked = 'N'
             WHERE task_id = l_next_task_id;
Line: 1427

              UPDATE wms_dispatched_tasks
                 SET device_invoked = 'Y'
                   , device_request_id = l_request_id
               WHERE task_id = l_next_task_id;
Line: 1448

        DELETE FROM wms_skip_task_exceptions
              WHERE task_id = task_rec.task_id
                AND task_id IN(
                     SELECT wste.task_id
                       FROM wms_skip_task_exceptions wste, mtl_parameters mp
                      WHERE ABS((SYSDATE - wste.creation_date) * 24 * 60) > mp.skip_task_waiting_minutes
                        AND wste.task_id = task_rec.task_id
                        AND wste.organization_id = mp.organization_id);
Line: 1494

      SELECT task_type
        INTO x_task_type
        FROM wms_dispatched_tasks
       WHERE device_id = x_avail_device_id
         AND device_invoked = 'Y'
         AND person_id = l_user_id
         AND status <= 3
         AND task_type IN(1, 3, 4, 5, 6);
Line: 1576

      SELECT mtlt.lot_number
           , mtlt.transaction_quantity
        FROM mtl_transaction_lots_temp mtlt
       WHERE mtlt.transaction_temp_id = p_temp_id;
Line: 1595

    SELECT NVL(content_lpn_id, 0)
         , NVL(lpn_id, 0)
         , transfer_lpn_id
         , transfer_subinventory
         , transfer_to_location
         , transaction_type_id
         , transaction_header_id
      INTO l_content_lpn_id
         , l_mmtt_from_lpn_id
         , l_transfer_lpn_id
         , l_orig_sub
         , l_orig_loc
         , l_tran_type_id
         , l_orig_txn_header_id
      FROM mtl_material_transactions_temp
     WHERE transaction_temp_id = p_temp_id;
Line: 1618

      UPDATE mtl_material_transactions_temp
         SET transfer_subinventory = p_sub
           , transfer_to_location = l_loc
       WHERE transaction_temp_id = p_temp_id;
Line: 1625

      SELECT msi.reservable_type
        INTO l_sub_reservable_type
        FROM mtl_secondary_inventories msi
       WHERE msi.secondary_inventory_name = p_sub
         AND msi.organization_id = p_org_id;
Line: 1636

        SELECT mmtt.inventory_item_id
             , mmtt.transaction_quantity
             , mmtt.transaction_uom
             , mmtt.subinventory_code
             , mmtt.locator_id
             , mmtt.revision
          INTO l_item_id
             , l_qty
             , l_uom
             , l_from_sub
             , l_from_loc
             , l_rev
          FROM mtl_material_transactions_temp mmtt
         WHERE mmtt.transaction_temp_id = p_temp_id;
Line: 1651

        SELECT msi.serial_number_control_code
             , msi.lot_control_code
          INTO l_serial_code
             , l_lot_code
          FROM mtl_system_items msi
         WHERE msi.inventory_item_id = l_item_id
           AND msi.organization_id = p_org_id;
Line: 1776

        SELECT 1
          INTO l_exist_lpn
          FROM DUAL
         WHERE EXISTS(SELECT 1
                        FROM wms_license_plate_numbers
                       WHERE license_plate_number = l_lpn
                         AND organization_id = p_org_id);
Line: 1850

        SELECT lpn_id
          INTO l_lpn_id
          FROM wms_license_plate_numbers
         WHERE license_plate_number = l_lpn
           AND organization_id = p_org_id;
Line: 1873

         UPDATE mtl_material_transactions_temp mmtt
            SET transaction_status    = 3
              , transaction_header_id = p_txn_hdr_id
              , last_update_date      = SYSDATE
              , last_updated_by       = p_user_id
              , transaction_batch_id  = p_txn_hdr_id
          WHERE mmtt.transaction_temp_id = p_temp_id;
Line: 1882

         UPDATE mtl_material_transactions_temp mmtt
            SET transaction_status    = 3
              , transaction_header_id = p_txn_hdr_id
              , transfer_lpn_id       = NULL
              , last_update_date      = SYSDATE
              , last_updated_by       = p_user_id
              , transaction_batch_id  = p_txn_hdr_id
          WHERE mmtt.transaction_temp_id = p_temp_id;
Line: 1894

         UPDATE mtl_material_transactions_temp mmtt
            SET transaction_status    = 3
              , transaction_header_id = p_txn_hdr_id
              , last_update_date      = SYSDATE
              , last_updated_by       = p_user_id
              , transaction_batch_id  = p_txn_hdr_id
              , transaction_batch_seq = p_temp_id
          WHERE mmtt.transaction_temp_id = p_temp_id;
Line: 1904

         UPDATE mtl_material_transactions_temp mmtt
            SET transaction_status    = 3
              , transaction_header_id = p_txn_hdr_id
              , transfer_lpn_id       = NULL
              , last_update_date      = SYSDATE
              , last_updated_by       = p_user_id
              , transaction_batch_id  = p_txn_hdr_id
              , transaction_batch_seq = p_temp_id
          WHERE mmtt.transaction_temp_id = p_temp_id;
Line: 1918

          mydebug('complete_pick: WIP issue: update txn qty and primary qty to -ve');
Line: 1927

          UPDATE mtl_material_transactions_temp
             SET transaction_quantity = -1 * ABS(transaction_quantity)
               , primary_quantity     = -1 * ABS(primary_quantity)
           WHERE transaction_temp_id = p_temp_id
             AND organization_id     = p_org_id;
Line: 1933

          UPDATE mtl_material_transactions_temp
             SET transaction_quantity = -1 * ABS(transaction_quantity)
               , primary_quantity     = -1 * ABS(primary_quantity)
               , process_flag         = 'W'
           WHERE transaction_temp_id = p_temp_id
             AND organization_id     = p_org_id;
Line: 1945

    UPDATE wms_exceptions
       SET transaction_header_id = p_txn_hdr_id
     WHERE transaction_header_id = l_orig_txn_header_id;
Line: 1965

    SELECT primary_uom_code
      INTO l_primary_uom
      FROM mtl_system_items
     WHERE organization_id = p_organization_id
       AND inventory_item_id = p_item_id;
Line: 2029

      SELECT  vendor_serial_number, vendor_lot_number, parent_serial_number
      , origination_date, end_item_unit_number, territory_code, time_since_new, cycles_since_new
      , time_since_overhaul, cycles_since_overhaul, time_since_repair, cycles_since_repair
      , time_since_visit, cycles_since_visit, time_since_mark, cycles_since_mark
      , number_of_repairs, serial_attribute_category, c_attribute1, c_attribute2
      , c_attribute3, c_attribute4, c_attribute5, c_attribute6, c_attribute7
      , c_attribute8, c_attribute9, c_attribute10, c_attribute11, c_attribute12
      , c_attribute13, c_attribute14, c_attribute15, c_attribute16, c_attribute17, c_attribute18
      , c_attribute19, c_attribute20, d_attribute1, d_attribute2, d_attribute3
      , d_attribute4, d_attribute5, d_attribute6, d_attribute7, d_attribute8
      , d_attribute9, d_attribute10, n_attribute1, n_attribute2, n_attribute3
      , n_attribute4, n_attribute5, n_attribute6, n_attribute7, n_attribute8
      , n_attribute9, n_attribute10
      FROM    mtl_serial_numbers
      WHERE   serial_number = v_serial_number
      AND     inventory_item_id = v_inventory_item_id;
Line: 2140

      SELECT expiration_date
        INTO l_exp_date
        FROM mtl_lot_numbers
       WHERE organization_id = l_org_id
         AND inventory_item_id = l_item_id
         AND lot_number = l_lot;
Line: 2152

        mydebug('process_lot_serial: Inserting Lots');
Line: 2155

      UPDATE mtl_transaction_lots_temp
         SET transaction_quantity = l_qty
           , primary_quantity = l_pr_qty
           , last_update_date = SYSDATE
           , last_updated_by = l_user_id
       WHERE transaction_temp_id = l_temp_id
         AND lot_number = l_lot;
Line: 2164

        mydebug('process_lot_serial: After lot update');
Line: 2170

      SELECT NVL(serial_transaction_temp_id, 0)
        INTO l_lot_ser_seq
        FROM mtl_transaction_lots_temp
       WHERE transaction_temp_id = l_temp_id
         AND lot_number = l_lot;
Line: 2177

        SELECT mtl_material_transactions_s.NEXTVAL
          INTO l_ser_seq
          FROM DUAL;
Line: 2185

      UPDATE mtl_transaction_lots_temp
         SET transaction_quantity = l_qty
           , primary_quantity = l_pr_qty
           , serial_transaction_temp_id = l_ser_seq
           , last_update_date = SYSDATE
           , last_updated_by = l_user_id
       WHERE transaction_temp_id = l_temp_id
         AND lot_number = l_lot;
Line: 2225

        INSERT INTO mtl_serial_numbers_temp
            ( TRANSACTION_TEMP_ID
           , LAST_UPDATE_DATE
           , LAST_UPDATED_BY
           , CREATION_DATE
           , CREATED_BY
           , fm_serial_number
           , to_serial_number
           , vendor_serial_number
           , vendor_lot_number
           , parent_serial_number
           , origination_date
           , end_item_unit_number
           , territory_code
           , time_since_new
           , cycles_since_new
           , time_since_overhaul
           , cycles_since_overhaul
           , time_since_repair
           , cycles_since_repair
           , time_since_visit
           , cycles_since_visit
           , time_since_mark
           , cycles_since_mark
           , number_of_repairs
           , serial_attribute_category
           , c_attribute1
           , c_attribute2
           , c_attribute3
           , c_attribute4
           , c_attribute5
           , c_attribute6
           , c_attribute7
           , c_attribute8
           , c_attribute9
           , c_attribute10
           , c_attribute11
           , c_attribute12
           , c_attribute13
           , c_attribute14
           , c_attribute15
           , c_attribute16
           , c_attribute17
           , c_attribute18
           , c_attribute19
           , c_attribute20
           , d_attribute1
           , d_attribute2
           , d_attribute3
           , d_attribute4
           , d_attribute5
           , d_attribute6
           , d_attribute7
           , d_attribute8
           , d_attribute9
           , d_attribute10
           , n_attribute1
           , n_attribute2
           , n_attribute3
           , n_attribute4
           , n_attribute5
           , n_attribute6
           , n_attribute7
           , n_attribute8
           , n_attribute9
           , n_attribute10
           )
            VALUES (
             l_ser_seq
           , Sysdate
           , l_user_id
           , Sysdate
           , l_user_id
           , l_fm_serial
           , l_to_serial
           , l_msn_attribute_rec.vendor_serial_number
           , l_msn_attribute_rec.vendor_lot_number
           , l_msn_attribute_rec.parent_serial_number
           , l_msn_attribute_rec.origination_date
           , l_msn_attribute_rec.end_item_unit_number
           , l_msn_attribute_rec.territory_code
           , l_msn_attribute_rec.time_since_new
           , l_msn_attribute_rec.cycles_since_new
           , l_msn_attribute_rec.time_since_overhaul
           , l_msn_attribute_rec.cycles_since_overhaul
           , l_msn_attribute_rec.time_since_repair
           , l_msn_attribute_rec.cycles_since_repair
           , l_msn_attribute_rec.time_since_visit
           , l_msn_attribute_rec.cycles_since_visit
           , l_msn_attribute_rec.time_since_mark
           , l_msn_attribute_rec.cycles_since_mark
           , l_msn_attribute_rec.number_of_repairs
           , l_msn_attribute_rec.serial_attribute_category
           , l_msn_attribute_rec.c_attribute1
           , l_msn_attribute_rec.c_attribute2
           , l_msn_attribute_rec.c_attribute3
           , l_msn_attribute_rec.c_attribute4
           , l_msn_attribute_rec.c_attribute5
           , l_msn_attribute_rec.c_attribute6
           , l_msn_attribute_rec.c_attribute7
           , l_msn_attribute_rec.c_attribute8
           , l_msn_attribute_rec.c_attribute9
           , l_msn_attribute_rec.c_attribute10
           , l_msn_attribute_rec.c_attribute11
           , l_msn_attribute_rec.c_attribute12
           , l_msn_attribute_rec.c_attribute13
           , l_msn_attribute_rec.c_attribute14
           , l_msn_attribute_rec.c_attribute15
           , l_msn_attribute_rec.c_attribute16
           , l_msn_attribute_rec.c_attribute17
           , l_msn_attribute_rec.c_attribute18
           , l_msn_attribute_rec.c_attribute19
           , l_msn_attribute_rec.c_attribute20
           , l_msn_attribute_rec.d_attribute1
           , l_msn_attribute_rec.d_attribute2
           , l_msn_attribute_rec.d_attribute3
           , l_msn_attribute_rec.d_attribute4
           , l_msn_attribute_rec.d_attribute5
           , l_msn_attribute_rec.d_attribute6
           , l_msn_attribute_rec.d_attribute7
           , l_msn_attribute_rec.d_attribute8
           , l_msn_attribute_rec.d_attribute9
           , l_msn_attribute_rec.d_attribute10
           , l_msn_attribute_rec.n_attribute1
           , l_msn_attribute_rec.n_attribute2
           , l_msn_attribute_rec.n_attribute3
           , l_msn_attribute_rec.n_attribute4
           , l_msn_attribute_rec.n_attribute5
           , l_msn_attribute_rec.n_attribute6
           , l_msn_attribute_rec.n_attribute7
           , l_msn_attribute_rec.n_attribute8
           , l_msn_attribute_rec.n_attribute9
           , l_msn_attribute_rec.n_attribute10
          );
Line: 2362

      /*INSERT INTO mtl_serial_numbers_temp
                  (
                   transaction_temp_id
                 , last_update_date
                 , last_updated_by
                 , creation_date
                 , created_by
                 , fm_serial_number
                 , to_serial_number
                  )
           VALUES (
                   l_ser_seq
                 , SYSDATE
                 , l_user_id
                 , SYSDATE
                 , l_user_id
                 , l_fm_serial
                 , l_to_serial
                  );*/
Line: 2385

        mydebug('process_lot_serial: Inserting Serials Only');
Line: 2416

        INSERT INTO mtl_serial_numbers_temp
            ( TRANSACTION_TEMP_ID
           , LAST_UPDATE_DATE
           , LAST_UPDATED_BY
           , CREATION_DATE
           , CREATED_BY
           , fm_serial_number
           , to_serial_number
           , vendor_serial_number
           , vendor_lot_number
           , parent_serial_number
           , origination_date
           , end_item_unit_number
           , territory_code
           , time_since_new
           , cycles_since_new
           , time_since_overhaul
           , cycles_since_overhaul
           , time_since_repair
           , cycles_since_repair
           , time_since_visit
           , cycles_since_visit
           , time_since_mark
           , cycles_since_mark
           , number_of_repairs
           , serial_attribute_category
           , c_attribute1
           , c_attribute2
           , c_attribute3
           , c_attribute4
           , c_attribute5
           , c_attribute6
           , c_attribute7
           , c_attribute8
           , c_attribute9
           , c_attribute10
           , c_attribute11
           , c_attribute12
           , c_attribute13
           , c_attribute14
           , c_attribute15
           , c_attribute16
           , c_attribute17
           , c_attribute18
           , c_attribute19
           , c_attribute20
           , d_attribute1
           , d_attribute2
           , d_attribute3
           , d_attribute4
           , d_attribute5
           , d_attribute6
           , d_attribute7
           , d_attribute8
           , d_attribute9
           , d_attribute10
           , n_attribute1
           , n_attribute2
           , n_attribute3
           , n_attribute4
           , n_attribute5
           , n_attribute6
           , n_attribute7
           , n_attribute8
           , n_attribute9
           , n_attribute10
         )
      VALUES (
             l_temp_id
           , Sysdate
           , l_user_id
           , Sysdate
           , l_user_id
           , l_fm_serial
           , l_to_serial
           , l_msn_attribute_rec.vendor_serial_number
           , l_msn_attribute_rec.vendor_lot_number
           , l_msn_attribute_rec.parent_serial_number
           , l_msn_attribute_rec.origination_date
           , l_msn_attribute_rec.end_item_unit_number
           , l_msn_attribute_rec.territory_code
           , l_msn_attribute_rec.time_since_new
           , l_msn_attribute_rec.cycles_since_new
           , l_msn_attribute_rec.time_since_overhaul
           , l_msn_attribute_rec.cycles_since_overhaul
           , l_msn_attribute_rec.time_since_repair
           , l_msn_attribute_rec.cycles_since_repair
           , l_msn_attribute_rec.time_since_visit
           , l_msn_attribute_rec.cycles_since_visit
           , l_msn_attribute_rec.time_since_mark
           , l_msn_attribute_rec.cycles_since_mark
           , l_msn_attribute_rec.number_of_repairs
           , l_msn_attribute_rec.serial_attribute_category
           , l_msn_attribute_rec.c_attribute1
           , l_msn_attribute_rec.c_attribute2
           , l_msn_attribute_rec.c_attribute3
           , l_msn_attribute_rec.c_attribute4
           , l_msn_attribute_rec.c_attribute5
           , l_msn_attribute_rec.c_attribute6
           , l_msn_attribute_rec.c_attribute7
           , l_msn_attribute_rec.c_attribute8
           , l_msn_attribute_rec.c_attribute9
           , l_msn_attribute_rec.c_attribute10
           , l_msn_attribute_rec.c_attribute11
           , l_msn_attribute_rec.c_attribute12
           , l_msn_attribute_rec.c_attribute13
           , l_msn_attribute_rec.c_attribute14
           , l_msn_attribute_rec.c_attribute15
           , l_msn_attribute_rec.c_attribute16
           , l_msn_attribute_rec.c_attribute17
           , l_msn_attribute_rec.c_attribute18
           , l_msn_attribute_rec.c_attribute19
           , l_msn_attribute_rec.c_attribute20
           , l_msn_attribute_rec.d_attribute1
           , l_msn_attribute_rec.d_attribute2
           , l_msn_attribute_rec.d_attribute3
           , l_msn_attribute_rec.d_attribute4
           , l_msn_attribute_rec.d_attribute5
           , l_msn_attribute_rec.d_attribute6
           , l_msn_attribute_rec.d_attribute7
           , l_msn_attribute_rec.d_attribute8
           , l_msn_attribute_rec.d_attribute9
           , l_msn_attribute_rec.d_attribute10
           , l_msn_attribute_rec.n_attribute1
           , l_msn_attribute_rec.n_attribute2
           , l_msn_attribute_rec.n_attribute3
           , l_msn_attribute_rec.n_attribute4
           , l_msn_attribute_rec.n_attribute5
           , l_msn_attribute_rec.n_attribute6
           , l_msn_attribute_rec.n_attribute7
           , l_msn_attribute_rec.n_attribute8
           , l_msn_attribute_rec.n_attribute9
           , l_msn_attribute_rec.n_attribute10
        );
Line: 2552

/*      INSERT INTO mtl_serial_numbers_temp
                  (
                   transaction_temp_id
                 , last_update_date
                 , last_updated_by
                 , creation_date
                 , created_by
                 , fm_serial_number
                 , to_serial_number
                  )
           VALUES (
                   l_temp_id
                 , SYSDATE
                 , l_user_id
                 , SYSDATE
                 , l_user_id
                 , l_fm_serial
                 , l_to_serial
                  );*/
Line: 2724

      SELECT serial_number
        FROM mtl_serial_numbers
       WHERE lpn_id = p_lpn
         AND inventory_item_id = p_item_id
         AND NVL(lot_number, -999) = NVL(p_lot, -999);
Line: 2731

      SELECT mtlt.primary_quantity
           , mtlt.lot_number
        FROM mtl_transaction_lots_temp mtlt
       WHERE mtlt.transaction_temp_id = p_temp_id;
Line: 2746

    t_lpn_lot_qty_table.DELETE;
Line: 2749

      SELECT 1
           , lpn_context
        INTO l_lpn_exists
           , l_lpn_context
        FROM wms_license_plate_numbers wlpn
       WHERE wlpn.organization_id = p_org_id
         AND wlpn.lpn_id = p_lpn;
Line: 2790

      SELECT 1
        INTO l_loaded
        FROM DUAL
       WHERE EXISTS(SELECT 1
                      FROM mtl_material_transactions_temp
                     WHERE (transfer_lpn_id = p_lpn
                            OR content_lpn_id = p_lpn));
Line: 2816

      SELECT w.subinventory_code
           , inv_project.get_locsegs(w.locator_id, w.organization_id)
           , w.license_plate_number
           , w.locator_id
           , w.lpn_context
        INTO l_sub
           , l_loc
           , l_from_lpn
           , l_loc_id
           , l_lpn_context
        FROM wms_license_plate_numbers w
       WHERE w.lpn_id = p_lpn
         AND w.locator_id IS NOT NULL;
Line: 2841

      SELECT COUNT(*)
        INTO l_sub_active
        FROM mtl_secondary_inventories
       WHERE NVL(disable_date, SYSDATE + 1) > SYSDATE
         AND organization_id = p_org_id
         AND secondary_inventory_name = l_sub;
Line: 2856

      SELECT COUNT(*)
        INTO l_loc_active
        FROM mtl_item_locations_kfv
       WHERE NVL(disable_date, SYSDATE + 1) > SYSDATE
         AND organization_id = p_org_id
         AND subinventory_code = l_sub
         AND inventory_location_id = l_loc_id;
Line: 2873

       SELECT locator_id,organization_id  INTO l_locator_id, l_organization_id
        from mtl_material_transactions_temp
        where transaction_temp_id = p_temp_id;
Line: 2877

         select nvl(project_id ,-999) , nvl(task_id ,-999)
        into  l_mmtt_proj_id , l_mmtt_task_id
        from  mtl_item_locations
        where inventory_location_id = l_locator_id
        and organization_id = l_organization_id ;
Line: 2883

      select nvl(project_id, -999) , nvl(task_id ,-999)
        into l_mil_proj_id , l_mil_task_id
        from mtl_item_locations
        where inventory_location_id = l_loc_id
        and organization_id = p_org_id ;
Line: 2928

      SELECT 1
        INTO l_so_cnt
        FROM wms_license_plate_numbers
       WHERE lpn_context = 11
         AND lpn_id = p_lpn
         AND organization_id = p_org_id;
Line: 2946

    SELECT primary_uom_code
         , lot_control_code
         , serial_number_control_code
      INTO l_primary_uom
         , l_lot_code
         , l_serial_code
      FROM mtl_system_items
     WHERE organization_id = p_org_id
       AND inventory_item_id = p_item_id;
Line: 2956

    SELECT mmtt.transfer_subinventory
      INTO l_xfr_sub_code
      FROM mtl_material_transactions_temp mmtt
     WHERE mmtt.transaction_temp_id = p_temp_id;
Line: 2973

      SELECT 1
        INTO l_item_cnt
        FROM DUAL
       WHERE EXISTS(
               SELECT 1
                 FROM wms_lpn_contents wlc
                WHERE wlc.parent_lpn_id = p_lpn
                  AND wlc.organization_id = p_org_id
                  AND wlc.inventory_item_id = p_item_id
                  AND NVL(wlc.revision, '-999') = NVL(p_rev, '-999'));
Line: 3002

        SELECT 1
          INTO l_item_cnt
          FROM DUAL
         WHERE EXISTS(
                 SELECT 1
                   FROM wms_lpn_contents wlc, mtl_transaction_lots_temp mtlt
                  WHERE wlc.parent_lpn_id = p_lpn
                    AND wlc.organization_id = p_org_id
                    AND wlc.inventory_item_id = p_item_id
                    AND NVL(wlc.revision, '-999') = NVL(p_rev, '-999')
                    AND(mtlt.transaction_temp_id = p_temp_id
                        AND mtlt.lot_number = wlc.lot_number));
Line: 3062

      SELECT allocated_lpn_id
        INTO l_allocated_lpn_id
        FROM mtl_material_transactions_temp
       WHERE transaction_temp_id = p_temp_id;
Line: 3096

    SELECT COUNT(DISTINCT inventory_item_id)
         , COUNT(DISTINCT lot_number)
         , COUNT(DISTINCT revision)
         , COUNT(DISTINCT cost_group_id)
      INTO l_item_cnt2
         , l_lot_cnt
         , l_rev_cnt
         , l_cg_cnt
      FROM wms_lpn_contents
     WHERE parent_lpn_id = p_lpn
       AND organization_id = p_org_id;
Line: 3108

    SELECT COUNT(*)
      INTO l_lpn_include_lpn
      FROM wms_license_plate_numbers
     WHERE outermost_lpn_id = p_lpn
       AND organization_id = p_org_id;
Line: 3142

             SELECT
         1,
         wlc.quantity,
         wlc.uom_code
         INTO
         l_lot_match,
         l_wlc_quantity,
         l_wlc_uom_code
         FROM
         wms_lpn_contents wlc
         WHERE  wlc.parent_lpn_id = p_lpn
         AND    wlc.inventory_item_id = p_item_id
         AND    wlc.organization_id = p_org_id
         AND    nvl(wlc.revision,'-999') = nvl(p_rev,'-999')
         AND    wlc.lot_number = l_mtlt_lot_number;
Line: 3185

            inv_quantity_tree_pub.update_quantities(
              p_api_version_number         => 1.0
            , p_init_msg_lst               => fnd_api.g_false
            , x_return_status              => l_return_status
            , x_msg_count                  => l_msg_cnt
            , x_msg_data                   => l_msg_data
            , p_organization_id            => p_org_id
            , p_inventory_item_id          => p_item_id
            , p_tree_mode                  => inv_quantity_tree_pub.g_transaction_mode
            , p_is_revision_control        => b_is_revision_control
            , p_is_lot_control             => TRUE
            , p_is_serial_control          => b_is_serial_control
            , p_revision                   => NVL(p_rev, NULL)
            , p_lot_number                 => l_mtlt_lot_number
            , p_subinventory_code          => l_sub
            , p_locator_id                 => l_loc_id
            , p_primary_quantity           => -l_mtlt_primary_qty
            , p_quantity_type              => inv_quantity_tree_pvt.g_qs_txn
            , x_qoh                        => l_qoh
            , x_rqoh                       => l_rqoh
            , x_qr                         => l_qr
            , x_qs                         => l_qs
            , x_att                        => l_att
            , x_atr                        => l_atr
            , p_lpn_id                     => p_lpn
            , p_transfer_subinventory_code => l_xfr_sub_code
            );
Line: 3215

                mydebug('lpn_match: after update qty tree for lpn l_att:' || l_att || ' for lot:' || l_mtlt_lot_number);
Line: 3219

                mydebug('lpn_match: calling update qty tree with lpn 1st time failed ');
Line: 3228

            inv_quantity_tree_pub.update_quantities(
              p_api_version_number         => 1.0
            , p_init_msg_lst               => fnd_api.g_false
            , x_return_status              => l_return_status
            , x_msg_count                  => l_msg_cnt
            , x_msg_data                   => l_msg_data
            , p_organization_id            => p_org_id
            , p_inventory_item_id          => p_item_id
            , p_tree_mode                  => inv_quantity_tree_pub.g_transaction_mode
            , p_is_revision_control        => b_is_revision_control
            , p_is_lot_control             => TRUE
            , p_is_serial_control          => b_is_serial_control
            , p_revision                   => NVL(p_rev, NULL)
            , p_lot_number                 => l_mtlt_lot_number
            , p_subinventory_code          => l_sub
            , p_locator_id                 => l_loc_id
            , p_primary_quantity           => -l_mtlt_primary_qty
            , p_quantity_type              => inv_quantity_tree_pvt.g_qs_txn
            , x_qoh                        => l_qoh
            , x_rqoh                       => l_rqoh
            , x_qr                         => l_qr
            , x_qs                         => l_qs
            , x_att                        => l_att
            , x_atr                        => l_atr
            --  , p_lpn_id                =>   p_lpn      withour lpn_id, only to locator level
            , p_transfer_subinventory_code => l_xfr_sub_code
            );
Line: 3258

                mydebug('lpn_match: after update qty tree without lpn l_att:' || l_att || ' for lot:' || l_mtlt_lot_number);
Line: 3262

                mydebug('lpn_match: calling update qty tree back without lpn 1st time failed ');
Line: 3346

            inv_quantity_tree_pub.update_quantities(
              p_api_version_number         => 1.0
            , p_init_msg_lst               => fnd_api.g_false
            , x_return_status              => l_return_status
            , x_msg_count                  => l_msg_cnt
            , x_msg_data                   => l_msg_data
            , p_organization_id            => p_org_id
            , p_inventory_item_id          => p_item_id
            , p_tree_mode                  => inv_quantity_tree_pub.g_transaction_mode
            , p_is_revision_control        => b_is_revision_control
            , p_is_lot_control             => TRUE
            , p_is_serial_control          => b_is_serial_control
            , p_revision                   => NVL(p_rev, NULL)
            , p_lot_number                 => l_mtlt_lot_number
            , p_subinventory_code          => l_sub
            , p_locator_id                 => l_loc_id
            , p_primary_quantity           => l_mtlt_primary_qty
            , p_quantity_type              => inv_quantity_tree_pvt.g_qs_txn
            , x_qoh                        => l_qoh
            , x_rqoh                       => l_rqoh
            , x_qr                         => l_qr
            , x_qs                         => l_qs
            , x_att                        => l_att
            , x_atr                        => l_atr
            , p_lpn_id                     => p_lpn
            , p_transfer_subinventory_code => l_xfr_sub_code
            );
Line: 3376

                mydebug('lpn_match: after update qty tree back for lpn l_att:' || l_att || ' for lot:' || l_mtlt_lot_number);
Line: 3380

                mydebug('lpn_match: calling update qty tree back with lpn 1st time failed ');
Line: 3389

            inv_quantity_tree_pub.update_quantities(
              p_api_version_number         => 1.0
            , p_init_msg_lst               => fnd_api.g_false
            , x_return_status              => l_return_status
            , x_msg_count                  => l_msg_cnt
            , x_msg_data                   => l_msg_data
            , p_organization_id            => p_org_id
            , p_inventory_item_id          => p_item_id
            , p_tree_mode                  => inv_quantity_tree_pub.g_transaction_mode
            , p_is_revision_control        => b_is_revision_control
            , p_is_lot_control             => TRUE
            , p_is_serial_control          => b_is_serial_control
            , p_revision                   => NVL(p_rev, NULL)
            , p_lot_number                 => l_mtlt_lot_number
            , p_subinventory_code          => l_sub
            , p_locator_id                 => l_loc_id
            , p_primary_quantity           => l_mtlt_primary_qty
            , p_quantity_type              => inv_quantity_tree_pvt.g_qs_txn
            , x_qoh                        => l_qoh
            , x_rqoh                       => l_rqoh
            , x_qr                         => l_qr
            , x_qs                         => l_qs
            , x_att                        => l_att
            , x_atr                        => l_atr
            --  , p_lpn_id                =>   p_lpn      withour lpn_id, only to locator level
            , p_transfer_subinventory_code => l_xfr_sub_code
            );
Line: 3419

                mydebug('lpn_match: after update qty tree back without lpn l_att:' || l_att || ' for lot:' || l_mtlt_lot_number);
Line: 3423

                mydebug('lpn_match: calling update qty tree back without lpn 1st time failed ');
Line: 3441

        SELECT COUNT(fm_serial_number)
          INTO l_serial_exist_cnt
          FROM mtl_serial_numbers_temp msnt
         WHERE msnt.transaction_temp_id = p_temp_id
           AND msnt.fm_serial_number IN(
                                        SELECT serial_number
                                          FROM mtl_serial_numbers
                                         WHERE lpn_id = p_lpn
                                           AND inventory_item_id = p_item_id
                                           AND NVL(revision, '-999') = NVL(p_rev, '-999'));
Line: 3468

        SELECT COUNT(fm_serial_number)
          INTO l_total_serial_cnt
          FROM mtl_serial_numbers_temp msnt, mtl_transaction_lots_temp mtlt
         WHERE mtlt.transaction_temp_id = p_temp_id
           AND msnt.transaction_temp_id = mtlt.serial_transaction_temp_id;
Line: 3503

        /*SELECT SUM ( INV_Convert.INV_UM_Convert(wlc.inventory_item_id,
                  null,
                  wlc.quantity,
                  wlc.uom_code,
                  p_uom,
                  null,
                  null) )
    INTO   l_lpn_qty
    FROM   wms_lpn_contents wlc
    WHERE  wlc.parent_lpn_id = p_lpn
    AND    wlc.inventory_item_id = p_item_id
    AND    Nvl(wlc.revision, '-999') = Nvl(p_rev, '-999');   -- bug fix 2123096  */
Line: 3522

          inv_quantity_tree_pub.update_quantities(
            p_api_version_number         => 1.0
          , p_init_msg_lst               => fnd_api.g_false
          , x_return_status              => l_return_status
          , x_msg_count                  => l_msg_cnt
          , x_msg_data                   => l_msg_data
          , p_organization_id            => p_org_id
          , p_inventory_item_id          => p_item_id
          , p_tree_mode                  => inv_quantity_tree_pub.g_transaction_mode
          , p_is_revision_control        => b_is_revision_control
          , p_is_lot_control             => FALSE
          , p_is_serial_control          => b_is_serial_control
          , p_revision                   => NVL(p_rev, NULL)
          , p_lot_number                 => NULL
          , p_subinventory_code          => l_sub
          , p_locator_id                 => l_loc_id
          , p_primary_quantity           => -p_qty
          , p_quantity_type              => inv_quantity_tree_pvt.g_qs_txn
          , x_qoh                        => l_qoh
          , x_rqoh                       => l_rqoh
          , x_qr                         => l_qr
          , x_qs                         => l_qs
          , x_att                        => l_att
          , x_atr                        => l_atr
          , p_lpn_id                     => p_lpn
          , p_transfer_subinventory_code => l_xfr_sub_code
          );
Line: 3552

              mydebug('lpn_match: update qty tree with lpn 2nd time: l_att:' || l_att);
Line: 3556

              mydebug('lpn_match: calling update qty tree with lpn 2nd time failed ');
Line: 3565

          inv_quantity_tree_pub.update_quantities(
            p_api_version_number         => 1.0
          , p_init_msg_lst               => fnd_api.g_false
          , x_return_status              => l_return_status
          , x_msg_count                  => l_msg_cnt
          , x_msg_data                   => l_msg_data
          , p_organization_id            => p_org_id
          , p_inventory_item_id          => p_item_id
          , p_tree_mode                  => inv_quantity_tree_pub.g_transaction_mode
          , p_is_revision_control        => b_is_revision_control
          , p_is_lot_control             => FALSE
          , p_is_serial_control          => b_is_serial_control
          , p_revision                   => NVL(p_rev, NULL)
          , p_lot_number                 => NULL
          , p_subinventory_code          => l_sub
          , p_locator_id                 => l_loc_id
          , p_primary_quantity           => -p_qty
          , p_quantity_type              => inv_quantity_tree_pvt.g_qs_txn
          , x_qoh                        => l_qoh
          , x_rqoh                       => l_rqoh
          , x_qr                         => l_qr
          , x_qs                         => l_qs
          , x_att                        => l_att
          , x_atr                        => l_atr
          --  , p_lpn_id                =>   p_lpn      withour lpn_id, only to locator level
          , p_transfer_subinventory_code => l_xfr_sub_code
          );
Line: 3595

              mydebug('lpn_match: update qty tree without lpn 2nd time:l_att:' || l_att);
Line: 3599

              mydebug('lpn_match: calling update qty tree back without lpn 2nd time failed ');
Line: 3652

          inv_quantity_tree_pub.update_quantities(
            p_api_version_number         => 1.0
          , p_init_msg_lst               => fnd_api.g_false
          , x_return_status              => l_return_status
          , x_msg_count                  => l_msg_cnt
          , x_msg_data                   => l_msg_data
          , p_organization_id            => p_org_id
          , p_inventory_item_id          => p_item_id
          , p_tree_mode                  => inv_quantity_tree_pub.g_transaction_mode
          , p_is_revision_control        => b_is_revision_control
          , p_is_lot_control             => FALSE
          , p_is_serial_control          => b_is_serial_control
          , p_revision                   => NVL(p_rev, NULL)
          , p_lot_number                 => NULL
          , p_subinventory_code          => l_sub
          , p_locator_id                 => l_loc_id
          , p_primary_quantity           => p_qty
          , p_quantity_type              => inv_quantity_tree_pvt.g_qs_txn
          , x_qoh                        => l_qoh
          , x_rqoh                       => l_rqoh
          , x_qr                         => l_qr
          , x_qs                         => l_qs
          , x_att                        => l_att
          , x_atr                        => l_atr
          , p_lpn_id                     => p_lpn
          , p_transfer_subinventory_code => l_xfr_sub_code
          );
Line: 3682

              mydebug('lpn_match: update qty tree back with lpn 2nd time: l_att:' || l_att);
Line: 3686

              mydebug('lpn_match: calling update qty tree with lpn 2nd time failed ');
Line: 3695

          inv_quantity_tree_pub.update_quantities(
            p_api_version_number         => 1.0
          , p_init_msg_lst               => fnd_api.g_false
          , x_return_status              => l_return_status
          , x_msg_count                  => l_msg_cnt
          , x_msg_data                   => l_msg_data
          , p_organization_id            => p_org_id
          , p_inventory_item_id          => p_item_id
          , p_tree_mode                  => inv_quantity_tree_pub.g_transaction_mode
          , p_is_revision_control        => b_is_revision_control
          , p_is_lot_control             => FALSE
          , p_is_serial_control          => b_is_serial_control
          , p_revision                   => NVL(p_rev, NULL)
          , p_lot_number                 => NULL
          , p_subinventory_code          => l_sub
          , p_locator_id                 => l_loc_id
          , p_primary_quantity           => p_qty
          , p_quantity_type              => inv_quantity_tree_pvt.g_qs_txn
          , x_qoh                        => l_qoh
          , x_rqoh                       => l_rqoh
          , x_qr                         => l_qr
          , x_qs                         => l_qs
          , x_att                        => l_att
          , x_atr                        => l_atr
          --  , p_lpn_id                =>   p_lpn      withour lpn_id, only to locator level
          , p_transfer_subinventory_code => l_xfr_sub_code
          );
Line: 3725

              mydebug('lpn_match: update qty tree back without lpn 2nd time:l_att:' || l_att);
Line: 3729

              mydebug('lpn_match: calling update qty tree back without lpn 2nd time failed ');
Line: 3749

      SELECT primary_quantity
           , transaction_uom
        INTO l_mmtt_qty
           , l_txn_uom
        FROM mtl_material_transactions_temp
       WHERE transaction_temp_id = p_temp_id;
Line: 3774

          SELECT COUNT(fm_serial_number)
            INTO l_serial_exist_cnt
            FROM mtl_serial_numbers_temp msnt, mtl_transaction_lots_temp mtlt
           WHERE mtlt.transaction_temp_id = p_temp_id
             AND msnt.transaction_temp_id = mtlt.serial_transaction_temp_id
             AND msnt.fm_serial_number IN(
                                        SELECT serial_number
                                          FROM mtl_serial_numbers
                                         WHERE lpn_id = p_lpn
                                           AND inventory_item_id = p_item_id
                                           AND NVL(revision, '-999') = NVL(p_rev, '-999'));
Line: 3828

             SELECT
         1,
         wlc.quantity,
         wlc.uom_code
         INTO
         l_lot_match,
         l_wlc_quantity,
         l_wlc_uom_code
         FROM
         wms_lpn_contents wlc
         WHERE  wlc.parent_lpn_id = p_lpn
         AND    wlc.inventory_item_id = p_item_id
         AND    wlc.organization_id = p_org_id
         AND    nvl(wlc.revision,'-999') = nvl(p_rev,'-999')
         AND    wlc.lot_number = l_mtlt_lot_number;
Line: 3905

            inv_quantity_tree_pub.update_quantities(
              p_api_version_number         => 1.0
            , p_init_msg_lst               => fnd_api.g_false
            , x_return_status              => l_return_status
            , x_msg_count                  => l_msg_cnt
            , x_msg_data                   => l_msg_data
            , p_organization_id            => p_org_id
            , p_inventory_item_id          => p_item_id
            , p_tree_mode                  => inv_quantity_tree_pub.g_transaction_mode
            , p_is_revision_control        => b_is_revision_control
            , p_is_lot_control             => TRUE
            , p_is_serial_control          => b_is_serial_control
            , p_revision                   => NVL(p_rev, NULL)
            , p_lot_number                 => l_mtlt_lot_number
            , p_subinventory_code          => l_sub
            , p_locator_id                 => l_loc_id
            , p_primary_quantity           => -l_mtlt_primary_qty
            , p_quantity_type              => inv_quantity_tree_pvt.g_qs_txn
            , x_qoh                        => l_qoh
            , x_rqoh                       => l_rqoh
            , x_qr                         => l_qr
            , x_qs                         => l_qs
            , x_att                        => l_att
            , x_atr                        => l_atr
            , p_lpn_id                     => p_lpn
            , p_transfer_subinventory_code => l_xfr_sub_code
            );
Line: 3935

                mydebug('lpn_match: update qty tree 3rd time for lpn l_att:' || l_att || ' for lot:' || l_mtlt_lot_number);
Line: 3939

                mydebug('lpn_match: calling update qty tree with lpn 3rd time failed ');
Line: 3948

            inv_quantity_tree_pub.update_quantities(
              p_api_version_number         => 1.0
            , p_init_msg_lst               => fnd_api.g_false
            , x_return_status              => l_return_status
            , x_msg_count                  => l_msg_cnt
            , x_msg_data                   => l_msg_data
            , p_organization_id            => p_org_id
            , p_inventory_item_id          => p_item_id
            , p_tree_mode                  => inv_quantity_tree_pub.g_transaction_mode
            , p_is_revision_control        => b_is_revision_control
            , p_is_lot_control             => TRUE
            , p_is_serial_control          => b_is_serial_control
            , p_revision                   => NVL(p_rev, NULL)
            , p_lot_number                 => l_mtlt_lot_number
            , p_subinventory_code          => l_sub
            , p_locator_id                 => l_loc_id
            , p_primary_quantity           => -l_mtlt_primary_qty
            , p_quantity_type              => inv_quantity_tree_pvt.g_qs_txn
            , x_qoh                        => l_qoh
            , x_rqoh                       => l_rqoh
            , x_qr                         => l_qr
            , x_qs                         => l_qs
            , x_att                        => l_att
            , x_atr                        => l_atr
            --  , p_lpn_id                =>   p_lpn      withour lpn_id, only to locator level
            , p_transfer_subinventory_code => l_xfr_sub_code
            );
Line: 3978

                mydebug('lpn_match: after update without lpn 3rd time l_att:' || l_att || ' for lot:' || l_mtlt_lot_number);
Line: 3982

                mydebug('lpn_match: calling update qty tree back 3rd time without lpn 3rd time failed ');
Line: 4126

            inv_quantity_tree_pub.update_quantities(
              p_api_version_number         => 1.0
            , p_init_msg_lst               => fnd_api.g_false
            , x_return_status              => l_return_status
            , x_msg_count                  => l_msg_cnt
            , x_msg_data                   => l_msg_data
            , p_organization_id            => p_org_id
            , p_inventory_item_id          => p_item_id
            , p_tree_mode                  => inv_quantity_tree_pub.g_transaction_mode
            , p_is_revision_control        => b_is_revision_control
            , p_is_lot_control             => TRUE
            , p_is_serial_control          => b_is_serial_control
            , p_revision                   => NVL(p_rev, NULL)
            , p_lot_number                 => l_mtlt_lot_number
            , p_subinventory_code          => l_sub
            , p_locator_id                 => l_loc_id
            , p_primary_quantity           => l_mtlt_primary_qty
            , p_quantity_type              => inv_quantity_tree_pvt.g_qs_txn
            , x_qoh                        => l_qoh
            , x_rqoh                       => l_rqoh
            , x_qr                         => l_qr
            , x_qs                         => l_qs
            , x_att                        => l_att
            , x_atr                        => l_atr
            , p_lpn_id                     => p_lpn
            , p_transfer_subinventory_code => l_xfr_sub_code
            );
Line: 4156

                mydebug('lpn_match: update qty tree back 3rd time for lpn l_att:' || l_att || ' for lot:' || l_mtlt_lot_number);
Line: 4160

                mydebug('lpn_match: calling update qty tree with lpn 3rd time failed ');
Line: 4169

            inv_quantity_tree_pub.update_quantities(
              p_api_version_number         => 1.0
            , p_init_msg_lst               => fnd_api.g_false
            , x_return_status              => l_return_status
            , x_msg_count                  => l_msg_cnt
            , x_msg_data                   => l_msg_data
            , p_organization_id            => p_org_id
            , p_inventory_item_id          => p_item_id
            , p_tree_mode                  => inv_quantity_tree_pub.g_transaction_mode
            , p_is_revision_control        => b_is_revision_control
            , p_is_lot_control             => TRUE
            , p_is_serial_control          => b_is_serial_control
            , p_revision                   => NVL(p_rev, NULL)
            , p_lot_number                 => l_mtlt_lot_number
            , p_subinventory_code          => l_sub
            , p_locator_id                 => l_loc_id
            , p_primary_quantity           => l_mtlt_primary_qty
            , p_quantity_type              => inv_quantity_tree_pvt.g_qs_txn
            , x_qoh                        => l_qoh
            , x_rqoh                       => l_rqoh
            , x_qr                         => l_qr
            , x_qs                         => l_qs
            , x_att                        => l_att
            , x_atr                        => l_atr
            --  , p_lpn_id                =>   p_lpn      withour lpn_id, only to locator level
            , p_transfer_subinventory_code => l_xfr_sub_code
            );
Line: 4199

                mydebug('lpn_match: after update qty tree back without lpn 3rd time l_att:' || l_att || ' for lot:' || l_mtlt_lot_number);
Line: 4203

                mydebug('lpn_match: calling update qty tree back without lpn 3rd time failed ');
Line: 4227

          SELECT COUNT(fm_serial_number)
            INTO l_total_serial_cnt
            FROM mtl_serial_numbers_temp msnt, mtl_transaction_lots_temp mtlt
           WHERE mtlt.transaction_temp_id = p_temp_id
             AND msnt.transaction_temp_id = mtlt.serial_transaction_temp_id;
Line: 4271

          SELECT COUNT(fm_serial_number)
            INTO l_serial_exist_cnt
            FROM mtl_serial_numbers_temp msnt
           WHERE msnt.transaction_temp_id = p_temp_id
             AND msnt.fm_serial_number IN(
                                        SELECT serial_number
                                          FROM mtl_serial_numbers
                                         WHERE lpn_id = p_lpn
                                           AND inventory_item_id = p_item_id
                                           AND NVL(revision, '-999') = NVL(p_rev, '-999'));
Line: 4304

        /*SELECT
          quantity,
          uom_code
          INTO
          l_exist_qty,
          l_lpn_uom
          FROM   wms_lpn_contents
          WHERE  parent_lpn_id = p_lpn
          AND    organization_id = p_org_id
          AND    inventory_item_id = p_item_id
          AND    Nvl(cost_group_id,'-999') = Nvl(p_cost_group_id,'-999')
          AND    Nvl(revision,'-999') = Nvl(p_rev,'-999');
Line: 4355

          inv_quantity_tree_pub.update_quantities(
            p_api_version_number         => 1.0
          , p_init_msg_lst               => fnd_api.g_false
          , x_return_status              => l_return_status
          , x_msg_count                  => l_msg_cnt
          , x_msg_data                   => l_msg_data
          , p_organization_id            => p_org_id
          , p_inventory_item_id          => p_item_id
          , p_tree_mode                  => inv_quantity_tree_pub.g_transaction_mode
          , p_is_revision_control        => b_is_revision_control
          , p_is_lot_control             => FALSE
          , p_is_serial_control          => b_is_serial_control
          , p_revision                   => NVL(p_rev, NULL)
          , p_lot_number                 => NULL
          , p_subinventory_code          => l_sub
          , p_locator_id                 => l_loc_id
          , p_primary_quantity           => -l_mmtt_qty
          , p_quantity_type              => inv_quantity_tree_pvt.g_qs_txn
          , x_qoh                        => l_qoh
          , x_rqoh                       => l_rqoh
          , x_qr                         => l_qr
          , x_qs                         => l_qs
          , x_att                        => l_att
          , x_atr                        => l_atr
          , p_lpn_id                     => p_lpn
          , p_transfer_subinventory_code => l_xfr_sub_code
          );
Line: 4385

              mydebug('lpn_match: update qty tree with lpn 4th time: l_att:' || l_att);
Line: 4389

              mydebug('lpn_match: calling update qty tree with lpn 4th time failed ');
Line: 4398

          inv_quantity_tree_pub.update_quantities(
            p_api_version_number         => 1.0
          , p_init_msg_lst               => fnd_api.g_false
          , x_return_status              => l_return_status
          , x_msg_count                  => l_msg_cnt
          , x_msg_data                   => l_msg_data
          , p_organization_id            => p_org_id
          , p_inventory_item_id          => p_item_id
          , p_tree_mode                  => inv_quantity_tree_pub.g_transaction_mode
          , p_is_revision_control        => b_is_revision_control
          , p_is_lot_control             => FALSE
          , p_is_serial_control          => b_is_serial_control
          , p_revision                   => NVL(p_rev, NULL)
          , p_lot_number                 => NULL
          , p_subinventory_code          => l_sub
          , p_locator_id                 => l_loc_id
          , p_primary_quantity           => -l_mmtt_qty
          , p_quantity_type              => inv_quantity_tree_pvt.g_qs_txn
          , x_qoh                        => l_qoh
          , x_rqoh                       => l_rqoh
          , x_qr                         => l_qr
          , x_qs                         => l_qs
          , x_att                        => l_att
          , x_atr                        => l_atr
          --  , p_lpn_id                =>   p_lpn      withour lpn_id, only to locator level
          , p_transfer_subinventory_code => l_xfr_sub_code
          );
Line: 4428

              mydebug('lpn_match: update qty tree without lpn 4th time:l_att:' || l_att);
Line: 4432

              mydebug('lpn_match: calling update qty tree without lpn 4th time failed ');
Line: 4525

          inv_quantity_tree_pub.update_quantities(
            p_api_version_number         => 1.0
          , p_init_msg_lst               => fnd_api.g_false
          , x_return_status              => l_return_status
          , x_msg_count                  => l_msg_cnt
          , x_msg_data                   => l_msg_data
          , p_organization_id            => p_org_id
          , p_inventory_item_id          => p_item_id
          , p_tree_mode                  => inv_quantity_tree_pub.g_transaction_mode
          , p_is_revision_control        => b_is_revision_control
          , p_is_lot_control             => FALSE
          , p_is_serial_control          => b_is_serial_control
          , p_revision                   => NVL(p_rev, NULL)
          , p_lot_number                 => NULL
          , p_subinventory_code          => l_sub
          , p_locator_id                 => l_loc_id
          , p_primary_quantity           => l_mmtt_qty
          , p_quantity_type              => inv_quantity_tree_pvt.g_qs_txn
          , x_qoh                        => l_qoh
          , x_rqoh                       => l_rqoh
          , x_qr                         => l_qr
          , x_qs                         => l_qs
          , x_att                        => l_att
          , x_atr                        => l_atr
          , p_lpn_id                     => p_lpn
          , p_transfer_subinventory_code => l_xfr_sub_code
          );
Line: 4555

              mydebug('lpn_match: update qty tree back with lpn 4th time: l_att:' || l_att);
Line: 4559

              mydebug('lpn_match: calling update qty tree back with lpn 4th time failed ');
Line: 4568

          inv_quantity_tree_pub.update_quantities(
            p_api_version_number         => 1.0
          , p_init_msg_lst               => fnd_api.g_false
          , x_return_status              => l_return_status
          , x_msg_count                  => l_msg_cnt
          , x_msg_data                   => l_msg_data
          , p_organization_id            => p_org_id
          , p_inventory_item_id          => p_item_id
          , p_tree_mode                  => inv_quantity_tree_pub.g_transaction_mode
          , p_is_revision_control        => b_is_revision_control
          , p_is_lot_control             => FALSE
          , p_is_serial_control          => b_is_serial_control
          , p_revision                   => NVL(p_rev, NULL)
          , p_lot_number                 => NULL
          , p_subinventory_code          => l_sub
          , p_locator_id                 => l_loc_id
          , p_primary_quantity           => l_mmtt_qty
          , p_quantity_type              => inv_quantity_tree_pvt.g_qs_txn
          , x_qoh                        => l_qoh
          , x_rqoh                       => l_rqoh
          , x_qr                         => l_qr
          , x_qs                         => l_qs
          , x_att                        => l_att
          , x_atr                        => l_atr
          --  , p_lpn_id                =>   p_lpn      withour lpn_id, only to locator level
          , p_transfer_subinventory_code => l_xfr_sub_code
          );
Line: 4598

              mydebug('lpn_match: update qty tree back without lpn 4th time:l_att:' || l_att);
Line: 4602

              mydebug('lpn_match: calling update qty tree back without lpn 4th time failed ');
Line: 4619

          SELECT COUNT(fm_serial_number)
            INTO l_total_serial_cnt
            FROM mtl_serial_numbers_temp msnt
           WHERE msnt.transaction_temp_id = p_temp_id;
Line: 4760

                SELECT 1
                INTO   l_allocate_serial_flag
                FROM   mtl_serial_numbers_temp msnt,
                       mtl_serial_numbers msn
                WHERE  msnt.transaction_temp_id = l_temp_serial_trans_temp
                AND    msn.serial_number = msnt.fm_serial_number
                AND    msn.lpn_id = p_lpn
                AND    ROWNUM = 1;
Line: 4774

                SELECT 1
                INTO   l_allocate_serial_flag
                FROM   mtl_material_transactions_temp mmtt,
                       mtl_serial_numbers_temp msnt,
                       mtl_serial_numbers msn
                WHERE  mmtt.transaction_temp_id = p_temp_id
                AND    mmtt.organization_id = p_org_id
                AND    mmtt.inventory_item_id = p_item_id
                AND    msnt.transaction_temp_id = mmtt.transaction_temp_id
                AND    msn.serial_number = msnt.fm_serial_number
                AND    msn.inventory_item_id = mmtt.inventory_item_id
                AND    msn.lpn_id = p_lpn
                AND    ROWNUM = 1;
Line: 4932

          inv_quantity_tree_pub.update_quantities
         (  p_api_version_number    =>   1.0
          , p_init_msg_lst          =>   fnd_api.g_false
          , x_return_status         =>   l_return_status
          , x_msg_count             =>   l_msg_cnt
          , x_msg_data              =>   l_msg_data
          , p_organization_id       =>   p_org_id
          , p_inventory_item_id     =>   p_item_id
          , p_tree_mode             =>   INV_Quantity_Tree_PUB.g_transaction_mode
          , p_is_revision_control   =>   b_is_revision_control
          , p_is_lot_control        =>   b_is_lot_control
          , p_is_serial_control     =>   b_is_serial_control
          --, p_demand_source_type_id =>   NULL
          , p_revision              =>   p_rev
          , p_lot_number            =>   p_lot
          , p_subinventory_code     =>   l_sub
          , p_locator_id            =>   l_loc_id
          , p_primary_quantity      =>   p_qty
          , p_quantity_type         =>   inv_quantity_tree_pvt.g_qs_txn
          , x_qoh                   =>   l_qoh
          , x_rqoh        =>   l_rqoh
          , x_qr        =>   l_qr
          , x_qs        =>   l_qs
          , x_att         =>   l_att
          , x_atr         =>   l_atr
          , p_lpn_id                =>   p_lpn
              , p_transfer_subinventory_code => l_xfr_sub_code
        );
Line: 4961

          inv_quantity_tree_pub.update_quantities
       (  p_api_version_number    =>   1.0
        , p_init_msg_lst          =>   fnd_api.g_false
        , x_return_status         =>   l_return_status
        , x_msg_count             =>   l_msg_cnt
        , x_msg_data              =>   l_msg_data
        , p_organization_id       =>   p_org_id
        , p_inventory_item_id     =>   p_item_id
        , p_tree_mode             =>   INV_Quantity_Tree_PUB.g_transaction_mode
        , p_is_revision_control   =>   b_is_revision_control
        , p_is_lot_control        =>   b_is_lot_control
        , p_is_serial_control     =>   b_is_serial_control
      --, p_demand_source_type_id =>   NULL
        , p_revision              =>   p_rev
        , p_lot_number            =>   p_lot
        , p_subinventory_code     =>   l_sub
        , p_locator_id            =>   l_loc_id
        , p_primary_quantity      =>   p_qty
        , p_quantity_type         =>   inv_quantity_tree_pvt.g_qs_txn
        , x_qoh                   =>   l_qoh
        , x_rqoh        =>   l_rqoh
        , x_qr        =>   l_qr
        , x_qs        =>   l_qs
        , x_att         =>   l_att
        , x_atr         =>   l_atr
          --  , p_lpn_id                =>   p_lpn      withour lpn_id, only to locator level
              , p_transfer_subinventory_code => l_xfr_sub_code
        );
Line: 5031

      UPDATE wms_license_plate_numbers
         SET lpn_context = wms_container_pub.lpn_context_packing
           , last_update_date = SYSDATE
           , last_updated_by = fnd_global.user_id
       WHERE lpn_id = p_lpn;
Line: 5060

      SELECT decode(mmtt.transaction_type_id, 35,'N',51,'N','Y')
        FROM mtl_material_transactions_temp mmtt, mtl_txn_request_lines mol
       WHERE (mmtt.transaction_temp_id = txn_temp_id OR mmtt.parent_line_id = txn_temp_id)
         AND mmtt.move_order_line_id = mol.line_id
         AND mol.line_status = inv_globals.g_to_status_cancel_by_source
         AND ROWNUM = 1;
Line: 5116

  , p_lots_to_delete      IN            VARCHAR2
  , p_mmtt_to_update      IN            VARCHAR2
  , p_serial_number       IN            VARCHAR2
  , x_out_lpn             OUT NOCOPY    NUMBER
  ) IS
    l_temp_id               NUMBER;
Line: 5147

      SELECT mmtt2.transaction_temp_id
           , mmtt1.transaction_uom
           , mmtt2.transaction_uom
           , mmtt2.transaction_quantity
           , mmtt2.primary_quantity
        FROM mtl_material_transactions_temp mmtt1, mtl_material_transactions_temp mmtt2
       WHERE mmtt1.transaction_temp_id = p_temp_id
         AND mmtt1.transaction_header_id = l_txn_hdr_id
         AND mmtt1.organization_id = p_org_id
         AND mmtt2.transaction_header_id = mmtt1.transaction_header_id
         AND mmtt2.organization_id = mmtt1.organization_id
         AND mmtt2.transaction_temp_id <> mmtt1.transaction_temp_id
         AND mmtt2.move_order_line_id = mmtt1.move_order_line_id
         AND NVL(mmtt2.reservation_id, 0) = NVL(mmtt1.reservation_id, 0)
         AND mmtt2.inventory_item_id = mmtt1.inventory_item_id
         AND mmtt2.subinventory_code = mmtt1.subinventory_code
         AND mmtt2.locator_id = mmtt1.locator_id
         AND NVL(mmtt2.transfer_lpn_id, 0) = NVL(mmtt1.transfer_lpn_id, 0)
         AND NVL(mmtt2.content_lpn_id, 0) = NVL(mmtt1.content_lpn_id, 0)
         AND NVL(mmtt2.lpn_id, 0) = NVL(mmtt1.lpn_id, 0);
Line: 5180

      SELECT mmtt.transaction_temp_id
        FROM mtl_material_transactions_temp mmtt
       WHERE mmtt.transaction_header_id = p_transaction_header_id;
Line: 5209

    SELECT transfer_subinventory
         , transfer_to_location
      INTO l_to_sub
         , l_to_loc
      FROM mtl_material_transactions_temp
     WHERE transaction_temp_id = p_temp_id;
Line: 5217

      SELECT 1
        INTO l_to_lpn_exists
        FROM wms_license_plate_numbers
       WHERE license_plate_number = p_to_lpn
         AND organization_id = p_org_id;
Line: 5305

          SELECT 0
            INTO l_loaded
            FROM DUAL
           WHERE NOT EXISTS(SELECT 1
                              FROM mtl_material_transactions_temp
                             WHERE content_lpn_id = p_from_lpn_id
                               AND transaction_temp_id<>p_temp_id);
Line: 5331

      SELECT lpn_id
           , lpn_context
        INTO l_to_lpn_id
           , l_to_lpn_context
        FROM wms_license_plate_numbers
       WHERE license_plate_number = p_to_lpn
         AND organization_id = p_org_id;
Line: 5348

      UPDATE wms_license_plate_numbers
         SET lpn_context = wms_container_pub.lpn_context_packing
           , last_update_date = SYSDATE
           , last_updated_by = fnd_global.user_id
       WHERE lpn_id = l_to_lpn_id;
Line: 5362

      inv_utilities.parse_vector(vector_in => p_mmtt_to_update, delimiter => ':', table_of_strings => l_tabtype);
Line: 5366

          mydebug('load_pick : MMTT about to update' || l_tabtype(l_counter) || ':');
Line: 5381

              mydebug('load_pick: getting outermost LPN for selected lpn ON PKLP');
Line: 5384

            SELECT parent_lpn_id
              INTO l_content_parent_lpn_id
              FROM wms_license_plate_numbers
             WHERE lpn_id = p_from_lpn_id
               AND organization_id = p_org_id;
Line: 5391

              mydebug('load_pick: outermost LPN for the selected LPN::' || l_content_parent_lpn_id);
Line: 5436

          UPDATE wms_license_plate_numbers
             SET lpn_context = wms_container_pub.lpn_context_packing
               , last_update_date = SYSDATE
               , last_updated_by = fnd_global.user_id
           WHERE lpn_id = l_content_lpn_id;
Line: 5445

        UPDATE mtl_material_transactions_temp
           SET transfer_lpn_id = l_transfer_lpn_id
             , content_lpn_id = l_content_lpn_id
             , lpn_id = l_lpn_id
         WHERE transaction_temp_id = l_tabtype(l_counter);
Line: 5453

        UPDATE wms_dispatched_tasks
           SET status = 4
             , loaded_time = SYSDATE
             , --loaded_time=to_date(to_char(sysdate,'DD-MON-YYYY HH:MI:SS'),'DD-MON-YYYY HH:MI:SS'),
               last_update_date = SYSDATE
             , last_updated_by = l_user_id
         WHERE transaction_temp_id = l_tabtype(l_counter);
Line: 5518

    SELECT transaction_header_id
         , --last_updated_by,Bug 2672785:Wrong value being fetched for user_id
           inventory_item_id
         , lot_number
         , transaction_type_id
         , transaction_source_type_id
      INTO l_txn_hdr_id
         , --l_user_id,
           l_item_id
         , l_lot
         , l_tran_type_id
         , l_tran_source_type_id
      FROM mtl_material_transactions_temp
     WHERE transaction_temp_id = x_temp_id;
Line: 5626

      SELECT 1
        INTO l_wf
        FROM mtl_transaction_reasons
       WHERE reason_id = p_qty_rsn_id
         AND workflow_name IS NOT NULL
         AND workflow_name <> ' '
         AND workflow_process IS NOT NULL
         AND workflow_process <> ' ';
Line: 5700

      inv_utilities.parse_vector(vector_in => p_lots_to_delete, delimiter => ':', table_of_strings => l_tabtype);
Line: 5708

          UPDATE mtl_serial_numbers
             SET group_mark_id = NULL
           WHERE inventory_item_id = l_item_id
             AND current_organization_id = p_org_id
             AND serial_number IN(SELECT fm_serial_number
                                    FROM mtl_serial_numbers_temp
                                   WHERE transaction_temp_id IN(SELECT transaction_temp_id
                                                                  FROM mtl_transaction_lots_temp
                                                                 WHERE lot_number = l_tabtype(l_counter)
                                                                   AND transaction_temp_id = p_temp_id));
Line: 5719

          DELETE FROM mtl_serial_numbers_temp
                WHERE transaction_temp_id IN(SELECT transaction_temp_id
                                               FROM mtl_transaction_lots_temp
                                              WHERE lot_number = l_tabtype(l_counter)
                                                AND transaction_temp_id = p_temp_id);
Line: 5726

        DELETE FROM mtl_transaction_lots_temp
              WHERE lot_number = l_tabtype(l_counter)
                AND transaction_temp_id = p_temp_id;
Line: 5736

        UPDATE mtl_serial_numbers msn
           SET msn.group_mark_id = NULL
         WHERE msn.inventory_item_id = l_item_id
           AND msn.current_organization_id = p_org_id
           AND msn.group_mark_id = p_temp_id
           AND msn.serial_number IN(SELECT msnt.fm_serial_number
                                      FROM mtl_serial_numbers_temp msnt
                                     WHERE msnt.transaction_temp_id = p_temp_id);
Line: 5745

        DELETE FROM mtl_serial_numbers_temp msnt
              WHERE msnt.transaction_temp_id = p_temp_id
                AND msnt.fm_serial_number IN(
                            SELECT msn.serial_number
                              FROM mtl_serial_numbers msn
                             WHERE msn.inventory_item_id = l_item_id
                               AND msn.current_organization_id = p_org_id
                               AND msn.group_mark_id IS NULL);
Line: 5761

      SELECT 1
        INTO l_bulk_pick_flag
        FROM DUAL
       WHERE EXISTS(SELECT 1
                      FROM mtl_material_transactions_temp mmtt
                     WHERE mmtt.parent_line_id = p_temp_id);
Line: 5806

        UPDATE mtl_material_transactions_temp
           SET transaction_quantity = transaction_quantity + l_mmtt2_txn_qty
             , primary_quantity = primary_quantity + l_mmtt2_primary_qty
         WHERE transaction_temp_id = p_temp_id;
Line: 5812

          UPDATE mtl_transaction_lots_temp
             SET transaction_temp_id = p_temp_id
           WHERE transaction_temp_id = l_mmtt2_txn_temp_id;
Line: 5816

          UPDATE mtl_serial_numbers_temp
             SET transaction_temp_id = p_temp_id
           WHERE transaction_temp_id = l_mmtt2_txn_temp_id;
Line: 5821

        DELETE FROM mtl_material_transactions_temp
              WHERE transaction_temp_id = l_mmtt2_txn_temp_id;
Line: 5824

        DELETE FROM wms_dispatched_tasks
              WHERE transaction_temp_id = l_mmtt2_txn_temp_id;
Line: 5863

                   SELECT transaction_uom
                         ,transaction_quantity
                         ,move_order_line_id
                    INTO  l_mmtt_transaction_uom
                         ,l_transaction_qty
                         , l_move_order_line_id
                    FROM  mtl_material_transactions_temp
                   WHERE  transaction_temp_id = p_temp_id;
Line: 5878

                    mydebug('load_pick: others exception encounted in selecting
mmtt transaction uom code ');
Line: 5888

                  SELECT uom_code INTO  l_mol_uom
                  FROM  mtl_txn_request_lines
                  WHERE line_id = l_move_order_line_id;
Line: 5896

                   mydebug('load_pick: others exception enchounted in selecting move order uom code');
Line: 5927

       DELETE FROM mtl_material_transactions_temp
        WHERE transaction_temp_id = p_temp_id;
Line: 5935

                update mtl_txn_request_lines
                   set quantity_detailed = quantity_detailed - l_mol_delta_qty
                 where line_id = l_move_order_line_id;
Line: 5941

                DELETE FROM wms_dispatched_tasks
                WHERE transaction_temp_id = p_temp_id;
Line: 5946

       DELETE FROM mtl_material_transactions_temp
        WHERE transaction_temp_id = p_temp_id;
Line: 5949

            update mtl_material_transactions_temp
            set transaction_temp_id=p_temp_id
            where transaction_temp_id=x_temp_id;    --Added bug 3765153
Line: 5978

      DELETE FROM wms_dispatched_tasks
            WHERE transaction_temp_id = p_temp_id;
Line: 6081

  PROCEDURE insert_mmtt_pack(
    p_temp_id           IN            NUMBER
  , p_lpn_id            IN            NUMBER
  , p_transfer_lpn      IN            VARCHAR2
  , p_container_item_id IN            NUMBER
  , x_return_status     OUT NOCOPY    VARCHAR2
  , x_msg_count         OUT NOCOPY    NUMBER
  , x_msg_data          OUT NOCOPY    VARCHAR2
  ) IS
    l_mmtt_rec          inv_mo_line_detail_util.g_mmtt_rec;
Line: 6125

        mydebug('insert_mmtt_pack: No LPN was passed');
Line: 6128

      SELECT transfer_cost_group_id
           , organization_id
           , transfer_subinventory
           , transfer_to_location
        INTO l_cost_group_id
           , l_org_id
           , l_sub
           , l_loc
        FROM mtl_material_transactions_temp
       WHERE transaction_temp_id = l_temp_id;
Line: 6141

      /* SELECT COUNT(*)  INTO l_exist_lpn
   FROM WMS_LICENSE_PLATE_NUMBERS
   WHERE license_plate_number=l_lpn
   AND organization_id=l_org_id;*/
Line: 6146

        SELECT 1
          INTO l_exist_lpn
          FROM DUAL
         WHERE EXISTS(SELECT 1
                        FROM wms_license_plate_numbers
                       WHERE license_plate_number = l_lpn
                         AND organization_id = l_org_id);
Line: 6162

          mydebug('insert_mmtt_pack: Creating LPN');
Line: 6188

            mydebug('insert_mmtt_pack: Successful');
Line: 6192

            mydebug('insert_mmtt_pack: Not Successful');
Line: 6197

            mydebug('insert_mmtt_pack: Not Successful2');
Line: 6220

        SELECT lpn_id
          INTO l_transfer_lpn_id
          FROM wms_license_plate_numbers
         WHERE license_plate_number = l_lpn
           AND organization_id = l_org_id;
Line: 6228

    SELECT mtl_material_transactions_s.NEXTVAL
      INTO l_new_temp_id
      FROM DUAL;
Line: 6232

    INSERT INTO mtl_material_transactions_temp
                (
                 transaction_header_id
               , transaction_temp_id
               , source_code
               , source_line_id
               , transaction_mode
               , lock_flag
               , last_update_date
               , last_updated_by
               , creation_date
               , created_by
               , last_update_login
               , request_id
               , program_application_id
               , program_id
               , program_update_date
               , inventory_item_id
               , revision
               , organization_id
               , subinventory_code
               , locator_id
               , transaction_quantity
               , primary_quantity
               , transaction_uom
               , transaction_cost
               , transaction_type_id
               , transaction_action_id
               , transaction_source_type_id
               , transaction_source_id
               , transaction_source_name
               , transaction_date
               , acct_period_id
               , distribution_account_id
               , transaction_reference
               , requisition_line_id
               , requisition_distribution_id
               , reason_id
               , lot_number
               , lot_expiration_date
               , serial_number
               , receiving_document
               , demand_id
               , rcv_transaction_id
               , move_transaction_id
               , completion_transaction_id
               , wip_entity_type
               , schedule_id
               , repetitive_line_id
               , employee_code
               , primary_switch
               , schedule_update_code
               , setup_teardown_code
               , item_ordering
               , negative_req_flag
               , operation_seq_num
               , picking_line_id
               , trx_source_line_id
               , trx_source_delivery_id
               , physical_adjustment_id
               , cycle_count_id
               , rma_line_id
               , customer_ship_id
               , currency_code
               , currency_conversion_rate
               , currency_conversion_type
               , currency_conversion_date
               , ussgl_transaction_code
               , vendor_lot_number
               , encumbrance_account
               , encumbrance_amount
               , ship_to_location
               , shipment_number
               , transfer_cost
               , transportation_cost
               , transportation_account
               , freight_code
               , containers
               , waybill_airbill
               , expected_arrival_date
               , transfer_subinventory
               , transfer_organization
               , transfer_to_location
               , new_average_cost
               , value_change
               , percentage_change
               , material_allocation_temp_id
               , demand_source_header_id
               , demand_source_line
               , demand_source_delivery
               , item_segments
               , item_description
               , item_trx_enabled_flag
               , item_location_control_code
               , item_restrict_subinv_code
               , item_restrict_locators_code
               , item_revision_qty_control_code
               , item_primary_uom_code
               , item_uom_class
               , item_shelf_life_code
               , item_shelf_life_days
               , item_lot_control_code
               , item_serial_control_code
               , item_inventory_asset_flag
               , allowed_units_lookup_code
               , department_id
               , department_code
               , wip_supply_type
               , supply_subinventory
               , supply_locator_id
               , valid_subinventory_flag
               , valid_locator_flag
               , locator_segments
               , current_locator_control_code
               , number_of_lots_entered
               , wip_commit_flag
               , next_lot_number
               , lot_alpha_prefix
               , next_serial_number
               , serial_alpha_prefix
               , shippable_flag
               , posting_flag
               , required_flag
               , process_flag
               , ERROR_CODE
               , error_explanation
               , attribute_category
               , attribute1
               , attribute2
               , attribute3
               , attribute4
               , attribute5
               , attribute6
               , attribute7
               , attribute8
               , attribute9
               , attribute10
               , attribute11
               , attribute12
               , attribute13
               , attribute14
               , attribute15
               , movement_id
               , reservation_quantity
               , shipped_quantity
               , transaction_line_number
               , task_id
               , to_task_id
               , source_task_id
               , project_id
               , source_project_id
               , pa_expenditure_org_id
               , to_project_id
               , expenditure_type
               , final_completion_flag
               , transfer_percentage
               , transaction_sequence_id
               , material_account
               , material_overhead_account
               , resource_account
               , outside_processing_account
               , overhead_account
               , flow_schedule
               , cost_group_id
               , demand_class
               , qa_collection_id
               , kanban_card_id
               , overcompletion_transaction_id
               , overcompletion_primary_qty
               , overcompletion_transaction_qty
               , end_item_unit_number
               , scheduled_payback_date
               , line_type_code
               , parent_transaction_temp_id
               , put_away_strategy_id
               , put_away_rule_id
               , pick_strategy_id
               , pick_rule_id
               , common_bom_seq_id
               , common_routing_seq_id
               , cost_type_id
               , org_cost_group_id
               , move_order_line_id
               , task_group_id
               , pick_slip_number
               , reservation_id
               , transaction_status
               , transfer_cost_group_id
               , lpn_id
               , transfer_lpn_id
               , content_lpn_id
               , operation_plan_id
               , transaction_batch_id
               , transaction_batch_seq
                )
      (SELECT transaction_header_id
            , l_new_temp_id
            , source_code
            , source_line_id
            , transaction_mode
            , lock_flag
            , last_update_date
            , last_updated_by
            , creation_date
            , created_by
            , last_update_login
            , request_id
            , program_application_id
            , program_id
            , program_update_date
            , inventory_item_id
            , revision
            , organization_id
            , transfer_subinventory
            , transfer_to_location
            , 1
            , 1
            , transaction_uom
            , transaction_cost
            , inv_globals.g_type_container_pack
            , 50
            , 13
            , NULL
            , NULL
            , SYSDATE
            , acct_period_id
            , distribution_account_id
            , transaction_reference
            , requisition_line_id
            , requisition_distribution_id
            , reason_id
            , lot_number
            , lot_expiration_date
            , serial_number
            , receiving_document
            , demand_id
            , rcv_transaction_id
            , move_transaction_id
            , completion_transaction_id
            , wip_entity_type
            , schedule_id
            , repetitive_line_id
            , employee_code
            , primary_switch
            , schedule_update_code
            , setup_teardown_code
            , item_ordering
            , negative_req_flag
            , operation_seq_num
            , picking_line_id
            , trx_source_line_id
            , trx_source_delivery_id
            , physical_adjustment_id
            , cycle_count_id
            , rma_line_id
            , customer_ship_id
            , currency_code
            , currency_conversion_rate
            , currency_conversion_type
            , currency_conversion_date
            , ussgl_transaction_code
            , vendor_lot_number
            , encumbrance_account
            , encumbrance_amount
            , ship_to_location
            , shipment_number
            , transfer_cost
            , transportation_cost
            , transportation_account
            , freight_code
            , containers
            , waybill_airbill
            , expected_arrival_date
            , transfer_subinventory
            , transfer_organization
            , transfer_to_location
            , new_average_cost
            , value_change
            , percentage_change
            , material_allocation_temp_id
            , demand_source_header_id
            , demand_source_line
            , demand_source_delivery
            , item_segments
            , item_description
            , item_trx_enabled_flag
            , item_location_control_code
            , item_restrict_subinv_code
            , item_restrict_locators_code
            , item_revision_qty_control_code
            , item_primary_uom_code
            , item_uom_class
            , item_shelf_life_code
            , item_shelf_life_days
            , item_lot_control_code
            , item_serial_control_code
            , item_inventory_asset_flag
            , allowed_units_lookup_code
            , department_id
            , department_code
            , wip_supply_type
            , supply_subinventory
            , supply_locator_id
            , valid_subinventory_flag
            , valid_locator_flag
            , locator_segments
            , current_locator_control_code
            , number_of_lots_entered
            , wip_commit_flag
            , next_lot_number
            , lot_alpha_prefix
            , next_serial_number
            , serial_alpha_prefix
            , shippable_flag
            , posting_flag
            , required_flag
            , process_flag
            , ERROR_CODE
            , error_explanation
            , attribute_category
            , attribute1
            , attribute2
            , attribute3
            , attribute4
            , attribute5
            , attribute6
            , attribute7
            , attribute8
            , attribute9
            , attribute10
            , attribute11
            , attribute12
            , attribute13
            , attribute14
            , attribute15
            , movement_id
            , reservation_quantity
            , shipped_quantity
            , transaction_line_number
            , task_id
            , to_task_id
            , source_task_id
            , project_id
            , source_project_id
            , pa_expenditure_org_id
            , to_project_id
            , expenditure_type
            , final_completion_flag
            , transfer_percentage
            , transaction_sequence_id
            , material_account
            , material_overhead_account
            , resource_account
            , outside_processing_account
            , overhead_account
            , flow_schedule
            , cost_group_id
            , demand_class
            , qa_collection_id
            , kanban_card_id
            , overcompletion_transaction_id
            , overcompletion_primary_qty
            , overcompletion_transaction_qty
            , end_item_unit_number
            , scheduled_payback_date
            , line_type_code
            , parent_transaction_temp_id
            , put_away_strategy_id
            , put_away_rule_id
            , pick_strategy_id
            , pick_rule_id
            , common_bom_seq_id
            , common_routing_seq_id
            , cost_type_id
            , org_cost_group_id
            , NULL
            , task_group_id
            , pick_slip_number
            , NULL
            , transaction_status
            , transfer_cost_group_id
            , lpn_id
            , l_transfer_lpn_id
            , l_lpn_id
            , operation_plan_id
            , transaction_header_id
            , l_new_temp_id
         FROM mtl_material_transactions_temp
        WHERE transaction_temp_id = l_temp_id);
Line: 6630

  END insert_mmtt_pack;
Line: 6674

          SELECT lpn_id  INTO l_sug_lpn_id
      FROM WMS_LICENSE_PLATE_NUMBERS
      WHERE license_plate_number=l_sug_lpn_name
      AND organization_id=l_org_id;
Line: 6681

    SELECT lpn_id
      INTO l_lpn_id
      FROM wms_license_plate_numbers
     WHERE license_plate_number = l_lpn_name
       AND organization_id = l_org_id;
Line: 6698

      /* SELECT COUNT(*)  INTO l_exist_lpn
   FROM WMS_LICENSE_PLATE_NUMBERS
   WHERE license_plate_number=l_lpn_name
   AND organization_id=l_org_id
   AND lpn_context<>wms_container_pub.lpn_context_packing;*/
Line: 6704

        SELECT 1
          INTO l_exist_lpn
          FROM DUAL
         WHERE EXISTS(
                 SELECT 1
                   FROM wms_license_plate_numbers
                  WHERE license_plate_number = l_lpn_name
                    AND organization_id = l_org_id
                    AND lpn_context <> wms_container_pub.lpn_context_packing);
Line: 6727

        /* SELECT COUNT(*)  INTO l_exist_lpn2
           FROM wms_license_plate_numbers w, wms_lpn_contents c
           WHERE w.license_plate_number=l_sug_lpn_name
           AND w.organization_id=l_org_id
           AND w.lpn_id=c.parent_lpn_id;*/
Line: 6733

          SELECT 1
            INTO l_exist_lpn2
            FROM DUAL
           WHERE EXISTS(SELECT 1
                          FROM wms_license_plate_numbers w, wms_lpn_contents c
                         WHERE w.license_plate_number = l_sug_lpn_name
                           AND w.organization_id = l_org_id
                           AND w.lpn_id = c.parent_lpn_id);
Line: 6860

      SELECT serial_number
        FROM mtl_serial_numbers
       WHERE lpn_id = p_lpn_id
         AND NVL(lot_number, 'NONE') = NVL(v_lot_number, 'NONE');
Line: 6866

      SELECT lot_number
           , quantity
           , uom_code
        FROM wms_lpn_contents
       WHERE parent_lpn_id = p_lpn_id;
Line: 6873

      SELECT *
        FROM mtl_transaction_lots_temp
       WHERE transaction_temp_id = p_temp_id
         AND lot_number = v_lot_number;
Line: 6918

        mydebug('multiple_lpn_pick: getting outermost LPN for selected lpn ON PKLP');
Line: 6922

      SELECT parent_lpn_id,subinventory_code,locator_id
        INTO l_content_parent_lpn_id,l_lpn_sub,l_lpn_loc
        FROM wms_license_plate_numbers
       WHERE lpn_id = l_lpn_id
         AND organization_id = p_org_id;
Line: 6929

        mydebug('multiple_lpn_pick: outermost LPN for the selected LPN::' || l_content_parent_lpn_id);
Line: 6951

    SELECT transfer_cost_group_id
         , transfer_subinventory
         , transfer_to_location
         , lot_number
         , transaction_quantity
         , transaction_uom
         , inventory_item_id
         , last_updated_by
         , move_order_line_id
      INTO l_cost_group_id
         , l_sub
         , l_loc
         , l_lot
         , l_orig_qty
         , l_uom
         , l_item_id
         , l_user_id
         , l_mo_line_id
      FROM mtl_material_transactions_temp
     WHERE transaction_temp_id = l_temp_id;
Line: 7003

    SELECT mtl_material_transactions_s.NEXTVAL
      INTO l_new_temp_id
      FROM DUAL;
Line: 7011

    INSERT INTO mtl_material_transactions_temp
                (
                 transaction_header_id
               , transaction_temp_id
               , source_code
               , source_line_id
               , transaction_mode
               , lock_flag
               , last_update_date
               , last_updated_by
               , creation_date
               , created_by
               , last_update_login
               , request_id
               , program_application_id
               , program_id
               , program_update_date
               , inventory_item_id
               , revision
               , organization_id
               , subinventory_code
               , locator_id
               , transaction_quantity
               , primary_quantity
               , transaction_uom
               , transaction_cost
               , transaction_type_id
               , transaction_action_id
               , transaction_source_type_id
               , transaction_source_id
               , transaction_source_name
               , transaction_date
               , acct_period_id
               , distribution_account_id
               , transaction_reference
               , requisition_line_id
               , requisition_distribution_id
               , reason_id
               , lot_number
               , lot_expiration_date
               , serial_number
               , receiving_document
               , demand_id
               , rcv_transaction_id
               , move_transaction_id
               , completion_transaction_id
               , wip_entity_type
               , schedule_id
               , repetitive_line_id
               , employee_code
               , primary_switch
               , schedule_update_code
               , setup_teardown_code
               , item_ordering
               , negative_req_flag
               , operation_seq_num
               , picking_line_id
               , trx_source_line_id
               , trx_source_delivery_id
               , physical_adjustment_id
               , cycle_count_id
               , rma_line_id
               , customer_ship_id
               , currency_code
               , currency_conversion_rate
               , currency_conversion_type
               , currency_conversion_date
               , ussgl_transaction_code
               , vendor_lot_number
               , encumbrance_account
               , encumbrance_amount
               , ship_to_location
               , shipment_number
               , transfer_cost
               , transportation_cost
               , transportation_account
               , freight_code
               , containers
               , waybill_airbill
               , expected_arrival_date
               , transfer_subinventory
               , transfer_organization
               , transfer_to_location
               , new_average_cost
               , value_change
               , percentage_change
               , material_allocation_temp_id
               , demand_source_header_id
               , demand_source_line
               , demand_source_delivery
               , item_segments
               , item_description
               , item_trx_enabled_flag
               , item_location_control_code
               , item_restrict_subinv_code
               , item_restrict_locators_code
               , item_revision_qty_control_code
               , item_primary_uom_code
               , item_uom_class
               , item_shelf_life_code
               , item_shelf_life_days
               , item_lot_control_code
               , item_serial_control_code
               , item_inventory_asset_flag
               , allowed_units_lookup_code
               , department_id
               , department_code
               , wip_supply_type
               , supply_subinventory
               , supply_locator_id
               , valid_subinventory_flag
               , valid_locator_flag
               , locator_segments
               , current_locator_control_code
               , number_of_lots_entered
               , wip_commit_flag
               , next_lot_number
               , lot_alpha_prefix
               , next_serial_number
               , serial_alpha_prefix
               , shippable_flag
               , posting_flag
               , required_flag
               , process_flag
               , ERROR_CODE
               , error_explanation
               , attribute_category
               , attribute1
               , attribute2
               , attribute3
               , attribute4
               , attribute5
               , attribute6
               , attribute7
               , attribute8
               , attribute9
               , attribute10
               , attribute11
               , attribute12
               , attribute13
               , attribute14
               , attribute15
               , movement_id
               , reservation_quantity
               , shipped_quantity
               , transaction_line_number
               , task_id
               , to_task_id
               , source_task_id
               , project_id
               , source_project_id
               , pa_expenditure_org_id
               , to_project_id
               , expenditure_type
               , final_completion_flag
               , transfer_percentage
               , transaction_sequence_id
               , material_account
               , material_overhead_account
               , resource_account
               , outside_processing_account
               , overhead_account
               , flow_schedule
               , cost_group_id
               , demand_class
               , qa_collection_id
               , kanban_card_id
               , overcompletion_transaction_id
               , overcompletion_primary_qty
               , overcompletion_transaction_qty
               , end_item_unit_number
               , scheduled_payback_date
               , line_type_code
               , parent_transaction_temp_id
               , put_away_strategy_id
               , put_away_rule_id
               , pick_strategy_id
               , pick_rule_id
               , common_bom_seq_id
               , common_routing_seq_id
               , cost_type_id
               , org_cost_group_id
               , move_order_line_id
               , task_group_id
               , pick_slip_number
               , reservation_id
               , transaction_status
               , transfer_cost_group_id
               , lpn_id
               , transfer_lpn_id
               , content_lpn_id
               , cartonization_id
               , standard_operation_id
               , wms_task_type
               , task_priority
               , container_item_id
               , operation_plan_id
                )
      (SELECT transaction_header_id
            , l_new_temp_id
            , source_code
            , source_line_id
            , transaction_mode
            , lock_flag
            , SYSDATE
            , l_user_id
            , SYSDATE
            , l_user_id
            , last_update_login
            , request_id
            , program_application_id
            , program_id
            , program_update_date
            , inventory_item_id
            , revision
            , organization_id
            , l_lpn_sub                  --, subinventory_code changed to LPN's sub bug3765153
            , l_lpn_loc                  --, locator_id changed to LPN's sub bug3765153
            , l_qty
            , l_pr_qty
            , transaction_uom
            , transaction_cost
            , transaction_type_id
            , transaction_action_id
            , transaction_source_type_id
            , transaction_source_id
            , transaction_source_name
            , transaction_date
            , acct_period_id
            , distribution_account_id
            , transaction_reference
            , requisition_line_id
            , requisition_distribution_id
            , reason_id
            , lot_number
            , lot_expiration_date
            , serial_number
            , receiving_document
            , demand_id
            , rcv_transaction_id
            , move_transaction_id
            , completion_transaction_id
            , wip_entity_type
            , schedule_id
            , repetitive_line_id
            , employee_code
            , primary_switch
            , schedule_update_code
            , setup_teardown_code
            , item_ordering
            , negative_req_flag
            , operation_seq_num
            , picking_line_id
            , trx_source_line_id
            , trx_source_delivery_id
            , physical_adjustment_id
            , cycle_count_id
            , rma_line_id
            , customer_ship_id
            , currency_code
            , currency_conversion_rate
            , currency_conversion_type
            , currency_conversion_date
            , ussgl_transaction_code
            , vendor_lot_number
            , encumbrance_account
            , encumbrance_amount
            , ship_to_location
            , shipment_number
            , transfer_cost
            , transportation_cost
            , transportation_account
            , freight_code
            , containers
            , waybill_airbill
            , expected_arrival_date
            , transfer_subinventory
            , transfer_organization
            , transfer_to_location
            , new_average_cost
            , value_change
            , percentage_change
            , material_allocation_temp_id
            , demand_source_header_id
            , demand_source_line
            , demand_source_delivery
            , item_segments
            , item_description
            , item_trx_enabled_flag
            , item_location_control_code
            , item_restrict_subinv_code
            , item_restrict_locators_code
            , item_revision_qty_control_code
            , item_primary_uom_code
            , item_uom_class
            , item_shelf_life_code
            , item_shelf_life_days
            , item_lot_control_code
            , item_serial_control_code
            , item_inventory_asset_flag
            , allowed_units_lookup_code
            , department_id
            , department_code
            , wip_supply_type
            , supply_subinventory
            , supply_locator_id
            , valid_subinventory_flag
            , valid_locator_flag
            , locator_segments
            , current_locator_control_code
            , number_of_lots_entered
            , wip_commit_flag
            , next_lot_number
            , lot_alpha_prefix
            , next_serial_number
            , serial_alpha_prefix
            , shippable_flag
            , posting_flag
            , required_flag
            , process_flag
            , ERROR_CODE
            , error_explanation
            , attribute_category
            , attribute1
            , attribute2
            , attribute3
            , attribute4
            , attribute5
            , attribute6
            , attribute7
            , attribute8
            , attribute9
            , attribute10
            , attribute11
            , attribute12
            , attribute13
            , attribute14
            , attribute15
            , movement_id
            , reservation_quantity
            , shipped_quantity
            , transaction_line_number
            , task_id
            , to_task_id
            , source_task_id
            , project_id
            , source_project_id
            , pa_expenditure_org_id
            , to_project_id
            , expenditure_type
            , final_completion_flag
            , transfer_percentage
            , transaction_sequence_id
            , material_account
            , material_overhead_account
            , resource_account
            , outside_processing_account
            , overhead_account
            , flow_schedule
            , cost_group_id
            , demand_class
            , qa_collection_id
            , kanban_card_id
            , overcompletion_transaction_id
            , overcompletion_primary_qty
            , overcompletion_transaction_qty
            , end_item_unit_number
            , scheduled_payback_date
            , line_type_code
            , parent_transaction_temp_id
            , put_away_strategy_id
            , put_away_rule_id
            , pick_strategy_id
            , pick_rule_id
            , common_bom_seq_id
            , common_routing_seq_id
            , cost_type_id
            , org_cost_group_id
            , move_order_line_id
            , task_group_id
            , pick_slip_number
            , reservation_id
            , transaction_status
            , transfer_cost_group_id
            , l_temp_lpn_id
            , l_transfer_lpn_id
            , l_content_lpn_id
            , cartonization_id
            , standard_operation_id
            , wms_task_type
            , task_priority
            , container_item_id
            , operation_plan_id
         FROM mtl_material_transactions_temp
        WHERE transaction_temp_id = l_temp_id);
Line: 7409

    UPDATE mtl_material_transactions_temp
       SET transaction_quantity = transaction_quantity - l_qty
         , primary_quantity = primary_quantity - l_pr_qty
     WHERE transaction_temp_id = l_temp_id;
Line: 7418

    SELECT lot_control_code
         , serial_number_control_code
      INTO l_lot_code
         , l_serial_code
      FROM mtl_system_items
     WHERE organization_id = l_org_id
       AND inventory_item_id = l_item_id;
Line: 7433

        mydebug('multiple_lpn_pick: Inserting Lots');
Line: 7493

              SELECT mtl_material_transactions_s.NEXTVAL
                INTO l_new_serial_temp_id
                FROM DUAL;
Line: 7506

              inv_rcv_common_apis.insert_mtlt(l_mtlt_rec);
Line: 7513

                UPDATE mtl_serial_numbers_temp
                   SET transaction_temp_id = l_new_serial_temp_id
                 WHERE transaction_temp_id = l_lot_serial_temp_id
                   AND fm_serial_number = l_serial_number
                   AND to_serial_number = l_serial_number;
Line: 7524

              UPDATE mtl_transaction_lots_temp
                 SET primary_quantity = primary_quantity - l_mtlt_rec.primary_quantity
                   , transaction_quantity = transaction_quantity - l_mtlt_rec.transaction_quantity
               WHERE transaction_temp_id = p_temp_id
                 AND lot_number = l_lpn_lot_number;
Line: 7535

              UPDATE mtl_transaction_lots_temp
                 SET transaction_temp_id = l_new_temp_id
               WHERE transaction_temp_id = p_temp_id
                 AND lot_number = l_lpn_lot_number;
Line: 7594

              /* Moved the selection of serial temp id here */
              IF (l_serial_code > 1
                  AND l_serial_code <> 6) THEN
                SELECT mtl_material_transactions_s.NEXTVAL
                  INTO l_new_serial_temp_id
                  FROM DUAL;
Line: 7620

              inv_rcv_common_apis.insert_mtlt(l_mtlt_rec);
Line: 7632

              UPDATE mtl_transaction_lots_temp
                 SET primary_quantity = primary_quantity - l_mtlt_rec.primary_quantity
                   , transaction_quantity = transaction_quantity - l_mtlt_rec.transaction_quantity
               WHERE transaction_temp_id = p_temp_id
                 AND lot_number = l_lpn_lot_number;
Line: 7652

                  INSERT INTO mtl_serial_numbers_temp
                              (
                               transaction_temp_id
                             , last_update_date
                             , last_updated_by
                             , creation_date
                             , created_by
                             , fm_serial_number
                             , to_serial_number
                              )
                       VALUES (
                               l_new_serial_temp_id
                             , SYSDATE
                             , l_user_id
                             , SYSDATE
                             , l_user_id
                             , l_serial_number
                             , l_serial_number
                              );
Line: 7682

                SELECT mtl_material_transactions_s.NEXTVAL
                  INTO l_new_serial_temp_id
                  FROM DUAL;
Line: 7690

              UPDATE mtl_transaction_lots_temp
                 SET transaction_temp_id = l_new_temp_id
                   , serial_transaction_temp_id = NVL(l_new_serial_temp_id, serial_transaction_temp_id)
               WHERE transaction_temp_id = p_temp_id
                 AND lot_number = l_lpn_lot_number;
Line: 7696

              /* AS: Need to insert Serial Numbers here also*/
              IF (l_serial_code > 1
                  AND l_serial_code <> 6) THEN
                IF (l_debug = 1) THEN
                  mydebug('multiple_lpn_pick: Lot/Ser controlled, allocate to serial OFF');
Line: 7709

                  INSERT INTO mtl_serial_numbers_temp
                              (
                               transaction_temp_id
                             , last_update_date
                             , last_updated_by
                             , creation_date
                             , created_by
                             , fm_serial_number
                             , to_serial_number
                              )
                       VALUES (
                               l_new_serial_temp_id
                             , SYSDATE
                             , l_user_id
                             , SYSDATE
                             , l_user_id
                             , l_serial_number
                             , l_serial_number
                              );
Line: 7753

        UPDATE mtl_serial_numbers_temp
           SET transaction_temp_id = l_new_temp_id
         WHERE transaction_temp_id = p_temp_id
           AND fm_serial_number = l_serial_number
           AND to_serial_number = l_serial_number;
Line: 7773

        INSERT INTO mtl_serial_numbers_temp
                    (
                     transaction_temp_id
                   , last_update_date
                   , last_updated_by
                   , creation_date
                   , created_by
                   , fm_serial_number
                   , to_serial_number
                    )
             VALUES (
                     l_new_temp_id
                   , SYSDATE
                   , l_user_id
                   , SYSDATE
                   , l_user_id
                   , l_serial_number
                   , l_serial_number
                    );
Line: 7800

    SELECT wms_dispatched_tasks_s.NEXTVAL
      INTO l_next_task_id
      FROM DUAL;
Line: 7805

      mydebug('multiple_lpn_pick: Before Insert into WMSDT');
Line: 7808

    INSERT INTO wms_dispatched_tasks
                (
                 task_id
               , transaction_temp_id
               , organization_id
               , user_task_type
               , person_id
               , effective_start_date
               , effective_end_date
               , equipment_id
               , equipment_instance
               , person_resource_id
               , machine_resource_id
               , status
               , dispatched_time
               , last_update_date
               , last_updated_by
               , creation_date
               , created_by
               , task_type
               , loaded_time
               , operation_plan_id
               , move_order_line_id
                )
      (SELECT l_next_task_id
            , l_new_temp_id
            , organization_id
            , user_task_type
            , person_id
            , effective_start_date
            , effective_end_date
            , equipment_id
            , equipment_instance
            , person_resource_id
            , machine_resource_id
            , 4
            , dispatched_time
            , last_update_date
            , last_updated_by
            , creation_date
            , created_by
            , task_type
            , SYSDATE
            , operation_plan_id
            , move_order_line_id
         --to_date(to_char(sysdate,'DD-MON-YYYY HH:MI:SS'),'DD-MON-YYYY HH:MI:SS')
       FROM   wms_dispatched_tasks
        WHERE transaction_temp_id = l_temp_id);
Line: 7858

      mydebug('multiple_lpn_pick: Update WMSDT as loaded');
Line: 7978

      SELECT wda.delivery_id
        FROM wsh_delivery_assignments_v        wda
           , wsh_delivery_details            wdd
           , mtl_material_transactions_temp  mmtt
       WHERE mmtt.transfer_lpn_id   = l_lpn_id
         AND wda.delivery_detail_id = wdd.delivery_detail_id
         AND wdd.move_order_line_id = mmtt.move_order_line_id
         AND wdd.organization_id    = mmtt.organization_id;
Line: 7988

      SELECT lpn_id
           , lpn_context
           , outermost_lpn_id
        FROM wms_license_plate_numbers
       WHERE license_plate_number = p_pick_to_lpn;
Line: 7995

      SELECT lpn_id
      FROM   wms_license_plate_numbers
      START  WITH lpn_id = l_lpn_id
      CONNECT BY parent_lpn_id = PRIOR lpn_id;
Line: 8003

      SELECT wda.delivery_id
        FROM wsh_delivery_assignments_v        wda
           , wsh_delivery_details            wdd
           , mtl_material_transactions_temp  mmtt
       WHERE wda.delivery_detail_id   = wdd.delivery_detail_id
         AND wdd.move_order_line_id   = mmtt.move_order_line_id
         AND wdd.organization_id      = mmtt.organization_id
         AND mmtt.transaction_temp_id = p_temp_id
         AND mmtt.organization_id     = p_organization_id;
Line: 8014

      SELECT wda.delivery_id
        FROM wsh_delivery_assignments_v wda, wsh_delivery_details wdd
       WHERE wda.parent_delivery_detail_id = wdd.delivery_detail_id
         AND wdd.lpn_id = l_lpn_id
         AND wdd.released_status = 'X'   -- For LPN reuse ER : 6845650
         AND wdd.organization_id = p_organization_id;
Line: 8026

      SELECT NVL(mil.project_id, -1)
           , NVL(mil.task_id, -1)
        FROM mtl_item_locations mil, mtl_material_transactions_temp mmtt
       WHERE mil.inventory_location_id = mmtt.transfer_to_location
         AND mil.organization_id       = mmtt.organization_id
         AND mmtt.transfer_lpn_id      = p_pick_to_lpn
         AND mmtt.organization_id      = p_organization_id;
Line: 8039

      SELECT NVL(mil.project_id, -1)
           , NVL(mil.task_id, -1)
        FROM mtl_item_locations mil, mtl_material_transactions_temp mmtt
       WHERE mil.inventory_location_id = mmtt.transfer_to_location
         AND mil.organization_id       = mmtt.organization_id
         AND mmtt.organization_id      = p_organization_id
         AND mmtt.transaction_temp_id  = p_temp_id;
Line: 8048

      SELECT mol.carton_grouping_id
        FROM mtl_txn_request_lines mol, mtl_material_transactions_temp mmtt
       WHERE mmtt.transaction_temp_id = p_temp_id
         AND mmtt.organization_id     = mol.organization_id
         AND mmtt.move_order_line_id  = mol.line_id;
Line: 8055

      SELECT DISTINCT mol.carton_grouping_id
                 FROM mtl_txn_request_lines mol, mtl_material_transactions_temp mmtt
                WHERE mmtt.transfer_lpn_id = p_lpn_id
                  AND mmtt.organization_id = mol.organization_id
                  AND mmtt.move_order_line_id = mol.line_id;
Line: 8136

       UPDATE wms_license_plate_numbers
          SET lpn_context = wms_container_pub.lpn_context_packing
            , last_update_date = SYSDATE
            , last_updated_by = fnd_global.user_id
        WHERE lpn_id = pick_to_lpn_rec.lpn_id;
Line: 8155

    SELECT mtrh.move_order_type
         , mmtt.transaction_type_id
         , mmtt.wip_entity_type
      INTO l_mmtt_mo_type
         , l_mmtt_txn_type_id
         , l_mmtt_wip_entity_type
      FROM mtl_txn_request_headers         mtrh
         , mtl_txn_request_lines           mtrl
         , mtl_material_transactions_temp  mmtt
     WHERE mtrh.header_id           = mtrl.header_id
       AND mtrl.line_id             = mmtt.move_order_line_id
       AND mmtt.transaction_temp_id = p_temp_id;
Line: 8171

       SELECT mtrh.move_order_type
         , mmtt.wip_entity_type
    INTO l_mo_type_in_lpn
         , l_wip_entity_type_in_lpn
    FROM mtl_txn_request_headers         mtrh
         , mtl_txn_request_lines           mtrl
         , mtl_material_transactions_temp  mmtt
    WHERE mtrh.header_id       = mtrl.header_id
    AND mtrl.line_id         = mmtt.move_order_line_id
    AND mmtt.transfer_lpn_id = pick_to_lpn_rec.lpn_id
    AND ROWNUM < 2;
Line: 8225

    SELECT mmtt.transfer_subinventory
         , mmtt.transfer_to_location
         , mmtt.inventory_item_id
         , mmtt.operation_plan_id
      INTO l_xfr_sub
         , l_xfr_to_location
         , l_item_id
         , l_operation_plan_id
      FROM mtl_material_transactions_temp mmtt
     WHERE mmtt.transaction_temp_id = p_temp_id;
Line: 8239

       SELECT lpn_controlled_flag
         INTO l_lpn_controlled_flag
         FROM mtl_secondary_inventories
        WHERE organization_id = p_organization_id
          AND secondary_inventory_name = l_xfr_sub;
Line: 8258

          SELECT COUNT(*)
            INTO l_count
            FROM mtl_material_transactions_temp mmtt
           WHERE mmtt.transaction_temp_id <> p_temp_id
             AND mmtt.transfer_lpn_id = pick_to_lpn_rec.lpn_id
             AND ( NVL(mmtt.transfer_subinventory, 0) <> l_xfr_sub
                   OR
                   NVL(mmtt.transfer_to_location, 0)  <> l_xfr_to_location
                 );
Line: 8296

          SELECT 1
            INTO l_count
            FROM DUAL
           WHERE EXISTS
               ( SELECT 'x'
                   FROM mtl_material_transactions_temp  mmtt
                      , mtl_secondary_inventories       msi
                  WHERE mmtt.transaction_temp_id    <> p_temp_id
                    AND mmtt.transfer_lpn_id         = pick_to_lpn_rec.lpn_id
                    AND msi.organization_id          = p_organization_id
                    AND msi.secondary_inventory_name = mmtt.transfer_subinventory
                    AND msi.lpn_controlled_flag      = wms_globals.g_lpn_controlled_sub
               );
Line: 8333

      SELECT COUNT(1)
        INTO l_count
        FROM mtl_material_transactions_temp mmtt
       WHERE mmtt.transaction_temp_id <> p_temp_id
         AND mmtt.transfer_lpn_id      = pick_to_lpn_rec.lpn_id
         AND mmtt.operation_plan_id   <> l_operation_plan_id;
Line: 8471

          SELECT wdd.delivery_detail_id INTO  l_line_rows(1)
               FROM wsh_delivery_details    wdd
                   , mtl_material_transactions_temp  mmtt
               WHERE mmtt.transaction_temp_id = p_temp_id
               AND wdd.move_order_line_id = mmtt.move_order_line_id
               AND wdd.organization_id    = mmtt.organization_id;
Line: 8478

               SELECT wdd.delivery_detail_id  INTO  l_line_rows(2)
               FROM wsh_delivery_details  wdd
                    , mtl_material_transactions_temp  mmtt
               WHERE mmtt.transfer_lpn_id   = pick_to_lpn_rec.lpn_id
               AND wdd.move_order_line_id = mmtt.move_order_line_id
               AND wdd.organization_id    = mmtt.organization_id
               AND rownum<2;
Line: 8935

    SELECT transaction_header_id
         , subinventory_code
         , locator_id
         , transfer_subinventory
         , transfer_to_location
         , revision
         , transaction_quantity
         , primary_quantity
         , transaction_uom
         , inventory_item_id
         , last_updated_by
         , move_order_line_id
         , reservation_id
      INTO l_txn_header_id
         , l_sug_sub
         , l_sug_loc
         , l_to_sub
         , l_to_loc
         , l_sug_rev
         , l_orig_txn_qty
         , l_orig_primary_qty
         , l_sug_uom
         , l_item_id
         , l_user_id
         , l_mo_line_id
         , l_reservation_id
      FROM mtl_material_transactions_temp
     WHERE transaction_temp_id = l_temp_id;
Line: 8967

    SELECT lot_control_code
         , serial_number_control_code
      INTO l_lot_code
         , l_serial_code
      FROM mtl_system_items
     WHERE organization_id = p_org_id
       AND inventory_item_id = l_item_id;
Line: 9143

      SELECT 1
        INTO l_to_lpn_exists
        FROM wms_license_plate_numbers
       WHERE license_plate_number = p_to_lpn
         AND organization_id = p_org_id;
Line: 9229

      SELECT lpn_id
           , lpn_context
        INTO l_to_lpn_id
           , l_to_lpn_context
        FROM wms_license_plate_numbers
       WHERE license_plate_number = p_to_lpn
         AND organization_id = p_org_id;
Line: 9253

      SELECT subinventory_code,locator_id  --Bug#4339517 . Added locator_id
        INTO l_res_sub,l_res_loc           --Bug#4339517 . Added l_res_loc
        FROM mtl_reservations
       WHERE reservation_id = l_reservation_id
         AND organization_id = p_org_id
         AND inventory_item_id = l_item_id;
Line: 9400

      SELECT mtl_material_transactions_s.NEXTVAL
        INTO l_new_temp_id
        FROM DUAL;
Line: 9415

      INSERT INTO mtl_material_transactions_temp
                  (
                   transaction_header_id
                 , transaction_temp_id
                 , source_code
                 , source_line_id
                 , transaction_mode
                 , lock_flag
                 , last_update_date
                 , last_updated_by
                 , creation_date
                 , created_by
                 , last_update_login
                 , request_id
                 , program_application_id
                 , program_id
                 , program_update_date
                 , inventory_item_id
                 , revision
                 , organization_id
                 , subinventory_code
                 , locator_id
                 , transaction_quantity
                 , primary_quantity
                 , transaction_uom
                 , transaction_cost
                 , transaction_type_id
                 , transaction_action_id
                 , transaction_source_type_id
                 , transaction_source_id
                 , transaction_source_name
                 , transaction_date
                 , acct_period_id
                 , distribution_account_id
                 , transaction_reference
                 , requisition_line_id
                 , requisition_distribution_id
                 , reason_id
                 , lot_number
                 , lot_expiration_date
                 , serial_number
                 , receiving_document
                 , demand_id
                 , rcv_transaction_id
                 , move_transaction_id
                 , completion_transaction_id
                 , wip_entity_type
                 , schedule_id
                 , repetitive_line_id
                 , employee_code
                 , primary_switch
                 , schedule_update_code
                 , setup_teardown_code
                 , item_ordering
                 , negative_req_flag
                 , operation_seq_num
                 , picking_line_id
                 , trx_source_line_id
                 , trx_source_delivery_id
                 , physical_adjustment_id
                 , cycle_count_id
                 , rma_line_id
                 , customer_ship_id
                 , currency_code
                 , currency_conversion_rate
                 , currency_conversion_type
                 , currency_conversion_date
                 , ussgl_transaction_code
                 , vendor_lot_number
                 , encumbrance_account
                 , encumbrance_amount
                 , ship_to_location
                 , shipment_number
                 , transfer_cost
                 , transportation_cost
                 , transportation_account
                 , freight_code
                 , containers
                 , waybill_airbill
                 , expected_arrival_date
                 , transfer_subinventory
                 , transfer_organization
                 , transfer_to_location
                 , new_average_cost
                 , value_change
                 , percentage_change
                 , material_allocation_temp_id
                 , demand_source_header_id
                 , demand_source_line
                 , demand_source_delivery
                 , item_segments
                 , item_description
                 , item_trx_enabled_flag
                 , item_location_control_code
                 , item_restrict_subinv_code
                 , item_restrict_locators_code
                 , item_revision_qty_control_code
                 , item_primary_uom_code
                 , item_uom_class
                 , item_shelf_life_code
                 , item_shelf_life_days
                 , item_lot_control_code
                 , item_serial_control_code
                 , item_inventory_asset_flag
                 , allowed_units_lookup_code
                 , department_id
                 , department_code
                 , wip_supply_type
                 , supply_subinventory
                 , supply_locator_id
                 , valid_subinventory_flag
                 , valid_locator_flag
                 , locator_segments
                 , current_locator_control_code
                 , number_of_lots_entered
                 , wip_commit_flag
                 , next_lot_number
                 , lot_alpha_prefix
                 , next_serial_number
                 , serial_alpha_prefix
                 , shippable_flag
                 , posting_flag
                 , required_flag
                 , process_flag
                 , ERROR_CODE
                 , error_explanation
                 , attribute_category
                 , attribute1
                 , attribute2
                 , attribute3
                 , attribute4
                 , attribute5
                 , attribute6
                 , attribute7
                 , attribute8
                 , attribute9
                 , attribute10
                 , attribute11
                 , attribute12
                 , attribute13
                 , attribute14
                 , attribute15
                 , movement_id
                 , reservation_quantity
                 , shipped_quantity
                 , transaction_line_number
                 , task_id
                 , to_task_id
                 , source_task_id
                 , project_id
                 , source_project_id
                 , pa_expenditure_org_id
                 , to_project_id
                 , expenditure_type
                 , final_completion_flag
                 , transfer_percentage
                 , transaction_sequence_id
                 , material_account
                 , material_overhead_account
                 , resource_account
                 , outside_processing_account
                 , overhead_account
                 , flow_schedule
                 , cost_group_id
                 , demand_class
                 , qa_collection_id
                 , kanban_card_id
                 , overcompletion_transaction_id
                 , overcompletion_primary_qty
                 , overcompletion_transaction_qty
                 , end_item_unit_number
                 , scheduled_payback_date
                 , line_type_code
                 , parent_transaction_temp_id
                 , put_away_strategy_id
                 , put_away_rule_id
                 , pick_strategy_id
                 , pick_rule_id
                 , common_bom_seq_id
                 , common_routing_seq_id
                 , cost_type_id
                 , org_cost_group_id
                 , move_order_line_id
                 , task_group_id
                 , pick_slip_number
                 , reservation_id
                 , transaction_status
                 , transfer_cost_group_id
                 , lpn_id
                 , transfer_lpn_id
                 , content_lpn_id
                 , cartonization_id
                 , standard_operation_id
                 , wms_task_type
                 , task_priority
                 , container_item_id
                 , operation_plan_id
                  )
        (SELECT transaction_header_id
              , l_new_temp_id
              , source_code
              , source_line_id
              , transaction_mode
              , lock_flag
              , SYSDATE
              , l_user_id
              , SYSDATE
              , l_user_id
              , last_update_login
              , request_id
              , program_application_id
              , program_id
              , program_update_date
              , inventory_item_id
              , revision
              , organization_id
              , subinventory_code
              , locator_id
              , l_qty
              , l_pr_qty
              , transaction_uom
              , transaction_cost
              , transaction_type_id
              , transaction_action_id
              , transaction_source_type_id
              , transaction_source_id
              , transaction_source_name
              , transaction_date
              , acct_period_id
              , distribution_account_id
              , transaction_reference
              , requisition_line_id
              , requisition_distribution_id
              , reason_id
              , lot_number
              , lot_expiration_date
              , serial_number
              , receiving_document
              , demand_id
              , rcv_transaction_id
              , move_transaction_id
              , completion_transaction_id
              , wip_entity_type
              , schedule_id
              , repetitive_line_id
              , employee_code
              , primary_switch
              , schedule_update_code
              , setup_teardown_code
              , item_ordering
              , negative_req_flag
              , operation_seq_num
              , picking_line_id
              , trx_source_line_id
              , trx_source_delivery_id
              , physical_adjustment_id
              , cycle_count_id
              , rma_line_id
              , customer_ship_id
              , currency_code
              , currency_conversion_rate
              , currency_conversion_type
              , currency_conversion_date
              , ussgl_transaction_code
              , vendor_lot_number
              , encumbrance_account
              , encumbrance_amount
              , ship_to_location
              , shipment_number
              , transfer_cost
              , transportation_cost
              , transportation_account
              , freight_code
              , containers
              , waybill_airbill
              , expected_arrival_date
              , transfer_subinventory
              , transfer_organization
              , transfer_to_location
              , new_average_cost
              , value_change
              , percentage_change
              , material_allocation_temp_id
              , demand_source_header_id
              , demand_source_line
              , demand_source_delivery
              , item_segments
              , item_description
              , item_trx_enabled_flag
              , item_location_control_code
              , item_restrict_subinv_code
              , item_restrict_locators_code
              , item_revision_qty_control_code
              , item_primary_uom_code
              , item_uom_class
              , item_shelf_life_code
              , item_shelf_life_days
              , item_lot_control_code
              , item_serial_control_code
              , item_inventory_asset_flag
              , allowed_units_lookup_code
              , department_id
              , department_code
              , wip_supply_type
              , supply_subinventory
              , supply_locator_id
              , valid_subinventory_flag
              , valid_locator_flag
              , locator_segments
              , current_locator_control_code
              , number_of_lots_entered
              , wip_commit_flag
              , next_lot_number
              , lot_alpha_prefix
              , next_serial_number
              , serial_alpha_prefix
              , shippable_flag
              , posting_flag
              , required_flag
              , process_flag
              , ERROR_CODE
              , error_explanation
              , attribute_category
              , attribute1
              , attribute2
              , attribute3
              , attribute4
              , attribute5
              , attribute6
              , attribute7
              , attribute8
              , attribute9
              , attribute10
              , attribute11
              , attribute12
              , attribute13
              , attribute14
              , attribute15
              , movement_id
              , reservation_quantity
              , shipped_quantity
              , transaction_line_number
              , task_id
              , to_task_id
              , source_task_id
              , project_id
              , source_project_id
              , pa_expenditure_org_id
              , to_project_id
              , expenditure_type
              , final_completion_flag
              , transfer_percentage
              , transaction_sequence_id
              , material_account
              , material_overhead_account
              , resource_account
              , outside_processing_account
              , overhead_account
              , flow_schedule
              , cost_group_id
              , demand_class
              , qa_collection_id
              , kanban_card_id
              , overcompletion_transaction_id
              , overcompletion_primary_qty
              , overcompletion_transaction_qty
              , end_item_unit_number
              , scheduled_payback_date
              , line_type_code
              , parent_transaction_temp_id
              , put_away_strategy_id
              , put_away_rule_id
              , pick_strategy_id
              , pick_rule_id
              , common_bom_seq_id
              , common_routing_seq_id
              , cost_type_id
              , org_cost_group_id
              , move_order_line_id
              , task_group_id
              , pick_slip_number
              , l_to_reservation_id -- This is the new reservation ID
              , transaction_status
              , transfer_cost_group_id
              , NULL -- lpn_id is null for loose
              , l_to_lpn_id -- transfer_lpn_id is toLPN for loose
              , NULL -- content_lpn_id is NULL for loose
              , cartonization_id
              , standard_operation_id
              , wms_task_type
              , task_priority
              , container_item_id
              , operation_plan_id
           FROM mtl_material_transactions_temp
          WHERE transaction_temp_id = l_temp_id);
Line: 9815

      UPDATE mtl_material_transactions_temp
         SET transaction_quantity = transaction_quantity - l_qty
           , primary_quantity = primary_quantity - l_pr_qty
           , lpn_id = null         --bug 4046834
           , content_lpn_id = null
           , transfer_lpn_id = null
           , last_update_date = SYSDATE
           , last_updated_by = l_user_id
       WHERE transaction_temp_id = l_temp_id;
Line: 9835

          mydebug('multiple_pick: Inserting Lots');
Line: 9838

        SELECT *
          INTO l_mtlt_rec
          FROM mtl_transaction_lots_temp
         WHERE transaction_temp_id = l_temp_id
           AND lot_number = p_lot;
Line: 9854

          SELECT mtl_material_transactions_s.NEXTVAL
            INTO l_new_serial_temp_id
            FROM DUAL;
Line: 9860

          UPDATE mtl_serial_numbers_temp
             SET transaction_temp_id = l_new_serial_temp_id
           WHERE transaction_temp_id = l_mtlt_rec.serial_transaction_temp_id
             AND fm_serial_number = l_fm_serial
             AND to_serial_number = l_to_serial;
Line: 9876

          SELECT mtl_material_transactions_s.NEXTVAL
            INTO l_new_serial_temp_id
            FROM DUAL;
Line: 9889

          mydebug('multiple_pick: Inserting into MTLT');
Line: 9897

        inv_rcv_common_apis.insert_mtlt(l_mtlt_rec);
Line: 9900

        UPDATE mtl_transaction_lots_temp
           SET primary_quantity = primary_quantity - l_mtlt_rec.primary_quantity
             , transaction_quantity = transaction_quantity - l_mtlt_rec.transaction_quantity
             , last_update_date = SYSDATE
             , last_updated_by = l_user_id
         WHERE transaction_temp_id = l_temp_id
           AND lot_number = p_lot;
Line: 9911

          mydebug('multiple_pick: After lot update');
Line: 9916

        DELETE FROM mtl_transaction_lots_temp
              WHERE transaction_quantity = 0
                AND lot_number = p_lot
                AND transaction_temp_id = p_temp_id;
Line: 9933

          UPDATE mtl_serial_numbers_temp
             SET transaction_temp_id = l_new_temp_id
           WHERE transaction_temp_id = l_temp_id
             AND fm_serial_number = l_fm_serial
             AND to_serial_number = l_to_serial;
Line: 9948

      SELECT wms_dispatched_tasks_s.NEXTVAL
        INTO l_next_task_id
        FROM DUAL;
Line: 9955

        mydebug('multiple_pick: Before Insert into WMSDT');
Line: 9958

      INSERT INTO wms_dispatched_tasks
                  (
                   task_id
                 , transaction_temp_id
                 , organization_id
                 , user_task_type
                 , person_id
                 , effective_start_date
                 , effective_end_date
                 , equipment_id
                 , equipment_instance
                 , person_resource_id
                 , machine_resource_id
                 , status
                 , dispatched_time
                 , last_update_date
                 , last_updated_by
                 , creation_date
                 , created_by
                 , task_type
                 , loaded_time
                 , operation_plan_id
                 , move_order_line_id
                  )
        (SELECT l_next_task_id
              , l_new_temp_id
              , organization_id
              , user_task_type
              , person_id
              , effective_start_date
              , effective_end_date
              , equipment_id
              , equipment_instance
              , person_resource_id
              , machine_resource_id
              , 3
              , dispatched_time
              , last_update_date
              , last_updated_by
              , creation_date
              , created_by
              , task_type
              , SYSDATE
              , operation_plan_id
              , move_order_line_id
           --to_date(to_char(sysdate,'DD-MON-YYYY HH:MI:SS'),'DD-MON-YYYY HH:MI:SS')
         FROM   wms_dispatched_tasks
          WHERE transaction_temp_id = l_temp_id);
Line: 10027

            this IS the CASE, we DO NOT need TO INSERT INTO mtlt OR msnt */
          l_lpn_exact_match  := 'Y';
Line: 10036

      SELECT subinventory_code
           , locator_id
        INTO l_act_sub
           , l_act_loc
        FROM wms_license_plate_numbers
       WHERE lpn_id = l_from_lpn_id;
Line: 10048

          mydebug('multiple_pick: getting outermost LPN for selected lpn ON PKLP');
Line: 10051

        SELECT parent_lpn_id
          INTO l_content_parent_lpn_id
          FROM wms_license_plate_numbers
         WHERE lpn_id = l_from_lpn_id
           AND organization_id = p_org_id;
Line: 10058

          mydebug('multiple_pick: outermost LPN for the selected LPN::' || l_content_parent_lpn_id);
Line: 10073

        UPDATE mtl_material_transactions_temp
           SET content_lpn_id = l_from_lpn_id
             , transfer_lpn_id = l_to_lpn_id
             , lpn_id = l_lpn_id
             , subinventory_code = l_act_sub
             , locator_id = l_act_loc
             , transaction_uom = p_act_uom
             , last_update_date = SYSDATE
             , last_updated_by = l_user_id
         WHERE transaction_temp_id = l_local_temp_id;
Line: 10084

        UPDATE mtl_material_transactions_temp
           SET transfer_lpn_id = l_to_lpn_id
             , lpn_id = l_from_lpn_id
             , content_lpn_id = NULL
             , subinventory_code = l_act_sub
             , locator_id = l_act_loc
             , transaction_uom = p_act_uom
             , last_update_date = SYSDATE
             , last_updated_by = l_user_id
         WHERE transaction_temp_id = l_local_temp_id;
Line: 10104

          SELECT NVL(serial_transaction_temp_id, 0)
            INTO l_lot_ser_seq
            FROM mtl_transaction_lots_temp
           WHERE transaction_temp_id = l_local_temp_id
             AND lot_number = l_lot;
Line: 10113

            SELECT mtl_material_transactions_s.NEXTVAL
              INTO l_new_serial_temp_id
              FROM DUAL;
Line: 10123

            INSERT INTO mtl_serial_numbers_temp
                        (
                         transaction_temp_id
                       , last_update_date
                       , last_updated_by
                       , creation_date
                       , created_by
                       , fm_serial_number
                       , to_serial_number
                        )
                 VALUES (
                         l_new_serial_temp_id
                       , SYSDATE
                       , l_user_id
                       , SYSDATE
                       , l_user_id
                       , l_fm_serial
                       , l_to_serial
                        );
Line: 10150

          UPDATE mtl_serial_numbers
             SET group_mark_id = l_txn_header_id
           WHERE inventory_item_id = l_item_id
             AND current_organization_id = p_org_id
             AND serial_number IN(SELECT fm_serial_number
                                    FROM mtl_serial_numbers_temp msnt
                                   WHERE msnt.transaction_temp_id = l_new_serial_temp_id);
Line: 10159

        SELECT count(MSNT.transaction_temp_id)
   INTO   l_serial_count
   FROM   Mtl_Serial_Numbers_Temp MSNT
   WHERE  MSNT.fm_serial_number = l_fm_serial;
Line: 10178

          UPDATE mtl_transaction_lots_temp
             SET transaction_quantity = l_qty
               , primary_quantity = l_pr_qty
               , serial_transaction_temp_id = l_new_serial_temp_id
               , last_update_date = SYSDATE
               , last_updated_by = l_user_id
           WHERE transaction_temp_id = l_local_temp_id
             AND lot_number = p_lot;
Line: 10189

              mydebug('multiple_pick: MTLT did not get updated. Lot number NOT passed');
Line: 10206

          INSERT INTO mtl_serial_numbers_temp
                      (
                       transaction_temp_id
                     , last_update_date
                     , last_updated_by
                     , creation_date
                     , created_by
                     , fm_serial_number
                     , to_serial_number
                     , serial_prefix
                      )
               VALUES (
                       l_local_temp_id
                     , SYSDATE
                     , l_user_id
                     , SYSDATE
                     , l_user_id
                     , l_fm_serial
                     , l_to_serial
                     , l_serial_prefix
                      );
Line: 10231

        UPDATE mtl_serial_numbers
           SET group_mark_id = l_txn_header_id
         WHERE inventory_item_id = l_item_id
           AND current_organization_id = p_org_id
           AND serial_number IN(SELECT fm_serial_number
                                  FROM mtl_serial_numbers_temp msnt
                                 WHERE msnt.transaction_temp_id = l_local_temp_id);
Line: 10240

        SELECT count(MSNT.transaction_temp_id)
   INTO   l_serial_count
   FROM   Mtl_Serial_Numbers_Temp MSNT
   WHERE  MSNT.fm_serial_number = l_fm_serial;
Line: 10276

      UPDATE mtl_material_transactions_temp
         SET transfer_lpn_id = l_to_lpn_id
           , lpn_id = NULL
           , content_lpn_id = NULL
           , subinventory_code = l_act_sub
           , locator_id = l_act_loc
           , last_update_date = SYSDATE
           , last_updated_by = l_user_id
       WHERE transaction_temp_id = l_local_temp_id;
Line: 10291

          SELECT NVL(serial_transaction_temp_id, 0)
            INTO l_lot_ser_seq
            FROM mtl_transaction_lots_temp
           WHERE transaction_temp_id = l_local_temp_id
             AND lot_number = l_lot;
Line: 10300

            SELECT mtl_material_transactions_s.NEXTVAL
              INTO l_new_serial_temp_id
              FROM DUAL;
Line: 10308

            INSERT INTO mtl_serial_numbers_temp
                        (
                         transaction_temp_id
                       , last_update_date
                       , last_updated_by
                       , creation_date
                       , created_by
                       , fm_serial_number
                       , to_serial_number
                        )
                 VALUES (
                         l_new_serial_temp_id
                       , SYSDATE
                       , l_user_id
                       , SYSDATE
                       , l_user_id
                       , l_fm_serial
                       , l_to_serial
                        );
Line: 10331

          UPDATE mtl_serial_numbers
             SET group_mark_id = l_txn_header_id
           WHERE inventory_item_id = l_item_id
             AND current_organization_id = p_org_id
             AND serial_number IN(SELECT fm_serial_number
                                    FROM mtl_serial_numbers_temp
                                   WHERE transaction_temp_id = l_new_serial_temp_id);
Line: 10340

        SELECT count(MSNT.transaction_temp_id)
   INTO   l_serial_count
   FROM   Mtl_Serial_Numbers_Temp MSNT
   WHERE  MSNT.fm_serial_number = l_fm_serial;
Line: 10356

        UPDATE mtl_transaction_lots_temp
           SET transaction_quantity = l_qty
             , primary_quantity = l_pr_qty
             , serial_transaction_temp_id = l_new_serial_temp_id
             , last_update_date = SYSDATE
             , last_updated_by = l_user_id
         WHERE transaction_temp_id = l_local_temp_id
           AND lot_number = p_lot;
Line: 10379

          INSERT INTO mtl_serial_numbers_temp
                      (
                       transaction_temp_id
                     , last_update_date
                     , last_updated_by
                     , creation_date
                     , created_by
                     , fm_serial_number
                     , to_serial_number
                     , serial_prefix
                      )
               VALUES (
                       l_local_temp_id
                     , SYSDATE
                     , l_user_id
                     , SYSDATE
                     , l_user_id
                     , l_fm_serial
                     , l_to_serial
                     , NVL(l_serial_prefix, 1)
                      );
Line: 10404

        UPDATE mtl_serial_numbers
           SET group_mark_id = l_txn_header_id
         WHERE inventory_item_id = l_item_id
           AND current_organization_id = p_org_id
           AND serial_number IN(SELECT fm_serial_number
                                  FROM mtl_serial_numbers_temp
                                 WHERE transaction_temp_id = l_local_temp_id);
Line: 10413

        SELECT count(MSNT.transaction_temp_id)
   INTO   l_serial_count
   FROM   Mtl_Serial_Numbers_Temp MSNT
   WHERE  MSNT.fm_serial_number = l_fm_serial;
Line: 10435

        mydebug('multiple_pick: Lot or serial controlled. Do not updated wmsdt AS loaded');
Line: 10439

        mydebug('multiple_pick: Plain item. Update WMSDT as loaded');
Line: 10442

      UPDATE wms_dispatched_tasks
         SET status = 4
           , loaded_time = SYSDATE
           , --to_date(to_char(sysdate,'DD-MON-YYYY HH:MI:SS'),'DD-MON-YYYY HH:MI:SS'),
             last_update_date = SYSDATE
           , last_updated_by = l_user_id
       WHERE transaction_temp_id = l_local_temp_id;
Line: 10462

      UPDATE wms_license_plate_numbers
         SET lpn_context = wms_container_pub.lpn_context_packing
           , last_update_date = SYSDATE
           , last_updated_by = fnd_global.user_id
       WHERE lpn_id = l_to_lpn_id;
Line: 10522

    /* SELECT COUNT(*) INTO l_exist FROM wms_license_plate_numbers
     WHERE license_plate_number=p_lpn;*/
Line: 10525

      SELECT 1
        INTO l_exist
        FROM DUAL
       WHERE EXISTS(SELECT 1
                      FROM wms_license_plate_numbers
                     WHERE license_plate_number = p_lpn);
Line: 10586

      SELECT lpn_id
        INTO p_lpn_id
        FROM wms_license_plate_numbers
       WHERE license_plate_number = p_lpn;
Line: 10669

      SELECT mmtt.transaction_temp_id
        FROM mtl_material_transactions_temp mmtt
       WHERE mmtt.transaction_header_id = l_txn_header_id
         AND mmtt.organization_id = l_org_id;
Line: 10676

           SELECT serial_number
                , organization_id
                , inventory_item_id
                , transaction_temp_id, lpn_id
           FROM wms_wsh_wdd_gtemp WHERE lpn_id = lpnid_in_msn;
Line: 10684

           SELECT lpn_id
           FROM   wms_license_plate_numbers
           START  WITH lpn_id = l_xfrlpnid
           CONNECT BY PRIOR lpn_id = parent_lpn_id;
Line: 10748

       SELECT WDD.DELIVERY_DETAIL_ID,
	 MTRL.SHIP_SET_ID,
	 MTRL.SHIP_MODEL_ID,
	 WRD.primary_quantity WRD_PRI_QUANTITY,
	 Nvl(WDD.requested_quantity,0) REQUESTED_QUANTITY,
	 WRD.primary_uom,
	 wrd.repl_type,
	 wrd.repl_level, -- TO DECIDE WHETHER TO PICK_RELEASE DEMAND OR allocate repl MO FOR LEVEL > 1
	 wdd.batch_id,
	 wrd.demand_type_id
	 FROM
	 wms_replenishment_details WRD,
	 MTL_TXN_REQUEST_LINES MTRL,
	 WSH_DELIVERY_DETAILS WDD
	 WHERE WRD.ORGANIZATION_ID = P_ORG_ID
	 AND WRD.SOURCE_LINE_ID    = p_mo_line_id
	 AND wrd.demand_type_id <> 4 -- true only for first level of REPL
	 AND WRD.SOURCE_LINE_ID    = MTRL.LINE_ID
	 AND WRD.SOURCE_HEADER_ID  = MTRL.HEADER_ID
	 AND WRD.ORGANIZATION_ID   = MTRL.ORGANIZATION_ID
	 AND WRD.INVENTORY_ITEM_ID = MTRL.INVENTORY_ITEM_ID
	 AND WRD.DEMAND_LINE_DETAIL_ID  = WDD.delivery_detail_id
	 AND WRD.ORGANIZATION_ID = WDD.organization_id
	 ORDER BY wdd.batch_id, DEMAND_SORT_ORDER;
Line: 10774

       SELECT wrd.demand_header_id,
	 wrd.demand_line_id,
	 WRD.primary_quantity WRD_PRI_QUANTITY,
	 wrd.repl_level, -- TO DECIDE WHETHER TO PICK_RELEASE DEMAND OR allocate repl MO FOR LEVEL > 1
	 wrd.demand_type_id
	 FROM
	 wms_replenishment_details WRD,
	 MTL_TXN_REQUEST_LINES MTRL
	 WHERE WRD.ORGANIZATION_ID = P_ORG_ID
	 AND WRD.SOURCE_LINE_ID    = p_mo_line_id
	 AND wrd.demand_type_id = 4  -- true for multi level repl (>1)
	 AND WRD.SOURCE_LINE_ID    = MTRL.LINE_ID
	 AND WRD.SOURCE_HEADER_ID  = MTRL.HEADER_ID
	 AND WRD.ORGANIZATION_ID   = MTRL.ORGANIZATION_ID
	 AND WRD.INVENTORY_ITEM_ID = MTRL.inventory_item_id
	 ORDER BY DEMAND_SORT_ORDER;
Line: 10794

       SELECT
	 WDD.DELIVERY_DETAIL_ID,
	 wdd.requested_quantity AS PRIMARY_QUANTITY,  -- this is always stored in primary UOM
	   wdd.requested_quantity_uom,

	   -- get for sort_attribute1
	   To_number(DECODE(l_release_sequence_rule_id,
	          null,
                  null,
                  DECODE(g_ordered_psr(1).attribute_name,
                         'ORDER_NUMBER',
                         DECODE(L_ORDER_ID_SORT,
                                'ASC',
                                To_number(wdd.source_header_number),
                                'DESC',
                                (-1 * To_number(wdd.SOURCE_HEADER_NUMBER)),
                                null),
                         'SHIPMENT_PRIORITY',
			 DECODE(WDD.SHIPMENT_PRIORITY_CODE,
				'High',
				20,
				'Standard',
				10,
			       NULL),
			 'INVOICE_VALUE',
                         wms_replenishment_pvt.GET_SORT_INVOICE_VALUE(WDD.SOURCE_HEADER_ID,
                                                L_INVOICE_VALUE_SORT),
                         'SCHEDULE_DATE',
                         DECODE(L_SCHEDULE_DATE_SORT,
                                 'ASC',
                                (WDD.DATE_SCHEDULED -
                                TO_DATE('01-01-1700 23:59:59',
                                         'DD-MM-YYYY HH24:MI:SS')),
                                'DESC',
                                (TO_DATE('01-01-1700 23:59:59',
                                         'DD-MM-YYYY HH24:MI:SS') -
                                WDD.DATE_SCHEDULED),
                                null),
                         'TRIP_STOP_DATE',
                         wms_replenishment_pvt.GET_SORT_TRIP_STOP_DATE(wdd.delivery_detail_id,
                                                 L_TRIP_STOP_DATE_SORT),
                         NULL))) as sort_attribute1,

           -- get for sort_attribute2
            To_number(DECODE(l_release_sequence_rule_id,
                  null,
                  null,
                  DECODE(g_ordered_psr(2).attribute_name,
                         'ORDER_NUMBER',
			 DECODE(L_ORDER_ID_SORT,
				'ASC',
                                To_number(wdd.source_header_number),
                                'DESC',
                                (-1 * To_number(wdd.SOURCE_HEADER_NUMBER)),
                                null),
                         'SHIPMENT_PRIORITY',
			 DECODE(WDD.SHIPMENT_PRIORITY_CODE,
				'High',
				20,
				'Standard',
				10,
				NULL),
                         'INVOICE_VALUE',
                         wms_replenishment_pvt.GET_SORT_INVOICE_VALUE(WDD.SOURCE_HEADER_ID,
                                                L_INVOICE_VALUE_SORT),
                         'SCHEDULE_DATE',
                         DECODE(L_SCHEDULE_DATE_SORT,
				'ASC',
                                (WDD.DATE_SCHEDULED -
                                TO_DATE('01-01-1700 23:59:59',
                                         'DD-MM-YYYY HH24:MI:SS')),
                                'DESC',
                                (TO_DATE('01-01-1700 23:59:59',
                                         'DD-MM-YYYY HH24:MI:SS') -
                                WDD.DATE_SCHEDULED),
                                null),
                         'TRIP_STOP_DATE',
                         wms_replenishment_pvt.GET_SORT_TRIP_STOP_DATE(wdd.delivery_detail_id,
                                                 L_TRIP_STOP_DATE_SORT),
                         NULL))) as sort_attribute2,

           -- get for sort_attribute3
            To_number(DECODE(l_release_sequence_rule_id,
                  null,
                  null,
                  DECODE(g_ordered_psr(3).attribute_name,
                         'ORDER_NUMBER',
			 DECODE(L_ORDER_ID_SORT,
				'ASC',
                                To_number(wdd.source_header_number),
                                'DESC',
                                (-1 * To_number(wdd.SOURCE_HEADER_NUMBER)),
                                null),
                         'SHIPMENT_PRIORITY',
			 DECODE(WDD.SHIPMENT_PRIORITY_CODE,
				'High',
				20,
				'Standard',
				10,
				NULL),
                         'INVOICE_VALUE',
                         wms_replenishment_pvt.GET_SORT_INVOICE_VALUE(WDD.SOURCE_HEADER_ID,
                                                L_INVOICE_VALUE_SORT),
                         'SCHEDULE_DATE',
                         DECODE(L_SCHEDULE_DATE_SORT,
				'ASC',
                                (WDD.DATE_SCHEDULED -
                                TO_DATE('01-01-1700 23:59:59',
                                         'DD-MM-YYYY HH24:MI:SS')),
                                'DESC',
                                (TO_DATE('01-01-1700 23:59:59',
                                         'DD-MM-YYYY HH24:MI:SS') -
                                WDD.DATE_SCHEDULED),
                                null),
                         'TRIP_STOP_DATE',
                         wms_replenishment_pvt.GET_SORT_TRIP_STOP_DATE(wdd.delivery_detail_id,
                                                 L_TRIP_STOP_DATE_SORT),
                         NULL))) as sort_attribute3,

           -- get for sort_attribute4
            To_number(DECODE(l_release_sequence_rule_id,
                  null,
                  null,
                  DECODE(g_ordered_psr(4).attribute_name,
                         'ORDER_NUMBER',
			 DECODE(L_ORDER_ID_SORT,
				'ASC',
                                To_number(wdd.source_header_number),
                                'DESC',
                                (-1 * To_number(wdd.SOURCE_HEADER_NUMBER)),
                                null),
                         'SHIPMENT_PRIORITY',
			 DECODE(WDD.SHIPMENT_PRIORITY_CODE,
				'High',
				20,
				'Standard',
				10,
				NULL),
			 'INVOICE_VALUE',
                         wms_replenishment_pvt.GET_SORT_INVOICE_VALUE(WDD.SOURCE_HEADER_ID,
                                                L_INVOICE_VALUE_SORT),
                         'SCHEDULE_DATE',
                         DECODE(L_SCHEDULE_DATE_SORT,
				'ASC',
                                (WDD.DATE_SCHEDULED -
                                TO_DATE('01-01-1700 23:59:59',
                                         'DD-MM-YYYY HH24:MI:SS')),
                                'DESC',
                                (TO_DATE('01-01-1700 23:59:59',
                                         'DD-MM-YYYY HH24:MI:SS') -
                                WDD.DATE_SCHEDULED),
                                null),
                         'TRIP_STOP_DATE',
                         wms_replenishment_pvt.GET_SORT_TRIP_STOP_DATE(wdd.delivery_detail_id,
                                                 L_TRIP_STOP_DATE_SORT),
                         NULL))) as sort_attribute4,

           -- get for sort_attribute5
            To_number(DECODE(l_release_sequence_rule_id,
                  null,
                  null,
                  DECODE(g_ordered_psr(5).attribute_name,
                         'ORDER_NUMBER',
			 DECODE(L_ORDER_ID_SORT,
				'ASC',
                                To_number(wdd.source_header_number),
                                'DESC',
                                (-1 * To_number(wdd.SOURCE_HEADER_NUMBER)),
                                null),
                         'SHIPMENT_PRIORITY',
			 DECODE(WDD.SHIPMENT_PRIORITY_CODE,
				'High',
				20,
				'Standard',
				10,
				null),
                         'INVOICE_VALUE',
                         wms_replenishment_pvt.GET_SORT_INVOICE_VALUE(WDD.SOURCE_HEADER_ID,
                                                L_INVOICE_VALUE_SORT),
                         'SCHEDULE_DATE',
                         DECODE(L_SCHEDULE_DATE_SORT,
				'ASC',
                                (WDD.DATE_SCHEDULED -
                                TO_DATE('01-01-1700 23:59:59',
                                         'DD-MM-YYYY HH24:MI:SS')),
                                'DESC',
                                (TO_DATE('01-01-1700 23:59:59',
                                         'DD-MM-YYYY HH24:MI:SS') -
                                WDD.DATE_SCHEDULED),
                                null),
                         'TRIP_STOP_DATE',
                         wms_replenishment_pvt.GET_SORT_TRIP_STOP_DATE(wdd.delivery_detail_id,
                                                 L_TRIP_STOP_DATE_SORT),
			   NULL))) as sort_attribute5

	 FROM
	WSH_DELIVERY_DETAILS wdd
	WHERE
	wdd.source_code = 'OE'
	AND wdd.requested_quantity > 0
	And WDD.ORGANIZATION_ID = L_ORG_ID
	AND WDD.INVENTORY_ITEM_ID = P_ITEM_ID
	-- original status demand lines only
	AND wdd.released_status in ('R','B') and replenishment_status is NULL
	 AND wdd.subinventory IS NULL  -- since push_repl conc program does not consider forward pick sub either
	  -- these demands should not be part of WRD
	  AND NOT EXISTS (select wrd.demand_line_detail_id
			  from WMS_REPLENISHMENT_DETAILS wrd
			  where wrd.demand_line_detail_id = wdd.delivery_detail_id
			  and wrd.demand_line_id = wdd.source_line_id
			  and wrd.organization_id = wdd.organization_id)
	ORDER BY organization_id, sort_attribute1, sort_attribute2, sort_attribute3, sort_attribute4, sort_attribute5;
Line: 11010

	   SELECT organization_id, TRANSACTION_TEMP_ID, MOVE_ORDER_LINE_ID, INVENTORY_ITEM_ID, PRIMARY_QUANTITY
	     FROM mtl_material_transactions_temp mmtt
	     WHERE TRANSACTION_HEADER_ID = l_txn_header_id
	     AND mmtt.organization_id = l_org_id
	     ORDER BY move_order_line_id asc,primary_quantity desc  ;
Line: 11065

        mydebug('pick_drop: Creating final row for packing. Calling insert_mmtt_pack');
Line: 11068

      wms_task_dispatch_gen.insert_mmtt_pack(
        p_temp_id                    => p_temp_id
      , p_lpn_id                     => p_from_lpn_id
      , p_transfer_lpn               => p_drop_lpn
      , p_container_item_id          => 0
      , x_return_status              => l_return_status
      , x_msg_count                  => l_msg_count
      , x_msg_data                   => l_msg_data
      );
Line: 11080

          mydebug('pick_drop: Insert MMTT pack Unexpected error');
Line: 11087

          mydebug('pick_drop: Insert MMTT pack error');
Line: 11096

      mydebug('pick_drop: After call to insert_mmtt_pack');
Line: 11099

    SELECT lpn_id
         , content_lpn_id
         , transfer_lpn_id
         , subinventory_code
         , locator_id
         , transfer_subinventory
         , transfer_to_location
         , transaction_type_id
         , move_order_line_id
         , transaction_source_type_id
         , inventory_item_id
         , transaction_action_id
      INTO l_lpn_id
         , l_content_lpn_id
         , l_transfer_lpn_id
         , l_from_sub
         , l_from_loc
         , l_transfer_sub
         , l_transfer_loc
         , l_tran_type_id
         , l_mo_line_id
         , l_tran_source_type_id
         , l_inventory_item_id
         , l_tran_action_id
      FROM mtl_material_transactions_temp
     WHERE transaction_temp_id = l_temp_id
       AND organization_id = l_org_id;
Line: 11128

       SELECT LPN_CONTROLLED_FLAG
         INTO l_is_transfer_sub_lpn
         FROM mtl_secondary_inventories
        WHERE ORGANIZATION_ID = p_org_id
          AND SECONDARY_INVENTORY_NAME = l_transfer_sub;
Line: 11146

         SELECT 1
           INTO l_cnt
           FROM DUAL
          WHERE EXISTS(SELECT 1
                         FROM mtl_material_transactions_temp
                        WHERE parent_line_id = l_temp_id);
Line: 11173

             UPDATE mtl_material_transactions_temp
                SET transaction_header_id = l_txn_header_id
                  , lpn_id                = l_lpn_id
                  , transfer_lpn_id       = l_transfer_lpn_id
                  , transaction_status    = 3
              WHERE parent_line_id  = l_temp_id
                AND organization_id = l_org_id;
Line: 11192

             UPDATE mtl_material_transactions_temp
                SET transaction_header_id = l_txn_header_id
                  , lpn_id                = l_content_lpn_id
                  , transfer_lpn_id       = l_content_lpn_id
                  , content_lpn_id        = NULL
                  , transaction_status    = 3
              WHERE parent_line_id  = l_temp_id
                AND organization_id = l_org_id;
Line: 11204

             UPDATE wms_license_plate_numbers
                SET subinventory_code = l_transfer_sub
                  , locator_id        = l_transfer_loc
                  , last_update_date = SYSDATE
                  , last_updated_by = fnd_global.user_id
              WHERE lpn_id          = l_content_lpn_id
                AND organization_id = l_org_id;
Line: 11219

          DELETE  mtl_material_transactions_temp
            WHERE transaction_temp_id = l_temp_id;
Line: 11260

        mydebug('pick_drop: Need to update the account period in MMTT');
Line: 11263

      UPDATE mtl_material_transactions_temp
         SET acct_period_id = l_period_id
       WHERE transaction_header_id = l_txn_header_id
         AND organization_id = l_org_id;
Line: 11350

        SELECT 1
          INTO l_wf
          FROM mtl_transaction_reasons
         WHERE reason_id = l_loc_reason_id
           AND workflow_name IS NOT NULL
           AND workflow_name <> ' '
           AND workflow_process IS NOT NULL
           AND workflow_process <> ' ';
Line: 11411

      mydebug('pick_drop: Insert WDT History');
Line: 11425

	    , p_delete_mmtt_flag           => 'N'
	    , p_txn_header_id              => l_txn_header_id
	    , p_transfer_lpn_id            => NVL(l_transfer_lpn_id, l_content_lpn_id)
	    );
Line: 11435

       SELECT lpn_id
	 INTO l_xfrlpnid
	 FROM wms_license_plate_numbers
	 WHERE license_plate_number = p_drop_lpn;
Line: 11490

	  SELECT count(transaction_temp_id)
	    INTO l_check_tasks
	    FROM mtl_material_transactions_temp mmtt
	    WHERE transfer_lpn_id = l_transfer_lpn_id
	    AND transaction_temp_id <> l_temp_id ;
Line: 11511

    UPDATE mtl_material_transactions_temp
      SET transaction_date = SYSDATE
      WHERE transaction_header_id = l_txn_header_id;
Line: 11579

	  SELECT COUNT(wdd2.lpn_id)
	    INTO l_shipped_wdd_count_in_lpn
	    FROM wsh_delivery_details wdd1
	    , wsh_delivery_details wdd2
	    , wsh_delivery_assignments_v wda
	    , wms_license_plate_numbers wlpn
	    WHERE wdd1.released_status          = 'C'
            AND wda.delivery_detail_id        = wdd1.delivery_detail_id
            AND wda.parent_delivery_detail_id = wdd2.delivery_detail_id
            AND wdd2.lpn_id                   = wlpn.lpn_id
            AND wlpn.outermost_lpn_id         = l_content_lpn_id;
Line: 11606

      DELETE wms_wsh_wdd_gtemp;
Line: 11617

	    INSERT INTO wms_wsh_wdd_gtemp
	      (SERIAL_NUMBER
	       , organization_id
	       , INVENTORY_ITEM_ID
	       , transaction_temp_id
	       , LPN_ID)
	      SELECT serial_number
	      , current_organization_id
	      , inventory_item_id
	      , group_mark_id
	      , lpn_id
	      FROM mtl_serial_numbers
	      WHERE lpn_id = rec_child_lpns_csr.lpn_id;
Line: 11654

	    mydebug('Repl MMTT records selected - Count :'||l_drop_lpn_item_tbl.COUNT() );
Line: 11731

		  SELECT 1, demand_type_id INTO l_exists_in_wrd, l_demand_type_id
		    FROM  wms_replenishment_details wrd
		    WHERE WRD.ORGANIZATION_ID = P_ORG_ID
		    AND WRD.SOURCE_LINE_ID =  L_DROP_LPN_ITEM_TBL(CNT).MOVE_ORDER_LINE_ID
		    AND WRD.INVENTORY_ITEM_ID = L_DROP_LPN_ITEM_TBL(CNT).INVENTORY_ITEM_ID
		    AND ROWNUM = 1;
Line: 11801

			 DELETE FROM  WMS_REPLENISHMENT_DETAILS
			   WHERE organization_id = p_org_id
			   AND demand_type_id = 4
			   AND demand_header_id = l_demand_header_id
			   AND demand_line_id = l_demand_line_id;
Line: 11858

			 wms_replenishment_pvt.update_wdd_repl_status
			   (p_deliv_detail_id   =>  l_delivery_detail_id
			    , p_repl_status     => 'C' -- for completed status
			    , x_return_status   => l_return_status
			    );
Line: 11871

			 DELETE FROM  WMS_REPLENISHMENT_DETAILS
			   WHERE  organization_id = p_org_id
			   AND DEMAND_LINE_DETAIL_ID= l_delivery_detail_id;
Line: 11889

			 -- the wms_replenishment_pvt.update_delivery_detail() API that insert the newly created
			 --  record with RR status in the WRD table AND updates the qty to l_remaining_mmtt_qty
			 -- for the old delivery_detail record in the WRD table

			 -- So after calling for the split-line action, I need to call shipping
			 -- AND mark the original delivery detail line to 'RC' and delete this WRD record


			 l_detail_id_tab.DELETE;
Line: 11932

			 -- At this point the new delivery is already inserted in the WRD table.
			 -- AND the qty for original delivery has been updated
			 -- TO l_remaining_mmtt_qty IN WRD as above api calls
			 -- wms_replenishment_pvt.update_delivery_detail() internally.
			 -- SO JUST MARK original delivery replenishment_status  RC
			 -- and then delete the original record from the WRD table

			 wms_replenishment_pvt.update_wdd_repl_status
			   (p_deliv_detail_id   =>  l_delivery_detail_id
			    , p_repl_status     => 'C' -- for completed status
			    , x_return_status   => l_return_status
			    );
Line: 11954

			 -- delete the original demand as it was marked RC
			 -- nwely created delviery will be in WRD as 'RR'
			 DELETE FROM  WMS_REPLENISHMENT_DETAILS
			   WHERE DEMAND_LINE_DETAIL_ID= l_delivery_detail_id;
Line: 12025

		   select pick_sequence_rule_id
		     INTO l_release_sequence_rule_id
		     from wsh_shipping_parameters
		     where organization_id = l_org_id;
Line: 12040

		-- delete old value
		g_ordered_psr.DELETE;
Line: 12080

			 wms_replenishment_pvt.update_wdd_repl_status
			   (p_deliv_detail_id   =>  l_delivery_detail_id
			    , p_repl_status     => 'C' -- for completed status
			    , x_return_status   => l_return_status
			    );
Line: 12107

			 -- the wms_replenishment_pvt.update_delivery_detail()
			 -- API but in this case since original
			 -- delivery_detial was NOT tracked in the WRD table
			 -- to start with, nothing happens there. In shipping,
			 -- we have a new split WDD though

			 -- So after calling for the split-line action, I need to call shipping
			 -- AND mark the original delivery detail line to 'RC' and delete this WRD record

			 l_detail_id_tab.DELETE;
Line: 12150

			 -- At this point the new delivery is already inserted in the WRD table.
			 -- AND the qty for original delivery has been updated
			 -- TO l_remaining_mmtt_qty IN WRD as above api calls
			 -- wms_replenishment_pvt.update_delivery_detail() internally.
			 -- SO JUST MARK original delviery replenishment_status  RC
			 -- and then delete the original record from the WRD table

			 wms_replenishment_pvt.update_wdd_repl_status
			   (p_deliv_detail_id   =>  l_delivery_detail_id
			    , p_repl_status     => 'C' -- for completed status
			    , x_return_status   => l_return_status
			    );
Line: 12169

			 -- in the WRD table. So no need to delete WRD

			 L_REMAINING_MMTT_QTY := 0;
Line: 12219

                   UPDATE mtl_serial_numbers
                   SET mtl_serial_numbers.group_mark_id = rec_msn_stg_mov_csr.transaction_temp_id
                   WHERE mtl_serial_numbers.serial_number = rec_msn_stg_mov_csr.serial_number
                   AND mtl_serial_numbers.current_organization_id = rec_msn_stg_mov_csr.organization_id
                   AND mtl_serial_numbers.inventory_item_id = rec_msn_stg_mov_csr.inventory_item_id
                   AND mtl_serial_numbers.lpn_id = rec_msn_stg_mov_csr.lpn_id;
Line: 12321

	  l_detail_id_tab.DELETE;
Line: 12335

	       -- Since inserted records has alredy been ordered by batch_id
	    END LOOP;
Line: 12372

       l_batch_id_tab.DELETE;
Line: 12373

       l_pick_rel_tab.DELETE;
Line: 12503

    SELECT COUNT(*)
      INTO l_mmtt_rowcnt
      FROM mtl_material_transactions_temp m
     WHERE m.cartonization_id IS NOT NULL
       AND m.cartonization_id = l_lpn_id
       AND parent_line_id IS NULL;
Line: 12516

      SELECT COUNT(*)
        INTO l_wdt_rowcnt
        FROM mtl_material_transactions_temp m, wms_dispatched_tasks t
       WHERE m.cartonization_id = l_lpn_id
         AND t.transaction_temp_id = m.transaction_temp_id
         AND t.status = 4;
Line: 12586

            SELECT bremp.resource_id role_id
                 , t.wms_task_type
                 , t.standard_operation_id
                 , t.operation_plan_id
                 , t.move_order_line_id
              INTO l_per_res_id
                 , l_wms_task_type
                 , l_std_op_id
                 , l_operation_plan_id
                 , l_move_order_line_id
              FROM mtl_material_transactions_temp t, bom_std_op_resources bsor, bom_resources bremp
             WHERE t.transaction_temp_id = task_rec.task_id
               AND t.standard_operation_id = bsor.standard_operation_id
               AND bsor.resource_id = bremp.resource_id
               AND bremp.resource_type = 2
               AND ROWNUM < 2;
Line: 12610

              SELECT resource_id
                INTO l_mac_res_id
                FROM bom_resource_equipments
               WHERE inventory_item_id = l_eqp_id
                 AND ROWNUM < 2;
Line: 12616

            select  breqp.resource_id equip_type_id
              INTO l_mac_res_id
              from mtl_material_transactions_temp t,
              bom_std_op_resources bsor,
              bom_resources breqp
              where t.transaction_temp_id = task_rec.task_id
              and t.standard_operation_id = bsor.standard_operation_id
              and bsor.resource_id = breqp.resource_id
              and breqp.resource_type = 1
              and rownum<2;
Line: 12629

            SELECT mtl_material_transactions_s.NEXTVAL txnhdrid
              INTO l_txn_hdr_id
              FROM DUAL;
Line: 12633

            UPDATE mtl_material_transactions_temp
               SET transaction_header_id = l_txn_hdr_id
             WHERE transaction_temp_id = task_rec.task_id;
Line: 12640

            SELECT wms_dispatched_tasks_s.NEXTVAL
              INTO l_next_task_id
              FROM DUAL;
Line: 12647

            INSERT INTO wms_dispatched_tasks
                        (
                         task_id
                       , transaction_temp_id
                       , organization_id
                       , user_task_type
                       , person_id
                       , effective_start_date
                       , effective_end_date
                       , equipment_id
                       , equipment_instance
                       , person_resource_id
                       , machine_resource_id
                       , status
                       , dispatched_time
                       , last_update_date
                       , last_updated_by
                       , creation_date
                       , created_by
                       , task_type
                       , priority
                       , operation_plan_id
                       , move_order_line_id
                        )
                 VALUES (
                         l_next_task_id
                       , task_rec.task_id
                       , l_org_id
                       , NVL(l_std_op_id, 2)
                       , l_user_id
                       , SYSDATE
                       , SYSDATE
                       , l_eqp_id
                       , l_eqp_ins
                       , l_per_res_id
                       , l_mac_res_id
                       , 3
                       , SYSDATE
                       , SYSDATE
                       , l_emp_id
                       , SYSDATE
                       , l_emp_id
                       , l_wms_task_type
                       , task_rec.task_priority
                       , l_operation_plan_id
                       , l_move_order_line_id
                        );
Line: 12696

              mydebug('pick_by_label: After Insert into WMSDT');
Line: 12810

        SELECT
          msnt.fm_serial_number,
          msnt.to_serial_number
          FROM  mtl_serial_numbers_temp msnt
          WHERE msnt.transaction_temp_id = p_pick_slip_id;
Line: 12817

        SELECT
          msnt.fm_serial_number,
          msnt.to_serial_number
          FROM
          mtl_serial_numbers_temp msnt,
          mtl_transaction_lots_temp mtlt
          WHERE mtlt.transaction_temp_id = p_pick_slip_id
          AND   msnt.transaction_temp_id = mtlt.serial_transaction_temp_id;
Line: 12878

      SELECT 1
        INTO l_mmtt_rowcnt
        FROM DUAL
       WHERE EXISTS(SELECT 1
                      FROM mtl_material_transactions_temp
                     WHERE transaction_temp_id = l_pick_slip_id
                     AND parent_line_id is NULL);
Line: 12905

        SELECT 1
          INTO l_wdt_rowcnt
          FROM DUAL
         WHERE EXISTS(SELECT 1
                        FROM wms_dispatched_tasks t
                       WHERE t.transaction_temp_id = l_pick_slip_id);
Line: 12931

          SELECT bremp.resource_id role_id
               , t.wms_task_type
               , t.standard_operation_id
               , t.operation_plan_id
               , t.move_order_line_id
               , t.inventory_item_id  --Bug#6009436
            INTO l_per_res_id
               , l_wms_task_type
               , l_std_op_id
               , l_operation_plan_id
               , l_move_order_line_id
               , l_item_id            --Bug6009436
            FROM mtl_material_transactions_temp t, bom_std_op_resources bsor, bom_resources bremp
           WHERE t.transaction_temp_id = l_pick_slip_id
             AND t.standard_operation_id = bsor.standard_operation_id
             AND bsor.resource_id = bremp.resource_id
             AND bremp.resource_type = 2
             AND t.organization_id = l_org_id  --Bug # 3704626
             AND ROWNUM < 2;
Line: 12967

            SELECT resource_id
              INTO l_mac_res_id
              FROM bom_resource_equipments
             WHERE inventory_item_id = l_eqp_id
               AND ROWNUM < 2;
Line: 12973

          select  breqp.resource_id equip_type_id
      INTO l_mac_res_id
      from mtl_material_transactions_temp t,
      bom_std_op_resources bsor,
      bom_resources breqp
      where t.transaction_temp_id = task_rec.task_id
      and t.standard_operation_id = bsor.standard_operation_id
      and bsor.resource_id = breqp.resource_id
      and breqp.resource_type = 1
      and rownum<2;
Line: 12997

        SELECT wms_dispatched_tasks_s.NEXTVAL
          INTO l_next_task_id
          FROM DUAL;
Line: 13003

        SELECT mtl_material_transactions_s.NEXTVAL txnhdrid
          INTO l_txn_hdr_id
          FROM DUAL;
Line: 13007

        UPDATE mtl_material_transactions_temp
           SET transaction_header_id = l_txn_hdr_id
         WHERE transaction_temp_id = l_pick_slip_id;
Line: 13012

	SELECT msi.serial_number_control_code
             , msi.lot_control_code
          INTO l_serial_ctrl_code
             , l_lot_ctrl_code
         FROM mtl_system_items msi
	 WHERE msi.inventory_item_id = l_item_id
         AND msi.organization_id =p_sign_on_org_id ;
Line: 13033

	        UPDATE MTL_SERIAL_NUMBERS msn
	        SET  GROUP_MARK_ID=l_txn_hdr_id
	        WHERE msn.current_organization_id=p_sign_on_org_id
	        AND msn.inventory_item_id= l_item_id
	        AND msn.SERIAL_NUMBER BETWEEN l_fm_serial_number AND
	 	                                l_to_serial_number;
Line: 13042

	     UPDATE mtl_serial_numbers_temp
	     SET group_header_id= l_txn_hdr_id
	     WHERE transaction_temp_id in ( SELECT serial_transaction_temp_id
	                                   FROM mtl_transaction_lots_temp
					   WHERE transaction_temp_id= l_pick_slip_id );
Line: 13055

                UPDATE MTL_SERIAL_NUMBERS msn
                SET  GROUP_MARK_ID=l_txn_hdr_id
	        WHERE msn.current_organization_id=p_sign_on_org_id
	        AND msn.inventory_item_id= l_item_id
	        AND msn.SERIAL_NUMBER BETWEEN l_fm_serial_number AND
		                                l_to_serial_number;
Line: 13064

	     UPDATE mtl_serial_numbers_temp
	     SET group_header_id= l_txn_hdr_id
             WHERE transaction_temp_id=l_pick_slip_id ;
Line: 13071

              mydebug('manual_pick: Updated MSNT');
Line: 13084

        INSERT INTO wms_dispatched_tasks
                    (
                     task_id
                   , transaction_temp_id
                   , organization_id
                   , user_task_type
                   , person_id
                   , effective_start_date
                   , effective_end_date
                   , equipment_id
                   , equipment_instance
                   , person_resource_id
                   , machine_resource_id
                   , status
                   , dispatched_time
                   , last_update_date
                   , last_updated_by
                   , creation_date
                   , created_by
                   , task_type
                   , operation_plan_id
                   , move_order_line_id
                    )
             VALUES (
                     l_next_task_id
                   , l_pick_slip_id
                   , l_org_id
                   , NVL(l_std_op_id, 2)
                   , l_user_id
                   , SYSDATE
                   , SYSDATE
                   , l_eqp_id
                   , l_eqp_ins
                   , l_per_res_id
                   , l_mac_res_id
                   , 3
                   , SYSDATE
                   , SYSDATE
                   , l_emp_id
                   , SYSDATE
                   , l_emp_id
                   , l_wms_task_type
                   , l_operation_plan_id
                   , l_move_order_line_id
                    );
Line: 13131

          mydebug('manual_pick: After Insert into WMSDT');
Line: 13182

    SELECT COUNT(*)
      INTO l_mmtt_rowcnt
      FROM mtl_material_transactions_temp m
     WHERE m.cartonization_id IS NOT NULL
       AND m.cartonization_id = l_lpn_id
       AND parent_line_id IS NULL;
Line: 13195

      SELECT COUNT(*)
        INTO l_wdt_rowcnt
        FROM mtl_material_transactions_temp m, wms_dispatched_tasks t
       WHERE m.cartonization_id = l_lpn_id
         AND t.transaction_temp_id = m.transaction_temp_id
         AND t.status = 4;
Line: 13263

      SELECT lpn_context
           , organization_id
        INTO lpn_cont
           , l_org_id
        FROM wms_license_plate_numbers
       WHERE license_plate_number = p_lpn;
Line: 13393

    SELECT reservable_type
      INTO l_reservable_type
      FROM mtl_secondary_inventories
     WHERE organization_id = p_organization_id
       AND secondary_inventory_name = p_subinventory_code;
Line: 13416

 PROCEDURE delete_allocation
  (
   p_temp_id                IN    NUMBER,
   p_lot_control_code       IN    NUMBER,
   p_serial_control_code    IN    NUMBER,
   p_serial_allocate_flag   IN    VARCHAR2,
   p_item_id                IN    NUMBER,
   p_org_id                 IN    NUMBER
   )

  IS
     l_fm_serial_number VARCHAR2(30);
Line: 13431

        SELECT
          msnt.fm_serial_number,
          msnt.to_serial_number
          FROM  mtl_serial_numbers_temp msnt
          WHERE msnt.transaction_temp_id = p_temp_id;
Line: 13438

        SELECT
          msnt.fm_serial_number,
          msnt.to_serial_number
          FROM
          mtl_serial_numbers_temp msnt,
          mtl_transaction_lots_temp mtlt
          WHERE mtlt.transaction_temp_id = p_temp_id
          AND   msnt.transaction_temp_id = mtlt.serial_transaction_temp_id;
Line: 13448

 DELETE FROM mtl_material_transactions_temp
     WHERE transaction_temp_id = p_temp_id;
Line: 13451

   DELETE FROM wms_dispatched_tasks
     WHERE transaction_temp_id = p_temp_id;
Line: 13468

            UPDATE mtl_serial_numbers
              SET  group_mark_id = NULL
              WHERE inventory_item_id         = p_item_id
              AND   current_organization_id   = p_org_id
              AND   serial_number BETWEEN l_fm_serial_number AND
l_to_serial_number;
Line: 13478

         DELETE FROM mtl_serial_numbers_temp msnt
           WHERE msnt.transaction_temp_id IN
           (SELECT mtlt.serial_transaction_temp_id
            FROM  mtl_transaction_lots_temp mtlt
             WHERE mtlt.transaction_temp_id = p_temp_id);
Line: 13486

            DELETE FROM mtl_transaction_lots_temp mtlt
              WHERE mtlt.transaction_temp_id = p_temp_id;
Line: 13491

END delete_allocation;
Line: 13530

      SELECT mmtt.transaction_header_id
           , mmtt.transaction_temp_id
           , mmtt.inventory_item_id
           , mmtt.organization_id
           , mmtt.revision
           , mmtt.lot_number
           , mmtt.subinventory_code
           , mmtt.locator_id
           , mmtt.move_order_line_id
           , mmtt.transaction_quantity
           , mmtt.transaction_uom
           , mmtt.primary_quantity
        FROM mtl_material_transactions_temp mmtt
       WHERE mmtt.transaction_temp_id = p_temp_id
         AND NOT EXISTS(SELECT 1
                          FROM mtl_material_transactions_temp t1
                         WHERE t1.parent_line_id = mmtt.transaction_temp_id)
      UNION ALL
      SELECT mmtt.transaction_header_id
           , mmtt.transaction_temp_id
           , mmtt.inventory_item_id
           , mmtt.organization_id
           , mmtt.revision
           , mmtt.lot_number
           , mmtt.subinventory_code
           , mmtt.locator_id
           , mmtt.move_order_line_id
           , mmtt.transaction_quantity
           , mmtt.transaction_uom
           , mmtt.primary_quantity
        FROM mtl_material_transactions_temp mmtt
       WHERE mmtt.parent_line_id = p_temp_id;
Line: 13564

      SELECT mtrh.move_order_type
           , mtrl.txn_source_id
           , mtrl.txn_source_line_id
           , mtrl.reference_id
           , mtrl.quantity
           , mtrl.uom_code
           , nvl(mtrl.quantity_delivered,0)
           , mtrl.line_status --bug3139307
        FROM mtl_txn_request_headers mtrh, mtl_txn_request_lines mtrl
       WHERE mtrl.line_id = l_mo_line_id
         AND mtrh.header_id = mtrl.header_id;
Line: 13577

      SELECT COUNT(*)
        FROM mtl_material_transactions_temp mmtt
       WHERE mmtt.move_order_line_id = l_mo_line_id
         AND mmtt.transaction_temp_id <> l_txn_temp_id
         AND NOT EXISTS(SELECT 1
                          FROM mtl_material_transactions_temp t1
                         WHERE t1.parent_line_id = mmtt.transaction_temp_id);
Line: 13702

        inv_trx_util_pub.delete_transaction(
          x_return_status       => x_return_status
        , x_msg_data            => x_msg_data
        , x_msg_count           => x_msg_count
        , p_transaction_temp_id => l_txn_temp_id
        , p_update_parent       => FALSE  --Added bug 3765153
        );
Line: 13718

        UPDATE mtl_txn_request_lines
           SET quantity_detailed = quantity_detailed - l_txn_qty
         WHERE line_id = l_mo_line_id;
Line: 13732

          DELETE FROM wms_dispatched_tasks WHERE transaction_temp_id = p_temp_id;
Line: 13783

             /*Need to delete the MMTT as the suggest_alternate-location
            procedure in WMSTRSAB.pls would set the MMTT transaction qty. primary
            transaction qty to zero before calling pick release. When Pick rellease
            backorders  the mo line it does not clean up the taks. This
           has to  be done here.*/

          INV_TRX_UTIL_PUB.delete_transaction(
            x_return_status       => x_return_status
          , x_msg_data            => x_msg_data
          , x_msg_count           => x_msg_count
          , p_transaction_temp_id => l_txn_temp_id
          , p_update_parent       => FALSE  --Added bug 3765153
          );
Line: 13806

          UPDATE mtl_txn_request_lines
             SET quantity_detailed = quantity_delivered
               , line_status = 5
           WHERE line_id = l_mo_line_id;
Line: 13833

          inv_trx_util_pub.delete_transaction(
            x_return_status       => x_return_status
          , x_msg_data            => x_msg_data
          , x_msg_count           => x_msg_count
          , p_transaction_temp_id => l_txn_temp_id
          , p_update_parent       => FALSE --Added bug3765153
          );
Line: 13849

                  UPDATE mtl_txn_request_lines
                     SET quantity_detailed = quantity_detailed - l_txn_qty,
                         line_status = 5
                   WHERE line_id = l_mo_line_id;
Line: 13855

          UPDATE mtl_txn_request_lines
             SET quantity_detailed = quantity_delivered
           WHERE line_id = l_mo_line_id;
Line: 13859

          inv_trx_util_pub.delete_transaction(
            x_return_status       => x_return_status
          , x_msg_data            => x_msg_data
          , x_msg_count           => x_msg_count
          , p_transaction_temp_id => l_txn_temp_id
          );
Line: 13897

             UPDATE mtl_txn_request_lines
                SET quantity_detailed = quantity_delivered
              WHERE line_id = l_mo_line_id;
Line: 13934

    SELECT negative_inv_receipt_code
      INTO l_negative_rcpt_code
      FROM mtl_parameters
     WHERE organization_id = p_organization_id;
Line: 13944

        SELECT COUNT(*)
          INTO x_lot_num_lov_count
          FROM mtl_lot_numbers_all_v mln, mtl_transaction_lots_temp mtlt
         WHERE mln.organization_id = p_organization_id
           AND mln.inventory_item_id = p_item_id
           AND mln.lot_number LIKE(p_lot_number || '%')
           AND mtlt.lot_number = mln.lot_number
           AND mtlt.transaction_temp_id = p_txn_temp_id
           AND inv_material_status_grp.is_status_applicable(
                p_wms_installed
              , NULL
              , p_transaction_type_id
              , NULL
              , NULL
              , p_organization_id
              , p_item_id
              , NULL
              , NULL
              , mln.lot_number
              , NULL
              , 'O'
              ) = 'Y';
Line: 13968

        SELECT COUNT(*)
          INTO x_lot_num_lov_count
          FROM mtl_onhand_quantities_detail moq, mtl_lot_numbers_all_v mln, mtl_transaction_lots_temp mtlt, wms_lpn_contents wlc
         WHERE mln.organization_id = p_organization_id
           AND mln.inventory_item_id = p_item_id
           AND mln.lot_number LIKE(p_lot_number || '%')
           AND moq.lot_number = mln.lot_number
           AND moq.inventory_item_id = mln.inventory_item_id
           AND moq.organization_id = mln.organization_id
           AND mtlt.lot_number = mln.lot_number
           AND mtlt.transaction_temp_id = p_txn_temp_id
           AND moq.containerized_flag = 1
           AND wlc.parent_lpn_id = p_lpn_id
           AND wlc.lot_number = mln.lot_number
           AND wlc.inventory_item_id = p_item_id
           AND wlc.organization_id = p_organization_id
           AND moq.subinventory_code = NVL(p_subinventory_code, moq.subinventory_code)
           AND NVL(moq.locator_id, -1) = NVL(NVL(p_locator_id, moq.locator_id), -1)
           AND inv_material_status_grp.is_status_applicable(
                p_wms_installed
              , NULL
              , p_transaction_type_id
              , NULL
              , NULL
              , p_organization_id
              , p_item_id
              , NULL
              , NULL
              , mln.lot_number
              , NULL
              , 'O'
              ) = 'Y';
Line: 14006

        SELECT COUNT(*)
          INTO x_lot_num_lov_count
          FROM mtl_onhand_quantities_detail moq, mtl_lot_numbers_all_v mln, mtl_transaction_lots_temp mtlt
         WHERE mln.organization_id = p_organization_id
           AND mln.inventory_item_id = p_item_id
           AND mln.lot_number LIKE(p_lot_number || '%')
           AND moq.lot_number = mln.lot_number
           AND moq.inventory_item_id = mln.inventory_item_id
           AND moq.organization_id = mln.organization_id
           AND mtlt.lot_number = mln.lot_number
           AND mtlt.transaction_temp_id = p_txn_temp_id
           AND moq.containerized_flag = 2
           AND moq.subinventory_code = NVL(p_subinventory_code, moq.subinventory_code)
           AND NVL(moq.locator_id, -1) = NVL(NVL(p_locator_id, moq.locator_id), -1)
           AND inv_material_status_grp.is_status_applicable(
                p_wms_installed
              , NULL
              , p_transaction_type_id
              , NULL
              , NULL
              , p_organization_id
              , p_item_id
              , NULL
              , NULL
              , mln.lot_number
              , NULL
              , 'O'
              ) = 'Y';
Line: 14035

        SELECT COUNT(*)
          INTO x_lot_num_lov_count
          FROM mtl_onhand_quantities_detail moq, mtl_lot_numbers_all_v mln, mtl_transaction_lots_temp mtlt, wms_lpn_contents wlc
         WHERE mln.organization_id = p_organization_id
           AND mln.inventory_item_id = p_item_id
           AND mln.lot_number LIKE(p_lot_number || '%')
           AND moq.lot_number = mln.lot_number
           AND moq.inventory_item_id = mln.inventory_item_id
           AND moq.organization_id = mln.organization_id
           AND mtlt.lot_number = mln.lot_number
           AND mtlt.transaction_temp_id = p_txn_temp_id
           AND moq.containerized_flag = 1
           AND wlc.parent_lpn_id = p_lpn_id
           AND wlc.lot_number = mln.lot_number
           AND wlc.inventory_item_id = p_item_id
           AND wlc.organization_id = p_organization_id
           AND moq.subinventory_code = NVL(p_subinventory_code, moq.subinventory_code)
           AND NVL(moq.locator_id, -1) = NVL(NVL(p_locator_id, moq.locator_id), -1)
           AND inv_material_status_grp.is_status_applicable(
                p_wms_installed
              , NULL
              , p_transaction_type_id
              , NULL
              , NULL
              , p_organization_id
              , p_item_id
              , NULL
              , NULL
              , mln.lot_number
              , NULL
              , 'O'
              ) = 'Y';
Line: 14092

    SELECT mmtt.transaction_type_id
         , mmtt.organization_id
         , mmtt.inventory_item_id
      INTO l_transaction_type_id
         , l_org_id
         , l_item_id
      FROM mtl_material_transactions_temp mmtt
     WHERE mmtt.transaction_temp_id = p_temp_id;
Line: 14188

    SELECT wms_task_type
      INTO l_wms_task_type
      FROM mtl_material_transactions_temp
     WHERE transaction_temp_id = p_temp_id;
Line: 14205

    SELECT mtrh.move_order_type
      INTO l_mmtt_mo_type
      FROM mtl_txn_request_headers mtrh, -- mo header for the new task
                                         mtl_txn_request_lines mtrl, mtl_material_transactions_temp mmtt
     WHERE mtrh.header_id = mtrl.header_id
       AND mtrl.line_id = mmtt.move_order_line_id
       AND mmtt.transaction_temp_id = p_temp_id;
Line: 14217

    SELECT msi.lpn_controlled_flag
         , mmtt.transfer_lpn_id
         , mmtt.transfer_subinventory
      INTO l_lpn_controlled_flag
         , l_xfr_lpn_id
         , l_orig_xfr_sub
      FROM mtl_material_transactions_temp mmtt, mtl_secondary_inventories msi
     WHERE mmtt.transaction_temp_id = p_temp_id
       AND mmtt.organization_id = msi.organization_id
       AND msi.secondary_inventory_name = p_confirmed_drop_sub;
Line: 14242

        SELECT 1
          INTO l_count
          FROM DUAL
         WHERE EXISTS(
                 SELECT 1
                   FROM mtl_material_transactions_temp mmtt
                  WHERE mmtt.transaction_temp_id <> p_temp_id
                    AND mmtt.transfer_lpn_id = l_xfr_lpn_id
                    AND mmtt.transfer_subinventory <> p_confirmed_drop_sub
                    AND mmtt.transfer_subinventory <> l_orig_xfr_sub);
Line: 14353

      SELECT   mmtt.transaction_temp_id
             , mmtt.inventory_item_id
             , mmtt.subinventory_code
             , mmtt.locator_id
             , NVL(mmtt.content_lpn_id, mmtt.lpn_id)
             , mmtt.transfer_lpn_id
             , mmtt.transaction_uom
             , mmtt.transaction_quantity
             , mmtt.primary_quantity
          FROM mtl_material_transactions_temp mmtt
         WHERE mmtt.transaction_header_id = p_txn_hdr_id
           AND mmtt.organization_id = p_org_id
           AND mmtt.transaction_quantity > 0
      AND mmtt.parent_line_id is NULL  --Added bug3765153 to ensure only parent line are picked
      ORDER BY mmtt.transaction_quantity DESC;
Line: 14370

      SELECT   mmtt.transaction_temp_id
             , mmtt.transaction_uom
             , mmtt.transaction_quantity
             , mmtt.primary_quantity
          FROM mtl_material_transactions_temp mmtt
         WHERE mmtt.parent_line_id = p_temp_id
           AND mmtt.organization_id = p_org_id
      ORDER BY mmtt.transaction_quantity DESC;
Line: 14380

      SELECT mmtt.transaction_temp_id
        FROM mtl_material_transactions_temp mmtt
          WHERE mmtt.organization_id = p_org_id
            AND mmtt.parent_line_id = p_parent_line_id;  --Added bug3765153 to determine and back order unpicked lines
Line: 14407

    SELECT mtl_material_transactions_s.NEXTVAL
      INTO x_new_txn_hdr_id
      FROM DUAL;
Line: 14454

          UPDATE mtl_material_transactions_temp mmtt
             SET mmtt.transaction_header_id = x_new_txn_hdr_id
               , mmtt.transfer_lpn_id = l_transfer_lpn_id
               , mmtt.lpn_id = l_lpn_id
               , mmtt.parent_line_id = l_parent_txn_temp_id --Modified from NULL bug3765153
               , mmtt.subinventory_code = l_parent_sub_code
               , mmtt.locator_id = l_parent_loc_id
               , mmtt.transaction_uom = l_parent_uom
               , mmtt.last_update_date = SYSDATE
               , mmtt.last_updated_by = p_user_id
           WHERE mmtt.transaction_temp_id = l_child_txn_temp_id;
Line: 14473

   select mtl_material_transactions_s.NEXTVAL
   into l_new_temp_id
   from dual; --Added bug3765153
Line: 14477

          INSERT INTO mtl_material_transactions_temp
                      (
                       transaction_header_id
                     , transaction_temp_id
                     , source_code
                     , source_line_id
                     , transaction_mode
                     , lock_flag
                     , last_update_date
                     , last_updated_by
                     , creation_date
                     , created_by
                     , last_update_login
                     , request_id
                     , program_application_id
                     , program_id
                     , program_update_date
                     , inventory_item_id
                     , revision
                     , organization_id
                     , subinventory_code
                     , locator_id
                     , transaction_quantity
                     , primary_quantity
                     , transaction_uom
                     , transaction_cost
                     , transaction_type_id
                     , transaction_action_id
                     , transaction_source_type_id
                     , transaction_source_id
                     , transaction_source_name
                     , transaction_date
                     , acct_period_id
                     , distribution_account_id
                     , transaction_reference
                     , requisition_line_id
                     , requisition_distribution_id
                     , reason_id
                     , lot_number
                     , lot_expiration_date
                     , serial_number
                     , receiving_document
                     , demand_id
                     , rcv_transaction_id
                     , move_transaction_id
                     , completion_transaction_id
                     , wip_entity_type
                     , schedule_id
                     , repetitive_line_id
                     , employee_code
                     , primary_switch
                     , schedule_update_code
                     , setup_teardown_code
                     , item_ordering
                     , negative_req_flag
                     , operation_seq_num
                     , picking_line_id
                     , trx_source_line_id
                     , trx_source_delivery_id
                     , physical_adjustment_id
                     , cycle_count_id
                     , rma_line_id
                     , customer_ship_id
                     , currency_code
                     , currency_conversion_rate
                     , currency_conversion_type
                     , currency_conversion_date
                     , ussgl_transaction_code
                     , vendor_lot_number
                     , encumbrance_account
                     , encumbrance_amount
                     , ship_to_location
                     , shipment_number
                     , transfer_cost
                     , transportation_cost
                     , transportation_account
                     , freight_code
                     , containers
                     , waybill_airbill
                     , expected_arrival_date
                     , transfer_subinventory
                     , transfer_organization
                     , transfer_to_location
                     , new_average_cost
                     , value_change
                     , percentage_change
                     , material_allocation_temp_id
                     , demand_source_header_id
                     , demand_source_line
                     , demand_source_delivery
                     , item_segments
                     , item_description
                     , item_trx_enabled_flag
                     , item_location_control_code
                     , item_restrict_subinv_code
                     , item_restrict_locators_code
                     , item_revision_qty_control_code
                     , item_primary_uom_code
                     , item_uom_class
                     , item_shelf_life_code
                     , item_shelf_life_days
                     , item_lot_control_code
                     , item_serial_control_code
                     , item_inventory_asset_flag
                     , allowed_units_lookup_code
                     , department_id
                     , department_code
                     , wip_supply_type
                     , supply_subinventory
                     , supply_locator_id
                     , valid_subinventory_flag
                     , valid_locator_flag
                     , locator_segments
                     , current_locator_control_code
                     , number_of_lots_entered
                     , wip_commit_flag
                     , next_lot_number
                     , lot_alpha_prefix
                     , next_serial_number
                     , serial_alpha_prefix
                     , shippable_flag
                     , posting_flag
                     , required_flag
                     , process_flag
                     , ERROR_CODE
                     , error_explanation
                     , attribute_category
                     , attribute1
                     , attribute2
                     , attribute3
                     , attribute4
                     , attribute5
                     , attribute6
                     , attribute7
                     , attribute8
                     , attribute9
                     , attribute10
                     , attribute11
                     , attribute12
                     , attribute13
                     , attribute14
                     , attribute15
                     , movement_id
                     , reservation_quantity
                     , shipped_quantity
                     , transaction_line_number
                     , task_id
                     , to_task_id
                     , source_task_id
                     , project_id
                     , source_project_id
                     , pa_expenditure_org_id
                     , to_project_id
                     , expenditure_type
                     , final_completion_flag
                     , transfer_percentage
                     , transaction_sequence_id
                     , material_account
                     , material_overhead_account
                     , resource_account
                     , outside_processing_account
                     , overhead_account
                     , flow_schedule
                     , cost_group_id
                     , demand_class
                     , qa_collection_id
                     , kanban_card_id
                     , overcompletion_transaction_id
                     , overcompletion_primary_qty
                     , overcompletion_transaction_qty
                     , end_item_unit_number
                     , scheduled_payback_date
                     , line_type_code
                     , parent_transaction_temp_id
                     , put_away_strategy_id
                     , put_away_rule_id
                     , pick_strategy_id
                     , pick_rule_id
                     , common_bom_seq_id
                     , common_routing_seq_id
                     , cost_type_id
                     , org_cost_group_id
                     , move_order_line_id
                     , task_group_id
                     , pick_slip_number
                     , reservation_id
                     , transaction_status
                     , transfer_cost_group_id
                     , lpn_id
                     , transfer_lpn_id
                     , content_lpn_id
                     , cartonization_id
                     , standard_operation_id
                     , wms_task_type
                     , task_priority
                     , container_item_id
                     , operation_plan_id
                     , parent_line_id
                      )
            (SELECT transaction_header_id
             , l_new_temp_id      --Changed from mtl_material_transactions_s.NEXTVAL bug3765153
                  , source_code
                  , source_line_id
                  , transaction_mode
                  , lock_flag
                  , SYSDATE
                  , last_updated_by
                  , SYSDATE
                  , created_by
                  , last_update_login
                  , request_id
                  , program_application_id
                  , program_id
                  , program_update_date
                  , inventory_item_id
                  , revision
                  , organization_id
                  , subinventory_code
                  , locator_id
                  , l_child_pri_qty - l_parent_pri_qty
                  , l_child_txn_qty - l_parent_txn_qty
                  , l_parent_uom
                  , transaction_cost
                  , transaction_type_id
                  , transaction_action_id
                  , transaction_source_type_id
                  , transaction_source_id
                  , transaction_source_name
                  , transaction_date
                  , acct_period_id
                  , distribution_account_id
                  , transaction_reference
                  , requisition_line_id
                  , requisition_distribution_id
                  , reason_id
                  , lot_number
                  , lot_expiration_date
                  , serial_number
                  , receiving_document
                  , demand_id
                  , rcv_transaction_id
                  , move_transaction_id
                  , completion_transaction_id
                  , wip_entity_type
                  , schedule_id
                  , repetitive_line_id
                  , employee_code
                  , primary_switch
                  , schedule_update_code
                  , setup_teardown_code
                  , item_ordering
                  , negative_req_flag
                  , operation_seq_num
                  , picking_line_id
                  , trx_source_line_id
                  , trx_source_delivery_id
                  , physical_adjustment_id
                  , cycle_count_id
                  , rma_line_id
                  , customer_ship_id
                  , currency_code
                  , currency_conversion_rate
                  , currency_conversion_type
                  , currency_conversion_date
                  , ussgl_transaction_code
                  , vendor_lot_number
                  , encumbrance_account
                  , encumbrance_amount
                  , ship_to_location
                  , shipment_number
                  , transfer_cost
                  , transportation_cost
                  , transportation_account
                  , freight_code
                  , containers
                  , waybill_airbill
                  , expected_arrival_date
                  , transfer_subinventory
                  , transfer_organization
                  , transfer_to_location
                  , new_average_cost
                  , value_change
                  , percentage_change
                  , material_allocation_temp_id
                  , demand_source_header_id
                  , demand_source_line
                  , demand_source_delivery
                  , item_segments
                  , item_description
                  , item_trx_enabled_flag
                  , item_location_control_code
                  , item_restrict_subinv_code
                  , item_restrict_locators_code
                  , item_revision_qty_control_code
                  , item_primary_uom_code
                  , item_uom_class
                  , item_shelf_life_code
                  , item_shelf_life_days
                  , item_lot_control_code
                  , item_serial_control_code
                  , item_inventory_asset_flag
                  , allowed_units_lookup_code
                  , department_id
                  , department_code
                  , wip_supply_type
                  , supply_subinventory
                  , supply_locator_id
                  , valid_subinventory_flag
                  , valid_locator_flag
                  , locator_segments
                  , current_locator_control_code
                  , number_of_lots_entered
                  , wip_commit_flag
                  , next_lot_number
                  , lot_alpha_prefix
                  , next_serial_number
                  , serial_alpha_prefix
                  , shippable_flag
                  , posting_flag
                  , required_flag
                  , process_flag
                  , ERROR_CODE
                  , error_explanation
                  , attribute_category
                  , attribute1
                  , attribute2
                  , attribute3
                  , attribute4
                  , attribute5
                  , attribute6
                  , attribute7
                  , attribute8
                  , attribute9
                  , attribute10
                  , attribute11
                  , attribute12
                  , attribute13
                  , attribute14
                  , attribute15
                  , movement_id
                  , reservation_quantity
                  , shipped_quantity
                  , transaction_line_number
                  , task_id
                  , to_task_id
                  , source_task_id
                  , project_id
                  , source_project_id
                  , pa_expenditure_org_id
                  , to_project_id
                  , expenditure_type
                  , final_completion_flag
                  , transfer_percentage
                  , transaction_sequence_id
                  , material_account
                  , material_overhead_account
                  , resource_account
                  , outside_processing_account
                  , overhead_account
                  , flow_schedule
                  , cost_group_id
                  , demand_class
                  , qa_collection_id
                  , kanban_card_id
                  , overcompletion_transaction_id
                  , overcompletion_primary_qty
                  , overcompletion_transaction_qty
                  , end_item_unit_number
                  , scheduled_payback_date
                  , line_type_code
                  , parent_transaction_temp_id
                  , put_away_strategy_id
                  , put_away_rule_id
                  , pick_strategy_id
                  , pick_rule_id
                  , common_bom_seq_id
                  , common_routing_seq_id
                  , cost_type_id
                  , org_cost_group_id
                  , move_order_line_id
                  , task_group_id
                  , pick_slip_number
                  , reservation_id
                  , transaction_status
                  , transfer_cost_group_id
                  , lpn_id
                  , transfer_lpn_id
                  , content_lpn_id
                  , cartonization_id
                  , standard_operation_id
                  , wms_task_type
                  , task_priority
                  , container_item_id
                  , operation_plan_id
                  , parent_line_id
               FROM mtl_material_transactions_temp
              WHERE transaction_temp_id = l_child_txn_temp_id);
Line: 14875

          UPDATE mtl_material_transactions_temp mmtt
             SET mmtt.transaction_header_id = x_new_txn_hdr_id
               , mmtt.transaction_quantity = l_parent_txn_qty
               , mmtt.primary_quantity = l_parent_pri_qty
               , mmtt.parent_line_id = NULL  --l_parent_txn_temp_id --Modified from NULL bug3765153
               , mmtt.transfer_lpn_id = l_transfer_lpn_id
               , mmtt.lpn_id = l_lpn_id
               , mmtt.subinventory_code = l_parent_sub_code
               , mmtt.locator_id = l_parent_loc_id
               , mmtt.transaction_uom = l_parent_uom
               , mmtt.last_update_date = SYSDATE
               , mmtt.last_updated_by = p_user_id
           WHERE mmtt.transaction_temp_id = l_child_txn_temp_id;
Line: 14916

    INSERT INTO wms_dispatched_tasks
                (
                 task_id
               , transaction_temp_id
               , organization_id
               , user_task_type
               , person_id
               , effective_start_date
               , effective_end_date
               , equipment_id
               , equipment_instance
               , person_resource_id
               , machine_resource_id
               , status
               , dispatched_time
               , last_update_date
               , last_updated_by
               , creation_date
               , created_by
               , task_type
               , loaded_time
               , operation_plan_id
               , move_order_line_id
                )
      (SELECT wms_dispatched_tasks_s.NEXTVAL
            , mmtt.transaction_temp_id
            , mmtt.organization_id
            , wdt.user_task_type
            , wdt.person_id
            , wdt.effective_start_date
            , wdt.effective_end_date
            , wdt.equipment_id
            , wdt.equipment_instance
            , wdt.person_resource_id
            , wdt.machine_resource_id
            , 4
            , wdt.dispatched_time
            , SYSDATE
            , p_user_id
            , SYSDATE
            , p_user_id
            , wdt.task_type
            , SYSDATE
            , mmtt.operation_plan_id
            , mmtt.move_order_line_id
         FROM wms_dispatched_tasks wdt, mtl_material_transactions_temp mmtt
        WHERE wdt.transaction_temp_id = p_temp_id
          AND mmtt.transaction_header_id = x_new_txn_hdr_id);
Line: 14965

   DELETE FROM wms_dispatched_tasks wdt
          WHERE wdt.transaction_temp_id IN(SELECT mmtt.transaction_temp_id
                                             FROM mtl_material_transactions_temp mmtt
                                            WHERE mmtt.transaction_header_id = p_txn_hdr_id
                                              AND mmtt.organization_id = p_org_id);
Line: 15001

    DELETE FROM mtl_material_transactions_temp mmtt
          WHERE mmtt.transaction_header_id = p_txn_hdr_id
            AND mmtt.organization_id = p_org_id;
Line: 15007

    update mtl_material_transactions_temp
    set parent_line_id = null
    where transaction_header_id = x_new_txn_hdr_id;
Line: 15040

      SELECT 1
        INTO l_wf
        FROM mtl_transaction_reasons
       WHERE reason_id = p_rsn_id
         AND workflow_name IS NOT NULL
         AND workflow_name <> ' '
         AND workflow_process IS NOT NULL
         AND workflow_process <> ' ';
Line: 15139

         select mmtt.subinventory_code,
         mmtt.locator_id,
         mmtt.revision,
         mmtt.lpn_id,
         null,
         null
         INTO l_sub,l_loc,l_rev,l_lpn,l_ser,l_lot
         from mtl_material_Transactions_temp mmtt
         where mmtt.inventory_item_id = p_inventory_item_id
         and mmtt.organization_id = p_organization_id
         and mmtt.transfer_lpn_id = p_transfer_lpn_id
         and mmtt.content_lpn_id is null
         and decode(p_revision_control,2,mmtt.revision,1,'~~') = nvl(p_revision,'~~')
         and rownum<2;
Line: 15154

         select mmtt.subinventory_code,
         mmtt.locator_id,
         mmtt.revision,
         mmtt.lpn_id,
         null,
         mtlt.lot_number
         INTO l_sub,l_loc,l_rev,l_lpn,l_ser,l_lot
         from mtl_material_Transactions_temp mmtt,
         mtl_transaction_lots_temp mtlt
         where mmtt.inventory_item_id = p_inventory_item_id
         and mmtt.organization_id = p_organization_id
         and mmtt.transfer_lpn_id = p_transfer_lpn_id
         and mmtt.content_lpn_id is null
            and decode(p_revision_control,2,mmtt.revision,1,'~~') = nvl(p_revision,'~~')
         and mmtt.transaction_temp_id = mtlt.transaction_temp_id
         and mtlt.lot_number = p_lot_number
         and rownum<2;
Line: 15183

     inv_cost_group_update.proc_get_costgroup(
              p_organization_id       => p_organization_id,
              p_inventory_item_id     => p_inventory_item_id,
              p_subinventory_code     => p_subinventory_code,
              p_locator_id            => p_locator_id,
              p_revision              => p_revision,
              p_lot_number            => p_lot_number,
              p_serial_number         => null,
              p_containerized_flag    => null,
              p_lpn_id                => p_lpn_id,
              p_transaction_action_id => null,
              x_cost_group_id         => l_cur_cost_group_id,
                 x_return_status         => x_return_status);
Line: 15200

     inv_cost_group_update.proc_get_costgroup(
                             p_organization_id       => p_organization_id,
                 p_inventory_item_id     => p_inventory_item_id,
                 p_subinventory_code     => l_sub,
                 p_locator_id            => l_loc,
                 p_revision              => l_rev,
                 p_lot_number            => l_lot,
                 p_serial_number         => l_ser,
                 p_containerized_flag    => null,
                 p_lpn_id                => l_lpn,
                 p_transaction_action_id => null,
                 x_cost_group_id         => l_exist_cost_group_id,
              x_return_status         => x_return_status);
Line: 15273

   SELECT lpn_id,
     lpn_context,
     subinventory_code,
     locator_id
     FROM wms_license_plate_numbers
    WHERE license_plate_number = p_drop_lpn
      AND organization_id      = p_organization_id;
Line: 15282

   SELECT wda.delivery_id
     FROM wsh_delivery_assignments        wda,
          wsh_delivery_details            wdd,
          mtl_material_transactions_temp  temp
    WHERE wda.delivery_detail_id  = wdd.delivery_detail_id
      AND wdd.move_order_line_id  = temp.move_order_line_id
      AND wdd.organization_id     = temp.organization_id
      AND temp.transfer_lpn_id    = p_pick_lpn_id
      AND temp.organization_id    = p_organization_id ;
Line: 15293

   SELECT wda.delivery_id
     FROM wsh_delivery_assignments        wda,
          wsh_delivery_details            wdd,
          wms_license_plate_numbers lpn
     WHERE wda.parent_delivery_detail_id = wdd.delivery_detail_id
      AND wdd.lpn_id                     = lpn.lpn_id
      AND wdd.released_status = 'X'   -- For LPN reuse ER : 6845650
      AND lpn.outermost_lpn_id           = l_lpn_id
      AND wdd.organization_id            = p_organization_id ;
Line: 15348

   /*   UPDATE wms_license_plate_numbers
         SET lpn_context = WMS_Container_PUB.LPN_CONTEXT_INV
      WHERE lpn_id = drop_lpn_rec.lpn_id;*/
Line: 15405

        SELECT delivery_detail_id
   INTO l_line_rows(1)
        FROM wsh_delivery_details
   WHERE lpn_id =  drop_lpn_rec.lpn_id
   AND rownum = 1 ;
Line: 15411

       SELECT wdd.delivery_detail_id
       INTO l_line_rows(2)
       FROM wsh_delivery_details wdd, Mtl_material_transactions_temp mmtt
       WHERE mmtt.move_order_line_id = wdd.move_order_line_id
       AND wdd.organization_id = mmtt.organization_id
       AND mmtt.organization_id= p_organization_id
       AND mmtt.transfer_lpn_id= p_pick_lpn_id
       AND rownum = 1 ;
Line: 15540

  SELECT wda.delivery_id
  FROM wsh_delivery_assignments        wda,
  wsh_delivery_details            wdd,
  mtl_material_transactions_temp  temp
  WHERE wda.delivery_detail_id   = wdd.delivery_detail_id
  AND wdd.move_order_line_id  = temp.move_order_line_id
  AND wdd.organization_id     = temp.organization_id
  AND temp.transfer_lpn_id    = p_pick_lpn_id
  AND temp.organization_id    = p_organization_id;
Line: 15554

  SELECT /*+ index(wda WSH_DELIVERY_ASSIGNMENTS_N1) ORDERED USE_NL (WDA WDD WLPN) */ wlpn.outermost_lpn_id
  FROM wsh_delivery_assignments        wda,
  wsh_delivery_details            wdd,
  wms_license_plate_numbers       wlpn
  WHERE  wda.delivery_id               = l_delivery_id_c
  AND wda.parent_delivery_detail_id = wdd.delivery_detail_id
  AND wdd.organization_id           = p_organization_id
    AND wdd.lpn_id                    = wlpn.lpn_id
  AND wlpn.subinventory_code        = l_drop_sub_c
  AND wlpn.locator_id               = l_drop_loc_c
  AND wlpn.lpn_context              = 11
    ORDER BY wda.CREATION_DATE DESC ;
Line: 15597

     Select transfer_subinventory, transfer_to_location into l_drop_sub,
       l_drop_loc
  from mtl_material_transactions_temp
  where transfer_lpn_id    = p_pick_lpn_id
  AND organization_id    = p_organization_id;
Line: 15630

  SELECT license_plate_number INTO x_lpn_number FROM
    wms_license_plate_numbers WHERE lpn_id = l_lpn_id;