DBA Data[Home] [Help]

APPS.INV_TRANSFER_ORDER_PVT SQL Statements

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

Line: 91

      SELECT mtl_txn_request_headers_s.NEXTVAL
        INTO l_header_id
        FROM DUAL;
Line: 96

        SELECT 'X'
          INTO l_dummy
          FROM mtl_txn_request_headers
         WHERE request_number = TO_CHAR(l_header_id)
           AND organization_id = NVL(p_organization_id, organization_id);
Line: 114

    SELECT 'X'
      INTO l_dummy
      FROM mtl_txn_request_headers
     WHERE request_number = p_request_number
       AND organization_id = p_organization_id;
Line: 130

    SELECT 'X'
      INTO l_dummy
      FROM mtl_txn_request_lines
     WHERE header_id = p_header_id
       AND organization_id = p_organization_id
       AND line_number = p_line_number;
Line: 148

    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: 158

  PROCEDURE delete_troldt(x_return_status OUT NOCOPY VARCHAR2, x_msg_data OUT NOCOPY VARCHAR2, x_msg_count OUT NOCOPY NUMBER, p_troldt_tbl IN inv_mo_line_detail_util.g_mmtt_tbl_type, p_move_order_type IN NUMBER) IS
    l_troldt_tbl            inv_mo_line_detail_util.g_mmtt_tbl_type;
Line: 206

        inv_reservation_pub.update_reservation(
          p_api_version_number         => 1.0
        , p_init_msg_lst               => fnd_api.g_true
        , x_return_status              => l_return_status
        , x_msg_count                  => l_msg_count
        , x_msg_data                   => l_msg_data
        , p_original_rsv_rec           => l_rsv_temp_rec
        , p_to_rsv_rec                 => l_to_rsv_rec
        , p_original_serial_number     => l_dummy_sn
        , p_to_serial_number           => l_dummy_sn
        , p_validation_flag            => fnd_api.g_true
        );
Line: 236

      inv_mo_line_detail_util.delete_row(x_return_status => l_return_status, p_line_id => l_troldt_tbl(l_counter).move_order_line_id, p_line_detail_id => l_troldt_tbl(l_counter).transaction_temp_id);
Line: 253

  END delete_troldt;
Line: 255

  PROCEDURE update_lots_temp(
    x_return_status    OUT NOCOPY VARCHAR2
  , x_msg_data         OUT NOCOPY VARCHAR2
  , x_msg_count        OUT NOCOPY NUMBER
  , p_operation            VARCHAR2
  , p_item_id              NUMBER
  , p_org_id               NUMBER
  , p_trx_temp_id          NUMBER
  , p_cancel_qty           NUMBER
  , p_trx_uom              VARCHAR2
  , p_primary_uom          VARCHAR2
  , p_last_updated_by      NUMBER
  , p_last_update_date     DATE
  , p_creation_date        DATE
  , p_created_by           NUMBER
  ) IS
    l_mtlt_cancel_qty  NUMBER;
Line: 282

      SELECT        transaction_quantity,
                    secondary_quantity         --INVCONV
                    , lot_number -- nsinghi bug#5724815.
               FROM mtl_transaction_lots_temp
              WHERE transaction_temp_id = p_trx_temp_id
           ORDER BY creation_date
      FOR UPDATE OF transaction_temp_id;
Line: 292

      SELECT tracking_quantity_ind, secondary_uom_code
      FROM   mtl_system_items_b
      WHERE  inventory_item_id = p_item_id
      AND    organization_id = p_org_id;
Line: 315

    IF p_operation = 'DELETE' THEN -- when cancel qty >sum(mmtt trx qty)
      IF (l_debug = 1) THEN
         DEBUG('Deleting the row in mtlt ', 'UPDATE LOTS TEMP');
Line: 320

      DELETE FROM mtl_transaction_lots_temp
            WHERE transaction_temp_id = p_trx_temp_id;
Line: 322

    ELSIF p_operation = 'UPDATE' THEN -- when cancel qty < sum(mmtt trx qty)
      SELECT COUNT(*)
        INTO l_lot_count
        FROM mtl_transaction_lots_temp
       WHERE transaction_temp_id = p_trx_temp_id;
Line: 343

             DEBUG('Delete current row ', 'UPDATE LOTS TEMP');
Line: 347

          DELETE FROM mtl_transaction_lots_temp
                WHERE  CURRENT OF c_mtlt;
Line: 351

             DEBUG('Update current row ', 'UPDATE LOTS TEMP');
Line: 371

                 DEBUG('Cannot convert uom to secondary uom', 'UPDATE LOTS TEMP');
Line: 389

          UPDATE mtl_transaction_lots_temp
             SET transaction_quantity = l_mtlt_trx_qty
               , secondary_quantity = l_mtlt_sec_trx_qty -- INVCONV
               , primary_quantity = l_mtlt_primary_qty
               , last_update_date = p_last_update_date
               , last_updated_by = p_last_updated_by
               , creation_date = p_creation_date
               , created_by = p_created_by
           WHERE  CURRENT OF c_mtlt;
Line: 418

        fnd_msg_pub.add_exc_msg(g_pkg_name, 'update lots temp');
Line: 422

  END update_lots_temp;
Line: 426

  PROCEDURE update_serial_temp(x_return_status OUT NOCOPY VARCHAR2, x_msg_data OUT NOCOPY VARCHAR2, x_msg_count OUT NOCOPY NUMBER, p_operation VARCHAR2, p_trx_temp_id NUMBER, p_cancel_qty NUMBER) IS
    l_serial_temp_id        NUMBER;
Line: 437

      SELECT        fm_serial_number
                  , to_serial_number
                  , group_header_id
               FROM mtl_serial_numbers_temp
              WHERE transaction_temp_id = p_trx_temp_id
           ORDER BY fm_serial_number DESC
      FOR UPDATE OF transaction_temp_id;
Line: 448

    IF p_operation = 'DELETE' THEN -- when cancel qty >sum(mmtt trx qty)
      DELETE FROM mtl_serial_numbers_temp
            WHERE transaction_temp_id = p_trx_temp_id;
Line: 451

    ELSIF p_operation = 'UPDATE' THEN -- when cancel qty < sum(mmtt trx qty)
      SELECT transaction_header_id
        INTO l_transaction_header_id
        FROM mtl_material_transactions_temp
       WHERE transaction_temp_id = p_trx_temp_id;
Line: 457

      SELECT COUNT(*)
        INTO l_serial_count
        FROM mtl_serial_numbers_temp
       WHERE transaction_temp_id = p_trx_temp_id;
Line: 471

              DELETE FROM mtl_serial_numbers_temp
                    WHERE  CURRENT OF serial_temp_csr;
Line: 475

              *** call serial_check.inv_unmark_rsv_serial instead of update msn directly
              UPDATE mtl_serial_numbers
                 SET line_mark_id = unmarked_value
                   , group_mark_id = unmarked_value
                   , lot_line_mark_id = unmarked_value
               WHERE group_mark_id IN (p_trx_temp_id, l_transaction_header_id)
                 AND serial_number >= NVL(l_fm_serial_number, serial_number)
                 AND serial_number <= NVL(l_to_serial_number, NVL(l_fm_serial_number, serial_number))
                 AND LENGTH(serial_number) = LENGTH(NVL(l_fm_serial_number, serial_number));
Line: 493

                 ,p_update_reservation => fnd_api.g_true);
Line: 522

        fnd_msg_pub.add_exc_msg(g_pkg_name, 'update serial temp');
Line: 526

  END update_serial_temp;
Line: 528

  PROCEDURE update_troldt(
    x_return_status   OUT    NOCOPY VARCHAR2
  , x_msg_data        OUT    NOCOPY VARCHAR2
  , x_msg_count       OUT    NOCOPY NUMBER
  , p_trolin_rec      IN     inv_move_order_pub.trolin_rec_type
  , p_old_trolin_rec  IN     inv_move_order_pub.trolin_rec_type
  , p_troldt_tbl      IN     inv_mo_line_detail_util.g_mmtt_tbl_type
  , p_move_order_type IN     NUMBER
  , x_trolin_rec      IN OUT    NOCOPY inv_move_order_pub.trolin_rec_type
  , p_delete_mmtt     IN     VARCHAR2 DEFAULT 'YES'  --Added bug3524130
  ) IS
    l_troldt_tbl            inv_mo_line_detail_util.g_mmtt_tbl_type;
