DBA Data[Home] [Help]

APPS.INV_MISSING_QTY_ACTIONS_ENGINE SQL Statements

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

Line: 29

      SELECT msi.lot_control_code, msi.serial_number_control_code
        FROM mtl_system_items msi, mtl_material_transactions_temp mmtt
       WHERE p_transaction_temp_id IS NOT NULL
         AND mmtt.transaction_temp_id = p_transaction_temp_id
         AND msi.inventory_item_id = mmtt.inventory_item_id
         AND msi.organization_id = mmtt.organization_id
      UNION ALL
      SELECT msi.lot_control_code, msi.serial_number_control_code
        FROM mtl_system_items msi, mtl_txn_request_lines mtrl
       WHERE p_transaction_temp_id IS NULL AND p_mo_line_id IS NOT NULL
         AND mtrl.line_id = p_mo_line_id
         AND msi.inventory_item_id = mtrl.inventory_item_id
         AND msi.organization_id = mtrl.organization_id;
Line: 134

    l_updated_count       NUMBER := 0;
Line: 135

    l_deleted_count       NUMBER := 0;
Line: 144

      UPDATE mtl_allocations_gtmp mat
         SET (primary_quantity, transaction_quantity,secondary_quantity)
              = (SELECT mat.primary_quantity - nvl(SUM(mtlt.primary_quantity),0)
                      , mat.transaction_quantity - nvl(SUM(mtlt.transaction_quantity),0)
                      , DECODE(NVL(mat.secondary_quantity,0) - NVL(SUM(mtlt.secondary_quantity),0)
                                 ,0,NULL,
                                 NVL(mat.secondary_quantity,0) - NVL(SUM(mtlt.secondary_quantity),0)
                               ) --INVCONV kkillams
                   FROM mtl_transaction_lots_temp mtlt
                  WHERE mtlt.transaction_temp_id = p_transaction_temp_id
                    AND mtlt.lot_number = mat.lot_number)

       WHERE mat.transaction_temp_id = p_transaction_temp_id;
Line: 157

      l_updated_count := SQL%ROWCOUNT;
Line: 159

      DELETE mtl_allocations_gtmp
        WHERE transaction_temp_id = p_transaction_temp_id AND primary_quantity <= 0;
Line: 161

      l_deleted_count := SQL%ROWCOUNT;
Line: 163

      DELETE mtl_allocations_gtmp
       WHERE transaction_temp_id = p_transaction_temp_id
         AND serial_number IN(  SELECT msn.serial_number
                                  FROM mtl_serial_numbers msn
                                 WHERE msn.group_mark_id = p_transaction_temp_id);
Line: 168

      l_deleted_count := SQL%ROWCOUNT;
Line: 170

      DELETE mtl_allocations_gtmp
        WHERE transaction_temp_id = p_transaction_temp_id
          AND serial_number IN( SELECT msn.serial_number
                                  FROM mtl_transaction_lots_temp mtlt, mtl_serial_numbers msn
                                 WHERE mtlt.transaction_temp_id = p_transaction_temp_id
                                   AND msn.group_mark_id = mtlt.serial_transaction_temp_id);
Line: 176

      l_deleted_count := SQL%ROWCOUNT;
Line: 179

        UPDATE mtl_allocations_gtmp mat
           SET (primary_quantity, transaction_quantity,secondary_quantity)
                = (SELECT mat.primary_quantity - nvl(SUM(mtlt.primary_quantity),0)
                        , mat.transaction_quantity - nvl(SUM(mtlt.transaction_quantity),0)
                        , DECODE(NVL(mat.secondary_quantity,0) - NVL(SUM(mtlt.secondary_quantity),0)
                                 ,0,NULL,
                                 NVL(mat.secondary_quantity,0) - NVL(SUM(mtlt.secondary_quantity),0)
                                ) --INVCONV kkillams

                     FROM mtl_transaction_lots_temp mtlt
                    WHERE mtlt.transaction_temp_id = p_transaction_temp_id
                      AND mtlt.lot_number = mat.lot_number)
         WHERE mat.transaction_temp_id = p_transaction_temp_id;
Line: 192

        l_updated_count := SQL%ROWCOUNT;
