DBA Data[Home] [Help]

APPS.INV_MATERIAL_ALLOCATIONS_GRP SQL Statements

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

Line: 9

remove_serial, update_lot, inv_trx_util_pub.insert_lot_trx. If proper care is
not exercised in calling them in conjunction, the state of allocations
can become invalid.
*/

g_pkg_name    CONSTANT VARCHAR2(50):= 'inv_material_allocations_grp';
Line: 34

  select primary_quantity, transaction_quantity, move_order_line_id,
  item_primary_uom_code, transaction_uom, inventory_item_id
  into x_primary_mmtt_qty, x_tx_qty, x_move_order_line_id,
  x_item_primary_uom_code, x_transaction_uom, x_inventory_item_id
  from mtl_material_transactions_temp
  where transaction_temp_id = p_transaction_temp_id;
Line: 90

  update mtl_txn_request_lines     --overpicking not supported for eam
  set quantity = quantity - p_qty_to_reduce,
  quantity_detailed = quantity_detailed - p_qty_to_reduce,
  line_status = decode(quantity,p_qty_to_reduce,5,line_status),
  status_date = sysdate            -- BUG 5636266
  where line_id = p_move_order_line_id
  returning txn_source_id, inventory_item_id,txn_source_line_id,organization_id
  into l_txn_source_id, l_inventory_item_id,l_operation_seq_num,l_organization_id;
Line: 104

    update wip_requirement_operations
    set quantity_allocated = quantity_allocated - p_qty_to_reduce
    where organization_id = l_organization_id
    and wip_entity_id = l_txn_source_id
    and operation_seq_num=l_operation_seq_num
    and inventory_item_id = l_inventory_item_id;
Line: 113

/* This procedure deletes a allocation and reduces the move order and WIP material
requirements by a corresponding amount. Thus this is to be used when the allocated
material is no longer wanted by the requestor.
*/
PROCEDURE delete_allocation(
  p_init_msg_list         IN            VARCHAR2,
  p_commit                IN            VARCHAR2,
  p_transaction_temp_id   IN            NUMBER,
  x_return_status         OUT NOCOPY    VARCHAR2,
  x_msg_count             OUT NOCOPY    NUMBER,
  x_msg_data              OUT NOCOPY    VARCHAR2
) IS
  l_module              constant varchar2(200) := g_module_name||'.delete_allocation';
Line: 136

  SAVEPOINT DELETE_ALLOCATION;
Line: 162

    'Calling inv_trx_util_pub.delete_transaction');
Line: 166

  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 => p_transaction_temp_id
  );
Line: 174

     'inv_trx_util_pub.delete_transaction returns. Return status='
     || x_return_status|| ', Message Count = '|| x_msg_count
     || ', Message data=' || REPLACE(x_msg_data, CHR(0), ' '));
Line: 196

  ROLLBACK to delete_allocation;
Line: 202

  ROLLBACK to delete_allocation;
Line: 203

end delete_allocation;
Line: 218

  p_delete_remaining         IN            VARCHAR2,
  x_new_transaction_temp_id  OUT NOCOPY    NUMBER,
  x_return_status            OUT NOCOPY    VARCHAR2,
  x_msg_count                OUT NOCOPY    NUMBER,
  x_msg_data                 OUT NOCOPY    VARCHAR2
) IS
  l_module              constant varchar2(200) := g_module_name||'.reduce_allocation_header';
Line: 248

    || ',p_delete_remaining='|| p_delete_remaining || ')');
Line: 298

    update mtl_material_transactions_temp
    set primary_quantity = l_final_qty,  --following line converts between base to tx uom
    transaction_quantity = l_final_tx_qty
    where transaction_temp_id = p_transaction_temp_id;
Line: 304

  if (p_delete_remaining is not null and (p_delete_remaining = 'Y')) then
    --Reduce the allocation quantities in Move order headers, lines and in WRO
    reduce_move_order(l_move_order_line_id, l_qty_to_reduce, 'Y');