Line: 612

             DEBUG('Cannot convert uom to secondary uom', 'UPDATE TROLNDT ');
Line: 630

         DEBUG(l_quantity_cancel, 'UPDATE TROLNDT ');
Line: 641

           DEBUG('inside the loop', 'UPDATE TROLNDT');
Line: 644

        SELECT lot_control_code
             , serial_number_control_code
          INTO l_lot_control_code
             , l_serial_control_code
          FROM mtl_system_items
         WHERE inventory_item_id = l_troldt_tbl(l_counter).inventory_item_id
           AND organization_id = l_troldt_tbl(l_counter).organization_id;
Line: 653

           DEBUG('Lot control code '|| TO_CHAR(l_lot_control_code), 'UPDATE TROLNDT');
Line: 681

             DEBUG('inside the decrease quantity condition', 'UPDATE TROLNDT');
Line: 686

          if detail exist, we need to delete the line detail for the delta quantity
          and update the detailed_qty on reservation if it exist for the particular detail record */
          IF (l_troldt_tbl(l_counter).transaction_quantity <= l_quantity_cancel) THEN
            IF (l_debug = 1) THEN
               DEBUG('delete detail row', 'UPDATE TROLNDT');
Line: 694

              update_lots_temp(
                x_return_status              => l_return_status
              , x_msg_count                  => l_msg_count
              , x_msg_data                   => l_msg_data
              , p_operation                  => 'DELETE'
              , p_item_id                    => l_troldt_tbl(l_counter).inventory_item_id
              , p_org_id                     => l_troldt_tbl(l_counter).organization_id
              , p_trx_temp_id                => l_troldt_tbl(l_counter).transaction_temp_id
              , p_cancel_qty                 => l_quantity_cancel
              , p_trx_uom                    => l_troldt_tbl(l_counter).transaction_uom
              , p_primary_uom                => l_troldt_tbl(l_counter).item_primary_uom_code
              , p_last_updated_by            => l_troldt_tbl(l_counter).last_updated_by
              , p_last_update_date           => l_troldt_tbl(l_counter).last_update_date
              , p_creation_date              => l_troldt_tbl(l_counter).creation_date
              , p_created_by                 => l_troldt_tbl(l_counter).created_by
              );
Line: 720

              update_serial_temp(x_return_status => l_return_status, x_msg_count => l_msg_count, x_msg_data => l_msg_data, p_operation => 'DELETE', p_trx_temp_id => l_troldt_tbl(l_counter).transaction_temp_id, p_cancel_qty => l_quantity_cancel);
Line: 742

            IF p_delete_mmtt = 'YES' THEN --Added bug3524130
            inv_mo_line_detail_util.delete_row(x_return_status => l_return_status, p_line_id => l_trolin_rec.line_id, p_line_detail_id => l_troldt_tbl(l_counter).transaction_temp_id);
Line: 753

               DEBUG('only need to update the line detail', 'UPDATE TROLNDT ');
Line: 757

              update_lots_temp(
                x_return_status              => l_return_status
              , x_msg_count                  => l_msg_count
              , x_msg_data                   => l_msg_data
              , p_operation                  => 'UPDATE'
              , p_item_id                    => l_troldt_tbl(l_counter).inventory_item_id
              , p_org_id                     => l_troldt_tbl(l_counter).organization_id
              , p_trx_temp_id                => l_troldt_tbl(l_counter).transaction_temp_id
              , p_cancel_qty                 => l_quantity_cancel
              , p_trx_uom                    => l_troldt_tbl(l_counter).transaction_uom
              , p_primary_uom                => l_troldt_tbl(l_counter).item_primary_uom_code
              , p_last_updated_by            => l_troldt_tbl(l_counter).last_updated_by
              , p_last_update_date           => l_troldt_tbl(l_counter).last_update_date
              , p_creation_date              => l_troldt_tbl(l_counter).creation_date
              , p_created_by                 => l_troldt_tbl(l_counter).created_by
              );
Line: 783

              update_serial_temp(x_return_status => l_return_status, x_msg_count => l_msg_count, x_msg_data => l_msg_data, p_operation => 'DELETE', p_trx_temp_id => l_troldt_tbl(l_counter).transaction_temp_id, p_cancel_qty => l_quantity_cancel);
Line: 813

                   DEBUG('Cannot convert uom to secondary uom', 'UPDATE TROLNDT ');
Line: 829

            inv_mo_line_detail_util.update_row(x_return_status => l_return_status, p_mo_line_detail_rec => l_troldt_tbl(l_counter));
Line: 848

            inv_reservation_pub.update_reservation(
              p_api_version_number         => 1.0
            , x_return_status              => l_return_status
            , x_msg_count                  => l_msg_count
            , x_msg_data                   => l_msg_data
            , p_original_rsv_rec           => l_rsv_temp_rec
            , p_to_rsv_rec                 => l_to_rsv_rec
            , p_original_serial_number     => l_dummy_sn
            , p_to_serial_number           => l_dummy_sn
            , p_validation_flag            => fnd_api.g_true
            );
Line: 875

             DEBUG('change status', 'UPDATE TROLNDT');
Line: 888

            inv_reservation_pub.update_reservation(
              p_api_version_number         => 1.0
            , x_return_status              => l_return_status
            , x_msg_count                  => x_msg_count
            , x_msg_data                   => x_msg_data
            , p_original_rsv_rec           => l_rsv_temp_rec
            , p_to_rsv_rec                 => l_to_rsv_rec
            , p_original_serial_number     => l_dummy_sn
            , p_to_serial_number           => l_dummy_sn
            , p_validation_flag            => fnd_api.g_true
            );
Line: 918

          inv_mo_line_detail_util.delete_row(x_return_status => l_return_status, p_line_id => l_trolin_rec.line_id, p_line_detail_id => l_troldt_tbl(l_counter).transaction_temp_id);
Line: 941

  END update_troldt;
Line: 973

    ELSIF l_trohdr_rec.operation = inv_globals.g_opr_update
          OR l_trohdr_rec.operation = inv_globals.g_opr_delete THEN
      l_trohdr_rec.db_flag  := fnd_api.g_true;
Line: 992

    IF (l_trohdr_rec.operation = inv_globals.g_opr_update
        OR l_trohdr_rec.operation = inv_globals.g_opr_create
        OR l_trohdr_rec.operation = inv_globals.g_opr_delete)
    THEN
      --  Attribute level validation.
      IF l_control_rec.default_attributes
         OR l_control_rec.change_attributes THEN
        --  Default missing attributes

--Bug# 4554438.Start
-- l_tmp_trohdr_rec is passed as there is NOCOPY for x_trohdr_rec
--        inv_default_trohdr.ATTRIBUTES(p_trohdr_rec => l_trohdr_rec, x_trohdr_rec => l_trohdr_rec);
Line: 1037

        IF l_trohdr_rec.operation = inv_globals.g_opr_delete THEN
          inv_validate_trohdr.entity_delete(x_return_status => l_return_status, p_trohdr_rec => l_trohdr_rec);
Line: 1052

        IF l_trohdr_rec.operation = inv_globals.g_opr_delete THEN
          inv_trohdr_util.delete_row(p_header_id => l_trohdr_rec.header_id);
Line: 1056

          l_trohdr_rec.last_update_date   := SYSDATE;
Line: 1057

          l_trohdr_rec.last_updated_by    := fnd_global.user_id;
Line: 1058

          l_trohdr_rec.last_update_login  := fnd_global.login_id;
Line: 1060

          IF l_trohdr_rec.operation = inv_globals.g_opr_update THEN
            inv_trohdr_util.update_row(l_trohdr_rec);