Line: 194

        DELETE mtl_allocations_gtmp
          WHERE transaction_temp_id = p_transaction_temp_id AND primary_quantity <= 0;
Line: 196

        l_deleted_count := SQL%ROWCOUNT;
Line: 202

      print_debug('# of Records Updated = ' || l_updated_count, l_api_name, g_info);
Line: 203

      print_debug('# of Records Deleted = ' || l_deleted_count, l_api_name, g_info);
Line: 204

      print_debug('Updated Temp Table to contain Unconfirmed Lots/Serials', l_api_name, g_info);
Line: 235

      SELECT mmtt.inventory_item_id
           , mmtt.transaction_uom
           , mmtt.reservation_id
           , msi.primary_uom_code
           , msi.replenish_to_order_flag
           , msi.bom_item_type
           , msi.secondary_uom_code --INVCONV kkillams
        FROM mtl_material_transactions_temp mmtt, mtl_system_items msi
       WHERE mmtt.transaction_temp_id = p_transaction_temp_id
         AND msi.inventory_item_id = mmtt.inventory_item_id
         AND msi.organization_id = mmtt.organization_id;
Line: 250

      SELECT primary_reservation_quantity, detailed_quantity
             ,secondary_reservation_quantity, secondary_detailed_quantity  --INVCONV kkillams
        FROM mtl_reservations
       WHERE reservation_id = l_mmtt_info.reservation_id;
Line: 269

      SELECT SUM(ABS(primary_quantity))
      INTO   l_mmtt_primary_qty_sum
      FROM   mtl_material_transactions_temp
      WHERE  reservation_id= l_mmtt_info.reservation_id;
Line: 289

      /*Bug:4700706. When the reservation record is deleted  somehow by this time we need not
        deal with the reservation.So we just return. */
      RETURN;
Line: 343

    inv_reservation_pvt.update_reservation(
      x_return_status          => x_return_status
    , x_msg_count              => x_msg_count
    , x_msg_data               => x_msg_data
    , p_api_version_number     => 1.0
    , p_original_rsv_rec       => l_from_rsv_rec
    , p_to_rsv_rec             => l_to_rsv_rec
    , p_original_serial_number => l_dummy_sn
    , p_to_serial_number       => l_dummy_sn
    );
Line: 400

    l_insert_count       NUMBER;
Line: 401

    l_update_count       NUMBER;
Line: 406

      SELECT mmtt.transaction_header_id, mmtt.organization_id, mmtt.inventory_item_id, mmtt.transaction_uom, msi.primary_uom_code
            , msi.secondary_uom_code --INVCONV kkillams
        FROM mtl_material_transactions_temp mmtt, mtl_system_items msi
       WHERE mmtt.transaction_temp_id = p_transaction_temp_id
         AND msi.inventory_item_id    = mmtt.inventory_item_id
         AND msi.organization_id      = mmtt.organization_id;
Line: 415

      SELECT lot_number, SUM(transaction_quantity) transaction_quantity ,SUM (primary_quantity) primary_quantity
             ,DECODE (SUM(NVL(secondary_quantity,0)),0,NULL,SUM(NVL(secondary_quantity,0))) secondary_quantity --INVCONV KKILLAMS
        FROM mtl_allocations_gtmp
       WHERE transaction_temp_id = p_transaction_temp_id
       GROUP BY lot_number;
Line: 440

    inv_trx_util_pub.copy_insert_line_trx(
      x_return_status       => x_return_status
    , x_msg_data            => x_msg_data
    , x_msg_count           => x_msg_count
    , x_new_txn_temp_id     => x_new_txn_temp_id
    , p_transaction_temp_id => p_transaction_temp_id
    , p_organization_id     => l_org_id
    , p_txn_qty             => l_rem_txn_qty
    , p_primary_qty         => l_rem_pri_qty
    , p_sec_txn_qty         => l_rem_sec_txn_qty  --INVCONV KKILLAMS
    );