Line: 311

        'Calling inv_trx_util_pub.copy_insert_line_trx');
Line: 314

    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_transaction_temp_id
    , p_transaction_temp_id => p_transaction_temp_id
    , p_organization_id     => p_organization_id
    , p_txn_qty             => l_qty_to_reduce
    , p_primary_qty         => l_qty_to_reduce
    );
Line: 326

       'inv_trx_util_pub.copy_insert_line_trx returns. Return status='
       || x_return_status|| ', Message Count = '|| x_msg_count
       || 'x_new_txn_temp_id='|| x_new_transaction_temp_id
       || ', Message data=' || REPLACE(x_msg_data, CHR(0), ' '));
Line: 402

    UPDATE mtl_serial_numbers_temp
       SET transaction_temp_id = p_new_transaction_temp_id
     WHERE transaction_temp_id = p_transaction_temp_id
       AND fm_serial_number = p_serial;
Line: 407

    UPDATE mtl_serial_numbers
       SET group_mark_id = p_new_transaction_temp_id
     WHERE group_mark_id = p_transaction_temp_id
       AND serial_number = p_serial;
Line: 413

    DELETE FROM mtl_serial_numbers_temp
    WHERE transaction_temp_id = p_transaction_temp_id
    and fm_serial_number = p_serial;
Line: 417

    UPDATE mtl_serial_numbers
       SET line_mark_id = -1
         , group_mark_id = -1
         , lot_line_mark_id = -1
     WHERE inventory_item_id = p_inventory_item_id  --no need of org id, item and serial are unique
       AND serial_number = p_serial;
Line: 464

  l_update_count number;
Line: 465

  l_insert_err_code number;
Line: 481

  l_insert_err_code := inv_trx_util_pub.insert_ser_trx(
    p_trx_tmp_id     => p_transaction_temp_id,
    p_user_id        => FND_GLOBAL.USER_ID,
    p_fm_ser_num     => p_serial,
    p_to_ser_num     => p_serial,
    x_proc_msg       => x_msg_data);
Line: 490

  if (l_insert_err_code = 0) then   -- 0 = success
    UPDATE mtl_serial_numbers
       SET group_mark_id = p_transaction_temp_id
     WHERE serial_number = p_serial
       AND current_organization_id = p_organization_id
       AND inventory_item_id = p_inventory_item_id;
Line: 496

    l_update_count := SQL%ROWCOUNT;
Line: 501

    l_update_count||  ' serials marked in MSN');
Line: 508

  if (l_insert_err_code = 0) then   -- 0 = success
    x_return_status := FND_API.G_RET_STS_SUCCESS;
Line: 528

1) Update lot quantity (if p_lot_quantity is non zero)
2) Delete a lot (if p_lot_quantity is zero)
3) Split a lot (if p_lot_quantity is less than current qty and new tx temp id is provided)
This API does not adjust the quantities at the MMTT or MSNT level and assumes
that they have been adjusted by another API call. Future work may need
to be done on the uniqueness of temp id, lot_number and qty combination.
*/
PROCEDURE update_lot(
  p_init_msg_list              IN            VARCHAR2,
  p_commit                     IN            VARCHAR2,
  p_transaction_temp_id        IN            NUMBER,
  p_serial_transaction_temp_id IN            NUMBER,
  p_lot                        IN            VARCHAR2,
  p_lot_quantity               IN            NUMBER,
  p_old_lot_quantity           IN            NUMBER,
  p_new_transaction_temp_id    IN            NUMBER,
  x_ser_trx_id                 OUT NOCOPY    NUMBER,
  x_return_status              OUT NOCOPY    VARCHAR2,
  x_msg_count                  OUT NOCOPY    NUMBER,
  x_msg_data                   OUT NOCOPY    VARCHAR2
) IS
  l_module    constant varchar2(200) := g_module_name||'.update_lot';