Line: 1065

            inv_trohdr_util.insert_row(l_trohdr_rec);
Line: 1109

  , p_delete_mmtt      IN        VARCHAR2 DEFAULT 'YES' --Added bug3524130
  ) IS
    l_return_status         VARCHAR2(1);
Line: 1215

        ELSIF l_trolin_rec.operation = inv_globals.g_opr_update
              OR l_trolin_rec.operation = inv_globals.g_opr_delete THEN
          l_trolin_rec.db_flag  := fnd_api.g_true;
Line: 1318

          IF l_trolin_rec.operation = inv_globals.g_opr_delete THEN
            inv_validate_trolin.entity_delete(x_return_status => l_return_status, p_trolin_rec => l_trolin_rec);
Line: 1393

          IF l_trolin_rec.operation = inv_globals.g_opr_delete THEN
            --debug('Calling inv_mold_query_rows');
Line: 1402

                 DEBUG('Calling Delete_Troldt', 'Inv_Transfer_Order_PVT.Trolins');
Line: 1404

              delete_troldt(x_return_status => l_return_status, x_msg_data => l_msg_data, x_msg_count => l_msg_count, p_troldt_tbl => l_troldt_tbl, p_move_order_type => l_move_order_type);
Line: 1415

            inv_trolin_util.delete_row(p_line_id => l_trolin_rec.line_id);
Line: 1416

          ELSIF l_trolin_rec.operation = inv_globals.g_opr_update THEN
            --  Get Who Information
	    -- Bug 3030538. Creation_date becomes null when both an update and
	    -- create are done in move orders form

            l_trolin_rec.creation_date      := l_old_trolin_rec.creation_date;
Line: 1423

            l_trolin_rec.last_update_date   := SYSDATE;
Line: 1424

            l_trolin_rec.last_updated_by    := fnd_global.user_id;
Line: 1425

            l_trolin_rec.last_update_login  := fnd_global.login_id;
Line: 1455

                   DEBUG('calling update troldt', 'Inv_Transfer_Order_PVT.Trolins');
Line: 1457

                update_troldt(
                  x_return_status              => l_return_status
                , x_msg_data                   => l_msg_data
                , x_msg_count                  => l_msg_count
                , p_trolin_rec                 => l_trolin_rec
                , p_old_trolin_rec             => l_old_trolin_rec
                , p_troldt_tbl                 => l_troldt_tbl
                , p_move_order_type            => p_move_order_type
                , x_trolin_rec                 => l_trolin_rec
		, p_delete_mmtt                => p_delete_mmtt  --Added bug 3524130
                );
Line: 1483

               DEBUG('calling update row', 'Inv_Transfer_Order_PVT.Trolins');
Line: 1486

            inv_trolin_util.update_row(l_trolin_rec);
Line: 1488

               DEBUG('after update row', 'Inv_Transfer_Order_PVT.Trolins');
Line: 1493

            l_trolin_rec.last_update_date   := SYSDATE;
Line: 1494

            l_trolin_rec.last_updated_by    := fnd_global.user_id;
Line: 1495

            l_trolin_rec.last_update_login  := fnd_global.login_id;
Line: 1502

            inv_trolin_util.insert_row(l_trolin_rec);
Line: 1696

  , p_delete_mmtt        IN      VARCHAR2 DEFAULT 'YES' --Added bug3524130
  ) IS
    l_api_version_number CONSTANT NUMBER                             := 1.0;
Line: 1791

      , p_delete_mmtt                => p_delete_mmtt  --Added bug 3524130
      );
Line: 2113

  PROCEDURE update_txn_source_line(p_line_id IN NUMBER,
				   p_new_source_line_id IN NUMBER)
    IS
       l_debug number;
Line: 2119

	  SELECT reservation_id, transaction_quantity, primary_quantity
	    FROM mtl_material_transactions_temp
	    WHERE move_order_line_id = p_line_id;
Line: 2150

     UPDATE mtl_txn_request_lines
       SET txn_source_line_id = p_new_source_line_id
       WHERE line_id = p_line_id;
Line: 2154

     UPDATE mtl_material_transactions_temp
       SET trx_source_line_id = p_new_source_line_id
       WHERE move_order_line_id = p_line_id;
Line: 2165

		 debug('About to call inv_reservation_pub.query_reservations', 'update_txn_source_line');
Line: 2182

		    debug('Error from query_reservations', 'update_txn_source_line');
Line: 2189

		    debug('Error from query_reservations', 'update_txn_source_line');
Line: 2196

		 debug('Original Reservation_ID: ' || rec_mmtt.reservation_id, 'update_txn_source_line');
Line: 2246

  END update_txn_source_line;
Line: 2255

    g_mo_picked_quantity_tbl.DELETE;
Line: 2256

    g_rsv_picked_quantity_tbl.DELETE;
