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:
309:
310: end if;
311:
312: IF PG_DEBUG <> 0 THEN
313: oe_debug_pub.add ('The dyanamic sql generated is');
314: oe_debug_pub.add ('SQL: ' || substr(sql_stmt,1, 1500));
315: oe_debug_pub.add (substr(sql_stmt,1501,3000));
316: oe_debug_pub.add ('The drive_mark is '||drive_mark);
317: END IF;
310: end if;
311:
312: IF PG_DEBUG <> 0 THEN
313: oe_debug_pub.add ('The dyanamic sql generated is');
314: oe_debug_pub.add ('SQL: ' || substr(sql_stmt,1, 1500));
315: oe_debug_pub.add (substr(sql_stmt,1501,3000));
316: oe_debug_pub.add ('The drive_mark is '||drive_mark);
317: END IF;
318:
311:
312: IF PG_DEBUG <> 0 THEN
313: oe_debug_pub.add ('The dyanamic sql generated is');
314: oe_debug_pub.add ('SQL: ' || substr(sql_stmt,1, 1500));
315: oe_debug_pub.add (substr(sql_stmt,1501,3000));
316: oe_debug_pub.add ('The drive_mark is '||drive_mark);
317: END IF;
318:
319: /*
312: IF PG_DEBUG <> 0 THEN
313: oe_debug_pub.add ('The dyanamic sql generated is');
314: oe_debug_pub.add ('SQL: ' || substr(sql_stmt,1, 1500));
315: oe_debug_pub.add (substr(sql_stmt,1501,3000));
316: oe_debug_pub.add ('The drive_mark is '||drive_mark);
317: END IF;
318:
319: /*
320: Below, we execute the sql statement according to which parameters
386: -- Order_Number, Line_id, Organization_id and Offset_Days is passed
387: EXECUTE IMMEDIATE sql_stmt USING p_sales_order, p_sales_order_line_id, l_organization_id, p_offset_days;
388:
389: else
390: oe_debug_pub.add ('INCORRECT COMBINATION of parameters');
391:
392: end if;
393:
394: select line_id, org_id, ship_from_org_id, schedule_ship_date
409: v_rec_count := v_rec_count + 1;
410:
411: -- Log all the record being processed.
412: IF PG_DEBUG <> 0 THEN
413: oe_debug_pub.add('+-------- Processing for --------------------------------------------------+');
414: oe_debug_pub.add('Sales order : '||p_sales_order );
415: oe_debug_pub.add('Sales Order Line ID[Config] : '||to_char(line_id_arr(i)));
416: oe_debug_pub.add('Ship from Org : '||to_char(ship_from_org_id_arr(i)));
417: END IF;
410:
411: -- Log all the record being processed.
412: IF PG_DEBUG <> 0 THEN
413: oe_debug_pub.add('+-------- Processing for --------------------------------------------------+');
414: oe_debug_pub.add('Sales order : '||p_sales_order );
415: oe_debug_pub.add('Sales Order Line ID[Config] : '||to_char(line_id_arr(i)));
416: oe_debug_pub.add('Ship from Org : '||to_char(ship_from_org_id_arr(i)));
417: END IF;
418:
411: -- Log all the record being processed.
412: IF PG_DEBUG <> 0 THEN
413: oe_debug_pub.add('+-------- Processing for --------------------------------------------------+');
414: oe_debug_pub.add('Sales order : '||p_sales_order );
415: oe_debug_pub.add('Sales Order Line ID[Config] : '||to_char(line_id_arr(i)));
416: oe_debug_pub.add('Ship from Org : '||to_char(ship_from_org_id_arr(i)));
417: END IF;
418:
419: l_stmt_num := 10;
412: IF PG_DEBUG <> 0 THEN
413: oe_debug_pub.add('+-------- Processing for --------------------------------------------------+');
414: oe_debug_pub.add('Sales order : '||p_sales_order );
415: oe_debug_pub.add('Sales Order Line ID[Config] : '||to_char(line_id_arr(i)));
416: oe_debug_pub.add('Ship from Org : '||to_char(ship_from_org_id_arr(i)));
417: END IF;
418:
419: l_stmt_num := 10;
420:
436: FOR UPDATE NOWAIT;
437: exception
438: when record_locked then
439: IF PG_DEBUG <> 0 THEN
440: oe_debug_pub.add('This line is locked by another process ');
441: END IF;
442: goto EndOfLoop;
443:
444: when no_data_found then
442: goto EndOfLoop;
443:
444: when no_data_found then
445: IF PG_DEBUG <> 0 THEN
446: oe_debug_pub.add('This line is no longer eligible for processing ');
447: END IF;
448: goto EndOfLoop;
449:
450: end;
474: x_msg_count => x_msg_count,
475: x_msg_data => x_msg_data);
476: If x_return_status = FND_API.G_RET_STS_ERROR then
477: if PG_DEBUG <> 0 then
478: oe_debug_pub.add('Set_created_by_context API ended with expected error',1);
479: end if;
480: raise FND_API.G_EXC_ERROR;
481: elsif x_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
482: if PG_DEBUG <> 0 then
479: end if;
480: raise FND_API.G_EXC_ERROR;
481: elsif x_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
482: if PG_DEBUG <> 0 then
483: oe_debug_pub.add('Set_created_by_context API ended with unexpected error',1);
484: end if;
485: raise FND_API.G_EXC_UNEXPECTED_ERROR;
486: end if; /*x_return_staus = FND_API.G_EXC_ERROR */
487: l_current_org_id := org_id_arr(i);
506: p_itemkey =>line_id_arr(i),
507: p_activity_name=>'CREATE_SUPPLY_ORDER_ELIGIBLE',
508: p_result_code=>'COMPLETE');
509: IF NOT l_res THEN
510: oe_debug_pub.add('auto_create_dropship: ' || 'Error occurred in updating the workflow status - Stmt_num'||to_char(l_stmt_num),1);
511: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
512: END IF;
513:
514: ELSE
531: p_activity_name=>'PURCHASE RELEASE ELIGIBLE',
532: p_result_code=>'COMPLETE');
533:
534: IF NOT l_res THEN
535: oe_debug_pub.add('auto_create_dropship: ' || 'Error occurred in updating the workflow status - Stmt_num'||to_char(l_stmt_num),1);
536: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
537: END IF;
538: END IF;
539: END IF;
545:
546: END LOOP; -- Sales Order Lines.
547:
548: IF PG_DEBUG <> 0 THEN
549: oe_debug_pub.add('+---------------------------------------------------------------------------+');
550: oe_debug_pub.add('The Batch ID for this run was : '||to_char(l_batch_id));
551: oe_debug_pub.add('+---------------------------------------------------------------------------+');
552: oe_debug_pub.add('Number of records Processed : '||to_char(v_rec_count));
553: END IF;
546: END LOOP; -- Sales Order Lines.
547:
548: IF PG_DEBUG <> 0 THEN
549: oe_debug_pub.add('+---------------------------------------------------------------------------+');
550: oe_debug_pub.add('The Batch ID for this run was : '||to_char(l_batch_id));
551: oe_debug_pub.add('+---------------------------------------------------------------------------+');
552: oe_debug_pub.add('Number of records Processed : '||to_char(v_rec_count));
553: END IF;
554:
547:
548: IF PG_DEBUG <> 0 THEN
549: oe_debug_pub.add('+---------------------------------------------------------------------------+');
550: oe_debug_pub.add('The Batch ID for this run was : '||to_char(l_batch_id));
551: oe_debug_pub.add('+---------------------------------------------------------------------------+');
552: oe_debug_pub.add('Number of records Processed : '||to_char(v_rec_count));
553: END IF;
554:
555: -- The following part of the code
548: IF PG_DEBUG <> 0 THEN
549: oe_debug_pub.add('+---------------------------------------------------------------------------+');
550: oe_debug_pub.add('The Batch ID for this run was : '||to_char(l_batch_id));
551: oe_debug_pub.add('+---------------------------------------------------------------------------+');
552: oe_debug_pub.add('Number of records Processed : '||to_char(v_rec_count));
553: END IF;
554:
555: -- The following part of the code
556: -- is modified by Renga Kannan on 11/12/01
571:
572:
573: EXCEPTION
574: WHEN FND_API.G_EXC_ERROR THEN
575: oe_debug_pub.add('auto_create_dropship: ' || ':exp error::'||to_char(l_stmt_num)||'::'||sqlerrm,1);
576: x_return_status := FND_API.G_RET_STS_ERROR;
577: RETCODE := 2;
578: conc_status := FND_CONCURRENT.SET_COMPLETION_STATUS('ERROR',Current_Error_Code);
579:
577: RETCODE := 2;
578: conc_status := FND_CONCURRENT.SET_COMPLETION_STATUS('ERROR',Current_Error_Code);
579:
580: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
581: oe_debug_pub.add('auto_create_dropship: ' || ':exp error::'||to_char(l_stmt_num)||'::'||sqlerrm,1);
582: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
583: RETCODE := 2;
584: conc_status := FND_CONCURRENT.SET_COMPLETION_STATUS('ERROR',Current_Error_Code);
585:
583: RETCODE := 2;
584: conc_status := FND_CONCURRENT.SET_COMPLETION_STATUS('ERROR',Current_Error_Code);
585:
586: WHEN OTHERS THEN
587: oe_debug_pub.add('auto_create_dropship: ' || ':exp error::'||to_char(l_stmt_num)||'::'||sqlerrm,1);
588: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
589: RETCODE := 2;
590: conc_status := FND_CONCURRENT.SET_COMPLETION_STATUS('ERROR',Current_Error_Code);
591: