24: x_transaction_uom OUT NOCOPY VARCHAR2,
25: x_inventory_item_id OUT NOCOPY NUMBER
26: ) return boolean IS
27: l_module constant varchar2(200) := g_module_name||'.get_mmtt_info';
28: l_log CONSTANT NUMBER := fnd_log.g_current_runtime_level;
29: l_elog CONSTANT boolean := ((FND_LOG.LEVEL_EXCEPTION >= l_log) and FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
30: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= l_log));
31: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= l_log));
32: begin
25: x_inventory_item_id OUT NOCOPY NUMBER
26: ) return boolean IS
27: l_module constant varchar2(200) := g_module_name||'.get_mmtt_info';
28: l_log CONSTANT NUMBER := fnd_log.g_current_runtime_level;
29: l_elog CONSTANT boolean := ((FND_LOG.LEVEL_EXCEPTION >= l_log) and FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
30: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= l_log));
31: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= l_log));
32: begin
33: --get primary qty from MMTT
26: ) return boolean IS
27: l_module constant varchar2(200) := g_module_name||'.get_mmtt_info';
28: l_log CONSTANT NUMBER := fnd_log.g_current_runtime_level;
29: l_elog CONSTANT boolean := ((FND_LOG.LEVEL_EXCEPTION >= l_log) and FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
30: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= l_log));
31: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= l_log));
32: begin
33: --get primary qty from MMTT
34: select primary_quantity, transaction_quantity, move_order_line_id,
27: l_module constant varchar2(200) := g_module_name||'.get_mmtt_info';
28: l_log CONSTANT NUMBER := fnd_log.g_current_runtime_level;
29: l_elog CONSTANT boolean := ((FND_LOG.LEVEL_EXCEPTION >= l_log) and FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
30: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= l_log));
31: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= l_log));
32: begin
33: --get primary qty from MMTT
34: select primary_quantity, transaction_quantity, move_order_line_id,
35: item_primary_uom_code, transaction_uom, inventory_item_id
38: from mtl_material_transactions_temp
39: where transaction_temp_id = p_transaction_temp_id;
40:
41: if (l_slog) then
42: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module,
43: 'MMTT: x_primary_mmtt_qty=' || x_primary_mmtt_qty|| ',x_tx_qty=' || x_tx_qty
44: || ',x_move_order_line_id=' || x_move_order_line_id
45: || ',x_item_primary_uom_code=' || x_item_primary_uom_code
46: || ',x_transaction_uom='|| x_transaction_uom
50: return true;
51: exception
52: when no_data_found then
53: if (l_elog) then
54: FND_LOG.STRING(FND_LOG.LEVEL_EXCEPTION, l_module,
55: 'Transaction Temp Id '|| p_transaction_temp_id || ' not found');
56: end if;
57: fnd_message.set_name('INV', 'INV_ALLOCATION_NOT_FOUND');
58: fnd_msg_pub.add;
58: fnd_msg_pub.add;
59: return false;
60: WHEN OTHERS THEN
61: if (l_slog) then
62: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module,
63: 'Unhandled exception in get_mmtt_info');
64: end if;
65: return false;
66: end get_mmtt_info;
74: p_qty_to_reduce in number,
75: p_reduce_wip_requirements in varchar2
76: ) IS
77: l_module constant varchar2(200) := g_module_name||'.reduce_move_order';
78: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
79: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
80: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
81: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
82: l_txn_source_id number;
75: p_reduce_wip_requirements in varchar2
76: ) IS
77: l_module constant varchar2(200) := g_module_name||'.reduce_move_order';
78: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
79: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
80: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
81: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
82: l_txn_source_id number;
83: l_inventory_item_id number;
76: ) IS
77: l_module constant varchar2(200) := g_module_name||'.reduce_move_order';
78: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
79: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
80: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
81: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
82: l_txn_source_id number;
83: l_inventory_item_id number;
84: l_operation_seq_num number;
77: l_module constant varchar2(200) := g_module_name||'.reduce_move_order';
78: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
79: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
80: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
81: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
82: l_txn_source_id number;
83: l_inventory_item_id number;
84: l_operation_seq_num number;
85: l_organization_id number;
97: into l_txn_source_id, l_inventory_item_id,l_operation_seq_num,l_organization_id;
98:
99: if ((p_reduce_wip_requirements is null) or (p_reduce_wip_requirements= 'Y')) then
100: if (l_slog) then
101: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module,
102: 'MTRL: l_txn_source_id (wip entity id)=' || l_txn_source_id );
103: end if;
104: update wip_requirement_operations
105: set quantity_allocated = quantity_allocated - p_qty_to_reduce
122: x_msg_count OUT NOCOPY NUMBER,
123: x_msg_data OUT NOCOPY VARCHAR2
124: ) IS
125: l_module constant varchar2(200) := g_module_name||'.delete_allocation';
126: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
127: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
128: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
129: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
130: l_primary_mmtt_qty number;
123: x_msg_data OUT NOCOPY VARCHAR2
124: ) IS
125: l_module constant varchar2(200) := g_module_name||'.delete_allocation';
126: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
127: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
128: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
129: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
130: l_primary_mmtt_qty number;
131: l_tx_qty number;
124: ) IS
125: l_module constant varchar2(200) := g_module_name||'.delete_allocation';
126: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
127: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
128: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
129: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
130: l_primary_mmtt_qty number;
131: l_tx_qty number;
132: l_move_order_line_id number;
125: l_module constant varchar2(200) := g_module_name||'.delete_allocation';
126: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
127: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
128: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
129: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
130: l_primary_mmtt_qty number;
131: l_tx_qty number;
132: l_move_order_line_id number;
133: l_dummy_v varchar2(3);
140: x_return_status := FND_API.G_RET_STS_SUCCESS;
141: x_msg_count := 0;
142:
143: if (l_plog) then
144: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, l_module,
145: 'Start of '||l_module ||'('||'p_transaction_temp_id='||p_transaction_temp_id||')');
146: end if;
147:
148: --API start
157: end if;
158: --Reduce the allocation quantities in Move order headers, lines and in WRO
159: reduce_move_order(l_move_order_line_id, l_primary_mmtt_qty, 'Y');
160: if (l_slog) then
161: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module,
162: 'Calling inv_trx_util_pub.delete_transaction');
163: end if;
164: --Call the inventory delete API.
165: --This API is similar to the wrapper inv_mo_line_detail_util.delete_allocation
169: , x_msg_count => x_msg_count
170: , p_transaction_temp_id => p_transaction_temp_id
171: );
172: if (l_slog) then
173: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module,
174: 'inv_trx_util_pub.delete_transaction returns. Return status='
175: || x_return_status|| ', Message Count = '|| x_msg_count
176: || ', Message data=' || REPLACE(x_msg_data, CHR(0), ' '));
177: end if;
185: END IF;
186: x_return_status := FND_API.G_RET_STS_SUCCESS;
187: FND_MSG_PUB.Count_And_Get('T', x_msg_count, x_msg_data);
188: if (l_plog) then
189: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, l_module, 'End of ' || l_module);
190: end if;
191:
192: EXCEPTION
193: WHEN fnd_api.g_exc_error THEN
221: x_msg_count OUT NOCOPY NUMBER,
222: x_msg_data OUT NOCOPY VARCHAR2
223: ) IS
224: l_module constant varchar2(200) := g_module_name||'.reduce_allocation_header';
225: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
226: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
227: l_plog CONSTANT boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
228: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
229: l_qty_to_reduce number;
222: x_msg_data OUT NOCOPY VARCHAR2
223: ) IS
224: l_module constant varchar2(200) := g_module_name||'.reduce_allocation_header';
225: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
226: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
227: l_plog CONSTANT boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
228: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
229: l_qty_to_reduce number;
230: l_final_qty number;
223: ) IS
224: l_module constant varchar2(200) := g_module_name||'.reduce_allocation_header';
225: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
226: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
227: l_plog CONSTANT boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
228: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
229: l_qty_to_reduce number;
230: l_final_qty number;
231: l_final_tx_qty number;
224: l_module constant varchar2(200) := g_module_name||'.reduce_allocation_header';
225: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
226: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
227: l_plog CONSTANT boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
228: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
229: l_qty_to_reduce number;
230: l_final_qty number;
231: l_final_tx_qty number;
232: l_primary_mmtt_qty number;
240: x_return_status := FND_API.G_RET_STS_SUCCESS;
241: x_msg_count := 0;
242:
243: if (l_plog) then
244: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, l_module,
245: 'Start of ' || l_module || '('
246: || 'p_transaction_temp_id='|| p_transaction_temp_id
247: || ',p_qty_to_reduce='|| p_qty_to_reduce || ',p_final_qty='|| p_final_qty
248: || ',p_delete_remaining='|| p_delete_remaining || ')');
265: l_final_qty := p_final_qty;
266: l_qty_to_reduce := l_primary_mmtt_qty - p_final_qty;
267: end if;
268: if (l_slog) then
269: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module,
270: 'Calculated l_final_qty='||l_final_qty||
271: ',l_qty_to_reduce='||l_qty_to_reduce);
272: end if;
273: --Validate final qty and if correct, reduce MMTT
272: end if;
273: --Validate final qty and if correct, reduce MMTT
274: if (l_final_qty <= 0) then
275: if (l_elog) then
276: FND_LOG.STRING(FND_LOG.LEVEL_EXCEPTION, l_module, 'Cannot reduce qty to below 0');
277: end if;
278: fnd_message.set_name('INV', 'INV_NON_POSITIVE_ISSUE_QTY');
279: fnd_msg_pub.add;
280: FND_MSG_PUB.Count_And_Get('T', x_msg_count, x_msg_data);
306: reduce_move_order(l_move_order_line_id, l_qty_to_reduce, 'Y');
307: elsif (l_qty_to_reduce > 0) then
308: -- save the remainder allocation by splitting current allocation.
309: if (l_slog) then
310: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module,
311: 'Calling inv_trx_util_pub.copy_insert_line_trx');
312: end if;
313: --call the split API passing in current transaction temp id, split qty
314: inv_trx_util_pub.copy_insert_line_trx(
321: , p_txn_qty => l_qty_to_reduce
322: , p_primary_qty => l_qty_to_reduce
323: );
324: if (l_slog) then
325: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module,
326: 'inv_trx_util_pub.copy_insert_line_trx returns. Return status='
327: || x_return_status|| ', Message Count = '|| x_msg_count
328: || 'x_new_txn_temp_id='|| x_new_transaction_temp_id
329: || ', Message data=' || REPLACE(x_msg_data, CHR(0), ' '));
339: END IF;
340: x_return_status := FND_API.G_RET_STS_SUCCESS;
341: FND_MSG_PUB.Count_And_Get('T', x_msg_count, x_msg_data);
342: if (l_plog) then
343: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, l_module, 'End of ' || l_module);
344: end if;
345:
346: EXCEPTION
347: WHEN fnd_api.g_exc_error THEN
377: x_msg_count OUT NOCOPY NUMBER,
378: x_msg_data OUT NOCOPY VARCHAR2
379: ) IS
380: l_module constant varchar2(200) := g_module_name||'.remove_serial';
381: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
382: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
383: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
384: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
385: BEGIN
378: x_msg_data OUT NOCOPY VARCHAR2
379: ) IS
380: l_module constant varchar2(200) := g_module_name||'.remove_serial';
381: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
382: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
383: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
384: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
385: BEGIN
386: SAVEPOINT remove_serial;
379: ) IS
380: l_module constant varchar2(200) := g_module_name||'.remove_serial';
381: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
382: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
383: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
384: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
385: BEGIN
386: SAVEPOINT remove_serial;
387: x_return_status := FND_API.G_RET_STS_SUCCESS;
380: l_module constant varchar2(200) := g_module_name||'.remove_serial';
381: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
382: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
383: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
384: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
385: BEGIN
386: SAVEPOINT remove_serial;
387: x_return_status := FND_API.G_RET_STS_SUCCESS;
388: x_msg_count := 0;
387: x_return_status := FND_API.G_RET_STS_SUCCESS;
388: x_msg_count := 0;
389:
390: if (l_plog) then
391: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, l_module,
392: 'Start of ' || l_module || '('
393: || 'p_transaction_temp_id='|| p_transaction_temp_id
394: || ',p_inventory_item_id='|| p_inventory_item_id
395: || ',p_serial='|| p_serial || ',p_lot='|| p_lot
428: END IF;
429: x_return_status := FND_API.G_RET_STS_SUCCESS;
430: FND_MSG_PUB.Count_And_Get('T', x_msg_count, x_msg_data);
431: if (l_plog) then
432: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, l_module, 'End of ' || l_module);
433: end if;
434:
435: EXCEPTION
436: WHEN OTHERS THEN
456: x_msg_count OUT NOCOPY NUMBER,
457: x_msg_data OUT NOCOPY VARCHAR2
458: ) IS
459: l_module constant varchar2(200) := g_module_name||'.add_serial';
460: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
461: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
462: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
463: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
464: l_update_count number;
457: x_msg_data OUT NOCOPY VARCHAR2
458: ) IS
459: l_module constant varchar2(200) := g_module_name||'.add_serial';
460: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
461: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
462: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
463: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
464: l_update_count number;
465: l_insert_err_code number;
458: ) IS
459: l_module constant varchar2(200) := g_module_name||'.add_serial';
460: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
461: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
462: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
463: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
464: l_update_count number;
465: l_insert_err_code number;
466: BEGIN
459: l_module constant varchar2(200) := g_module_name||'.add_serial';
460: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
461: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
462: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
463: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
464: l_update_count number;
465: l_insert_err_code number;
466: BEGIN
467: SAVEPOINT add_serial;
468: x_return_status := FND_API.G_RET_STS_SUCCESS;
469: x_msg_count := 0;
470:
471: if (l_plog) then
472: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, l_module,
473: 'Start of ' || l_module || '(' ||
474: 'p_transaction_temp_id='|| p_transaction_temp_id ||
475: 'p_organization_id='|| p_organization_id ||
476: 'p_inventory_item_id='|| p_inventory_item_id ||
496: l_update_count := SQL%ROWCOUNT;
497: end if;
498:
499: if (l_slog) then
500: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module,
501: l_update_count|| ' serials marked in MSN');
502: end if;
503: --API end
504:
511: else
512: x_return_status := FND_API.G_RET_STS_ERROR;
513: end if;
514: if (l_plog) then
515: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, l_module, 'End of ' || l_module);
516: end if;
517:
518: EXCEPTION
519: WHEN OTHERS THEN
546: x_msg_count OUT NOCOPY NUMBER,
547: x_msg_data OUT NOCOPY VARCHAR2
548: ) IS
549: l_module constant varchar2(200) := g_module_name||'.update_lot';
550: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
551: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
552: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
553: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
554: l_update_count number := 0;
547: x_msg_data OUT NOCOPY VARCHAR2
548: ) IS
549: l_module constant varchar2(200) := g_module_name||'.update_lot';
550: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
551: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
552: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
553: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
554: l_update_count number := 0;
555: l_delete_count number := 0;
548: ) IS
549: l_module constant varchar2(200) := g_module_name||'.update_lot';
550: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
551: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
552: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
553: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
554: l_update_count number := 0;
555: l_delete_count number := 0;
556: l_insert_ret_status number := null;
549: l_module constant varchar2(200) := g_module_name||'.update_lot';
550: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
551: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
552: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
553: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
554: l_update_count number := 0;
555: l_delete_count number := 0;
556: l_insert_ret_status number := null;
557: l_reduction_qty number := null;
560: x_return_status := FND_API.G_RET_STS_SUCCESS;
561: x_msg_count := 0;
562:
563: if (l_plog) then
564: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, l_module,
565: 'Start of ' || l_module || '('
566: || 'p_transaction_temp_id='|| p_transaction_temp_id
567: || ' p_serial_transaction_temp_id='|| p_serial_transaction_temp_id
568: || ',p_lot='|| p_lot || ',p_lot_quantity='|| p_lot_quantity
593: --or partitioning may change it within a transaction
594: end if;
595: l_update_count := SQL%ROWCOUNT;
596: if (l_slog) then
597: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module,
598: l_update_count || ' row(s) updated in MTLT');
599: end if;
600: l_reduction_qty := (p_old_lot_quantity - p_lot_quantity);
601: if (p_new_transaction_temp_id is not null and (l_reduction_qty >0)) then
600: l_reduction_qty := (p_old_lot_quantity - p_lot_quantity);
601: if (p_new_transaction_temp_id is not null and (l_reduction_qty >0)) then
602: --split this mtlt row under a new MMTT row with remaining qty
603: if (l_slog) then
604: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module,
605: 'Calling inv_trx_util_pub.insert_lot_trx('|| 'p_pri_qty=p_trx_qty='|| l_reduction_qty);
606: end if;
607: l_insert_ret_status := inv_trx_util_pub.insert_lot_trx(
608: p_trx_tmp_id => p_new_transaction_temp_id
612: , p_pri_qty => l_reduction_qty
613: , x_proc_msg => x_msg_data
614: , x_ser_trx_id => x_ser_trx_id);
615: if (l_slog) then
616: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module,
617: 'inv_trx_util_pub.insert_lot_trx returned: Status='||
618: l_insert_ret_status|| ' (0 success, -1 failure)'||
619: ', Return Message='|| x_msg_data|| ', Serial Temp Id='||
620: x_ser_trx_id);
627: and primary_quantity = p_old_lot_quantity
628: and rownum = 1;
629: l_delete_count := SQL%ROWCOUNT;
630: if (l_slog) then
631: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module,
632: l_delete_count || ' row(s) deleted in MTLT');
633: end if;
634: end if;
635: --API end
639: END IF;
640: x_return_status := FND_API.G_RET_STS_SUCCESS;
641: FND_MSG_PUB.Count_And_Get('T', x_msg_count, x_msg_data);
642: if (l_plog) then
643: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, l_module, 'End of ' || l_module);
644: end if;
645:
646: EXCEPTION
647: WHEN OTHERS THEN
666: x_msg_count OUT NOCOPY NUMBER,
667: x_msg_data OUT NOCOPY VARCHAR2
668: ) IS
669: l_module constant varchar2(200) := g_module_name||'.mark_lot_with_ser_temp_id';
670: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
671: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
672: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
673: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
674: l_update_count number := 0;
667: x_msg_data OUT NOCOPY VARCHAR2
668: ) IS
669: l_module constant varchar2(200) := g_module_name||'.mark_lot_with_ser_temp_id';
670: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
671: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
672: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
673: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
674: l_update_count number := 0;
675: l_ser_trx_id number;
668: ) IS
669: l_module constant varchar2(200) := g_module_name||'.mark_lot_with_ser_temp_id';
670: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
671: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
672: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
673: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
674: l_update_count number := 0;
675: l_ser_trx_id number;
676: BEGIN
669: l_module constant varchar2(200) := g_module_name||'.mark_lot_with_ser_temp_id';
670: l_elog boolean := ((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) and
671: FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION, l_module));
672: l_plog boolean := (l_elog and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
673: l_slog boolean := (l_plog and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL));
674: l_update_count number := 0;
675: l_ser_trx_id number;
676: BEGIN
677: SAVEPOINT mark_lot_with_ser_temp_id;
678: x_return_status := FND_API.G_RET_STS_ERROR;
679: x_msg_count := 0;
680:
681: if (l_plog) then
682: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, l_module,
683: 'Start of ' || l_module || '(' ||'p_commit=' ||p_commit
684: || 'p_transaction_temp_id='|| p_transaction_temp_id
685: || ',p_lot='|| p_lot || ',p_primary_quantity='|| p_primary_quantity|| ')');
686: end if;
698: x_return_status := FND_API.G_RET_STS_SUCCESS;
699: x_ser_trx_id := l_ser_trx_id;
700: end if;
701: if (l_slog) then
702: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module, l_update_count ||
703: ' row(s) updated in MTLT with serial_transaction_temp_id: '|| x_ser_trx_id);
704: end if;
705: --API end
706:
708: COMMIT WORK;
709: END IF;
710: FND_MSG_PUB.Count_And_Get('T', x_msg_count, x_msg_data);
711: if (l_plog) then
712: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, l_module, 'End of ' || l_module);
713: end if;
714:
715: EXCEPTION
716: WHEN OTHERS THEN