192: error_cant_go_neg EXCEPTION;
193:
194:
195: BEGIN
196: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
197: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
198: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' batch_id='||p_batch_header_rec.batch_id);
199: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
200: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' line_no='||p_material_detail_rec.line_no);
193:
194:
195: BEGIN
196: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
197: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
198: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' batch_id='||p_batch_header_rec.batch_id);
199: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
200: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' line_no='||p_material_detail_rec.line_no);
201: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' line_type='||p_material_detail_rec.line_type);
194:
195: BEGIN
196: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
197: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
198: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' batch_id='||p_batch_header_rec.batch_id);
199: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
200: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' line_no='||p_material_detail_rec.line_no);
201: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' line_type='||p_material_detail_rec.line_type);
202: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
195: BEGIN
196: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
197: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
198: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' batch_id='||p_batch_header_rec.batch_id);
199: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
200: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' line_no='||p_material_detail_rec.line_no);
201: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' line_type='||p_material_detail_rec.line_type);
202: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
203: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty_type='||p_qty_type);
196: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
197: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
198: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' batch_id='||p_batch_header_rec.batch_id);
199: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
200: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' line_no='||p_material_detail_rec.line_no);
201: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' line_type='||p_material_detail_rec.line_type);
202: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
203: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty_type='||p_qty_type);
204: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_backflush_rsrc_usg_ind='||p_backflush_rsrc_usg_ind);
197: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
198: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' batch_id='||p_batch_header_rec.batch_id);
199: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
200: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' line_no='||p_material_detail_rec.line_no);
201: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' line_type='||p_material_detail_rec.line_type);
202: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
203: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty_type='||p_qty_type);
204: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_backflush_rsrc_usg_ind='||p_backflush_rsrc_usg_ind);
205: IF p_trans_date IS NULL THEN
198: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' batch_id='||p_batch_header_rec.batch_id);
199: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
200: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' line_no='||p_material_detail_rec.line_no);
201: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' line_type='||p_material_detail_rec.line_type);
202: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
203: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty_type='||p_qty_type);
204: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_backflush_rsrc_usg_ind='||p_backflush_rsrc_usg_ind);
205: IF p_trans_date IS NULL THEN
206: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_trans_date IS NULL');
199: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
200: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' line_no='||p_material_detail_rec.line_no);
201: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' line_type='||p_material_detail_rec.line_type);
202: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
203: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty_type='||p_qty_type);
204: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_backflush_rsrc_usg_ind='||p_backflush_rsrc_usg_ind);
205: IF p_trans_date IS NULL THEN
206: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_trans_date IS NULL');
207: ELSE
200: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' line_no='||p_material_detail_rec.line_no);
201: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' line_type='||p_material_detail_rec.line_type);
202: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
203: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty_type='||p_qty_type);
204: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_backflush_rsrc_usg_ind='||p_backflush_rsrc_usg_ind);
205: IF p_trans_date IS NULL THEN
206: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_trans_date IS NULL');
207: ELSE
208: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_trans_date='||to_char(p_trans_date, 'DD-MON-YYYY HH24:MI:SS'));
202: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
203: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty_type='||p_qty_type);
204: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_backflush_rsrc_usg_ind='||p_backflush_rsrc_usg_ind);
205: IF p_trans_date IS NULL THEN
206: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_trans_date IS NULL');
207: ELSE
208: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_trans_date='||to_char(p_trans_date, 'DD-MON-YYYY HH24:MI:SS'));
209: END IF;
210: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' gme_common_pvt.g_move_to_temp='||gme_common_pvt.g_move_to_temp);
204: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_backflush_rsrc_usg_ind='||p_backflush_rsrc_usg_ind);
205: IF p_trans_date IS NULL THEN
206: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_trans_date IS NULL');
207: ELSE
208: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_trans_date='||to_char(p_trans_date, 'DD-MON-YYYY HH24:MI:SS'));
209: END IF;
210: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' gme_common_pvt.g_move_to_temp='||gme_common_pvt.g_move_to_temp);
211: END IF;
212:
206: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_trans_date IS NULL');
207: ELSE
208: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_trans_date='||to_char(p_trans_date, 'DD-MON-YYYY HH24:MI:SS'));
209: END IF;
210: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' gme_common_pvt.g_move_to_temp='||gme_common_pvt.g_move_to_temp);
211: END IF;
212:
213: /* Set the return status to success initially */
214: x_return_status := FND_API.G_RET_STS_SUCCESS;
235: ,x_pct_plan_res => l_incr_factor_res
236: ,x_return_status => l_return_status);
237:
238: --FPBug#4667093 Begin
239: IF ( NVL(G_DEBUG,-1) <= GME_DEBUG.G_LOG_STATEMENT ) THEN
240: gme_debug.put_line (g_pkg_name||'.'||l_api_name||'Single Product:l_incr_factor= '||l_incr_factor);
241: END IF;
242:
243: /* add the incr qty to old actual to come up with new actual
236: ,x_return_status => l_return_status);
237:
238: --FPBug#4667093 Begin
239: IF ( NVL(G_DEBUG,-1) <= GME_DEBUG.G_LOG_STATEMENT ) THEN
240: gme_debug.put_line (g_pkg_name||'.'||l_api_name||'Single Product:l_incr_factor= '||l_incr_factor);
241: END IF;
242:
243: /* add the incr qty to old actual to come up with new actual
244: as l_incr_factor now depicts the percent increase from previous actual
261: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
262: RAISE error_derive_factor;
263: END IF;
264:
265: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
266: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_incr_factor= '||l_incr_factor);
267: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_incr_factor_res= '||l_incr_factor_res);
268: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_hold_new_actual= '||l_hold_new_actual);
269: END IF;
262: RAISE error_derive_factor;
263: END IF;
264:
265: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
266: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_incr_factor= '||l_incr_factor);
267: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_incr_factor_res= '||l_incr_factor_res);
268: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_hold_new_actual= '||l_hold_new_actual);
269: END IF;
270: --FPBug#4667093 End
263: END IF;
264:
265: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
266: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_incr_factor= '||l_incr_factor);
267: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_incr_factor_res= '||l_incr_factor_res);
268: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_hold_new_actual= '||l_hold_new_actual);
269: END IF;
270: --FPBug#4667093 End
271: ELSE
264:
265: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
266: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_incr_factor= '||l_incr_factor);
267: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_incr_factor_res= '||l_incr_factor_res);
268: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_hold_new_actual= '||l_hold_new_actual);
269: END IF;
270: --FPBug#4667093 End
271: ELSE
272: -- if this is a phantom batch, the qty passed is the incr factor as already calculated
279: */
280: l_hold_new_actual := l_in_material_detail_rec.actual_qty +
281: ((l_in_material_detail_rec.wip_plan_qty * l_incr_factor) / 100);
282:
283: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
284: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' phantom batch; l_incr_factor= '||l_incr_factor);
285: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_hold_new_actual= '||l_hold_new_actual);
286: END IF;
287: --FPBug#4667093 End
280: l_hold_new_actual := l_in_material_detail_rec.actual_qty +
281: ((l_in_material_detail_rec.wip_plan_qty * l_incr_factor) / 100);
282:
283: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
284: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' phantom batch; l_incr_factor= '||l_incr_factor);
285: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_hold_new_actual= '||l_hold_new_actual);
286: END IF;
287: --FPBug#4667093 End
288:
281: ((l_in_material_detail_rec.wip_plan_qty * l_incr_factor) / 100);
282:
283: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
284: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' phantom batch; l_incr_factor= '||l_incr_factor);
285: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_hold_new_actual= '||l_hold_new_actual);
286: END IF;
287: --FPBug#4667093 End
288:
289: END IF;
296:
297: FOR i IN 1 .. l_material_detail_tbl.COUNT LOOP
298: l_material_detail_rec := l_material_detail_tbl (i);
299:
300: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
301: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' -------------------------------------');
302: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' TOP of material detail loop; processing material_detail_id: '||l_material_detail_rec.material_detail_id);
303: END IF;
304:
297: FOR i IN 1 .. l_material_detail_tbl.COUNT LOOP
298: l_material_detail_rec := l_material_detail_tbl (i);
299:
300: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
301: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' -------------------------------------');
302: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' TOP of material detail loop; processing material_detail_id: '||l_material_detail_rec.material_detail_id);
303: END IF;
304:
305: --FPBug#4667093 add IF condition
298: l_material_detail_rec := l_material_detail_tbl (i);
299:
300: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
301: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' -------------------------------------');
302: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' TOP of material detail loop; processing material_detail_id: '||l_material_detail_rec.material_detail_id);
303: END IF;
304:
305: --FPBug#4667093 add IF condition
306: /* if material line is same as the line which drives IB then don't calculate new actual */
305: --FPBug#4667093 add IF condition
306: /* if material line is same as the line which drives IB then don't calculate new actual */
307: IF l_material_detail_rec.material_detail_id = l_in_material_detail_rec.material_detail_id THEN
308: l_new_actual := l_hold_new_actual;
309: IF ( NVL(G_DEBUG,-1) <= GME_DEBUG.G_LOG_STATEMENT ) THEN
310: gme_debug.put_line (g_pkg_name||'.'||l_api_name||'IB Driven new actual: '||l_new_actual);
311: END IF;
312: ELSE
313: IF (l_material_detail_rec.scale_type = 0) THEN
306: /* if material line is same as the line which drives IB then don't calculate new actual */
307: IF l_material_detail_rec.material_detail_id = l_in_material_detail_rec.material_detail_id THEN
308: l_new_actual := l_hold_new_actual;
309: IF ( NVL(G_DEBUG,-1) <= GME_DEBUG.G_LOG_STATEMENT ) THEN
310: gme_debug.put_line (g_pkg_name||'.'||l_api_name||'IB Driven new actual: '||l_new_actual);
311: END IF;
312: ELSE
313: IF (l_material_detail_rec.scale_type = 0) THEN
314: -- set actual qty for fixed line only if it is zero
315: -- fixed items will have already been set the first time through
316: IF (l_material_detail_rec.actual_qty = 0) THEN
317: l_new_actual := l_material_detail_rec.wip_plan_qty;
318:
319: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
320: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' fixed scale: new actual: '||l_new_actual);
321: END IF;
322: ELSE
323: l_new_actual := l_material_detail_rec.actual_qty;
316: IF (l_material_detail_rec.actual_qty = 0) THEN
317: l_new_actual := l_material_detail_rec.wip_plan_qty;
318:
319: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
320: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' fixed scale: new actual: '||l_new_actual);
321: END IF;
322: ELSE
323: l_new_actual := l_material_detail_rec.actual_qty;
324: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
320: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' fixed scale: new actual: '||l_new_actual);
321: END IF;
322: ELSE
323: l_new_actual := l_material_detail_rec.actual_qty;
324: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
325: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' fixed scale: same actual: '||l_new_actual);
326: END IF;
327: END IF; /* l_material_detail_rec.actual_qty = 0 */
328: ELSE
321: END IF;
322: ELSE
323: l_new_actual := l_material_detail_rec.actual_qty;
324: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
325: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' fixed scale: same actual: '||l_new_actual);
326: END IF;
327: END IF; /* l_material_detail_rec.actual_qty = 0 */
328: ELSE
329: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
325: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' fixed scale: same actual: '||l_new_actual);
326: END IF;
327: END IF; /* l_material_detail_rec.actual_qty = 0 */
328: ELSE
329: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
330: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' actual_qty= '||l_material_detail_rec.actual_qty);
331: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' wip_plan_qty= '||l_material_detail_rec.wip_plan_qty);
332: END IF;
333:
326: END IF;
327: END IF; /* l_material_detail_rec.actual_qty = 0 */
328: ELSE
329: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
330: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' actual_qty= '||l_material_detail_rec.actual_qty);
331: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' wip_plan_qty= '||l_material_detail_rec.wip_plan_qty);
332: END IF;
333:
334: -- add the incr qty to old actual to come up with new actual
327: END IF; /* l_material_detail_rec.actual_qty = 0 */
328: ELSE
329: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
330: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' actual_qty= '||l_material_detail_rec.actual_qty);
331: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' wip_plan_qty= '||l_material_detail_rec.wip_plan_qty);
332: END IF;
333:
334: -- add the incr qty to old actual to come up with new actual
335: -- as p_incr_factor now depicts the percent increase from previous actual.
334: -- add the incr qty to old actual to come up with new actual
335: -- as p_incr_factor now depicts the percent increase from previous actual.
336: l_new_actual := l_material_detail_rec.actual_qty +
337: ((l_material_detail_rec.wip_plan_qty * l_incr_factor) / 100);
338: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
339: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' not fixed scale: new actual: '||l_new_actual);
340: END IF;
341:
342: --FPBug#4667093 Begin
335: -- as p_incr_factor now depicts the percent increase from previous actual.
336: l_new_actual := l_material_detail_rec.actual_qty +
337: ((l_material_detail_rec.wip_plan_qty * l_incr_factor) / 100);
338: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
339: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' not fixed scale: new actual: '||l_new_actual);
340: END IF;
341:
342: --FPBug#4667093 Begin
343: IF (l_material_detail_rec.scale_type = 2) THEN
345: l_scale_rec.qty := l_new_actual;
346: l_scale_rec.scale_multiple := l_material_detail_rec.scale_multiple;
347: l_scale_rec.rounding_direction := l_material_detail_rec.rounding_direction;
348:
349: IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
350: gme_debug.put_line('values going to int mult scale are: ');
351: gme_debug.put_line('qty '||l_scale_rec.qty);
352: gme_debug.put_line('rnd variance '||l_scale_rec.scale_rounding_variance);
353: gme_debug.put_line('multiple '||l_scale_rec.scale_multiple);
346: l_scale_rec.scale_multiple := l_material_detail_rec.scale_multiple;
347: l_scale_rec.rounding_direction := l_material_detail_rec.rounding_direction;
348:
349: IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
350: gme_debug.put_line('values going to int mult scale are: ');
351: gme_debug.put_line('qty '||l_scale_rec.qty);
352: gme_debug.put_line('rnd variance '||l_scale_rec.scale_rounding_variance);
353: gme_debug.put_line('multiple '||l_scale_rec.scale_multiple);
354: gme_debug.put_line('rnd direction '||l_scale_rec.rounding_direction);
347: l_scale_rec.rounding_direction := l_material_detail_rec.rounding_direction;
348:
349: IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
350: gme_debug.put_line('values going to int mult scale are: ');
351: gme_debug.put_line('qty '||l_scale_rec.qty);
352: gme_debug.put_line('rnd variance '||l_scale_rec.scale_rounding_variance);
353: gme_debug.put_line('multiple '||l_scale_rec.scale_multiple);
354: gme_debug.put_line('rnd direction '||l_scale_rec.rounding_direction);
355: END IF;
348:
349: IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
350: gme_debug.put_line('values going to int mult scale are: ');
351: gme_debug.put_line('qty '||l_scale_rec.qty);
352: gme_debug.put_line('rnd variance '||l_scale_rec.scale_rounding_variance);
353: gme_debug.put_line('multiple '||l_scale_rec.scale_multiple);
354: gme_debug.put_line('rnd direction '||l_scale_rec.rounding_direction);
355: END IF;
356:
349: IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
350: gme_debug.put_line('values going to int mult scale are: ');
351: gme_debug.put_line('qty '||l_scale_rec.qty);
352: gme_debug.put_line('rnd variance '||l_scale_rec.scale_rounding_variance);
353: gme_debug.put_line('multiple '||l_scale_rec.scale_multiple);
354: gme_debug.put_line('rnd direction '||l_scale_rec.rounding_direction);
355: END IF;
356:
357: gmd_common_scale.integer_multiple_scale
350: gme_debug.put_line('values going to int mult scale are: ');
351: gme_debug.put_line('qty '||l_scale_rec.qty);
352: gme_debug.put_line('rnd variance '||l_scale_rec.scale_rounding_variance);
353: gme_debug.put_line('multiple '||l_scale_rec.scale_multiple);
354: gme_debug.put_line('rnd direction '||l_scale_rec.rounding_direction);
355: END IF;
356:
357: gmd_common_scale.integer_multiple_scale
358: ( p_scale_rec => l_scale_rec
365: END IF;
366:
367: l_new_actual := l_scale_rec_out.qty;
368:
369: IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
370: gme_debug.put_line('new actual after integer scaling is '||l_new_actual);
371: END IF;
372: END IF; /* l_material_detail_rec.scale_type = 2 */
373: --FPBug#4667093 End
366:
367: l_new_actual := l_scale_rec_out.qty;
368:
369: IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
370: gme_debug.put_line('new actual after integer scaling is '||l_new_actual);
371: END IF;
372: END IF; /* l_material_detail_rec.scale_type = 2 */
373: --FPBug#4667093 End
374: END IF; -- IF (l_material_detail_rec.scale_type = 0)
375: END IF; /*l_material_detail_rec.material_detail_id = p_material_detail_rec.material_detail_id*/
376:
377: -- Bug 8267588 - Round the actual qty to 5 decimal places.
378: l_new_actual := ROUND(l_new_actual, 5);
379: IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
380: gme_debug.put_line('new actual after rounding is '||l_new_actual);
381: END IF;
382:
383: -- Bug 9560022 - Moved this check so that it happens after rounding is done.
376:
377: -- Bug 8267588 - Round the actual qty to 5 decimal places.
378: l_new_actual := ROUND(l_new_actual, 5);
379: IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
380: gme_debug.put_line('new actual after rounding is '||l_new_actual);
381: END IF;
382:
383: -- Bug 9560022 - Moved this check so that it happens after rounding is done.
384: IF l_new_actual < 0 THEN
381: END IF;
382:
383: -- Bug 9560022 - Moved this check so that it happens after rounding is done.
384: IF l_new_actual < 0 THEN
385: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
386: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' raising error; new actual= '||l_new_actual);
387: END IF;
388: RAISE error_cant_go_neg;
389: END IF;
382:
383: -- Bug 9560022 - Moved this check so that it happens after rounding is done.
384: IF l_new_actual < 0 THEN
385: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
386: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' raising error; new actual= '||l_new_actual);
387: END IF;
388: RAISE error_cant_go_neg;
389: END IF;
390:
419: IF NOT gme_material_details_dbl.fetch_row(l_phantom_material_rec, l_phantom_material_rec) THEN
420: RAISE error_fetch_matl;
421: END IF;
422:
423: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
424: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' processing phantom batch with batch_id/material_detail_id: '||l_phantom_batch_rec.batch_id||'/'||l_phantom_material_rec.material_detail_id);
425: END IF;
426:
427: incremental_backflush
420: RAISE error_fetch_matl;
421: END IF;
422:
423: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
424: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' processing phantom batch with batch_id/material_detail_id: '||l_phantom_batch_rec.batch_id||'/'||l_phantom_material_rec.material_detail_id);
425: END IF;
426:
427: incremental_backflush
428: (p_batch_header_rec => l_phantom_batch_rec
452: ELSIF l_batch_header_rec.update_inventory_ind = 'Y' AND
453: l_item_rec.mtl_transactions_enabled_flag = 'Y' THEN
454: IF l_new_actual = 0 THEN
455: -- full revert
456: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
457: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' new actual = 0; calling gme_unrelease_batch_pvt.revert_material_full');
458: END IF;
459:
460: -- Bug 8751983 - Set to 2 if user is going negative.
453: l_item_rec.mtl_transactions_enabled_flag = 'Y' THEN
454: IF l_new_actual = 0 THEN
455: -- full revert
456: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
457: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' new actual = 0; calling gme_unrelease_batch_pvt.revert_material_full');
458: END IF;
459:
460: -- Bug 8751983 - Set to 2 if user is going negative.
461: IF gme_common_pvt.g_ib_timestamp_set = 1 THEN
482: l_upd_material := TRUE;
483: ELSIF l_incr_qty < 0 THEN
484: -- partial revert
485: l_decr_qty := -1 * l_incr_qty;
486: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
487: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' call revert_material_partial: incr_qty/decr_qty= '||l_incr_qty||'/'||l_decr_qty);
488: END IF;
489:
490: -- Bug 8751983 - Set to 2 if user is going negative.
483: ELSIF l_incr_qty < 0 THEN
484: -- partial revert
485: l_decr_qty := -1 * l_incr_qty;
486: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
487: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' call revert_material_partial: incr_qty/decr_qty= '||l_incr_qty||'/'||l_decr_qty);
488: END IF;
489:
490: -- Bug 8751983 - Set to 2 if user is going negative.
491: IF gme_common_pvt.g_ib_timestamp_set = 1 THEN
511: END IF;
512: l_upd_material := TRUE;
513: ELSIF l_incr_qty = 0 THEN
514: -- nothing to do
515: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
516: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' incr_qty calculated to 0... nothing to do');
517: END IF;
518: l_upd_material := FALSE;
519: ELSE
512: l_upd_material := TRUE;
513: ELSIF l_incr_qty = 0 THEN
514: -- nothing to do
515: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
516: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' incr_qty calculated to 0... nothing to do');
517: END IF;
518: l_upd_material := FALSE;
519: ELSE
520: -- consume or yield based on line type
518: l_upd_material := FALSE;
519: ELSE
520: -- consume or yield based on line type
521: IF l_material_detail_rec.line_type = gme_common_pvt.g_line_type_ing THEN
522: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
523: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' calling gme_release_batch_pvt.consume_material with target_qty= '||l_new_actual);
524: END IF;
525: gme_release_batch_pvt.consume_material
526: (p_material_dtl_rec => l_material_detail_rec
519: ELSE
520: -- consume or yield based on line type
521: IF l_material_detail_rec.line_type = gme_common_pvt.g_line_type_ing THEN
522: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
523: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' calling gme_release_batch_pvt.consume_material with target_qty= '||l_new_actual);
524: END IF;
525: gme_release_batch_pvt.consume_material
526: (p_material_dtl_rec => l_material_detail_rec
527: ,p_trans_date => p_trans_date
530: ,x_exception_material_tbl => x_exception_material_tbl
531: ,x_actual_qty => l_actual_qty
532: ,x_return_status => l_return_status);
533: ELSE
534: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
535: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' calling gme_complete_batch_pvt.yield_material with target_qty= '||l_new_actual);
536: END IF;
537: gme_complete_batch_pvt.yield_material
538: (p_material_dtl_rec => l_material_detail_rec
531: ,x_actual_qty => l_actual_qty
532: ,x_return_status => l_return_status);
533: ELSE
534: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
535: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' calling gme_complete_batch_pvt.yield_material with target_qty= '||l_new_actual);
536: END IF;
537: gme_complete_batch_pvt.yield_material
538: (p_material_dtl_rec => l_material_detail_rec
539: ,p_yield_qty => l_new_actual
546: END IF;
547:
548: IF l_return_status NOT IN (FND_API.G_RET_STS_SUCCESS, gme_common_pvt.g_exceptions_err) THEN
549: x_return_status := l_return_status;
550: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
551: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' raising exception with x_return_status= '||x_return_status);
552: END IF;
553: RAISE error_consum_yield;
554: END IF;
547:
548: IF l_return_status NOT IN (FND_API.G_RET_STS_SUCCESS, gme_common_pvt.g_exceptions_err) THEN
549: x_return_status := l_return_status;
550: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
551: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' raising exception with x_return_status= '||x_return_status);
552: END IF;
553: RAISE error_consum_yield;
554: END IF;
555:
561:
562: IF l_upd_material THEN
563: l_material_detail_rec.actual_qty := l_actual_qty;
564:
565: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
566: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' calling update material actual qty= '||l_material_detail_rec.actual_qty);
567: END IF;
568:
569: IF NOT gme_material_details_dbl.update_row (l_material_detail_rec) THEN
562: IF l_upd_material THEN
563: l_material_detail_rec.actual_qty := l_actual_qty;
564:
565: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
566: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' calling update material actual qty= '||l_material_detail_rec.actual_qty);
567: END IF;
568:
569: IF NOT gme_material_details_dbl.update_row (l_material_detail_rec) THEN
570: RAISE error_update_row;
574: IF nvl(l_batch_header_rec.parentline_id,0) <> 0 AND
575: l_material_detail_rec.material_detail_id = l_in_material_detail_rec.material_detail_id THEN
576: -- Update the parent ingredient actual_qty. Phantom product updated accounted for.
577: -- in previous update. The transactions would have been taken care of.
578: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
579: gme_debug.put_line (g_pkg_name||'.'||l_api_name||'Updating actual qty for parent ingred to '||l_actual_qty);
580: gme_debug.put_line ('parent line is '||l_batch_header_rec.parentline_id);
581: END IF;
582:
575: l_material_detail_rec.material_detail_id = l_in_material_detail_rec.material_detail_id THEN
576: -- Update the parent ingredient actual_qty. Phantom product updated accounted for.
577: -- in previous update. The transactions would have been taken care of.
578: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
579: gme_debug.put_line (g_pkg_name||'.'||l_api_name||'Updating actual qty for parent ingred to '||l_actual_qty);
580: gme_debug.put_line ('parent line is '||l_batch_header_rec.parentline_id);
581: END IF;
582:
583: UPDATE gme_material_details
576: -- Update the parent ingredient actual_qty. Phantom product updated accounted for.
577: -- in previous update. The transactions would have been taken care of.
578: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
579: gme_debug.put_line (g_pkg_name||'.'||l_api_name||'Updating actual qty for parent ingred to '||l_actual_qty);
580: gme_debug.put_line ('parent line is '||l_batch_header_rec.parentline_id);
581: END IF;
582:
583: UPDATE gme_material_details
584: SET actual_qty = l_actual_qty,
593: -- Back out 9628831.
594: -- IF l_batch_header_rec.laboratory_ind = 1 THEN
595: l_material_detail_rec.actual_qty := l_new_actual;
596:
597: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
598: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' calling update material actual qty= '||l_material_detail_rec.actual_qty);
599: END IF;
600:
601: IF NOT gme_material_details_dbl.update_row (l_material_detail_rec) THEN
594: -- IF l_batch_header_rec.laboratory_ind = 1 THEN
595: l_material_detail_rec.actual_qty := l_new_actual;
596:
597: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
598: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' calling update material actual qty= '||l_material_detail_rec.actual_qty);
599: END IF;
600:
601: IF NOT gme_material_details_dbl.update_row (l_material_detail_rec) THEN
602: RAISE error_update_row;
607: IF nvl(l_batch_header_rec.parentline_id, 0) <> 0 AND
608: l_material_detail_rec.material_detail_id = l_in_material_detail_rec.material_detail_id THEN
609: -- Update the parent ingredient actual_qty. Phantom product updated accounted for.
610: -- in previous update. The transactions would have been taken care of.
611: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
612: gme_debug.put_line (g_pkg_name||'.'||l_api_name||'Updating actual qty for parent ingred to '||l_new_actual);
613: gme_debug.put_line ('parent line is '||l_batch_header_rec.parentline_id);
614: END IF;
615:
608: l_material_detail_rec.material_detail_id = l_in_material_detail_rec.material_detail_id THEN
609: -- Update the parent ingredient actual_qty. Phantom product updated accounted for.
610: -- in previous update. The transactions would have been taken care of.
611: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
612: gme_debug.put_line (g_pkg_name||'.'||l_api_name||'Updating actual qty for parent ingred to '||l_new_actual);
613: gme_debug.put_line ('parent line is '||l_batch_header_rec.parentline_id);
614: END IF;
615:
616: -- Bug 8508788 - Let's update the parent ingredient with the correct actual qty.
609: -- Update the parent ingredient actual_qty. Phantom product updated accounted for.
610: -- in previous update. The transactions would have been taken care of.
611: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
612: gme_debug.put_line (g_pkg_name||'.'||l_api_name||'Updating actual qty for parent ingred to '||l_new_actual);
613: gme_debug.put_line ('parent line is '||l_batch_header_rec.parentline_id);
614: END IF;
615:
616: -- Bug 8508788 - Let's update the parent ingredient with the correct actual qty.
617: UPDATE gme_material_details
716: END IF; -- IF gme_common_pvt.g_ib_timestamp_set > 0
717: END IF; -- IF l_in_batch_step_rec.batchstep_id IS NOT NULL THEN
718: END IF; -- IF l_batch_header_rec.automatic_step_calculation = 1 THEN
719:
720: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
721: gme_debug.put_line('Exiting api '||g_pkg_name||'.'||l_api_name||' for batch_id= '||p_batch_header_rec.batch_id||' and x_return_status= '||x_return_status);
722: END IF;
723:
724: EXCEPTION
717: END IF; -- IF l_in_batch_step_rec.batchstep_id IS NOT NULL THEN
718: END IF; -- IF l_batch_header_rec.automatic_step_calculation = 1 THEN
719:
720: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
721: gme_debug.put_line('Exiting api '||g_pkg_name||'.'||l_api_name||' for batch_id= '||p_batch_header_rec.batch_id||' and x_return_status= '||x_return_status);
722: END IF;
723:
724: EXCEPTION
725: WHEN error_fetch_batch OR error_fetch_matl OR error_update_row THEN
734: WHEN update_step_qty_error OR ERROR_UPDATING_STEPS THEN
735: x_return_status := l_return_status;
736: WHEN OTHERS THEN
737: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
738: IF g_debug <= gme_debug.g_log_procedure THEN
739: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
740: END IF;
741: x_return_status := FND_API.g_ret_sts_unexp_error;
742: END incremental_backflush;
735: x_return_status := l_return_status;
736: WHEN OTHERS THEN
737: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
738: IF g_debug <= gme_debug.g_log_procedure THEN
739: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
740: END IF;
741: x_return_status := FND_API.g_ret_sts_unexp_error;
742: END incremental_backflush;
743:
773: -- p_qty_type 2 % plan
774:
775: BEGIN
776:
777: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
778: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
779: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
780: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
781: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty_type='||p_qty_type);
774:
775: BEGIN
776:
777: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
778: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
779: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
780: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
781: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty_type='||p_qty_type);
782: --FPBug#4667093 rework
775: BEGIN
776:
777: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
778: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
779: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
780: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
781: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty_type='||p_qty_type);
782: --FPBug#4667093 rework
783: gme_debug.put_line(g_pkg_name||'.'||l_api_name||'p_gme_ib_factor ='||p_gme_ib_factor||' line type='||p_material_detail_rec.line_type);
776:
777: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
778: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
779: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
780: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
781: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty_type='||p_qty_type);
782: --FPBug#4667093 rework
783: gme_debug.put_line(g_pkg_name||'.'||l_api_name||'p_gme_ib_factor ='||p_gme_ib_factor||' line type='||p_material_detail_rec.line_type);
784: END IF;
777: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
778: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
779: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
780: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
781: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty_type='||p_qty_type);
782: --FPBug#4667093 rework
783: gme_debug.put_line(g_pkg_name||'.'||l_api_name||'p_gme_ib_factor ='||p_gme_ib_factor||' line type='||p_material_detail_rec.line_type);
784: END IF;
785:
779: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
780: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
781: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty_type='||p_qty_type);
782: --FPBug#4667093 rework
783: gme_debug.put_line(g_pkg_name||'.'||l_api_name||'p_gme_ib_factor ='||p_gme_ib_factor||' line type='||p_material_detail_rec.line_type);
784: END IF;
785:
786: /* Set the return status to success initially */
787: x_return_status := FND_API.G_RET_STS_SUCCESS;
809: l_plan_qty := p_material_detail_rec.plan_qty;
810: l_required_qty := p_material_detail_rec.wip_plan_qty;
811: END IF;
812:
813: IF nvl(g_debug,-1) <= gme_debug.g_log_statement THEN
814: gme_debug.put_line(g_pkg_name||'.'||l_api_name||'l_required_qty: '||l_required_qty);
815: END IF;
816: --FPBug#4667093 End
817:
810: l_required_qty := p_material_detail_rec.wip_plan_qty;
811: END IF;
812:
813: IF nvl(g_debug,-1) <= gme_debug.g_log_statement THEN
814: gme_debug.put_line(g_pkg_name||'.'||l_api_name||'l_required_qty: '||l_required_qty);
815: END IF;
816: --FPBug#4667093 End
817:
818: -- x_pct_plan is the percent to be applied to WIP plan to come up with the incremental qty
877: -- New % is ((incr qty / wip_plan) * (wip_plan / plan)) * 100
878: x_pct_plan_res := (( l_incr_qty / l_required_qty ) * (l_required_qty / l_plan_qty)) * 100;
879: END IF;
880:
881: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
882: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' x_pct_plan= '||x_pct_plan);
883: END IF;
884:
885: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
878: x_pct_plan_res := (( l_incr_qty / l_required_qty ) * (l_required_qty / l_plan_qty)) * 100;
879: END IF;
880:
881: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
882: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' x_pct_plan= '||x_pct_plan);
883: END IF;
884:
885: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
886: gme_debug.put_line('Exiting api '||g_pkg_name||'.'||l_api_name||' with x_return_status= '||x_return_status);
881: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
882: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' x_pct_plan= '||x_pct_plan);
883: END IF;
884:
885: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
886: gme_debug.put_line('Exiting api '||g_pkg_name||'.'||l_api_name||' with x_return_status= '||x_return_status);
887: END IF;
888:
889: EXCEPTION
882: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' x_pct_plan= '||x_pct_plan);
883: END IF;
884:
885: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
886: gme_debug.put_line('Exiting api '||g_pkg_name||'.'||l_api_name||' with x_return_status= '||x_return_status);
887: END IF;
888:
889: EXCEPTION
890: --FPBug#4667093
891: WHEN ERROR_IN_GET_TOTAL_QTY THEN
892: x_return_status := l_return_status;
893: WHEN OTHERS THEN
894: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
895: IF g_debug <= gme_debug.g_log_procedure THEN
896: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
897: END IF;
898: x_return_status := FND_API.g_ret_sts_unexp_error;
899: END derive_factor;
892: x_return_status := l_return_status;
893: WHEN OTHERS THEN
894: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
895: IF g_debug <= gme_debug.g_log_procedure THEN
896: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
897: END IF;
898: x_return_status := FND_API.g_ret_sts_unexp_error;
899: END derive_factor;
900:
919:
920: error_updating_steps EXCEPTION;
921:
922: BEGIN
923: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
924: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
925: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' batchstep_id='||p_batchstep_id);
926: END IF;
927:
920: error_updating_steps EXCEPTION;
921:
922: BEGIN
923: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
924: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
925: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' batchstep_id='||p_batchstep_id);
926: END IF;
927:
928: -- Set the return status to success initially
921:
922: BEGIN
923: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
924: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
925: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' batchstep_id='||p_batchstep_id);
926: END IF;
927:
928: -- Set the return status to success initially
929: x_return_status := FND_API.G_RET_STS_SUCCESS;
965: END IF;
966: END IF;
967: END LOOP;
968:
969: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
970: gme_debug.put_line('Exiting api '||g_pkg_name||'.'||l_api_name);
971: END IF;
972:
973: EXCEPTION
966: END IF;
967: END LOOP;
968:
969: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
970: gme_debug.put_line('Exiting api '||g_pkg_name||'.'||l_api_name);
971: END IF;
972:
973: EXCEPTION
974: WHEN error_updating_steps THEN
974: WHEN error_updating_steps THEN
975: NULL;
976: WHEN OTHERS THEN
977: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
978: IF g_debug <= gme_debug.g_log_procedure THEN
979: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
980: END IF;
981: x_return_status := FND_API.g_ret_sts_unexp_error;
982: END update_dependent_steps;
975: NULL;
976: WHEN OTHERS THEN
977: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
978: IF g_debug <= gme_debug.g_log_procedure THEN
979: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
980: END IF;
981: x_return_status := FND_API.g_ret_sts_unexp_error;
982: END update_dependent_steps;
983:
1057: l_lot_record_used NUMBER;
1058: l_skip_lot NUMBER;
1059: BEGIN
1060:
1061: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1062: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1063: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
1064: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
1065: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_lot_control_code='||p_lot_control_code);
1058: l_skip_lot NUMBER;
1059: BEGIN
1060:
1061: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1062: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1063: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
1064: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
1065: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_lot_control_code='||p_lot_control_code);
1066: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_create_resv_pend_lots='||p_create_resv_pend_lots);
1059: BEGIN
1060:
1061: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1062: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1063: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
1064: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
1065: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_lot_control_code='||p_lot_control_code);
1066: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_create_resv_pend_lots='||p_create_resv_pend_lots);
1067: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_lot_divisible_flag='||p_lot_divisible_flag);
1060:
1061: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1062: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1063: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
1064: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
1065: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_lot_control_code='||p_lot_control_code);
1066: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_create_resv_pend_lots='||p_create_resv_pend_lots);
1067: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_lot_divisible_flag='||p_lot_divisible_flag);
1068: END IF;
1061: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1062: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1063: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
1064: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
1065: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_lot_control_code='||p_lot_control_code);
1066: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_create_resv_pend_lots='||p_create_resv_pend_lots);
1067: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_lot_divisible_flag='||p_lot_divisible_flag);
1068: END IF;
1069:
1062: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1063: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
1064: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
1065: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_lot_control_code='||p_lot_control_code);
1066: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_create_resv_pend_lots='||p_create_resv_pend_lots);
1067: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_lot_divisible_flag='||p_lot_divisible_flag);
1068: END IF;
1069:
1070: -- Set the return status to success initially
1063: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
1064: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
1065: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_lot_control_code='||p_lot_control_code);
1066: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_create_resv_pend_lots='||p_create_resv_pend_lots);
1067: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_lot_divisible_flag='||p_lot_divisible_flag);
1068: END IF;
1069:
1070: -- Set the return status to success initially
1071: x_return_status := FND_API.G_RET_STS_SUCCESS;
1083: ,p_order_by => 2
1084: ,x_mmt_tbl => l_mmt_tbl
1085: ,x_return_status => x_return_status);
1086:
1087: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1088: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' gme_transactions_pvt.get_mat_trans returned '||l_mmt_tbl.count||' trxns with return_status='||x_return_status);
1089: END IF;
1090:
1091: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1084: ,x_mmt_tbl => l_mmt_tbl
1085: ,x_return_status => x_return_status);
1086:
1087: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1088: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' gme_transactions_pvt.get_mat_trans returned '||l_mmt_tbl.count||' trxns with return_status='||x_return_status);
1089: END IF;
1090:
1091: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1092: RAISE error_get_trans;
1119:
1120: IF p_material_detail_rec.line_type = gme_common_pvt.g_line_type_ing THEN
1121: IF p_lot_divisible_flag = 'N' THEN
1122: l_whole_qty := TRUE;
1123: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1124: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_whole_qty = TRUE because lot indivisible item');
1125: END IF;
1126: ELSE
1127: l_whole_qty := FALSE;
1120: IF p_material_detail_rec.line_type = gme_common_pvt.g_line_type_ing THEN
1121: IF p_lot_divisible_flag = 'N' THEN
1122: l_whole_qty := TRUE;
1123: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1124: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_whole_qty = TRUE because lot indivisible item');
1125: END IF;
1126: ELSE
1127: l_whole_qty := FALSE;
1128: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1124: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_whole_qty = TRUE because lot indivisible item');
1125: END IF;
1126: ELSE
1127: l_whole_qty := FALSE;
1128: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1129: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_whole_qty = FALSE because lot is divisible; next check if dispensed');
1130: END IF;
1131: END IF;
1132:
1125: END IF;
1126: ELSE
1127: l_whole_qty := FALSE;
1128: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1129: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_whole_qty = FALSE because lot is divisible; next check if dispensed');
1130: END IF;
1131: END IF;
1132:
1133: -- test again for dispensed items
1133: -- test again for dispensed items
1134: IF NOT l_whole_qty THEN
1135: IF NVL(p_material_detail_rec.dispense_ind,'N') = 'Y' THEN
1136: l_whole_qty := TRUE;
1137: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1138: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_whole_qty = TRUE because dispensed item');
1139: END IF;
1140: END IF;
1141: END IF;
1134: IF NOT l_whole_qty THEN
1135: IF NVL(p_material_detail_rec.dispense_ind,'N') = 'Y' THEN
1136: l_whole_qty := TRUE;
1137: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1138: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_whole_qty = TRUE because dispensed item');
1139: END IF;
1140: END IF;
1141: END IF;
1142: ELSE -- product and byproduct doesn't apply for either dispensed or lot divisible... don't have to take whole qty
1140: END IF;
1141: END IF;
1142: ELSE -- product and byproduct doesn't apply for either dispensed or lot divisible... don't have to take whole qty
1143: l_whole_qty := FALSE;
1144: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1145: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_whole_qty = FALSE because prod/byprod');
1146: END IF;
1147: END IF;
1148:
1141: END IF;
1142: ELSE -- product and byproduct doesn't apply for either dispensed or lot divisible... don't have to take whole qty
1143: l_whole_qty := FALSE;
1144: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1145: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_whole_qty = FALSE because prod/byprod');
1146: END IF;
1147: END IF;
1148:
1149: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1145: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_whole_qty = FALSE because prod/byprod');
1146: END IF;
1147: END IF;
1148:
1149: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1150: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_trxn_type='||l_trxn_type);
1151: END IF;
1152:
1153: IF p_lot_control_code = 1 THEN
1146: END IF;
1147: END IF;
1148:
1149: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1150: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_trxn_type='||l_trxn_type);
1151: END IF;
1152:
1153: IF p_lot_control_code = 1 THEN
1154:
1151: END IF;
1152:
1153: IF p_lot_control_code = 1 THEN
1154:
1155: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1156: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' ********** NOT LOT CONTROL **********');
1157: END IF;
1158:
1159: i := 1;
1152:
1153: IF p_lot_control_code = 1 THEN
1154:
1155: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1156: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' ********** NOT LOT CONTROL **********');
1157: END IF;
1158:
1159: i := 1;
1160: WHILE i <= l_mmt_tbl.count AND l_qty > 0 LOOP
1159: i := 1;
1160: WHILE i <= l_mmt_tbl.count AND l_qty > 0 LOOP
1161: l_mmt_rec := l_mmt_tbl(i);
1162:
1163: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1164: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; ******************* ');
1165: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; processing i='||i);
1166: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; processing trxns_id='||l_mmt_rec.transaction_id);
1167: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; qty to reduce='||l_qty);
1160: WHILE i <= l_mmt_tbl.count AND l_qty > 0 LOOP
1161: l_mmt_rec := l_mmt_tbl(i);
1162:
1163: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1164: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; ******************* ');
1165: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; processing i='||i);
1166: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; processing trxns_id='||l_mmt_rec.transaction_id);
1167: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; qty to reduce='||l_qty);
1168: END IF;
1161: l_mmt_rec := l_mmt_tbl(i);
1162:
1163: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1164: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; ******************* ');
1165: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; processing i='||i);
1166: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; processing trxns_id='||l_mmt_rec.transaction_id);
1167: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; qty to reduce='||l_qty);
1168: END IF;
1169:
1162:
1163: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1164: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; ******************* ');
1165: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; processing i='||i);
1166: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; processing trxns_id='||l_mmt_rec.transaction_id);
1167: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; qty to reduce='||l_qty);
1168: END IF;
1169:
1170: IF l_mmt_rec.transaction_type_id = l_trxn_type THEN
1163: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1164: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; ******************* ');
1165: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; processing i='||i);
1166: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; processing trxns_id='||l_mmt_rec.transaction_id);
1167: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; qty to reduce='||l_qty);
1168: END IF;
1169:
1170: IF l_mmt_rec.transaction_type_id = l_trxn_type THEN
1171: l_trxn_qty := l_mmt_rec.transaction_quantity;
1183: END IF;
1184: END IF;
1185: END IF;
1186:
1187: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1188: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; calling gme_transactions_pvt.delete_material_txn for trxns_id='||l_mmt_rec.transaction_id);
1189: END IF;
1190:
1191: -- Bug 13017256 - Let's pass in user entered date. It will get used if necessary.
1184: END IF;
1185: END IF;
1186:
1187: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1188: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; calling gme_transactions_pvt.delete_material_txn for trxns_id='||l_mmt_rec.transaction_id);
1189: END IF;
1190:
1191: -- Bug 13017256 - Let's pass in user entered date. It will get used if necessary.
1192: -- delete this transaction, reduce the qty to decrement
1197: ,x_return_status => l_return_status);
1198:
1199: IF l_return_status = gme_common_pvt.g_not_transactable THEN
1200: -- do nothing... move on to the next, to try to reduce
1201: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1202: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; gme_transactions_pvt.delete_material_txn returned '||l_return_status);
1203: END IF;
1204: ELSIF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1205: x_return_status := l_return_status;
1198:
1199: IF l_return_status = gme_common_pvt.g_not_transactable THEN
1200: -- do nothing... move on to the next, to try to reduce
1201: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1202: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; gme_transactions_pvt.delete_material_txn returned '||l_return_status);
1203: END IF;
1204: ELSIF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1205: x_return_status := l_return_status;
1206: RAISE error_trans;
1245: RAISE inv_negative;
1246: END IF;
1247: END IF;
1248:
1249: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1250: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; calling gme_transactions_pvt.update_material_txn for trxns_id='||l_mmt_rec.transaction_id);
1251: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; update trxn with qty='||l_mmt_rec.transaction_quantity);
1252: END IF;
1253:
1246: END IF;
1247: END IF;
1248:
1249: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1250: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; calling gme_transactions_pvt.update_material_txn for trxns_id='||l_mmt_rec.transaction_id);
1251: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; update trxn with qty='||l_mmt_rec.transaction_quantity);
1252: END IF;
1253:
1254: gme_transactions_pvt.update_material_txn
1247: END IF;
1248:
1249: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1250: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; calling gme_transactions_pvt.update_material_txn for trxns_id='||l_mmt_rec.transaction_id);
1251: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; update trxn with qty='||l_mmt_rec.transaction_quantity);
1252: END IF;
1253:
1254: gme_transactions_pvt.update_material_txn
1255: (p_mmt_rec => l_mmt_rec
1257: ,x_return_status => l_return_status);
1258:
1259: IF l_return_status = gme_common_pvt.g_not_transactable THEN
1260: -- do nothing... move on to the next, to try to reduce
1261: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1262: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; gme_transactions_pvt.update_material_txn returned '||l_return_status);
1263: END IF;
1264: ELSIF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1265: x_return_status := l_return_status;
1258:
1259: IF l_return_status = gme_common_pvt.g_not_transactable THEN
1260: -- do nothing... move on to the next, to try to reduce
1261: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1262: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; gme_transactions_pvt.update_material_txn returned '||l_return_status);
1263: END IF;
1264: ELSIF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1265: x_return_status := l_return_status;
1266: RAISE error_trans;
1296: END IF;
1297:
1298: END IF; -- IF l_trxn_qty <= l_qty THEN
1299: ELSE
1300: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1301: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' cant process because not the same transaction_type_id: trxns_id='||l_mmt_rec.transaction_id);
1302: END IF;
1303: END IF; -- IF l_mmt_rec.transaction_type_id = l_trxn_type THEN
1304:
1297:
1298: END IF; -- IF l_trxn_qty <= l_qty THEN
1299: ELSE
1300: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1301: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' cant process because not the same transaction_type_id: trxns_id='||l_mmt_rec.transaction_id);
1302: END IF;
1303: END IF; -- IF l_mmt_rec.transaction_type_id = l_trxn_type THEN
1304:
1305: i := i + 1;
1307: END LOOP;
1308: ELSE -- p_lot_control_code = 2 which means lot control
1309:
1310:
1311: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1312: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' ********** LOT CONTROL **********');
1313: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' right before cursor cur_lot_qty');
1314: END IF;
1315:
1308: ELSE -- p_lot_control_code = 2 which means lot control
1309:
1310:
1311: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1312: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' ********** LOT CONTROL **********');
1313: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' right before cursor cur_lot_qty');
1314: END IF;
1315:
1316: FOR cur_lot_qty_rec IN cur_lot_qty(
1309:
1310:
1311: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1312: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' ********** LOT CONTROL **********');
1313: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' right before cursor cur_lot_qty');
1314: END IF;
1315:
1316: FOR cur_lot_qty_rec IN cur_lot_qty(
1317: p_material_detail_rec.inventory_item_id
1318: ,p_material_detail_rec.organization_id
1319: ,p_material_detail_rec.batch_id
1320: ,p_material_detail_rec.material_detail_id) LOOP
1321: l_lot_qty_tab(cur_lot_qty_rec.lot_number) := ABS(cur_lot_qty_rec.sum_trx);
1322: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1323: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' lot tab index: lot_number:'||cur_lot_qty_rec.lot_number);
1324: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' lot tab qty sum: '||l_lot_qty_tab(cur_lot_qty_rec.lot_number));
1325: END IF;
1326: END LOOP;
1319: ,p_material_detail_rec.batch_id
1320: ,p_material_detail_rec.material_detail_id) LOOP
1321: l_lot_qty_tab(cur_lot_qty_rec.lot_number) := ABS(cur_lot_qty_rec.sum_trx);
1322: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1323: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' lot tab index: lot_number:'||cur_lot_qty_rec.lot_number);
1324: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' lot tab qty sum: '||l_lot_qty_tab(cur_lot_qty_rec.lot_number));
1325: END IF;
1326: END LOOP;
1327:
1320: ,p_material_detail_rec.material_detail_id) LOOP
1321: l_lot_qty_tab(cur_lot_qty_rec.lot_number) := ABS(cur_lot_qty_rec.sum_trx);
1322: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1323: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' lot tab index: lot_number:'||cur_lot_qty_rec.lot_number);
1324: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' lot tab qty sum: '||l_lot_qty_tab(cur_lot_qty_rec.lot_number));
1325: END IF;
1326: END LOOP;
1327:
1328: -- loop the trxns checking each lot trxn against lot sum to see if
1333: i := 1;
1334: WHILE i <= l_mmt_tbl.count AND l_qty > 0 LOOP
1335: l_mmt_rec := l_mmt_tbl(i);
1336:
1337: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1338: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; ******************* ');
1339: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; processing i='||i);
1340: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; processing trxns_id='||l_mmt_rec.transaction_id);
1341: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; qty to reduce='||l_qty);
1334: WHILE i <= l_mmt_tbl.count AND l_qty > 0 LOOP
1335: l_mmt_rec := l_mmt_tbl(i);
1336:
1337: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1338: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; ******************* ');
1339: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; processing i='||i);
1340: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; processing trxns_id='||l_mmt_rec.transaction_id);
1341: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; qty to reduce='||l_qty);
1342: END IF;
1335: l_mmt_rec := l_mmt_tbl(i);
1336:
1337: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1338: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; ******************* ');
1339: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; processing i='||i);
1340: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; processing trxns_id='||l_mmt_rec.transaction_id);
1341: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; qty to reduce='||l_qty);
1342: END IF;
1343:
1336:
1337: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1338: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; ******************* ');
1339: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; processing i='||i);
1340: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; processing trxns_id='||l_mmt_rec.transaction_id);
1341: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; qty to reduce='||l_qty);
1342: END IF;
1343:
1344:
1337: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1338: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; ******************* ');
1339: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; processing i='||i);
1340: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; processing trxns_id='||l_mmt_rec.transaction_id);
1341: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; qty to reduce='||l_qty);
1342: END IF;
1343:
1344:
1345: IF l_mmt_rec.transaction_type_id = l_trxn_type THEN
1364:
1365: l_decr_qty := 0;
1366: j:= 1;
1367:
1368: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1369: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' before lot loop; l_mmln_tbl.COUNT='||l_mmln_tbl.COUNT);
1370: END IF;
1371:
1372: -- keep last successful qties; in case update or delete is not successful, and you have to go back
1365: l_decr_qty := 0;
1366: j:= 1;
1367:
1368: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1369: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' before lot loop; l_mmln_tbl.COUNT='||l_mmln_tbl.COUNT);
1370: END IF;
1371:
1372: -- keep last successful qties; in case update or delete is not successful, and you have to go back
1373: l_last_lot_qty_tab := l_lot_qty_tab;
1376:
1377: -- Bug 9072371 - Check potential negative inventory for each specific lot.
1378: l_lot_record_used := 0;
1379: WHILE j <= l_mmln_tbl.COUNT AND l_qty > 0 LOOP
1380: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1381: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; j='||j);
1382: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_decr_qty='||l_decr_qty);
1383: END IF;
1384:
1377: -- Bug 9072371 - Check potential negative inventory for each specific lot.
1378: l_lot_record_used := 0;
1379: WHILE j <= l_mmln_tbl.COUNT AND l_qty > 0 LOOP
1380: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1381: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; j='||j);
1382: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_decr_qty='||l_decr_qty);
1383: END IF;
1384:
1385: -- Bug 9072371 - Check potential negative inventory for each specific lot.
1378: l_lot_record_used := 0;
1379: WHILE j <= l_mmln_tbl.COUNT AND l_qty > 0 LOOP
1380: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1381: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; j='||j);
1382: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_decr_qty='||l_decr_qty);
1383: END IF;
1384:
1385: -- Bug 9072371 - Check potential negative inventory for each specific lot.
1386: -- Continue to next lot if this one cannot be used.
1398: -- Bug 9072371 - Don't process this lot if it will drive inventory negative.
1399: IF l_skip_lot = 0 THEN
1400: ln := l_mmln_tbl(j).lot_number;
1401:
1402: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1403: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; processing lot number='||ln);
1404: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; sum lot trxn for this lot='||l_lot_qty_tab(ln));
1405: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_qty='||l_qty);
1406: END IF;
1399: IF l_skip_lot = 0 THEN
1400: ln := l_mmln_tbl(j).lot_number;
1401:
1402: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1403: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; processing lot number='||ln);
1404: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; sum lot trxn for this lot='||l_lot_qty_tab(ln));
1405: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_qty='||l_qty);
1406: END IF;
1407:
1400: ln := l_mmln_tbl(j).lot_number;
1401:
1402: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1403: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; processing lot number='||ln);
1404: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; sum lot trxn for this lot='||l_lot_qty_tab(ln));
1405: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_qty='||l_qty);
1406: END IF;
1407:
1408: -- if you need to take the entire lot qty, then take it... else, go on to figure out how much you can take
1401:
1402: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1403: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; processing lot number='||ln);
1404: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; sum lot trxn for this lot='||l_lot_qty_tab(ln));
1405: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_qty='||l_qty);
1406: END IF;
1407:
1408: -- if you need to take the entire lot qty, then take it... else, go on to figure out how much you can take
1409: IF l_whole_qty THEN
1423: END IF;
1424: END IF;
1425: END IF;
1426:
1427: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1428: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; reducing lot qty by='||l_temp_qty);
1429: END IF;
1430:
1431: l_mmln_tbl(j).transaction_quantity := l_mmln_tbl(j).transaction_quantity - l_temp_qty;
1424: END IF;
1425: END IF;
1426:
1427: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1428: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; reducing lot qty by='||l_temp_qty);
1429: END IF;
1430:
1431: l_mmln_tbl(j).transaction_quantity := l_mmln_tbl(j).transaction_quantity - l_temp_qty;
1432: l_mmln_tbl(j).primary_quantity := NULL;
1445:
1446: -- Bug 9072371 - Set flag which says at least one valid lot record was found.
1447: l_lot_record_used := 1;
1448:
1449: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1450: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_mmln_tbl(j).transaction_quantity='||l_mmln_tbl(j).transaction_quantity);
1451: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_lot_qty_tab(ln)='||l_lot_qty_tab(ln));
1452: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_qty='||l_qty);
1453: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_decr_qty='||l_decr_qty);
1446: -- Bug 9072371 - Set flag which says at least one valid lot record was found.
1447: l_lot_record_used := 1;
1448:
1449: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1450: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_mmln_tbl(j).transaction_quantity='||l_mmln_tbl(j).transaction_quantity);
1451: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_lot_qty_tab(ln)='||l_lot_qty_tab(ln));
1452: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_qty='||l_qty);
1453: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_decr_qty='||l_decr_qty);
1454: END IF;
1447: l_lot_record_used := 1;
1448:
1449: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1450: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_mmln_tbl(j).transaction_quantity='||l_mmln_tbl(j).transaction_quantity);
1451: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_lot_qty_tab(ln)='||l_lot_qty_tab(ln));
1452: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_qty='||l_qty);
1453: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_decr_qty='||l_decr_qty);
1454: END IF;
1455: END IF; -- skip lot check.
1448:
1449: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1450: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_mmln_tbl(j).transaction_quantity='||l_mmln_tbl(j).transaction_quantity);
1451: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_lot_qty_tab(ln)='||l_lot_qty_tab(ln));
1452: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_qty='||l_qty);
1453: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_decr_qty='||l_decr_qty);
1454: END IF;
1455: END IF; -- skip lot check.
1456: j := j + 1;
1449: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1450: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_mmln_tbl(j).transaction_quantity='||l_mmln_tbl(j).transaction_quantity);
1451: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_lot_qty_tab(ln)='||l_lot_qty_tab(ln));
1452: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_qty='||l_qty);
1453: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in lot loop; l_decr_qty='||l_decr_qty);
1454: END IF;
1455: END IF; -- skip lot check.
1456: j := j + 1;
1457: END LOOP;
1455: END IF; -- skip lot check.
1456: j := j + 1;
1457: END LOOP;
1458:
1459: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1460: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' after lot loop; l_decr_qty='||l_decr_qty);
1461: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' after lot loop; l_mmt_rec.transaction_quantity='||l_mmt_rec.transaction_quantity);
1462: END IF;
1463:
1456: j := j + 1;
1457: END LOOP;
1458:
1459: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1460: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' after lot loop; l_decr_qty='||l_decr_qty);
1461: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' after lot loop; l_mmt_rec.transaction_quantity='||l_mmt_rec.transaction_quantity);
1462: END IF;
1463:
1464: -- Bug 9072371 - If at least one valid lot record was found then process.
1457: END LOOP;
1458:
1459: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1460: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' after lot loop; l_decr_qty='||l_decr_qty);
1461: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' after lot loop; l_mmt_rec.transaction_quantity='||l_mmt_rec.transaction_quantity);
1462: END IF;
1463:
1464: -- Bug 9072371 - If at least one valid lot record was found then process.
1465: IF l_lot_record_used = 1 THEN
1476: RAISE inv_negative;
1477: END IF;
1478: END IF;
1479:
1480: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1481: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; calling gme_transactions_pvt.delete_material_txn with trxn_id='||l_mmt_tbl(i).transaction_id);
1482: END IF;
1483:
1484: -- Bug 13017256 - Let's pass in user entered date. It will get used if necessary.
1477: END IF;
1478: END IF;
1479:
1480: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1481: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; calling gme_transactions_pvt.delete_material_txn with trxn_id='||l_mmt_tbl(i).transaction_id);
1482: END IF;
1483:
1484: -- Bug 13017256 - Let's pass in user entered date. It will get used if necessary.
1485: -- delete this transaction, reduce the qty to decrement
1492:
1493: IF l_return_status = gme_common_pvt.g_not_transactable THEN
1494: l_trxn_success := FALSE;
1495: -- do nothing... move on to the next, to try to reduce
1496: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1497: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; gme_transactions_pvt.delete_material_txn returned '||l_return_status);
1498: END IF;
1499: ELSIF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1500: x_return_status := l_return_status;
1493: IF l_return_status = gme_common_pvt.g_not_transactable THEN
1494: l_trxn_success := FALSE;
1495: -- do nothing... move on to the next, to try to reduce
1496: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1497: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; gme_transactions_pvt.delete_material_txn returned '||l_return_status);
1498: END IF;
1499: ELSIF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1500: x_return_status := l_return_status;
1501: RAISE error_trans;
1546: RAISE inv_negative;
1547: END IF;
1548: END IF;
1549:
1550: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1551: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' quantity decremented from transaction:'||l_decr_qty);
1552:
1553: FOR j IN 1..l_mmln_tbl.COUNT LOOP
1554: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_mmln_tbl lot number:'||l_mmln_tbl(j).lot_number);
1547: END IF;
1548: END IF;
1549:
1550: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1551: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' quantity decremented from transaction:'||l_decr_qty);
1552:
1553: FOR j IN 1..l_mmln_tbl.COUNT LOOP
1554: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_mmln_tbl lot number:'||l_mmln_tbl(j).lot_number);
1555: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_mmln_tbl lot quantity: '||l_mmln_tbl(j).transaction_quantity);
1550: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1551: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' quantity decremented from transaction:'||l_decr_qty);
1552:
1553: FOR j IN 1..l_mmln_tbl.COUNT LOOP
1554: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_mmln_tbl lot number:'||l_mmln_tbl(j).lot_number);
1555: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_mmln_tbl lot quantity: '||l_mmln_tbl(j).transaction_quantity);
1556: END LOOP;
1557:
1558: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' new transaction quantity:'||l_mmt_rec.transaction_quantity);
1551: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' quantity decremented from transaction:'||l_decr_qty);
1552:
1553: FOR j IN 1..l_mmln_tbl.COUNT LOOP
1554: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_mmln_tbl lot number:'||l_mmln_tbl(j).lot_number);
1555: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_mmln_tbl lot quantity: '||l_mmln_tbl(j).transaction_quantity);
1556: END LOOP;
1557:
1558: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' new transaction quantity:'||l_mmt_rec.transaction_quantity);
1559:
1554: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_mmln_tbl lot number:'||l_mmln_tbl(j).lot_number);
1555: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_mmln_tbl lot quantity: '||l_mmln_tbl(j).transaction_quantity);
1556: END LOOP;
1557:
1558: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' new transaction quantity:'||l_mmt_rec.transaction_quantity);
1559:
1560: FOR j IN 1..l_mmln_tbl_new.COUNT LOOP
1561: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_mmln_tbl_new lot number:'||l_mmln_tbl_new(j).lot_number);
1562: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_mmln_tbl_new lot quantity: '||l_mmln_tbl_new(j).transaction_quantity);
1557:
1558: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' new transaction quantity:'||l_mmt_rec.transaction_quantity);
1559:
1560: FOR j IN 1..l_mmln_tbl_new.COUNT LOOP
1561: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_mmln_tbl_new lot number:'||l_mmln_tbl_new(j).lot_number);
1562: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_mmln_tbl_new lot quantity: '||l_mmln_tbl_new(j).transaction_quantity);
1563: END LOOP;
1564:
1565: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' calling gme_transactions_pvt.update_material_txn with updatd l_mmt_rec and new l_mmln_tbl_new');
1558: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' new transaction quantity:'||l_mmt_rec.transaction_quantity);
1559:
1560: FOR j IN 1..l_mmln_tbl_new.COUNT LOOP
1561: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_mmln_tbl_new lot number:'||l_mmln_tbl_new(j).lot_number);
1562: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_mmln_tbl_new lot quantity: '||l_mmln_tbl_new(j).transaction_quantity);
1563: END LOOP;
1564:
1565: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' calling gme_transactions_pvt.update_material_txn with updatd l_mmt_rec and new l_mmln_tbl_new');
1566: END IF;
1561: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_mmln_tbl_new lot number:'||l_mmln_tbl_new(j).lot_number);
1562: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' l_mmln_tbl_new lot quantity: '||l_mmln_tbl_new(j).transaction_quantity);
1563: END LOOP;
1564:
1565: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' calling gme_transactions_pvt.update_material_txn with updatd l_mmt_rec and new l_mmln_tbl_new');
1566: END IF;
1567:
1568: gme_transactions_pvt.update_material_txn
1569: (p_mmt_rec => l_mmt_rec
1572:
1573: IF l_return_status = gme_common_pvt.g_not_transactable THEN
1574: l_trxn_success := FALSE;
1575: -- do nothing... move on to the next, to try to reduce
1576: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1577: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; gme_transactions_pvt.update_material_txn returned '||l_return_status);
1578: END IF;
1579: ELSIF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1580: x_return_status := l_return_status;
1573: IF l_return_status = gme_common_pvt.g_not_transactable THEN
1574: l_trxn_success := FALSE;
1575: -- do nothing... move on to the next, to try to reduce
1576: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1577: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in trxn loop; gme_transactions_pvt.update_material_txn returned '||l_return_status);
1578: END IF;
1579: ELSIF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1580: x_return_status := l_return_status;
1581: RAISE error_trans;
1636: END IF;
1637: END IF; -- IF l_decr_qty = l_mmt_rec.transaction_quantity THEN
1638: END IF; -- IF l_lot_record_used = 1 THEN
1639: ELSE
1640: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1641: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' cant process because not the same transaction_type_id: trxns_id='||l_mmt_rec.transaction_id);
1642: END IF;
1643: END IF; -- IF l_mmt_rec.transaction_type_id = l_trxn_type THEN
1644:
1637: END IF; -- IF l_decr_qty = l_mmt_rec.transaction_quantity THEN
1638: END IF; -- IF l_lot_record_used = 1 THEN
1639: ELSE
1640: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1641: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' cant process because not the same transaction_type_id: trxns_id='||l_mmt_rec.transaction_id);
1642: END IF;
1643: END IF; -- IF l_mmt_rec.transaction_type_id = l_trxn_type THEN
1644:
1645: i := i + 1;
1648:
1649: -- actual qty is reduced by the amount requested less what couldn't be reduced
1650: x_actual_qty := p_material_detail_rec.actual_qty - l_total_decr_qty;
1651:
1652: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1653: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' total decremented='||l_total_decr_qty);
1654: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' new actual='||x_actual_qty);
1655: END IF;
1656:
1649: -- actual qty is reduced by the amount requested less what couldn't be reduced
1650: x_actual_qty := p_material_detail_rec.actual_qty - l_total_decr_qty;
1651:
1652: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1653: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' total decremented='||l_total_decr_qty);
1654: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' new actual='||x_actual_qty);
1655: END IF;
1656:
1657: -- raise exception if couldn't reduce by requested
1650: x_actual_qty := p_material_detail_rec.actual_qty - l_total_decr_qty;
1651:
1652: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
1653: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' total decremented='||l_total_decr_qty);
1654: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' new actual='||x_actual_qty);
1655: END IF;
1656:
1657: -- raise exception if couldn't reduce by requested
1658: IF l_total_decr_qty < p_qty THEN
1666: ,x_exception_material_tbl => x_exception_material_tbl
1667: ,x_return_status => x_return_status);
1668: END IF;
1669:
1670: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1671: gme_debug.put_line('Exiting api '||g_pkg_name||'.'||l_api_name||' with return status= '||x_return_status);
1672: END IF;
1673:
1674: EXCEPTION
1667: ,x_return_status => x_return_status);
1668: END IF;
1669:
1670: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1671: gme_debug.put_line('Exiting api '||g_pkg_name||'.'||l_api_name||' with return status= '||x_return_status);
1672: END IF;
1673:
1674: EXCEPTION
1675: WHEN error_get_trans OR error_get_lot OR error_trans OR inv_negative THEN
1675: WHEN error_get_trans OR error_get_lot OR error_trans OR inv_negative THEN
1676: NULL;
1677: WHEN OTHERS THEN
1678: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
1679: IF g_debug <= gme_debug.g_log_procedure THEN
1680: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
1681: END IF;
1682: x_return_status := FND_API.g_ret_sts_unexp_error;
1683: END revert_material_partial;
1676: NULL;
1677: WHEN OTHERS THEN
1678: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
1679: IF g_debug <= gme_debug.g_log_procedure THEN
1680: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
1681: END IF;
1682: x_return_status := FND_API.g_ret_sts_unexp_error;
1683: END revert_material_partial;
1684:
1709: --Bug#5111078
1710: error_inv_action_lab EXCEPTION;
1711:
1712: BEGIN
1713: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1714: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1715: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
1716: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' batch_id='||p_batch_header_rec.batch_id);
1717: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_adjust_cmplt='||p_adjust_cmplt);
1710: error_inv_action_lab EXCEPTION;
1711:
1712: BEGIN
1713: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1714: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1715: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
1716: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' batch_id='||p_batch_header_rec.batch_id);
1717: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_adjust_cmplt='||p_adjust_cmplt);
1718: END IF;
1711:
1712: BEGIN
1713: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1714: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1715: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
1716: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' batch_id='||p_batch_header_rec.batch_id);
1717: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_adjust_cmplt='||p_adjust_cmplt);
1718: END IF;
1719:
1712: BEGIN
1713: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1714: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1715: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
1716: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' batch_id='||p_batch_header_rec.batch_id);
1717: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_adjust_cmplt='||p_adjust_cmplt);
1718: END IF;
1719:
1720: -- Set the return status to success initially
1713: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1714: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1715: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' material_detail_id='||p_material_detail_rec.material_detail_id);
1716: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' batch_id='||p_batch_header_rec.batch_id);
1717: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_adjust_cmplt='||p_adjust_cmplt);
1718: END IF;
1719:
1720: -- Set the return status to success initially
1721: x_return_status := FND_API.G_RET_STS_SUCCESS;
1769: IF NVL(l_step_status, 0) = gme_common_pvt.g_step_cancelled THEN
1770: RAISE error_step_cancelled;
1771: END IF;
1772:
1773: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1774: gme_debug.put_line('Exiting api '||g_pkg_name||'.'||l_api_name);
1775: END IF;
1776:
1777: EXCEPTION
1770: RAISE error_step_cancelled;
1771: END IF;
1772:
1773: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1774: gme_debug.put_line('Exiting api '||g_pkg_name||'.'||l_api_name);
1775: END IF;
1776:
1777: EXCEPTION
1778: WHEN ERROR_INV_ACTION_FPO THEN
1804: x_return_status := FND_API.G_RET_STS_ERROR;
1805: gme_common_pvt.log_message('PM_INVALID_PHANTOM_ACTION');
1806: WHEN OTHERS THEN
1807: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
1808: IF g_debug <= gme_debug.g_log_procedure THEN
1809: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
1810: END IF;
1811: x_return_status := FND_API.g_ret_sts_unexp_error;
1812: END validate_material_for_IB;
1805: gme_common_pvt.log_message('PM_INVALID_PHANTOM_ACTION');
1806: WHEN OTHERS THEN
1807: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
1808: IF g_debug <= gme_debug.g_log_procedure THEN
1809: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
1810: END IF;
1811: x_return_status := FND_API.g_ret_sts_unexp_error;
1812: END validate_material_for_IB;
1813:
1820: ERROR_INV_INCR_TYPE EXCEPTION;
1821: ERROR_QTY_CANT_BE_ZERO EXCEPTION;
1822: ERROR_QTY_CREATE_NEG_ACTUAL EXCEPTION;
1823: BEGIN
1824: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1825: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1826: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty_type='||p_qty_type);
1827: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
1828: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_actual_qty='||p_actual_qty);
1821: ERROR_QTY_CANT_BE_ZERO EXCEPTION;
1822: ERROR_QTY_CREATE_NEG_ACTUAL EXCEPTION;
1823: BEGIN
1824: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1825: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1826: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty_type='||p_qty_type);
1827: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
1828: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_actual_qty='||p_actual_qty);
1829: END IF;
1822: ERROR_QTY_CREATE_NEG_ACTUAL EXCEPTION;
1823: BEGIN
1824: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1825: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1826: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty_type='||p_qty_type);
1827: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
1828: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_actual_qty='||p_actual_qty);
1829: END IF;
1830:
1823: BEGIN
1824: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1825: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1826: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty_type='||p_qty_type);
1827: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
1828: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_actual_qty='||p_actual_qty);
1829: END IF;
1830:
1831: -- Set the return status to success initially
1824: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1825: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1826: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty_type='||p_qty_type);
1827: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
1828: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_actual_qty='||p_actual_qty);
1829: END IF;
1830:
1831: -- Set the return status to success initially
1832: x_return_status := FND_API.G_RET_STS_SUCCESS;
1859: RAISE ERROR_QTY_CREATE_NEG_ACTUAL;
1860: END IF;
1861: END IF;
1862:
1863: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1864: gme_debug.put_line('Exiting api '||g_pkg_name||'.'||l_api_name);
1865: END IF;
1866:
1867: EXCEPTION
1860: END IF;
1861: END IF;
1862:
1863: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1864: gme_debug.put_line('Exiting api '||g_pkg_name||'.'||l_api_name);
1865: END IF;
1866:
1867: EXCEPTION
1868: WHEN ERROR_INV_INCR_TYPE THEN
1875: x_return_status := FND_API.G_RET_STS_ERROR;
1876: gme_common_pvt.log_message( 'GME_API_QTY_CANT_BE_ZERO');
1877: WHEN OTHERS THEN
1878: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
1879: IF g_debug <= gme_debug.g_log_procedure THEN
1880: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
1881: END IF;
1882: x_return_status := FND_API.g_ret_sts_unexp_error;
1883: END validate_qty_for_IB;
1876: gme_common_pvt.log_message( 'GME_API_QTY_CANT_BE_ZERO');
1877: WHEN OTHERS THEN
1878: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
1879: IF g_debug <= gme_debug.g_log_procedure THEN
1880: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
1881: END IF;
1882: x_return_status := FND_API.g_ret_sts_unexp_error;
1883: END validate_qty_for_IB;
1884:
1896:
1897: um_convert_error EXCEPTION;
1898:
1899: BEGIN
1900: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1901: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1902: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_item_id='||p_item_id);
1903: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_lot_number='||p_lot_number);
1904: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
1897: um_convert_error EXCEPTION;
1898:
1899: BEGIN
1900: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1901: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1902: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_item_id='||p_item_id);
1903: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_lot_number='||p_lot_number);
1904: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
1905: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_from_um='||p_from_um);
1898:
1899: BEGIN
1900: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1901: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1902: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_item_id='||p_item_id);
1903: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_lot_number='||p_lot_number);
1904: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
1905: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_from_um='||p_from_um);
1906: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_to_um='||p_to_um);
1899: BEGIN
1900: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1901: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1902: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_item_id='||p_item_id);
1903: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_lot_number='||p_lot_number);
1904: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
1905: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_from_um='||p_from_um);
1906: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_to_um='||p_to_um);
1907: END IF;
1900: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1901: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1902: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_item_id='||p_item_id);
1903: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_lot_number='||p_lot_number);
1904: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
1905: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_from_um='||p_from_um);
1906: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_to_um='||p_to_um);
1907: END IF;
1908:
1901: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
1902: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_item_id='||p_item_id);
1903: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_lot_number='||p_lot_number);
1904: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
1905: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_from_um='||p_from_um);
1906: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_to_um='||p_to_um);
1907: END IF;
1908:
1909: /* Set the return status to success initially */
1902: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_item_id='||p_item_id);
1903: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_lot_number='||p_lot_number);
1904: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_qty='||p_qty);
1905: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_from_um='||p_from_um);
1906: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' p_to_um='||p_to_um);
1907: END IF;
1908:
1909: /* Set the return status to success initially */
1910: x_return_status := FND_API.G_RET_STS_SUCCESS;
1911:
1912: IF p_to_um = p_from_um THEN
1913: x_conv_qty := p_qty;
1914: ELSE
1915: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1916: gme_debug.put_line
1917: ( g_pkg_name
1918: || '.'
1919: || l_api_name
1912: IF p_to_um = p_from_um THEN
1913: x_conv_qty := p_qty;
1914: ELSE
1915: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1916: gme_debug.put_line
1917: ( g_pkg_name
1918: || '.'
1919: || l_api_name
1920: || ' before call to inv_convert.inv_um_convert');
1932: ,to_name => NULL);
1933:
1934: -- Note: -99999 should be in gme_common_pvt
1935: IF x_conv_qty = -99999 THEN
1936: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1937: gme_debug.put_line
1938: ( g_pkg_name
1939: || '.'
1940: || l_api_name
1933:
1934: -- Note: -99999 should be in gme_common_pvt
1935: IF x_conv_qty = -99999 THEN
1936: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1937: gme_debug.put_line
1938: ( g_pkg_name
1939: || '.'
1940: || l_api_name
1941: || ' inv_convert.inv_um_convert returned error');
1944: RAISE um_convert_error;
1945: END IF;
1946: END IF; -- IF p_to_um = p_from_um THEN
1947:
1948: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1949: gme_debug.put_line
1950: ( g_pkg_name
1951: || '.'
1952: || l_api_name
1945: END IF;
1946: END IF; -- IF p_to_um = p_from_um THEN
1947:
1948: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1949: gme_debug.put_line
1950: ( g_pkg_name
1951: || '.'
1952: || l_api_name
1953: || ' converted qty = '||x_conv_qty);
1952: || l_api_name
1953: || ' converted qty = '||x_conv_qty);
1954: END IF;
1955:
1956: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1957: gme_debug.put_line('Exiting api '||g_pkg_name||'.'||l_api_name);
1958: END IF;
1959: EXCEPTION
1960: WHEN um_convert_error THEN
1953: || ' converted qty = '||x_conv_qty);
1954: END IF;
1955:
1956: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
1957: gme_debug.put_line('Exiting api '||g_pkg_name||'.'||l_api_name);
1958: END IF;
1959: EXCEPTION
1960: WHEN um_convert_error THEN
1961: FND_MESSAGE.SET_NAME('INV','INV_NO_CONVERSION_ERR');
1964: x_return_status := fnd_api.g_ret_sts_error;
1965: WHEN OTHERS THEN
1966: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
1967:
1968: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1969: gme_debug.put_line ( 'Unexpected error: '
1970: || g_pkg_name
1971: || '.'
1972: || l_api_name
1965: WHEN OTHERS THEN
1966: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
1967:
1968: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1969: gme_debug.put_line ( 'Unexpected error: '
1970: || g_pkg_name
1971: || '.'
1972: || l_api_name
1973: || ': '