Line: 482

        INSERT INTO mtl_transaction_lots_temp(
                      transaction_temp_id
                    , lot_number, transaction_quantity, primary_quantity
                    , serial_transaction_temp_id, group_header_id
                    , last_update_date, last_updated_by, creation_date, created_by
                    ,secondary_quantity  --INVCONV kkillams
                    )
               VALUES(
                      x_new_txn_temp_id
                    , curr_lot.lot_number,least(l_rem_txn_qty, l_lot_txn_qty), least(l_rem_pri_qty, l_lot_pri_qty)
                    , mtl_material_transactions_s.NEXTVAL, l_txn_header_id
                    , SYSDATE, fnd_global.user_id, SYSDATE, fnd_global.user_id
                    , DECODE(least(NVL(l_rem_sec_txn_qty,0), NVL(l_lot_sec_qty,0))
                                            ,0,NULL
                                            ,least(NVL(l_rem_sec_txn_qty,0), NVL(l_lot_sec_qty,0)))--INVCONV kkillams
                    )
            RETURNING serial_transaction_temp_id, transaction_quantity, primary_quantity
                      ,secondary_quantity --INVCONV kkillams
                 INTO l_serial_txn_temp_id, l_lot_txn_qty, l_lot_pri_qty
                      ,l_lot_sec_qty; --INVCONV kkillams
Line: 504

          print_debug('Lot Controlled Item. So Inserting MTLT', l_api_name, g_info);
Line: 512

          INSERT INTO mtl_serial_numbers_temp(
                        transaction_temp_id
                      , fm_serial_number, to_serial_number, serial_prefix
                      , last_update_date, last_updated_by, creation_date, created_by
                      )
                 SELECT l_serial_txn_temp_id
                      , serial_number, serial_number, 1
                      , SYSDATE, fnd_global.user_id, SYSDATE, fnd_global.user_id
                   FROM mtl_allocations_gtmp
                  WHERE transaction_temp_id = p_transaction_temp_id
                    AND lot_number = curr_lot.lot_number
                    AND ROWNUM <= l_lot_pri_qty;
Line: 524

          l_insert_count := SQL%ROWCOUNT;
Line: 529

          UPDATE mtl_serial_numbers
             SET group_mark_id = l_serial_txn_temp_id
               , line_mark_id = l_serial_txn_temp_id
           WHERE serial_number IN (SELECT fm_serial_number FROM mtl_serial_numbers_temp
                                    WHERE transaction_temp_id = l_serial_txn_temp_id)
             AND inventory_item_id = l_item_id;
Line: 535

          l_update_count := SQL%ROWCOUNT;
Line: 538

            print_debug('Lot and Serial Controlled Item. So Inserting MSNT', l_api_name, g_info);
Line: 539

            print_debug('# of Serials Inserted into MSNT = ' || l_insert_count, l_api_name, g_info);
Line: 540

            print_debug('# of Serials Marked in MSN      = ' || l_update_count, l_api_name, g_info);
Line: 551

       INSERT INTO mtl_serial_numbers_temp(
                     transaction_temp_id
                   , fm_serial_number, to_serial_number, serial_prefix
                   , last_update_date, last_updated_by, creation_date, created_by
                   )
              SELECT x_new_txn_temp_id
                   , serial_number, serial_number, 1
                   , SYSDATE, fnd_global.user_id, SYSDATE, fnd_global.user_id
                FROM mtl_allocations_gtmp
               WHERE transaction_temp_id = p_transaction_temp_id
                 AND ROWNUM <= l_rem_pri_qty;
Line: 562

       l_insert_count := SQL%ROWCOUNT;
Line: 567

       UPDATE mtl_serial_numbers
          SET group_mark_id = x_new_txn_temp_id
            , line_mark_id= x_new_txn_temp_id
        WHERE serial_number IN (SELECT fm_serial_number FROM mtl_serial_numbers_temp
                                 WHERE transaction_temp_id = x_new_txn_temp_id)
          AND inventory_item_id = l_item_id;
Line: 573

       l_update_count := SQL%ROWCOUNT;
Line: 576

         print_debug('Serial Controlled Item. So Inserting MSNT', l_api_name, g_info);
Line: 577

         print_debug('# of Serials Inserted into MSNT = ' || l_insert_count, l_api_name, g_info);
Line: 578

         print_debug('# of Serials Marked in MSN      = ' || l_update_count, l_api_name, g_info);
Line: 702

    l_update_rsv          BOOLEAN := FALSE;
Line: 738

  /*  -- For a Lot Controlled Item, MTLT would have been updated and so we need to consider that
    -- while Querying for the Availability.
    IF p_lot_number IS NOT NULL THEN
      l_available_qty := l_available_qty - p_primary_quantity;
Line: 794

    l_update_rsv := (l_reservation_count = 1);
Line: 802

    If (l_update_rsv AND (p_reservation_id IS NOT NULL)) Then
      l_existing_cc_res_pri_qty := l_reservations_tbl(1).primary_reservation_quantity;
Line: 854

         existing reservation is updated */
      IF l_update_rsv THEN
        l_cc_rsv_rec := l_reservations_tbl(1);
Line: 865

        inv_reservation_pvt.update_reservation(
          x_return_status              => x_return_status
        , x_msg_count                  => l_msg_count
        , x_msg_data                   => l_msg_data
        , p_api_version_number         => 1.0
        , p_init_msg_lst               => fnd_api.g_false
        , p_original_rsv_rec           => l_reservations_tbl(1)
        , p_to_rsv_rec                 => l_cc_rsv_rec
        , p_original_serial_number     => l_dummy_sn
        , p_to_serial_number           => l_dummy_sn
        , p_validation_flag            => fnd_api.g_true
        );
Line: 878

          fnd_message.set_name('INV','INV_UPDATE_RSV_FAILED');
Line: 913

           updated in the Reservation created now */
        l_cc_rsv_rec.reservation_id := l_new_reservation_id;
Line: 939

      inv_reservation_pvt.update_reservation(
        x_return_status              => x_return_status
      , x_msg_count                  => l_msg_count
      , x_msg_data                   => l_msg_data
      , p_api_version_number         => 1.0
      , p_init_msg_lst               => fnd_api.g_false
      , p_original_rsv_rec           => l_existing_rsv_rec
      , p_to_rsv_rec                 => l_cc_rsv_rec
      , p_original_serial_number     => l_dummy_sn
      , p_to_serial_number           => l_dummy_sn
      , p_validation_flag            => fnd_api.g_true
      );
Line: 952

        fnd_message.set_name('INV','INV_UPDATE_RSV_FAILED');
Line: 990

      SELECT mmtt.organization_id
           , mmtt.inventory_item_id
           , mmtt.reservation_id
           , mmtt.revision
           , mmtt.subinventory_code
           , mmtt.locator_id
           , mmtt.transaction_uom
           , msi.primary_uom_code
           , msi.secondary_uom_code --INVCONV kkillams
        FROM mtl_material_transactions_temp mmtt, mtl_system_items msi
       WHERE mmtt.transaction_temp_id = p_transaction_temp_id
         AND msi.inventory_item_id    = mmtt.inventory_item_id
         AND msi.organization_id      = mmtt.organization_id;
Line: 1006

      SELECT lot_number
            ,SUM(transaction_quantity) transaction_quantity
            ,SUM(primary_quantity) primary_quantity
            ,DECODE(SUM(NVL(secondary_quantity,0)),0,NULL,SUM(NVL(secondary_quantity,0))) secondary_quantity  --INVCONV kkillams
        FROM mtl_allocations_gtmp
       WHERE transaction_temp_id = p_transaction_temp_id
       GROUP BY lot_number;
Line: 1103

    INSERT INTO mtl_allocations_gtmp(transaction_temp_id, lot_number, transaction_quantity, primary_quantity
                ,secondary_quantity) --INVCONV kkillams
      SELECT p_transaction_temp_id, mtlt.lot_number, SUM(mtlt.transaction_quantity), SUM(mtlt.primary_quantity)
             ,DECODE(SUM(NVL(mtlt.secondary_quantity,0)),0,NULL,SUM(NVL(mtlt.secondary_quantity,0)))  --INVCONV kkillams
        FROM mtl_transaction_lots_temp mtlt
       WHERE p_transaction_temp_id IS NOT NULL
         AND mtlt.transaction_temp_id = p_transaction_temp_id
        GROUP BY mtlt.lot_number
      UNION ALL
      SELECT mmtt.transaction_temp_id, mtlt.lot_number, SUM(mtlt.transaction_quantity), SUM(mtlt.primary_quantity)
            ,DECODE(SUM(NVL(mtlt.secondary_quantity,0)),0,NULL,SUM(NVL(mtlt.secondary_quantity,0)))  --INVCONV kkillams
        FROM mtl_material_transactions_temp mmtt, mtl_transaction_lots_temp mtlt
       WHERE p_transaction_temp_id IS NULL AND p_mo_line_id IS NOT NULL
         AND mmtt.move_order_line_id = p_mo_line_id
         AND mtlt.transaction_temp_id = mmtt.transaction_temp_id
        GROUP BY mmtt.transaction_temp_id, mtlt.lot_number;
