DBA Data[Home] [Help]

APPS.EAM_MATERIAL_ALLOCATIONS_PVT 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):= 'eam_material_allocations_pvt';
Line: 29

  select primary_quantity, transaction_quantity, move_order_line_id
  into x_primary_mmtt_qty, x_tx_qty, x_move_order_line_id
  from mtl_material_transactions_temp
  where transaction_temp_id = p_transaction_temp_id;
Line: 75

  update mtl_txn_request_lines
  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)
  where line_id = p_move_order_line_id
  returning txn_source_id, inventory_item_id
  into l_txn_source_id, l_inventory_item_id;
Line: 88

    update wip_requirement_operations
    set quantity_allocated = quantity_allocated - p_qty_to_reduce
    where wip_entity_id = l_txn_source_id
    and inventory_item_id = l_inventory_item_id;
Line: 95

/* 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: 114

  SAVEPOINT DELETE_ALLOCATION;
Line: 139

    'Calling inv_trx_util_pub.delete_transaction');
Line: 143

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

      'inv_trx_util_pub.delete_transaction',x_return_status,x_msg_count,x_msg_data);
Line: 171

  ROLLBACK to delete_allocation;
Line: 177

  ROLLBACK to delete_allocation;
Line: 178

end delete_allocation;
Line: 193

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

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

	--Following elsif (3 lines): not sure whether we should allow delete here
  --also or only in delete_allocation
	--elsif (l_final_qty = 0) then
	--  delete mtl_material_transactions_temp
	--  where transaction_temp_id = p_transaction_temp_id;
Line: 256

    update mtl_material_transactions_temp
    set primary_quantity = l_final_qty,  --following line converts between base to tx uom
    transaction_quantity = l_final_qty * (l_tx_qty/l_primary_mmtt_qty)
    where transaction_temp_id = p_transaction_temp_id;
Line: 262

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

        'Calling inv_trx_util_pub.copy_insert_line_trx');
Line: 272

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

        'inv_trx_util_pub.copy_insert_line_trx',x_return_status,x_msg_count,x_msg_data);
Line: 286

        'inv_trx_util_pub.copy_insert_line_trx returned '
        || 'x_new_txn_temp_id='|| x_new_transaction_temp_id);
Line: 357

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

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

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

    UPDATE mtl_serial_numbers
       SET line_mark_id = -1
         , group_mark_id = -1
         , lot_line_mark_id = -1
     WHERE group_mark_id =  p_transaction_temp_id
       AND serial_number = p_serial;
Line: 417

  l_insert_count number;
Line: 418

  l_update_count number;
Line: 436

  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
   )
  VALUES(p_transaction_temp_id,p_serial, p_serial, 1
    , SYSDATE, fnd_global.user_id, SYSDATE, fnd_global.user_id);
Line: 442

  l_insert_count := SQL%ROWCOUNT;
Line: 444

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

  l_update_count := SQL%ROWCOUNT;
Line: 453

   l_insert_count|| ' serials inserted into MSNT. '||l_update_count||
   ' serials marked in MSN');
Line: 477

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

  l_update_count number := 0;
Line: 502

  l_delete_count number := 0;
Line: 503

  l_insert_ret_status number := null;
Line: 524

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

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

    l_update_count := SQL%ROWCOUNT;
Line: 545

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

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

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

        '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: 571

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

    l_delete_count := SQL%ROWCOUNT;
Line: 579

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

end update_lot;
Line: 603

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

  l_update_count number := 0;
Line: 634

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

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

  l_update_count := SQL%ROWCOUNT;
Line: 642

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

    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);