20: | Fixed Bug 2367220 |
21: | 17-DEC-2003 : Bugfix 3319313 |
22: | - fixed source code issue |
23: | - fixed OQ-CQ issue in the cursor |
24: | - Replaced fnd_file with oe_debug_pub for consistency |
25: | 01-Jun-2005 : Renga Kannan Added NOCOPY HINT for all out parameters.
26:
27: | 05-Jul-2005 : Renga Kannan Modified code for MOAC project
28: | |
157: RETCODE := 0;
158:
159: lSourceCode := FND_PROFILE.VALUE('ONT_SOURCE_CODE'); --bugfix 3319313
160: IF PG_DEBUG <> 0 THEN
161: oe_debug_pub.add('l_source_code = '||lsourcecode);
162: END IF;
163:
164: -- set the batch_id to the request_id
165: l_batch_id := FND_GLOBAL.CONC_REQUEST_ID;
169:
170: -- for all the sales order lines (entered, booked )
171: -- Given parameters.
172: IF PG_DEBUG <> 0 THEN
173: oe_debug_pub.add('+---------------------------------------------------------------------------+');
174: oe_debug_pub.add('+------------------ Parameters passed into the procedure ------------------+');
175: oe_debug_pub.add('Sales order : '||p_sales_order );
176: oe_debug_pub.add('Sales Order Line ID[Model] : '||to_char(p_sales_order_line_id));
177: oe_debug_pub.add('Organization_id : '||p_organization_id);
170: -- for all the sales order lines (entered, booked )
171: -- Given parameters.
172: IF PG_DEBUG <> 0 THEN
173: oe_debug_pub.add('+---------------------------------------------------------------------------+');
174: oe_debug_pub.add('+------------------ Parameters passed into the procedure ------------------+');
175: oe_debug_pub.add('Sales order : '||p_sales_order );
176: oe_debug_pub.add('Sales Order Line ID[Model] : '||to_char(p_sales_order_line_id));
177: oe_debug_pub.add('Organization_id : '||p_organization_id);
178: oe_debug_pub.add('Offset Days : '||to_char(p_offset_days));
171: -- Given parameters.
172: IF PG_DEBUG <> 0 THEN
173: oe_debug_pub.add('+---------------------------------------------------------------------------+');
174: oe_debug_pub.add('+------------------ Parameters passed into the procedure ------------------+');
175: oe_debug_pub.add('Sales order : '||p_sales_order );
176: oe_debug_pub.add('Sales Order Line ID[Model] : '||to_char(p_sales_order_line_id));
177: oe_debug_pub.add('Organization_id : '||p_organization_id);
178: oe_debug_pub.add('Offset Days : '||to_char(p_offset_days));
179: oe_debug_pub.add('+---------------------------------------------------------------------------+');
172: IF PG_DEBUG <> 0 THEN
173: oe_debug_pub.add('+---------------------------------------------------------------------------+');
174: oe_debug_pub.add('+------------------ Parameters passed into the procedure ------------------+');
175: oe_debug_pub.add('Sales order : '||p_sales_order );
176: oe_debug_pub.add('Sales Order Line ID[Model] : '||to_char(p_sales_order_line_id));
177: oe_debug_pub.add('Organization_id : '||p_organization_id);
178: oe_debug_pub.add('Offset Days : '||to_char(p_offset_days));
179: oe_debug_pub.add('+---------------------------------------------------------------------------+');
180: END IF;
173: oe_debug_pub.add('+---------------------------------------------------------------------------+');
174: oe_debug_pub.add('+------------------ Parameters passed into the procedure ------------------+');
175: oe_debug_pub.add('Sales order : '||p_sales_order );
176: oe_debug_pub.add('Sales Order Line ID[Model] : '||to_char(p_sales_order_line_id));
177: oe_debug_pub.add('Organization_id : '||p_organization_id);
178: oe_debug_pub.add('Offset Days : '||to_char(p_offset_days));
179: oe_debug_pub.add('+---------------------------------------------------------------------------+');
180: END IF;
181:
174: oe_debug_pub.add('+------------------ Parameters passed into the procedure ------------------+');
175: oe_debug_pub.add('Sales order : '||p_sales_order );
176: oe_debug_pub.add('Sales Order Line ID[Model] : '||to_char(p_sales_order_line_id));
177: oe_debug_pub.add('Organization_id : '||p_organization_id);
178: oe_debug_pub.add('Offset Days : '||to_char(p_offset_days));
179: oe_debug_pub.add('+---------------------------------------------------------------------------+');
180: END IF;
181:
182: l_organization_id := p_organization_id;
175: oe_debug_pub.add('Sales order : '||p_sales_order );
176: oe_debug_pub.add('Sales Order Line ID[Model] : '||to_char(p_sales_order_line_id));
177: oe_debug_pub.add('Organization_id : '||p_organization_id);
178: oe_debug_pub.add('Offset Days : '||to_char(p_offset_days));
179: oe_debug_pub.add('+---------------------------------------------------------------------------+');
180: END IF;
181:
182: l_organization_id := p_organization_id;
183:
307:
308: end if;
309:
310: IF PG_DEBUG <> 0 THEN
311: oe_debug_pub.add ('The dyanamic sql generated is');
312: oe_debug_pub.add ('SQL: ' || substr(sql_stmt,1, 1500));
313: oe_debug_pub.add (substr(sql_stmt,1501,3000));
314: oe_debug_pub.add ('The drive_mark is '||drive_mark);
315: END IF;
308: end if;
309:
310: IF PG_DEBUG <> 0 THEN
311: oe_debug_pub.add ('The dyanamic sql generated is');
312: oe_debug_pub.add ('SQL: ' || substr(sql_stmt,1, 1500));
313: oe_debug_pub.add (substr(sql_stmt,1501,3000));
314: oe_debug_pub.add ('The drive_mark is '||drive_mark);
315: END IF;
316:
309:
310: IF PG_DEBUG <> 0 THEN
311: oe_debug_pub.add ('The dyanamic sql generated is');
312: oe_debug_pub.add ('SQL: ' || substr(sql_stmt,1, 1500));
313: oe_debug_pub.add (substr(sql_stmt,1501,3000));
314: oe_debug_pub.add ('The drive_mark is '||drive_mark);
315: END IF;
316:
317: /*
310: IF PG_DEBUG <> 0 THEN
311: oe_debug_pub.add ('The dyanamic sql generated is');
312: oe_debug_pub.add ('SQL: ' || substr(sql_stmt,1, 1500));
313: oe_debug_pub.add (substr(sql_stmt,1501,3000));
314: oe_debug_pub.add ('The drive_mark is '||drive_mark);
315: END IF;
316:
317: /*
318: Below, we execute the sql statement according to which parameters
384: -- Order_Number, Line_id, Organization_id and Offset_Days is passed
385: EXECUTE IMMEDIATE sql_stmt USING p_sales_order, p_sales_order_line_id, l_organization_id, p_offset_days;
386:
387: else
388: oe_debug_pub.add ('INCORRECT COMBINATION of parameters');
389:
390: end if;
391:
392: select line_id, org_id, ship_from_org_id, schedule_ship_date
407: v_rec_count := v_rec_count + 1;
408:
409: -- Log all the record being processed.
410: IF PG_DEBUG <> 0 THEN
411: oe_debug_pub.add('+-------- Processing for --------------------------------------------------+');
412: oe_debug_pub.add('Sales order : '||p_sales_order );
413: oe_debug_pub.add('Sales Order Line ID[Config] : '||to_char(line_id_arr(i)));
414: oe_debug_pub.add('Ship from Org : '||to_char(ship_from_org_id_arr(i)));
415: END IF;
408:
409: -- Log all the record being processed.
410: IF PG_DEBUG <> 0 THEN
411: oe_debug_pub.add('+-------- Processing for --------------------------------------------------+');
412: oe_debug_pub.add('Sales order : '||p_sales_order );
413: oe_debug_pub.add('Sales Order Line ID[Config] : '||to_char(line_id_arr(i)));
414: oe_debug_pub.add('Ship from Org : '||to_char(ship_from_org_id_arr(i)));
415: END IF;
416:
409: -- Log all the record being processed.
410: IF PG_DEBUG <> 0 THEN
411: oe_debug_pub.add('+-------- Processing for --------------------------------------------------+');
412: oe_debug_pub.add('Sales order : '||p_sales_order );
413: oe_debug_pub.add('Sales Order Line ID[Config] : '||to_char(line_id_arr(i)));
414: oe_debug_pub.add('Ship from Org : '||to_char(ship_from_org_id_arr(i)));
415: END IF;
416:
417: l_stmt_num := 10;
410: IF PG_DEBUG <> 0 THEN
411: oe_debug_pub.add('+-------- Processing for --------------------------------------------------+');
412: oe_debug_pub.add('Sales order : '||p_sales_order );
413: oe_debug_pub.add('Sales Order Line ID[Config] : '||to_char(line_id_arr(i)));
414: oe_debug_pub.add('Ship from Org : '||to_char(ship_from_org_id_arr(i)));
415: END IF;
416:
417: l_stmt_num := 10;
418:
434: FOR UPDATE NOWAIT;
435: exception
436: when record_locked then
437: IF PG_DEBUG <> 0 THEN
438: oe_debug_pub.add('This line is locked by another process ');
439: END IF;
440: goto EndOfLoop;
441:
442: when no_data_found then
440: goto EndOfLoop;
441:
442: when no_data_found then
443: IF PG_DEBUG <> 0 THEN
444: oe_debug_pub.add('This line is no longer eligible for processing ');
445: END IF;
446: goto EndOfLoop;
447:
448: end;
472: x_msg_count => x_msg_count,
473: x_msg_data => x_msg_data);
474: If x_return_status = FND_API.G_RET_STS_ERROR then
475: if PG_DEBUG <> 0 then
476: oe_debug_pub.add('Set_created_by_context API ended with expected error',1);
477: end if;
478: raise FND_API.G_EXC_ERROR;
479: elsif x_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
480: if PG_DEBUG <> 0 then
477: end if;
478: raise FND_API.G_EXC_ERROR;
479: elsif x_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
480: if PG_DEBUG <> 0 then
481: oe_debug_pub.add('Set_created_by_context API ended with unexpected error',1);
482: end if;
483: raise FND_API.G_EXC_UNEXPECTED_ERROR;
484: end if; /*x_return_staus = FND_API.G_EXC_ERROR */
485: l_current_org_id := org_id_arr(i);
504: p_itemkey =>line_id_arr(i),
505: p_activity_name=>'CREATE_SUPPLY_ORDER_ELIGIBLE',
506: p_result_code=>'COMPLETE');
507: IF NOT l_res THEN
508: oe_debug_pub.add('auto_create_dropship: ' || 'Error occurred in updating the workflow status - Stmt_num'||to_char(l_stmt_num),1);
509: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
510: END IF;
511:
512: ELSE
529: p_activity_name=>'PURCHASE RELEASE ELIGIBLE',
530: p_result_code=>'COMPLETE');
531:
532: IF NOT l_res THEN
533: oe_debug_pub.add('auto_create_dropship: ' || 'Error occurred in updating the workflow status - Stmt_num'||to_char(l_stmt_num),1);
534: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
535: END IF;
536: END IF;
537: END IF;
543:
544: END LOOP; -- Sales Order Lines.
545:
546: IF PG_DEBUG <> 0 THEN
547: oe_debug_pub.add('+---------------------------------------------------------------------------+');
548: oe_debug_pub.add('The Batch ID for this run was : '||to_char(l_batch_id));
549: oe_debug_pub.add('+---------------------------------------------------------------------------+');
550: oe_debug_pub.add('Number of records Processed : '||to_char(v_rec_count));
551: END IF;
544: END LOOP; -- Sales Order Lines.
545:
546: IF PG_DEBUG <> 0 THEN
547: oe_debug_pub.add('+---------------------------------------------------------------------------+');
548: oe_debug_pub.add('The Batch ID for this run was : '||to_char(l_batch_id));
549: oe_debug_pub.add('+---------------------------------------------------------------------------+');
550: oe_debug_pub.add('Number of records Processed : '||to_char(v_rec_count));
551: END IF;
552:
545:
546: IF PG_DEBUG <> 0 THEN
547: oe_debug_pub.add('+---------------------------------------------------------------------------+');
548: oe_debug_pub.add('The Batch ID for this run was : '||to_char(l_batch_id));
549: oe_debug_pub.add('+---------------------------------------------------------------------------+');
550: oe_debug_pub.add('Number of records Processed : '||to_char(v_rec_count));
551: END IF;
552:
553: -- The following part of the code
546: IF PG_DEBUG <> 0 THEN
547: oe_debug_pub.add('+---------------------------------------------------------------------------+');
548: oe_debug_pub.add('The Batch ID for this run was : '||to_char(l_batch_id));
549: oe_debug_pub.add('+---------------------------------------------------------------------------+');
550: oe_debug_pub.add('Number of records Processed : '||to_char(v_rec_count));
551: END IF;
552:
553: -- The following part of the code
554: -- is modified by Renga Kannan on 11/12/01
569:
570:
571: EXCEPTION
572: WHEN FND_API.G_EXC_ERROR THEN
573: oe_debug_pub.add('auto_create_dropship: ' || ':exp error::'||to_char(l_stmt_num)||'::'||sqlerrm,1);
574: x_return_status := FND_API.G_RET_STS_ERROR;
575: RETCODE := 2;
576: conc_status := FND_CONCURRENT.SET_COMPLETION_STATUS('ERROR',Current_Error_Code);
577:
575: RETCODE := 2;
576: conc_status := FND_CONCURRENT.SET_COMPLETION_STATUS('ERROR',Current_Error_Code);
577:
578: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
579: oe_debug_pub.add('auto_create_dropship: ' || ':exp error::'||to_char(l_stmt_num)||'::'||sqlerrm,1);
580: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
581: RETCODE := 2;
582: conc_status := FND_CONCURRENT.SET_COMPLETION_STATUS('ERROR',Current_Error_Code);
583:
581: RETCODE := 2;
582: conc_status := FND_CONCURRENT.SET_COMPLETION_STATUS('ERROR',Current_Error_Code);
583:
584: WHEN OTHERS THEN
585: oe_debug_pub.add('auto_create_dropship: ' || ':exp error::'||to_char(l_stmt_num)||'::'||sqlerrm,1);
586: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
587: RETCODE := 2;
588: conc_status := FND_CONCURRENT.SET_COMPLETION_STATUS('ERROR',Current_Error_Code);
589: