158: l_partial_qty := CTO_WIP_WRAPPER.Get_NotInv_Qty(p_line_id) - CTO_WIP_WRAPPER.Get_Reserved_Qty(p_line_id);
159:
160:
161: IF PG_DEBUG <> 0 THEN
162: oe_debug_pub.add('insert_wip_interface: ' || 'Partial qty for WO creation (in primary UOM) : '||to_char(l_partial_qty), 2);
163:
164: oe_debug_pub.add('insert_wip_interface: ' || 'Dep Plan Flag for line_id '||to_char(p_line_id)||' is '||lDepPlanFlag, 2);
165: END IF;
166:
160:
161: IF PG_DEBUG <> 0 THEN
162: oe_debug_pub.add('insert_wip_interface: ' || 'Partial qty for WO creation (in primary UOM) : '||to_char(l_partial_qty), 2);
163:
164: oe_debug_pub.add('insert_wip_interface: ' || 'Dep Plan Flag for line_id '||to_char(p_line_id)||' is '||lDepPlanFlag, 2);
165: END IF;
166:
167: -- added for 14157494: Begin -- Check if any routing is present for the line_id
168: SELECT count(1)
174: AND oel.ship_from_org_id = bor.organization_id
175: AND ROWNUM = 1;
176:
177: IF PG_DEBUG <> 0 THEN
178: oe_debug_pub.add('insert_wip_interface: l_routing_count :'|| to_char(l_routing_count) ,1);
179: END IF;
180: -- added for 14157494: End
181:
182: IF lDepPlanFlag = 'N' THEN
196: WHERE oel.line_id = p_line_id
197: AND oel.ship_from_org_id = bp.organization_id;
198:
199: IF PG_DEBUG <> 0 THEN
200: oe_debug_pub.add('insert_wip_interface: ' || 'enavle lower level supply value is '|| l_mlsupply_parameter , 4);
201:
202:
203: END IF;
204:
207:
208:
209:
210: IF PG_DEBUG <> 0 THEN
211: oe_debug_pub.add('insert_wip_interface: ' || 'Before call to create_subassembly_jobs with enable lower supply param '|| l_mlsupply_parameter , 4);
212:
213:
214: END IF;
215:
233: );
234:
235: IF l_return_status = FND_API.G_RET_STS_ERROR THEN
236: IF PG_DEBUG <> 0 THEN
237: oe_debug_pub.add ('insert_wip_interface: ' || 'failed after get_wroking_day' || l_return_status ,1);
238: oe_debug_pub.add ('insert_wip_interface: ' || 'error message' || l_error_message ,1);
239: END IF;
240: RAISE FND_API.G_EXC_ERROR;
241: ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
234:
235: IF l_return_status = FND_API.G_RET_STS_ERROR THEN
236: IF PG_DEBUG <> 0 THEN
237: oe_debug_pub.add ('insert_wip_interface: ' || 'failed after get_wroking_day' || l_return_status ,1);
238: oe_debug_pub.add ('insert_wip_interface: ' || 'error message' || l_error_message ,1);
239: END IF;
240: RAISE FND_API.G_EXC_ERROR;
241: ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
242: IF PG_DEBUG <> 0 THEN
239: END IF;
240: RAISE FND_API.G_EXC_ERROR;
241: ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
242: IF PG_DEBUG <> 0 THEN
243: oe_debug_pub.add ('insert_wip_interface: ' || ' failed after call to get_working_day' || l_return_status ,1);
244: oe_debug_pub.add ('insert_wip_interface: ' || 'error message' || l_error_message ,1);
245: END IF;
246: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
247: ELSE
240: RAISE FND_API.G_EXC_ERROR;
241: ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
242: IF PG_DEBUG <> 0 THEN
243: oe_debug_pub.add ('insert_wip_interface: ' || ' failed after call to get_working_day' || l_return_status ,1);
244: oe_debug_pub.add ('insert_wip_interface: ' || 'error message' || l_error_message ,1);
245: END IF;
246: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
247: ELSE
248: IF PG_DEBUG <> 0 THEN
245: END IF;
246: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
247: ELSE
248: IF PG_DEBUG <> 0 THEN
249: oe_debug_pub.add('insert_wip_interface: ' || 'success from create_Subassembly_jobs ' ,1);
250: oe_debug_pub.add('insert_wip_interface: ' || l_error_message ,1);
251: END IF;
252: END IF;
253:
246: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
247: ELSE
248: IF PG_DEBUG <> 0 THEN
249: oe_debug_pub.add('insert_wip_interface: ' || 'success from create_Subassembly_jobs ' ,1);
250: oe_debug_pub.add('insert_wip_interface: ' || l_error_message ,1);
251: END IF;
252: END IF;
253:
254:
362: );
363:
364: if (SQL%ROWCOUNT > 0) then
365: IF PG_DEBUG <> 0 THEN
366: oe_debug_pub.add('insert_wip_interface: ' || 'Number of Rows Inserted in WJSI: ' || to_char(SQL%ROWCOUNT));
367: END IF;
368: x_return_status := FND_API.G_RET_STS_SUCCESS;
369: else
370: x_return_status := FND_API.G_RET_STS_ERROR;
394:
395: for lNextRec IN c_delivery_lines LOOP
396:
397: IF PG_DEBUG <> 0 THEN
398: oe_debug_pub.add('insert_wip_interface: ' || 'line_id = '||to_char(p_line_id), 2);
399:
400: oe_debug_pub.add('insert_wip_interface: ' || 'delivery_id = '||to_char(lNextRec.delivery_id), 2);
401:
402: oe_debug_pub.add('insert_wip_interface: ' || 'lsn = '||to_char(lNextRec.lsn), 2);
396:
397: IF PG_DEBUG <> 0 THEN
398: oe_debug_pub.add('insert_wip_interface: ' || 'line_id = '||to_char(p_line_id), 2);
399:
400: oe_debug_pub.add('insert_wip_interface: ' || 'delivery_id = '||to_char(lNextRec.delivery_id), 2);
401:
402: oe_debug_pub.add('insert_wip_interface: ' || 'lsn = '||to_char(lNextRec.lsn), 2);
403:
404: oe_debug_pub.add('insert_wip_interface: ' || 'Qty = '||to_char(lNextRec.pQuantity), 2);
398: oe_debug_pub.add('insert_wip_interface: ' || 'line_id = '||to_char(p_line_id), 2);
399:
400: oe_debug_pub.add('insert_wip_interface: ' || 'delivery_id = '||to_char(lNextRec.delivery_id), 2);
401:
402: oe_debug_pub.add('insert_wip_interface: ' || 'lsn = '||to_char(lNextRec.lsn), 2);
403:
404: oe_debug_pub.add('insert_wip_interface: ' || 'Qty = '||to_char(lNextRec.pQuantity), 2);
405: END IF;
406:
400: oe_debug_pub.add('insert_wip_interface: ' || 'delivery_id = '||to_char(lNextRec.delivery_id), 2);
401:
402: oe_debug_pub.add('insert_wip_interface: ' || 'lsn = '||to_char(lNextRec.lsn), 2);
403:
404: oe_debug_pub.add('insert_wip_interface: ' || 'Qty = '||to_char(lNextRec.pQuantity), 2);
405: END IF;
406:
407: l_current_qty := lNextRec.pQuantity;
408: IF PG_DEBUG <> 0 THEN
405: END IF;
406:
407: l_current_qty := lNextRec.pQuantity;
408: IF PG_DEBUG <> 0 THEN
409: oe_debug_pub.add('insert_wip_interface: ' || 'l_current_qty::'||to_char(l_current_qty), 2);
410: END IF;
411:
412: IF l_current_qty > l_partial_qty - l_wo_created_qty THEN
413: l_current_qty := l_partial_qty - l_wo_created_qty;
412: IF l_current_qty > l_partial_qty - l_wo_created_qty THEN
413: l_current_qty := l_partial_qty - l_wo_created_qty;
414: END IF;
415: IF PG_DEBUG <> 0 THEN
416: oe_debug_pub.add('insert_wip_interface: ' || 'New l_current_qty::'||to_char(l_current_qty), 2);
417: END IF;
418:
419:
420: --looking for ML supply org parameter value
450: );
451:
452: IF l_return_status = FND_API.G_RET_STS_ERROR THEN
453: IF PG_DEBUG <> 0 THEN
454: oe_debug_pub.add ('insert_wip_interface: ' || 'failed after get_wroking_day' || l_return_status ,1);
455: oe_debug_pub.add ('insert_wip_interface: ' || 'error message' || l_error_message ,1);
456: END IF;
457: RAISE FND_API.G_EXC_ERROR;
458: ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
451:
452: IF l_return_status = FND_API.G_RET_STS_ERROR THEN
453: IF PG_DEBUG <> 0 THEN
454: oe_debug_pub.add ('insert_wip_interface: ' || 'failed after get_wroking_day' || l_return_status ,1);
455: oe_debug_pub.add ('insert_wip_interface: ' || 'error message' || l_error_message ,1);
456: END IF;
457: RAISE FND_API.G_EXC_ERROR;
458: ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
459: IF PG_DEBUG <> 0 THEN
456: END IF;
457: RAISE FND_API.G_EXC_ERROR;
458: ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
459: IF PG_DEBUG <> 0 THEN
460: oe_debug_pub.add ('insert_wip_interface: ' || ' failed after call to get_working_day' || l_return_status ,1);
461: oe_debug_pub.add ('insert_wip_interface: ' || 'error message' || l_error_message ,1);
462: END IF;
463: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
464: ELSE
457: RAISE FND_API.G_EXC_ERROR;
458: ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
459: IF PG_DEBUG <> 0 THEN
460: oe_debug_pub.add ('insert_wip_interface: ' || ' failed after call to get_working_day' || l_return_status ,1);
461: oe_debug_pub.add ('insert_wip_interface: ' || 'error message' || l_error_message ,1);
462: END IF;
463: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
464: ELSE
465: IF PG_DEBUG <> 0 THEN
462: END IF;
463: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
464: ELSE
465: IF PG_DEBUG <> 0 THEN
466: oe_debug_pub.add('insert_wip_interface: ' || 'success from get_working_day ' ,1);
467: oe_debug_pub.add('insert_wip_interface: ' || l_error_message ,1);
468: END IF;
469: END IF;
470:
463: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
464: ELSE
465: IF PG_DEBUG <> 0 THEN
466: oe_debug_pub.add('insert_wip_interface: ' || 'success from get_working_day ' ,1);
467: oe_debug_pub.add('insert_wip_interface: ' || l_error_message ,1);
468: END IF;
469: END IF;
470:
471:
599:
600:
601: if (SQL%ROWCOUNT > 0) then
602: IF PG_DEBUG <> 0 THEN
603: oe_debug_pub.add('insert_wip_interface: ' || 'Number of Rows Inserted in WJSI for departure planned : ' ||
604: to_char(SQL%ROWCOUNT),1);
605: END IF;
606: x_return_status := FND_API.G_RET_STS_SUCCESS;
607: else
613: l_stmt_num := 180;
614: l_wo_created_qty := l_wo_created_qty + l_current_qty;
615:
616: IF PG_DEBUG <> 0 THEN
617: oe_debug_pub.add('insert_wip_interface: ' || 'Qty of wo created::'||to_char(l_wo_created_qty),2);
618: END IF;
619:
620: IF (l_wo_created_qty >= l_partial_qty) THEN
621: IF PG_DEBUG <> 0 THEN
618: END IF;
619:
620: IF (l_wo_created_qty >= l_partial_qty) THEN
621: IF PG_DEBUG <> 0 THEN
622: oe_debug_pub.add('insert_wip_interface: ' || 'Exiting out of partial qty loop',2);
623: END IF;
624: EXIT;
625: END IF;
626:
636: x_error_message := 'CTOWIPUB.insert wip interface expected excpn: ';
637:
638:
639: IF PG_DEBUG <> 0 THEN
640: oe_debug_pub.add('insert_wip_interface: ' || ' expected excpn: ' || x_error_message,1);
641: END IF;
642:
643:
644:
648: substrb(sqlerrm,1,100) ;
649:
650:
651: IF PG_DEBUG <> 0 THEN
652: oe_debug_pub.add('insert_wip_inetrface: ' || ' UN expected excpn: ' || x_error_message,1);
653: END IF;
654:
655:
656:
658: x_error_message := 'CTOWIPUB.insert_wip_interface raised no-data-found: '|| ':' ||
659: substrb(sqlerrm,1,100);
660: x_return_status := FND_API.G_RET_STS_ERROR;
661: IF PG_DEBUG <> 0 THEN
662: oe_debug_pub.add('insert_wip_interface: ' || x_error_message,1);
663: END IF;
664: cto_msg_pub.cto_message('BOM', 'BOM_ATO_PROCESS_ERROR');
665:
666: when INSERT_ERROR then
667: x_return_status := FND_API.G_RET_STS_ERROR;
668: x_error_message := 'CTOWIPUB.insert_wip_interface raised INSERT_ERROR:' || to_char(l_stmt_num)|| ':' ||
669: substrb(sqlerrm,1,100);
670: IF PG_DEBUG <> 0 THEN
671: oe_debug_pub.add('insert_wip_interface: ' || x_error_message,1);
672: END IF;
673:
674: when OTHERS then
675: x_return_status := FND_API.G_RET_STS_ERROR;
676: x_error_message := 'CTOWIPUB.insert_wip_interface raised OTHERS excpn: ' || to_char(l_stmt_num)|| ':' ||
677: substrb(sqlerrm,1,100) ;
678:
679: IF PG_DEBUG <> 0 THEN
680: oe_debug_pub.add('insert_wip_interface: ' || x_error_message,1);
681: END IF;
682: cto_msg_pub.cto_message('BOM', 'BOM_ATO_PROCESS_ERROR');
683: OE_MSG_PUB.Add_Exc_Msg
684: ( G_PKG_NAME
809:
810: EXCEPTION
811: when NO_DATA_FOUND then
812: IF PG_DEBUG <> 0 THEN
813: oe_debug_pub.add('Delivery_Planned: ' || 'Delivery lines HAVE NOT BEEN IMPORTED for order line '||to_char(p_line_id), 2);
814: END IF;
815: RAISE Delivery_Not_Planned;
816:
817: END; /* Block checking if delivery lines are imported*/
839: and rownum = 1;
840:
841: IF l_assigned = 'NOTASSIGNED' THEN
842: IF PG_DEBUG <> 0 THEN
843: oe_debug_pub.add('Delivery_Planned: ' || 'Deliveries have NOT BEEN ASSIGNED for line '||to_char(p_line_id), 1);
844: END IF;
845: RAISE Delivery_Not_Planned;
846: END IF; /* if delivery not assigned for any delivery line*/
847:
847:
848: EXCEPTION
849: when no_data_found then
850: IF PG_DEBUG <> 0 THEN
851: oe_debug_pub.add('Delivery_Planned: ' || 'Deliveries HAVE BEEN ASSIGNED for all delivery lines for order line '||to_char(p_line_id), 2);
852: END IF;
853:
854: END; /* Block checking for delivery assignments*/
855:
875: and rownum=1;
876:
877: IF l_planned = 'NOTPLANNED' THEN
878: IF PG_DEBUG <> 0 THEN
879: oe_debug_pub.add('Delivery_Planned: ' || 'Deliveries have been assigned, but NOT PLANNED yet for line '||to_char(p_line_id), 1);
880: END IF;
881: RAISE Delivery_Not_Planned;
882: END IF; /* if delivery not planned*/
883:
883:
884: EXCEPTION
885: when NO_DATA_FOUND then
886: IF PG_DEBUG <> 0 THEN
887: oe_debug_pub.add('Delivery_Planned: ' || 'Deliveries HAVE BEEN PLANNED for order line '||to_char(p_line_id), 2);
888: END IF;
889:
890: END; /* Block checking if deliveries planned */
891:
902: x_result_out := FND_API.G_FALSE;
903:
904: when FND_API.G_EXC_ERROR then
905: IF PG_DEBUG <> 0 THEN
906: oe_debug_pub.add('Delivery_Planned: ' || 'CTO_WIP_UTIL.Delivery_Planned::exp error', 1);
907: END IF;
908: x_return_status := FND_API.G_RET_STS_ERROR;
909: CTO_MSG_PUB.Count_And_Get
910: (p_msg_count => x_msg_count
912: );
913:
914: when FND_API.G_EXC_UNEXPECTED_ERROR then
915: IF PG_DEBUG <> 0 THEN
916: oe_debug_pub.add('Delivery_Planned: ' || 'CTO_WIP_UTIL.Delivery_Planned::unexp error', 1);
917: END IF;
918: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
919: CTO_MSG_PUB.Count_And_Get
920: (p_msg_count => x_msg_count
922: );
923:
924: when OTHERS then
925: IF PG_DEBUG <> 0 THEN
926: oe_debug_pub.add('Delivery_Planned: ' || 'CTO_WIP_UTIL.Delivery_Planned::others', 1);
927: END IF;
928: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
929: if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
930: then