Line: 554

  l_update_count number := 0;
Line: 555

  l_delete_count number := 0;
Line: 556

  l_insert_ret_status number := null;
Line: 577

      update mtl_transaction_lots_temp
      set primary_quantity = p_lot_quantity,
      transaction_quantity = p_lot_quantity
      where serial_transaction_temp_id = p_serial_transaction_temp_id
      and transaction_temp_id = p_transaction_temp_id
      and lot_number = p_lot
      and primary_quantity = p_old_lot_quantity;
Line: 585

      update mtl_transaction_lots_temp
      set primary_quantity = p_lot_quantity,
      transaction_quantity = p_lot_quantity
      where transaction_temp_id = p_transaction_temp_id
      and lot_number = p_lot
      and primary_quantity = p_old_lot_quantity
      and rownum = 1;--update only one row since there is no PK in this table
Line: 595

    l_update_count := SQL%ROWCOUNT;
Line: 598

      l_update_count || ' row(s) updated in MTLT');
Line: 605

        'Calling inv_trx_util_pub.insert_lot_trx('|| 'p_pri_qty=p_trx_qty='|| l_reduction_qty);
Line: 607

      l_insert_ret_status := inv_trx_util_pub.insert_lot_trx(
        p_trx_tmp_id => p_new_transaction_temp_id
      , p_user_id    => fnd_global.user_id
      , p_lot_number => p_lot
      , p_trx_qty    => l_reduction_qty
      , p_pri_qty    => l_reduction_qty
      , x_proc_msg   => x_msg_data
      , x_ser_trx_id => x_ser_trx_id);
Line: 617

        'inv_trx_util_pub.insert_lot_trx returned: Status='||
        l_insert_ret_status|| ' (0 success, -1 failure)'||
        ', Return Message='|| x_msg_data|| ', Serial Temp Id='||
        x_ser_trx_id);
Line: 624

    delete from mtl_transaction_lots_temp
    where transaction_temp_id = p_transaction_temp_id
    and lot_number = p_lot
    and primary_quantity = p_old_lot_quantity
    and rownum = 1;
Line: 629

    l_delete_count := SQL%ROWCOUNT;
Line: 632

      l_delete_count || ' row(s) deleted in MTLT');
Line: 653

end update_lot;
Line: 656

child records in MSNT can be inserted for this lot.
*/
PROCEDURE mark_lot_with_ser_temp_id(
  p_init_msg_list              IN            VARCHAR2,
  p_commit                     IN            VARCHAR2,
  p_transaction_temp_id        IN            NUMBER,
  p_lot                        IN            VARCHAR2,
  p_primary_quantity           IN            NUMBER,
  x_ser_trx_id                 OUT NOCOPY    NUMBER,
  x_return_status              OUT NOCOPY    VARCHAR2,
  x_msg_count                  OUT NOCOPY    NUMBER,
  x_msg_data                   OUT NOCOPY    VARCHAR2
) IS
  l_module    constant varchar2(200) := g_module_name||'.mark_lot_with_ser_temp_id';
Line: 674

  l_update_count number := 0;
Line: 689

  SELECT MTL_MATERIAL_TRANSACTIONS_S.NEXTVAL into l_ser_trx_id from dual;
Line: 690

  update mtl_transaction_lots_temp
    set serial_transaction_temp_id = l_ser_trx_id
    where transaction_temp_id = p_transaction_temp_id
    and lot_number = p_lot
    and primary_quantity = p_primary_quantity
    and rownum = 1;
Line: 696

  l_update_count := SQL%ROWCOUNT;
Line: 697

  if (l_update_count = 1) then
    x_return_status := FND_API.G_RET_STS_SUCCESS;
Line: 702

    FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module, l_update_count ||
    ' row(s) updated in MTLT with serial_transaction_temp_id: '|| x_ser_trx_id);