Line: 2257

    g_mmtt_cache_tbl.DELETE;   --Bug: 4994950 (Actual bug #4762505)
Line: 2271

      SELECT reservation_id
        FROM mtl_reservations
       WHERE NVL(staged_flag, 'N') = 'N'
         AND supply_source_type_id = 13
         AND demand_source_type_id IN (2, 8)
         AND demand_source_line_id = p_source_line_id
         AND demand_source_line_detail IS NULL;
Line: 2321

    SELECT     1
    INTO  l_ato_item
    FROM dual
    WHERE EXISTS (SELECT msi.inventory_item_id
                  FROM mtl_system_items msi, mtl_Reservations mtr
                  WHERE msi.inventory_item_id = mtr.inventory_item_id
                  AND msi.organization_id = mtr.organization_id
                  AND bom_item_type = 4
                  AND replenish_to_order_flag = 'Y'
                  AND mtr.demand_source_line_id  =  p_source_line_id
                  AND mtr.demand_source_line_detail IS NULL);
Line: 2346

              SELECT 1
              INTO  l_unstaged_so_exists
              FROM dual
              WHERE EXISTS ( SELECT delivery_Detail_id
                             FROM wsh_delivery_Details
                             WHERE source_line_id = p_source_line_id
                             AND released_status in ( 'B','R','S'));
Line: 2373

        SELECT 1
          INTO l_unstaged_so_exists
          FROM DUAL
         WHERE EXISTS( SELECT /*+ index(wsh_delivery_details WSH_DELIVERY_DETAILS_N3) */ delivery_detail_id
                         FROM wsh_delivery_details
                        WHERE source_line_id = p_source_line_id
                          AND (released_status IN ('B','R','S')));
Line: 2402

        inv_reservation_pub.delete_reservation(
          p_api_version_number         => 1.0
        , p_init_msg_lst               => fnd_api.g_true
        , x_return_status              => l_return_status
        , x_msg_count                  => l_msg_count
        , x_msg_data                   => l_msg_data
        , p_rsv_rec                    => l_mtl_reservation_rec
        , p_serial_number              => l_original_serial_number
        );
Line: 2412

           DEBUG('after delete reservation return status is '|| l_return_status, 'Clean_Reservations');
Line: 2539

    l_update_shipping             BOOLEAN;
Line: 2565

      SELECT primary_uom_code, secondary_uom_code, tracking_quantity_ind
      FROM   mtl_system_items
      WHERE  inventory_item_id = l_item_id
      AND    organization_id   = l_org_id;
Line: 2571

      SELECT lot_number
           , primary_quantity
           , transaction_quantity
           , secondary_quantity
           , secondary_unit_of_measure
           , serial_transaction_temp_id
           , grade_code
        FROM mtl_transaction_lots_temp
       WHERE transaction_temp_id = l_trx_temp_id
       ORDER BY lot_number;
Line: 2584

      SELECT msn.serial_number
        FROM mtl_serial_numbers msn, mtl_serial_numbers_temp msnt
       WHERE msnt.transaction_temp_id = DECODE(l_lot_control_code, 1, l_trx_temp_id, l_ser_trx_temp_id)
         AND msn.current_organization_id = l_org_id
         AND msn.inventory_item_id = l_item_id
         AND msn.serial_number BETWEEN msnt.fm_serial_number AND NVL(msnt.to_serial_number, msnt.fm_serial_number)
         AND length(msn.serial_number) = length(msnt.fm_serial_number);
Line: 2593

      SELECT reservation_id
           , primary_reservation_quantity
           , detailed_quantity
        FROM mtl_reservations
       WHERE demand_source_line_id = l_trolin_rec.txn_source_line_id
         AND NVL(detailed_quantity, 0) > 0
         AND NVL(staged_flag, 'N') = 'N'
         AND demand_source_line_detail IS NULL;
Line: 2603

      SELECT reservation_id
        FROM mtl_reservations
       WHERE NVL(staged_flag, 'N') = 'N'
         AND demand_source_line_id = l_trolin_rec.txn_source_line_id
         AND demand_source_line_detail IS NULL;
Line: 2612

      SELECT msn.serial_number
        FROM mtl_serial_numbers msn, mtl_serial_numbers_temp msnt
       WHERE msnt.transaction_temp_id = l_trx_temp_id
         AND msn.serial_number BETWEEN msnt.fm_serial_number AND NVL(msnt.to_serial_number, msnt.fm_serial_number)
         AND length(msn.serial_number) = length(msnt.fm_serial_number)
         AND msn.reservation_id = l_reservation_id;
Line: 2621

      Select entity_type
      From wip_entities
      Where wip_entity_id = l_trolin_rec.txn_source_id;
Line: 2627

       SELECT  ABS(transaction_quantity) , mmtt.transaction_uom, ABS(primary_quantity), NVL(ABS(secondary_transaction_quantity), 0)
         FROM mtl_material_transactions_temp mmtt
       WHERE move_order_line_id = p_mo_line_id;
Line: 2724

    SELECT moh.move_order_type
      INTO l_move_order_type
      FROM mtl_txn_request_headers moh, mtl_txn_request_lines mol
     WHERE mol.line_id = l_trolin_rec.line_id
       AND mol.header_id = moh.header_id;
Line: 2873

      SELECT NVL(SUM(ABS(transaction_quantity)), 0)
           , NVL(SUM(ABS(primary_quantity)), 0)
           , NVL(SUM(ABS(secondary_transaction_quantity)), 0)
        INTO l_pending_quantity
           , l_primary_pending_quantity
           , l_sec_pending_quantity
        FROM mtl_material_transactions_temp
       WHERE move_order_line_id = l_trolin_rec.line_id; */
Line: 2999

        SELECT NVL(SUM(ABS(primary_quantity)), 0)
            ,  NVL(SUM(ABS(secondary_transaction_quantity)), 0)
          INTO l_rsv_primary_quantity
            ,  l_sec_rsv_quantity
          FROM mtl_material_transactions_temp
         WHERE reservation_id = l_mmtt_rec.reservation_id;
Line: 3108

               DEBUG('Unable to lock the work order line for update', 'Finalize_Pick_Confirm');
Line: 3132

       SELECT COUNT(*)
       INTO l_other_mmtt_rec
       FROM mtl_material_transactions_temp
       WHERE move_order_line_id = l_trolin_rec.line_id
       AND transaction_temp_id <> l_mmtt_rec.transaction_temp_id;
Line: 3170

              g_mmtt_cache_tbl.DELETE(l_trolin_rec.line_id);
Line: 3185

          g_mmtt_cache_tbl.DELETE(l_trolin_rec.line_id);  --Bug:4994950
Line: 3203

       DEBUG('calling update_row', 'Finalize_Pick_Confirm');
Line: 3205

    inv_trolin_util.update_row(l_trolin_rec);
Line: 3224

          DEBUG('Replenishment Move Order will not update g_mmtt_cache_tbl', 'Finalize_Pick_Confirm');
Line: 3243

    SELECT lot_control_code
           , serial_number_control_code
           , reservable_type
        INTO l_lot_control_code
           , l_serial_control_code
           , l_reservable_type_item
        FROM mtl_system_items
       WHERE inventory_item_id = l_mmtt_rec.inventory_item_id
         AND organization_id = l_mmtt_rec.organization_id;
Line: 3254

         DEBUG('After select lot_control_code = '|| l_lot_control_code, 'Finalize_Pick_confirm');
Line: 3255

         DEBUG('After select l_serial_control_code = '|| l_serial_control_code, 'Finalize_Pick_Confirm');
Line: 3284

            *** call serial_check.inv_unmark_rsv_serial instead of update msn directly
            UPDATE mtl_serial_numbers
               SET group_mark_id = NULL
             WHERE serial_number = l_serial_number
               AND inventory_item_id = l_mmtt_rec.inventory_item_id;
Line: 3298

                ,p_update_reservation => fnd_api.g_true);
Line: 3320

          *** call serial_check.inv_unmark_rsv_serial instead of update msn directly
          UPDATE mtl_serial_numbers
             SET group_mark_id = NULL
           WHERE serial_number = l_serial_number
             AND inventory_item_id = l_mmtt_rec.inventory_item_id;
Line: 3334

                ,p_update_reservation => fnd_api.g_true);
Line: 3360

         SELECT reservable_type
           INTO l_reservable_type
           FROM mtl_secondary_inventories
          WHERE organization_id = l_mmtt_rec.organization_id
            AND secondary_inventory_name = l_mmtt_rec.transfer_subinventory;
Line: 3478

          inv_reservation_pub.update_reservation(
            p_api_version_number         => 1.0
          , p_init_msg_lst               => fnd_api.g_false
          , x_return_status              => l_return_status
          , x_msg_count                  => x_msg_count
          , x_msg_data                   => x_msg_data
          , p_original_rsv_rec           => l_mtl_reservation_tbl(1)
          , p_to_rsv_rec                 => l_mtl_reservation_rec
          , p_original_serial_number     => l_original_serial_number
          , p_to_serial_number           => l_to_serial_number
          , p_validation_flag            => fnd_api.g_true -- Explicitly set the validation flag to true with respect to the Bug 4004597
          , p_over_reservation_flag      => 3  -- Bug 4997704, Passing p_over_reservation_flag to reservation API to handle overpicking scenarios
	  );
Line: 3492

             DEBUG('after update reservation return status is '|| l_return_status, 'Finalize_Pick_Confirm');
Line: 3535

        SELECT COUNT(*) INTO l_lot_count
          FROM mtl_transaction_lots_temp
         WHERE transaction_temp_id = p_transaction_temp_id;
Line: 3579

                  UPDATE mtl_serial_numbers
                  SET    reservation_id = null
                  WHERE  reservation_id = l_mtl_reservation_tbl(1).reservation_id
                  AND    serial_number = l_serial_number;
Line: 3594

                 DEBUG('serial count with updated null reservation_id = ' || l_serial_count, 'Finalize_Pick_Confirm');
Line: 3598

                  UPDATE mtl_reservations
                  SET    serial_reservation_quantity = serial_reservation_quantity - l_serial_count
                  WHERE  reservation_id = l_mtl_reservation_tbl(1).reservation_id;
Line: 3616

                UPDATE mtl_serial_numbers
                SET    reservation_id = null
                WHERE  reservation_id = l_mtl_reservation_tbl(1).reservation_id
                AND    serial_number = l_serial_number;
Line: 3627

                 DEBUG('serial count with updated null reservation_id = ' || l_serial_count, 'Finalize_Pick_Confirm');
Line: 3631

                  UPDATE mtl_reservations
                  SET    serial_reservation_quantity = serial_reservation_quantity - l_serial_count
                  WHERE  reservation_id = l_mtl_reservation_tbl(1).reservation_id;
Line: 3641

             DEBUG('not reservable staging subinventory, '|| 'delete org wide reservation', 'Finalize_Pick_Confirm');
Line: 3655

          ELSE -- if qty > rsv qty, delete reservation
            l_mtl_reservation_rec.primary_reservation_quantity  := 0;
Line: 3683

          inv_reservation_pub.update_reservation(
            p_api_version_number         => 1.0
          , p_init_msg_lst               => fnd_api.g_false
          , x_return_status              => l_return_status
          , x_msg_count                  => x_msg_count
          , x_msg_data                   => x_msg_data
          , p_original_rsv_rec           => l_mtl_reservation_tbl(1)
          , p_to_rsv_rec                 => l_mtl_reservation_rec
          , p_original_serial_number     => l_original_serial_number
          , p_to_serial_number           => l_to_serial_number
          , p_validation_flag            => fnd_api.g_true
          , p_over_reservation_flag      => 3  -- Bug 4997704, Passing p_over_reservation_flag to reservation API to handle overpicking scenarios
          );
Line: 3697

             DEBUG('after update reservation return status is '|| l_return_status, 'Finalize_Pick_Confirm');
Line: 4038

                inv_reservation_pub.update_reservation(
                  p_api_version_number         => 1.0
                , p_init_msg_lst               => fnd_api.g_false
                , x_return_status              => l_return_status
                , x_msg_count                  => x_msg_count
                , x_msg_data                   => x_msg_data
                , p_original_rsv_rec           => l_mtl_reservation_tbl(1)
                , p_to_rsv_rec                 => l_mtl_reservation_rec
                , p_original_serial_number     => l_original_serial_number
                , p_to_serial_number           => l_to_serial_number
                , p_validation_flag            => fnd_api.g_true
                , p_over_reservation_flag      => 3  -- Bug 4997704, Passing p_over_reservation_flag to reservation API to handle overpicking scenarios
                );
Line: 4052

                   DEBUG('after update reservation return status is '|| l_return_status, 'Finalize_Pick_Confirm');
Line: 4099

                inv_staged_reservation_util.update_staged_flag(x_return_status => l_return_status, x_msg_count => x_msg_count, x_msg_data => x_msg_data, p_reservation_id => l_reservation_id, p_staged_flag => 'Y');
Line: 4103

                     DEBUG('Error in update_staged_flag', 'Finalize_Pick_Confirm');
Line: 4108

                     DEBUG('Unexpected error in update_staged_flag', 'Finalize_Pick_Confirm');
Line: 4112

              END IF; -- Create or Update
Line: 4158

              inv_reservation_pub.update_reservation(
                p_api_version_number         => 1.0
              , p_init_msg_lst               => fnd_api.g_false
              , x_return_status              => l_return_status
              , x_msg_count                  => x_msg_count
              , x_msg_data                   => x_msg_data
              , p_original_rsv_rec           => l_mtl_reservation_tbl(1)
              , p_to_rsv_rec                 => l_mtl_reservation_rec
              , p_original_serial_number     => l_original_serial_number
              , p_to_serial_number           => l_to_serial_number
              , p_validation_flag            => fnd_api.g_true
              , p_over_reservation_flag      => 3  -- Bug 4997704, Passing p_over_reservation_flag to reservation API to handle overpicking scenarios
              );
Line: 4172

                 DEBUG('after update reservation return status is '|| l_return_status, 'Finalize_Pick_Confirm');
Line: 4219

              inv_staged_reservation_util.update_staged_flag
                    (x_return_status        => l_return_status
                    , x_msg_count           => x_msg_count
                    , x_msg_data            => x_msg_data
                    , p_reservation_id      => l_reservation_id
                    , p_staged_flag         => 'Y'
                    );
Line: 4229

                   DEBUG('Error in update_staged_flag', 'Finalize_Pick_Confirm');
Line: 4234

                   DEBUG('Unexpected error in update_staged_flag', 'Finalize_Pick_Confirm');
Line: 4238

            END IF; -- Create or Update
Line: 4246

         DEBUG('before select delivery_detail_id', 'Finalize_Pick_Confirm');
Line: 4251

        SELECT /*+index (WDD WSH_DELIVERY_DETAILS_N7)*/
                  delivery_detail_id, source_header_id, source_line_id
              INTO l_delivery_detail_id, l_source_header_id, l_source_line_id
              FROM wsh_delivery_details WDD
             WHERE WDD.move_order_line_id = l_mmtt_rec.move_order_line_id
               AND WDD.move_order_line_id IS NOT NULL
               AND WDD.released_status = 'S'
        FOR UPDATE NOWAIT;
Line: 4285

         DEBUG('after select delivery_detail_id', 'Finalize_Pick_Confirm');
Line: 4344

		 SELECT license_plate_number
		 INTO l_container_name
		 FROM wms_license_plate_numbers
		 WHERE organization_id= l_mmtt_rec.organization_id
		 AND lpn_id=l_shipping_attr(1).transfer_lpn_id;
Line: 4350

		  SELECT wdd.released_status,wdd.delivery_detail_id
		  INTO l_status_code,l_container_delivery_det_id
		  FROM   wsh_delivery_details wdd
		  WHERE wdd.container_name =l_container_name
          AND wdd.released_status = 'X';  -- ER : 6845650
Line: 4373

                     WSH_CONTAINER_GRP.Update_Container(
                          p_api_version => 1.0,
                          p_init_msg_list => FND_API.G_FALSE,
             	          p_commit =>FND_API.G_FALSE,
	                  p_validation_level => FND_API.G_VALID_LEVEL_FULL,
                          x_return_status =>  x_return_status,
                          x_msg_count => x_msg_count,
                          x_msg_data => x_msg_data,
                          p_container_rec => l_container_rec
                         );
Line: 4385

                         debug('WSH_Container_Grp.Update_Containers returns error','Finalize Pick Confirm');
Line: 4390

                        debug('WSH_Container_Grp.Update_Containers returns success','Finalize Pick Confirm');