Line: 1159

    INSERT INTO mtl_allocations_gtmp(transaction_temp_id, serial_number)
      SELECT p_transaction_temp_id, msn.serial_number
        FROM mtl_serial_numbers msn
       WHERE p_transaction_temp_id IS NOT NULL
         AND msn.group_mark_id = p_transaction_temp_id
      UNION ALL
      SELECT mmtt.transaction_temp_id, msn.serial_number
        FROM mtl_material_transactions_temp mmtt, mtl_serial_numbers msn
       WHERE p_transaction_temp_id IS NULL AND p_mo_line_id IS NOT NULL
         AND mmtt.move_order_line_id = p_mo_line_id
         AND msn.group_mark_id = mmtt.transaction_temp_id;
Line: 1200

    INSERT INTO mtl_allocations_gtmp(transaction_temp_id, lot_number, serial_number, transaction_quantity, primary_quantity)
      SELECT p_transaction_temp_id, mtlt.lot_number, msn.serial_number, 1, 1
        FROM mtl_transaction_lots_temp mtlt, mtl_serial_numbers msn
       WHERE p_transaction_temp_id IS NOT NULL
         AND mtlt.transaction_temp_id = p_transaction_temp_id
         AND msn.group_mark_id        = mtlt.serial_transaction_temp_id
      UNION ALL
      SELECT mmtt.transaction_temp_id, mtlt.lot_number, msn.serial_number, 1, 1
        FROM mtl_material_transactions_temp mmtt, mtl_transaction_lots_temp mtlt, mtl_serial_numbers msn
       WHERE p_transaction_temp_id IS NULL and p_mo_line_id IS NOT NULL
         AND mmtt.move_order_line_id  = p_mo_line_id
         AND mtlt.transaction_temp_id = mmtt.transaction_temp_id
         AND msn.group_mark_id        = mtlt.serial_transaction_temp_id;
Line: 1294

    DELETE mtl_allocations_gtmp;
Line: 1462

PROCEDURE update_allocation_qty
   (
    x_return_status       OUT NOCOPY VARCHAR2
  , x_msg_data            OUT NOCOPY VARCHAR2
  , x_msg_count           OUT NOCOPY NUMBER
  , p_transaction_temp_id            NUMBER
  , p_confirmed_quantity             NUMBER
  , p_transaction_uom                VARCHAR2
  --INVCONV kkillams
  , p_sec_confirmed_quantity         NUMBER
  , p_secondary_uom_code             VARCHAR2
 --INVCONV kkillams
  )
  IS
l_api_name            VARCHAR2(30) := 'UPDATE_ALLOCATION_QTY';
Line: 1492

   SELECT inventory_item_id, organization_id INTO l_inventory_item_id,l_organization_id
   FROM mtl_material_transactions_temp WHERE transaction_temp_id = p_transaction_temp_id;
Line: 1495

   SELECT primary_uom_code INTO l_primary_uom FROM mtl_system_items
   WHERE inventory_item_id =l_inventory_item_id
   AND organization_id =l_organization_id;
Line: 1521

   UPDATE mtl_material_transactions_temp SET transaction_quantity =p_confirmed_quantity
                                             , primary_quantity= l_confirmed_quantity_primary
                                             --INVCONV kkillams
                                             , secondary_uom_code             = p_secondary_uom_code
                                             , secondary_transaction_quantity =  p_sec_confirmed_quantity
                                             --END INVCONV kkillams
                                             WHERE  transaction_temp_id = p_transaction_temp_id;
Line: 1545

END update_allocation_qty;