Line: 4400

		    /*UPDATE WSH_DELIVERY_DETAILS
		    SET CONTAINER_NAME=l_new_container_name,
				       lpn_id=NULL,
				       last_update_date=sysdate,
				       last_updated_by=fnd_global.user_id,
				       last_update_login=fnd_global.login_id
		    WHERE container_name =  l_container_name ;
Line: 4437

         DEBUG('about to call update shipping attributes', 'Finalize_Pick_Confirm');
Line: 4473

            SELECT 1 INTO l_dummy_num
            FROM fnd_tables
            WHERE table_name = 'WMS_OP_PLANS_B'
            AND rownum < 2;
Line: 4517

          l_update_shipping  := TRUE;
Line: 4527

              SELECT WMS_CATCH_WEIGHT_PVT.G_PRICE_PRIMARY INTO l_catch_weight_enabled FROM DUAL
              WHERE EXISTS (
                SELECT 1
                FROM mtl_material_transactions_temp mmtt,
                     mtl_transaction_lots_temp mtlt
                WHERE mmtt.organization_id = l_mmtt_rec.organization_id
                AND   mmtt.inventory_item_id = l_mmtt_rec.inventory_item_id
                AND   NVL(mmtt.revision, '@') = NVL(l_mmtt_rec.revision, '@')
                AND   mmtt.transaction_source_type_id = INV_GLOBALS.G_SourceType_SalesOrder
                AND   mmtt.transaction_action_id = INV_GLOBALS.G_Action_Stgxfr
                AND   NVL(mmtt.content_lpn_id, mmtt.transfer_lpn_id) = l_lpn_id
                AND   mtlt.transaction_temp_id = mmtt.transaction_temp_id
                AND   mtlt.lot_number = l_lot_number
                AND   (mtlt.secondary_quantity IS NULL OR mtlt.secondary_unit_of_measure IS NULL) );
Line: 4608

               DEBUG('Calling Update Shipping Attributes for a serial range of lot items', 'Finalize Pick Confirm');
Line: 4623

            wsh_interface.update_shipping_attributes(p_source_code => 'INV', p_changed_attributes => l_shipping_attr, x_return_status => l_return_status);
Line: 4625

               DEBUG('after update shipping attributes', 'Finalize_Pick_Confirm');
Line: 4630

                 DEBUG('return error from update shipping attributes', 'Finalize_Pick_Confirm');
Line: 4635

                 DEBUG('return error from update shipping attributes', 'Finalize_Pick_Confirm');
Line: 4666

                l_update_shipping  := FALSE;
Line: 4669

              IF l_update_shipping = TRUE THEN
                l_shipping_attr(1).serial_number     := l_serial_number;
Line: 4712

                   DEBUG('Calling Update Shipping Attributes', 'Finalize Pick Confirm');
Line: 4719

                wsh_interface.update_shipping_attributes(p_source_code => 'INV', p_changed_attributes => l_shipping_attr, x_return_status => l_return_status);
Line: 4721

                   DEBUG('after update shipping attributes', 'Finalize_Pick_Confirm');
Line: 4726

                     DEBUG('return error from update shipping attributes', 'Finalize_Pick_Confirm');
Line: 4731

                     DEBUG('return error from update shipping attributes', 'Finalize_Pick_Confirm');
Line: 4738

                *** call serial_check.inv_unmark_rsv_serial instead of update msn directly
                UPDATE mtl_serial_numbers
                   SET group_mark_id = NULL
                 WHERE serial_number = l_serial_number
                   AND inventory_item_id = l_mmtt_rec.inventory_item_id;
Line: 4752

                   ,p_update_reservation => fnd_api.g_true);
Line: 4760

              DELETE FROM mtl_serial_numbers_temp
              WHERE transaction_temp_id = l_serial_trx_temp_id;
Line: 4773

            SELECT WMS_CATCH_WEIGHT_PVT.G_PRICE_PRIMARY INTO l_catch_weight_enabled FROM DUAL
            WHERE EXISTS (
              SELECT 1
              FROM mtl_material_transactions_temp mmtt
              WHERE mmtt.organization_id = l_mmtt_rec.organization_id
              AND   mmtt.inventory_item_id = l_mmtt_rec.inventory_item_id
              AND   NVL(mmtt.revision, '@') = NVL(l_mmtt_rec.revision, '@')
              AND   mmtt.transaction_source_type_id = INV_GLOBALS.G_SourceType_SalesOrder
              AND   mmtt.transaction_action_id = INV_GLOBALS.G_Action_Stgxfr
              AND   NVL(mmtt.content_lpn_id, mmtt.transfer_lpn_id) = l_lpn_id
              AND   (mmtt.secondary_transaction_quantity IS NULL OR mmtt.secondary_uom_code IS NULL) );
Line: 4837

             DEBUG('Calling Update Shipping Attributes for a serial range', 'Finalize Pick Confirm');
Line: 4849

          wsh_interface.update_shipping_attributes(p_source_code => 'INV', p_changed_attributes => l_shipping_attr, x_return_status => l_return_status);
Line: 4851

             DEBUG('after update shipping attributes', 'Finalize_Pick_Confirm');
Line: 4856

               DEBUG('return error from update shipping attributes', 'Finalize_Pick_Confirm');
Line: 4861

               DEBUG('return unexpected error from update shipping attributes', 'Finalize_Pick_Confirm');
Line: 4869

          l_update_shipping             := TRUE;
Line: 4891

              l_update_shipping  := FALSE;
Line: 4894

            IF l_update_shipping = TRUE THEN
              l_shipping_attr(1).serial_number     := l_serial_number;
Line: 4934

                 DEBUG('Calling Update Shipping Attributes', 'Finalize Pick Confirm');
Line: 4940

              wsh_interface.update_shipping_attributes(p_source_code => 'INV', p_changed_attributes => l_shipping_attr, x_return_status => l_return_status);
Line: 4942

                 DEBUG('after update shipping attributes', 'Finalize_Pick_Confirm');
Line: 4947

                   DEBUG('return error from update shipping attributes', 'Finalize_Pick_Confirm');
Line: 4952

                   DEBUG('return error from update shipping attributes', 'Finalize_Pick_Confirm');
Line: 4959

              *** call serial_check.inv_unmark_rsv_serial instead of update msn directly
              UPDATE mtl_serial_numbers
                 SET group_mark_id = NULL
               WHERE serial_number = l_serial_number
                 AND inventory_item_id = l_mmtt_rec.inventory_item_id;
Line: 4973

                 ,p_update_reservation => fnd_api.g_true);
Line: 4981

            DELETE FROM mtl_serial_numbers_temp
            WHERE transaction_temp_id = p_transaction_temp_id;
Line: 5004

              SELECT WMS_CATCH_WEIGHT_PVT.G_PRICE_PRIMARY INTO l_catch_weight_enabled FROM DUAL
              WHERE EXISTS (
                SELECT 1
                FROM mtl_material_transactions_temp mmtt,
                     mtl_transaction_lots_temp mtlt
                WHERE mmtt.organization_id = l_mmtt_rec.organization_id
                AND   mmtt.inventory_item_id = l_mmtt_rec.inventory_item_id
                AND   NVL(mmtt.revision, '@') = NVL(l_mmtt_rec.revision, '@')
                AND   mmtt.transaction_source_type_id = INV_GLOBALS.G_SourceType_SalesOrder
                AND   mmtt.transaction_action_id = INV_GLOBALS.G_Action_Stgxfr
                AND   NVL(mmtt.content_lpn_id, mmtt.transfer_lpn_id) = l_lpn_id
                AND   mtlt.transaction_temp_id = mmtt.transaction_temp_id
                AND   mtlt.lot_number = l_lot_number
                AND   (mtlt.secondary_quantity IS NULL OR mtlt.secondary_unit_of_measure IS NULL) );
Line: 5077

             DEBUG('Calling Update Shipping Attributes', 'Finalize Pick Confirm');
Line: 5083

          wsh_interface.update_shipping_attributes(p_source_code => 'INV', p_changed_attributes => l_shipping_attr, x_return_status => l_return_status);
Line: 5085

             DEBUG('after update shipping attributes', 'Finalize_Pick_Confirm');
Line: 5090

               DEBUG('return error from update shipping attributes', 'Finalize_Pick_Confirm');
Line: 5095

               DEBUG('return error from update shipping attributes', 'Finalize_Pick_Confirm');
Line: 5109

            SELECT WMS_CATCH_WEIGHT_PVT.G_PRICE_PRIMARY INTO l_catch_weight_enabled FROM DUAL
            WHERE EXISTS (
              SELECT 1
              FROM mtl_material_transactions_temp mmtt
              WHERE mmtt.organization_id = l_mmtt_rec.organization_id
              AND   mmtt.inventory_item_id = l_mmtt_rec.inventory_item_id
              AND   NVL(mmtt.revision, '@') = NVL(l_mmtt_rec.revision, '@')
              AND   mmtt.transaction_source_type_id = INV_GLOBALS.G_SourceType_SalesOrder
              AND   mmtt.transaction_action_id = INV_GLOBALS.G_Action_Stgxfr
              AND   NVL(mmtt.content_lpn_id, mmtt.transfer_lpn_id) = l_lpn_id
              AND   (mmtt.secondary_transaction_quantity IS NULL OR mmtt.secondary_uom_code IS NULL) );
Line: 5168

           DEBUG('Calling Update Shipping Attributes', 'Finalize Pick Confirm');
Line: 5174

        wsh_interface.update_shipping_attributes(p_source_code => 'INV', p_changed_attributes => l_shipping_attr, x_return_status => l_return_status);
Line: 5176

           DEBUG('after update shipping attributes', 'Finalize_Pick_Confirm');
Line: 5181

             DEBUG('return error from update shipping attributes', 'Finalize_Pick_Confirm');
Line: 5186

             DEBUG('return unexpected error from update shipping attributes', 'Finalize_Pick_Confirm');
Line: 5228

          SELECT NVL(SUM(ABS(primary_quantity)), 0)
              ,  NVL(SUM(ABS(secondary_transaction_quantity)), 0)
            INTO l_mmtt_rsv_quantity
              ,  l_sec_mmtt_rsv_quantity
            FROM mtl_material_transactions_temp
           WHERE reservation_id = l_reservation_id;
Line: 5261

            inv_reservation_pub.update_reservation(
              p_api_version_number         => 1.0
            , p_init_msg_lst               => fnd_api.g_false
            , x_return_status              => l_return_status
            , x_msg_count                  => x_msg_count
            , x_msg_data                   => x_msg_data
            , p_original_rsv_rec           => l_mtl_reservation_rec2
            , p_to_rsv_rec                 => l_mtl_reservation_rec3
            , p_original_serial_number     => l_original_serial_number
            , p_to_serial_number           => l_to_serial_number
            , p_validation_flag            => fnd_api.g_true
            , p_over_reservation_flag      => 3  -- Bug 4997704, Passing p_over_reservation_flag to reservation API to handle overpicking scenarios
            );
Line: 5275

               DEBUG('after update reservation return status is '|| l_return_status, 'Finalize_Pick_Confirm');
Line: 5296

      SELECT lot_control_code
           , serial_number_control_code
           , reservable_type
        INTO l_lot_control_code
           , l_serial_control_code
           , l_reservable_type_item
        FROM mtl_system_items
       WHERE inventory_item_id = l_mmtt_rec.inventory_item_id
         AND organization_id = l_mmtt_rec.organization_id;
Line: 5307

         DEBUG('After select lot_control_code = '|| l_lot_control_code, 'Finalize_Pick_confirm');
Line: 5308

         DEBUG('After select l_serial_control_code = '|| l_serial_control_code, 'Finalize_Pick_Confirm');
Line: 5324

         SELECT reservable_type
           INTO l_reservable_type
           FROM mtl_secondary_inventories
          WHERE organization_id = l_mmtt_rec.organization_id
            AND secondary_inventory_name = l_mmtt_rec.transfer_subinventory;
Line: 5401

          inv_reservation_pub.update_reservation(
            p_api_version_number         => 1.0
          , p_init_msg_lst               => fnd_api.g_false
          , x_return_status              => l_return_status
          , x_msg_count                  => x_msg_count
          , x_msg_data                   => x_msg_data
          , p_original_rsv_rec           => l_mtl_reservation_tbl(1)
          , p_to_rsv_rec                 => l_mtl_reservation_rec
          , p_original_serial_number     => l_original_serial_number
          , p_to_serial_number           => l_to_serial_number
          , p_validation_flag            => fnd_api.g_true -- Explicitly set the validation flag to true with respect to the Bug 4004597
          , p_over_reservation_flag      => 3  -- Bug 4997704, Passing p_over_reservation_flag to reservation API to handle overpicking scenarios
          );
Line: 5415

             DEBUG('after update reservation return status is '|| l_return_status, 'Finalize_Pick_Confirm');
Line: 5458

        SELECT COUNT(*) INTO l_lot_count
          FROM mtl_transaction_lots_temp
         WHERE transaction_temp_id = p_transaction_temp_id;
Line: 5468

             DEBUG('not reservable staging subinventory, '|| 'delete org wide reservation', 'Finalize_Pick_Confirm');
Line: 5482

          ELSE -- if qty > rsv qty, delete reservation
            l_mtl_reservation_rec.primary_reservation_quantity  := 0;
Line: 5507

          inv_reservation_pub.update_reservation(
            p_api_version_number         => 1.0
          , p_init_msg_lst               => fnd_api.g_false
          , x_return_status              => l_return_status
          , x_msg_count                  => x_msg_count
          , x_msg_data                   => x_msg_data
          , p_original_rsv_rec           => l_mtl_reservation_tbl(1)
          , p_to_rsv_rec                 => l_mtl_reservation_rec
          , p_original_serial_number     => l_original_serial_number
          , p_to_serial_number           => l_to_serial_number
          , p_validation_flag            => fnd_api.g_true
          , p_over_reservation_flag      => 3  -- Bug 4997704, Passing p_over_reservation_flag to reservation API to handle overpicking scenarios
          );
Line: 5521

             DEBUG('after update reservation return status is '|| l_return_status, 'Finalize_Pick_Confirm');
Line: 5841

                    DEBUG('Update reservation id '|| l_mtl_reservation_rec.reservation_id, 'Finalize_Pick_Confirm');
Line: 5843

                inv_reservation_pub.update_reservation(
                  p_api_version_number         => 1.0
                , p_init_msg_lst               => fnd_api.g_false
                , x_return_status              => l_return_status
                , x_msg_count                  => x_msg_count
                , x_msg_data                   => x_msg_data
                , p_original_rsv_rec           => l_mtl_reservation_tbl(1)
                , p_to_rsv_rec                 => l_mtl_reservation_rec
                , p_original_serial_number     => l_original_serial_number
                , p_to_serial_number           => l_to_serial_number
                , p_validation_flag            => fnd_api.g_true
                , p_over_reservation_flag      => 3  -- Bug 4997704, Passing p_over_reservation_flag to reservation API to handle overpicking scenarios
                );
Line: 5857

                   DEBUG('after update reservation return status is '|| l_return_status, 'Finalize_Pick_Confirm');
Line: 5906

                inv_staged_reservation_util.update_staged_flag(x_return_status => l_return_status, x_msg_count => x_msg_count, x_msg_data => x_msg_data, p_reservation_id => l_reservation_id, p_staged_flag => 'Y');
Line: 5910

                     DEBUG('Error in update_staged_flag', 'Finalize_Pick_Confirm');
Line: 5915

                     DEBUG('Unexpected error in update_staged_flag', 'Finalize_Pick_Confirm');
Line: 5919

              END IF; -- Create or Update
Line: 5966

              inv_reservation_pub.update_reservation(
                p_api_version_number         => 1.0
              , p_init_msg_lst               => fnd_api.g_false
              , x_return_status              => l_return_status
              , x_msg_count                  => x_msg_count
              , x_msg_data                   => x_msg_data
              , p_original_rsv_rec           => l_mtl_reservation_tbl(1)
              , p_to_rsv_rec                 => l_mtl_reservation_rec
              , p_original_serial_number     => l_original_serial_number
              , p_to_serial_number           => l_to_serial_number
              , p_validation_flag            => fnd_api.g_true
              , p_over_reservation_flag      => 3  -- Bug 4997704, Passing p_over_reservation_flag to reservation API to handle overpicking scenarios
              );
Line: 5980

                 DEBUG('after update reservation return status is '|| l_return_status, 'Finalize_Pick_Confirm');
Line: 6030

              inv_staged_reservation_util.update_staged_flag
                    (x_return_status        => l_return_status
                    , x_msg_count           => x_msg_count
                    , x_msg_data            => x_msg_data
                    , p_reservation_id      => l_reservation_id
                    , p_staged_flag         => 'Y'
                    );
Line: 6040

                   DEBUG('Error in update_staged_flag', 'Finalize_Pick_Confirm');
Line: 6045

                   DEBUG('Unexpected error in update_staged_flag', 'Finalize_Pick_Confirm');
Line: 6049

            END IF; -- Create or Update
Line: 6094

          SELECT NVL(SUM(ABS(primary_quantity)), 0)
              ,  NVL(SUM(ABS(secondary_transaction_quantity)), 0)
            INTO l_mmtt_rsv_quantity
              ,  l_sec_mmtt_rsv_quantity
            FROM mtl_material_transactions_temp
           WHERE reservation_id = l_reservation_id;
Line: 6129

            inv_reservation_pub.update_reservation(
              p_api_version_number         => 1.0
            , p_init_msg_lst               => fnd_api.g_false
            , x_return_status              => l_return_status
            , x_msg_count                  => x_msg_count
            , x_msg_data                   => x_msg_data
            , p_original_rsv_rec           => l_mtl_reservation_rec2
            , p_to_rsv_rec                 => l_mtl_reservation_rec3
            , p_original_serial_number     => l_original_serial_number
            , p_to_serial_number           => l_to_serial_number
            , p_validation_flag            => fnd_api.g_true
            , p_over_reservation_flag      => 3  -- Bug 4997704, Passing p_over_reservation_flag to reservation API to handle overpicking scenarios
            );
Line: 6143

               DEBUG('after update reservation return status is '|| l_return_status, 'Finalize_Pick_Confirm');
Line: 6193

 	       SELECT DISTINCT move_order_line_id
 	         FROM mtl_material_transactions_temp a
 	         WHERE transaction_header_id = p_transaction_header_id
 	         AND transaction_source_type_id = 4
 	         AND transaction_action_id = 2
 	         AND move_order_line_id IS NOT NULL
 	         AND nvl(transaction_status, 1) <> 2
 	         AND process_flag = 'Y'
 	         AND NOT EXISTS ( SELECT 1
 	                          FROM mtl_material_transactions_temp b
 	                          WHERE b.move_order_line_id = a.move_order_line_id
 	                          AND (nvl(transaction_status,1) = 2 OR error_code IS NOT NULL));
Line: 6207

        SELECT DISTINCT move_order_line_id
          FROM mtl_material_transactions_temp a
         WHERE transaction_header_id = p_transaction_header_id
           AND move_order_line_id IS NOT NULL
           AND nvl(transaction_status,1) <> 2
           AND process_flag = 'Y'
           AND NOT EXISTS ( SELECT 1
                              FROM mtl_material_transactions_temp b
                             WHERE b.move_order_line_id = a.move_order_line_id
                               AND (nvl(transaction_status,1) = 2 OR error_code IS NOT NULL));
Line: 6219

        SELECT mtrh.move_order_type
          FROM mtl_txn_request_headers mtrh
             , mtl_txn_request_lines mtrl
         WHERE mtrl.line_id = p_mo_line_id
           AND mtrh.header_id = mtrl.header_id;
Line: 6290

 	              inv_trolin_util.update_row(l_trolin_rec);
Line: 6374

           SELECT a.rowid
                 ,a.FM_SERIAL_NUMBER
                 ,a.TO_SERIAL_NUMBER
                 ,b.organization_id
                 ,b.inventory_item_id
           FROM   mtl_Serial_numbers_temp a, mtl_material_transactions_temp b
           where  a.transaction_temp_id= p_transaction_temp_id
           and   a.transaction_temp_id = b.transaction_temp_id;
Line: 6385

    delete_remaining_serial BOOLEAN := FALSE;
Line: 6391

    l_new_num_update      NUMBER;
Line: 6394

    l_new_NUM_str_update  VARCHAR2(100);
Line: 6422

      if (qty_count>p_qty AND NOT delete_remaining_Serial) then
    	--get rid of xtra serial numbers from msnt
	--(qty_count-p_qty) serials
	--if the diff_qty>(qty_count-p_qty)
	--if range then reduce this range
	--following logic will derive the to_Serial_number
        --If range

        IF (l_debug = 1) THEN
          DEBUG('p_qty= '||p_qty||' diff_qty= '||diff_qty||' qty_count= '||qty_count,'INV_TRANSFER_ORDER_PVT.adjust_serial_numbers_in_MMTT');
Line: 6443

              delete from mtl_Serial_numbers_temp
              where transaction_temp_id = p_transaction_temp_id
              and fm_Serial_number = l_Serial_cursor.fm_serial_number
              and to_Serial_number = l_Serial_cursor.to_serial_number;
Line: 6449

              *** call serial_check.inv_unmark_rsv_serial instead of update msn directly
              update mtl_Serial_numbers
              set group_mark_id = null
              where current_organization_id = l_serial_cursor.organization_id
              and inventory_item_id = l_Serial_cursor.inventory_item_id
              and serial_number between l_Serial_cursor.fm_Serial_number and l_serial_cursor.to_Serial_number;
Line: 6464

                 ,p_update_reservation => fnd_api.g_true);
Line: 6467

              delete_remaining_serial := TRUE;
Line: 6490

           l_new_num_update:=l_from_number+(diff_qty-((qty_count-p_qty)+1))+1;
Line: 6492

             DEBUG('l_new_num= '||l_new_num||' l_new_num_update='||l_new_num_update,'INV_TRANSFER_ORDER_PVT.adjust_serial_numbers_in_MMTT');
Line: 6497

    	       l_new_num_str_update:=lpad(l_new_num_update,length(l_from_number),'0');
Line: 6500

             DEBUG('l_new_num_Str= '||l_new_num_str||' l_new_num_Str_update='||l_new_num_str_update,'INV_TRANSFER_ORDER_PVT.adjust_serial_numbers_in_MMTT');
Line: 6504

           update mtl_serial_numbers_temp
           set fm_Serial_number = l_Serial_cursor.fm_serial_number
           ,to_Serial_number = x_prefix||l_new_num_str
           where fm_Serial_number = l_Serial_cursor.fm_serial_number
           and to_Serial_number = l_Serial_cursor.to_serial_number
           and transaction_temp_id = p_transaction_temp_id;
Line: 6512

             DEBUG('after update l_new_num_Str= '||l_new_num_str,'INV_TRANSFER_ORDER_PVT.adjust_serial_numbers_in_MMTT');
Line: 6514

    	   --set a flag to delete the subsequent records from MSNT

           --unmark these serial numbers in MSN
          /*** {{ R12 Enhanced reservations code changes,
           *** call serial_check.inv_unmark_rsv_serial instead of update msn directly
           update mtl_serial_numbers
           set group_mark_id = null
           where current_organization_id = l_serial_cursor.organization_id
           and inventory_item_id = l_serial_cursor.inventory_item_id
           and serial_number between x_prefix||l_new_num_str_update and l_Serial_cursor.to_serial_number;
Line: 6528

              (from_serial_number   => x_prefix||l_new_num_str_update
              ,to_serial_number     => l_serial_cursor.to_serial_number
              ,serial_code          => null
              ,hdr_id               => null
              ,p_inventory_item_id  => l_serial_cursor.inventory_item_id
              ,p_update_reservation => fnd_api.g_true);
Line: 6536

           delete_remaining_serial := TRUE;
Line: 6541

               DEBUG('after update fm_Serial_num= '||l_Serial_cursor.fm_serial_number||' to_Ser_num= '||l_serial_cursor.to_serial_number,'INV_TRANSFER_ORDER_PVT.adjust_serial_numbers_in_MMTT');
Line: 6544

            delete from mtl_serial_numbers_temp
            where fm_Serial_number = l_Serial_cursor.fm_serial_number
            and to_serial_number = l_serial_cursor.to_serial_number
            and transaction_temp_id = p_transaction_Temp_id;
Line: 6550

            *** call serial_check.inv_unmark_rsv_serial instead of update msn directly
            update mtl_serial_numbers
            set group_mark_id = null
            where current_organization_id = l_serial_cursor.organization_id
            and inventory_item_id = l_serial_cursor.inventory_item_id
            and serial_number = l_Serial_cursor.fm_serial_number;
Line: 6565

               ,p_update_reservation => fnd_api.g_true);
Line: 6568

            delete_remaining_serial := TRUE;
Line: 6574

      if (delete_remaining_serial and l_counter > 1 and NOT been_here) then
            IF (l_debug = 1) THEN
              DEBUG('After update fm_Serial_num= '||l_Serial_cursor.fm_serial_number||' to_Ser_num= '||l_serial_cursor.to_serial_number,'INV_TRANSFER_ORDER_PVT.adjust_serial_numbers_in_MMTT');
Line: 6579

            delete from mtl_serial_numbers_temp
            where fm_Serial_number = l_Serial_cursor.fm_serial_number
            and to_serial_number = l_serial_cursor.to_serial_number
            and transaction_temp_id = p_transaction_Temp_id;
Line: 6586

            *** call serial_check.inv_unmark_rsv_serial instead of update msn directly
            update mtl_serial_numbers
            set group_mark_id = null
            where current_organization_id = l_serial_cursor.organization_id
            and inventory_item_id = l_serial_cursor.inventory_item_id
            and serial_number = l_Serial_cursor.to_serial_number;
Line: 6601

               ,p_update_reservation => fnd_api.g_true);