34: l_dynstring := '@'||x_dblink;
35: END IF;
36:
37: IF PG_DEBUG in ('Y', 'C') THEN
38: msc_sch_wb.atp_debug('put_into_temp_table: ' || 'session_id : '||x_session_id);
39: msc_sch_wb.atp_debug('enter put_into_temp_table');
40: msc_sch_wb.atp_debug('put_into_temp_table: ' || 'l_dynstring = '||l_dynstring);
41: -- bug 2974324. Repeated statements removed from here.
42: END IF;
35: END IF;
36:
37: IF PG_DEBUG in ('Y', 'C') THEN
38: msc_sch_wb.atp_debug('put_into_temp_table: ' || 'session_id : '||x_session_id);
39: msc_sch_wb.atp_debug('enter put_into_temp_table');
40: msc_sch_wb.atp_debug('put_into_temp_table: ' || 'l_dynstring = '||l_dynstring);
41: -- bug 2974324. Repeated statements removed from here.
42: END IF;
43:
36:
37: IF PG_DEBUG in ('Y', 'C') THEN
38: msc_sch_wb.atp_debug('put_into_temp_table: ' || 'session_id : '||x_session_id);
39: msc_sch_wb.atp_debug('enter put_into_temp_table');
40: msc_sch_wb.atp_debug('put_into_temp_table: ' || 'l_dynstring = '||l_dynstring);
41: -- bug 2974324. Repeated statements removed from here.
42: END IF;
43:
44: /* -- bug3378648:we dont need this sql as this should be done locally
58:
59: EXECUTE IMMEDIATE sql_stmt USING x_session_id, x_session_id;
60:
61: IF PG_DEBUG in ('Y', 'C') THEN
62: msc_sch_wb.atp_debug('put_into_temp_table: ' || 'delete details temp rows := '|| SQL%ROWCOUNT);
63: END IF;
64: END IF;
65: /* -- bug3378648:we dont need this sql as this should be done locally
66:
68:
69: /*
70: MSC_ATP_UTILS.PUT_SD_DATA(x_atp_supply_demand, x_dblink, x_session_id);
71: IF PG_DEBUG in ('Y', 'C') THEN
72: msc_sch_wb.atp_debug('put_into_temp_table: ' || ' Inserted supply demand records ');
73: END IF;
74:
75: -- MSC_ATP_UTILS.PUT_PERIOD_DATA(x_atp_period, x_dblink, x_session_id);
76: -- dsting call it with null because we'll transfer it later
75: -- MSC_ATP_UTILS.PUT_PERIOD_DATA(x_atp_period, x_dblink, x_session_id);
76: -- dsting call it with null because we'll transfer it later
77: -- I'm not really expecting anything here
78: IF PG_DEBUG in ('Y', 'C') THEN
79: msc_sch_wb.atp_debug('put_into_temp_table: ' || ' dsting expect 0 period recs: ' || x_atp_period.level.count);
80: END IF;
81: MSC_ATP_UTILS.PUT_PERIOD_DATA(x_atp_period, NULL, x_session_id);
82:
83: IF PG_DEBUG in ('Y', 'C') THEN
80: END IF;
81: MSC_ATP_UTILS.PUT_PERIOD_DATA(x_atp_period, NULL, x_session_id);
82:
83: IF PG_DEBUG in ('Y', 'C') THEN
84: msc_sch_wb.atp_debug('put_into_temp_table: ' || ' Inserted period records ');
85: msc_sch_wb.atp_debug('enter put_into_temp_table :30');
86: END IF;
87:
88: -- dsting transfer it later
81: MSC_ATP_UTILS.PUT_PERIOD_DATA(x_atp_period, NULL, x_session_id);
82:
83: IF PG_DEBUG in ('Y', 'C') THEN
84: msc_sch_wb.atp_debug('put_into_temp_table: ' || ' Inserted period records ');
85: msc_sch_wb.atp_debug('enter put_into_temp_table :30');
86: END IF;
87:
88: -- dsting transfer it later
89: -- MSC_ATP_UTILS.PUT_Pegging_Data(x_session_id, x_dblink);
88: -- dsting transfer it later
89: -- MSC_ATP_UTILS.PUT_Pegging_Data(x_session_id, x_dblink);
90:
91: IF PG_DEBUG in ('Y', 'C') THEN
92: msc_sch_wb.atp_debug('put_into_temp_table: ' || 'Inserted Pegging Records');
93: END IF;
94: */
95:
96: MSC_ATP_UTILS.Put_Scheduling_data(x_atp_rec, x_mode, x_dblink, x_session_id);
95:
96: MSC_ATP_UTILS.Put_Scheduling_data(x_atp_rec, x_mode, x_dblink, x_session_id);
97:
98: IF PG_DEBUG in ('Y', 'C') THEN
99: msc_sch_wb.atp_debug('put_into_temp_table: ' || ' Inserted main records ');
100: END IF;
101:
102: --commit; -- autonomous transaction
103:
108:
109: WHEN MSC_ATP_PUB.ATP_INVALID_OBJECTS_FOUND THEN
110: -- bug 2974324. Redundant cursor statements removed from here.
111: IF PG_DEBUG in ('Y', 'C') THEN
112: msc_sch_wb.atp_debug('ATP Invalid Objects Found in put_Into_temp_table ');
113: msc_sch_wb.atp_debug('put_into_temp_table: ' || ' Error in MSCUATPB.pls '||substr(sqlerrm,1,100));
114: END IF;
115: x_msg_data := substr(sqlerrm,1,100);
116: x_return_status := FND_API.G_RET_STS_ERROR;
109: WHEN MSC_ATP_PUB.ATP_INVALID_OBJECTS_FOUND THEN
110: -- bug 2974324. Redundant cursor statements removed from here.
111: IF PG_DEBUG in ('Y', 'C') THEN
112: msc_sch_wb.atp_debug('ATP Invalid Objects Found in put_Into_temp_table ');
113: msc_sch_wb.atp_debug('put_into_temp_table: ' || ' Error in MSCUATPB.pls '||substr(sqlerrm,1,100));
114: END IF;
115: x_msg_data := substr(sqlerrm,1,100);
116: x_return_status := FND_API.G_RET_STS_ERROR;
117: -- IF l_dynstring is null THEN
121:
122: WHEN OTHERS THEN
123: -- bug 2974324. Redundant cursor statements removed from here.
124: IF PG_DEBUG in ('Y', 'C') THEN
125: msc_sch_wb.atp_debug('put_into_temp_table: ' || ' Error in MSCUATPB.pls '||substr(sqlerrm,1,100));
126: END IF;
127: x_msg_data := substr(sqlerrm,1,100);
128: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
129:
164: l_mso_lead_time_factor number;
165: BEGIN
166:
167: IF PG_DEBUG in ('Y', 'C') THEN
168: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'Entering get from temp table');
169: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'p_details_falg := ' || p_details_flag);
170: END IF;
171: -- initialize API returm status to success
172: x_return_status := FND_API.G_RET_STS_SUCCESS;
165: BEGIN
166:
167: IF PG_DEBUG in ('Y', 'C') THEN
168: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'Entering get from temp table');
169: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'p_details_falg := ' || p_details_flag);
170: END IF;
171: -- initialize API returm status to success
172: x_return_status := FND_API.G_RET_STS_SUCCESS;
173:
195: END IF;
196: ---e_cto_rearch
197:
198: IF PG_DEBUG in ('Y', 'C') THEN
199: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'get from temp table, l_dynstring = '||l_dynstring);
200: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'get from temp table, x_session_id = '||x_session_id);
201: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'get from temp table, x_mode = ' || x_mode);
202: END IF;
203:
196: ---e_cto_rearch
197:
198: IF PG_DEBUG in ('Y', 'C') THEN
199: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'get from temp table, l_dynstring = '||l_dynstring);
200: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'get from temp table, x_session_id = '||x_session_id);
201: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'get from temp table, x_mode = ' || x_mode);
202: END IF;
203:
204: -- cchen: rewrite this sql_stmt. based on the mode we either have status 1
197:
198: IF PG_DEBUG in ('Y', 'C') THEN
199: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'get from temp table, l_dynstring = '||l_dynstring);
200: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'get from temp table, x_session_id = '||x_session_id);
201: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'get from temp table, x_mode = ' || x_mode);
202: END IF;
203:
204: -- cchen: rewrite this sql_stmt. based on the mode we either have status 1
205: -- or 2 in the where clause
219: l_status_flag := 99;
220: END IF;
221:
222: IF PG_DEBUG in ('Y', 'C') THEN
223: msc_sch_wb.atp_debug('l_status_flag := ' || l_status_flag);
224: END IF;
225:
226: SELECT
227: ACTION
551: NVL(ATO_Model_Line_Id, ORDER_LINE_ID))
552: ORDER BY sequence_number;
553:
554: IF PG_DEBUG in ('Y', 'C') THEN
555: msc_sch_wb.atp_debug('Records Retrieved := ' || x_atp_rec.inventory_item_id.count );
556: END IF;
557:
558: --bug3520746 Begin Changes
559: --bug3610706 added the condition for de-centrlized env.
579: WHERE session_id = :x_session_id)';
580: EXECUTE IMMEDIATE sql_stmt USING x_session_id;
581:
582: IF PG_DEBUG in ('Y', 'C') THEN
583: msc_sch_wb.atp_debug('Rows inserted in msc_regions_temp:'|| sql%rowcount);
584: END IF;
585: END IF;
586: --bug3520746 End Changes
587: ---s_cto_rearch
698: 'FROM mrp_atp_schedule_temp'||l_dynstring||'
699: WHERE session_id = :x_session_id';
700:
701: IF PG_DEBUG in ('Y', 'C') THEN
702: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'sql_stmt ' || sql_stmt);
703: END IF;
704:
705: IF x_mode = results_mode THEN
706: sql_stmt := sql_stmt || ' AND status_flag = 2'; -- changed form 1 to 2
712: sql_stmt := sql_stmt || ' ORDER BY sequence_number ';
713: -- End Bug 2341719 .
714:
715: IF PG_DEBUG in ('Y', 'C') THEN
716: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'sql_stmt ' || sql_stmt);
717: END IF;
718:
719: OPEN sched_cv FOR sql_stmt USING x_session_id;
720:
718:
719: OPEN sched_cv FOR sql_stmt USING x_session_id;
720:
721: IF PG_DEBUG in ('Y', 'C') THEN
722: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'after open sched_cv ' );
723: END IF;
724:
725: LOOP
726: IF PG_DEBUG in ('Y', 'C') THEN
723: END IF;
724:
725: LOOP
726: IF PG_DEBUG in ('Y', 'C') THEN
727: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'get from temp table, in LOOP,line 1');
728: END IF;
729:
730: FETCH sched_cv INTO sched_rec;
731: temp := SQLCODE;
729:
730: FETCH sched_cv INTO sched_rec;
731: temp := SQLCODE;
732: IF PG_DEBUG in ('Y', 'C') THEN
733: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'after fetch: SQLCODE = '||temp);
734: END IF;
735:
736: EXIT WHEN sched_cv%NOTFOUND;
737: -- process record
736: EXIT WHEN sched_cv%NOTFOUND;
737: -- process record
738:
739: IF PG_DEBUG in ('Y', 'C') THEN
740: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'get from temp table, in LOOP,after exit');
741: END IF;
742:
743: MSC_SATP_FUNC.Extend_Atp(x_atp_rec, x_return_status, 1);
744:
807:
808: --diag_atp
809: x_atp_rec.attribute_02(i) := sched_rec.diagnostic_atp_flag;
810: IF PG_DEBUG in ('Y', 'C') THEN
811: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'Diagnostic flag: ' || sched_rec.diagnostic_atp_flag);
812: END IF;
813: i := i + 1;
814:
815: END LOOP;
824: x_atp_period,
825: x_atp_supply_demand);
826:
827: IF PG_DEBUG in ('Y', 'C') THEN
828: msc_sch_wb.atp_debug('leaving get_from_temp_table');
829: END IF;
830: END IF; -- If x_mode = results_mode
831:
832: EXCEPTION
833:
834: WHEN MSC_ATP_PUB.ATP_INVALID_OBJECTS_FOUND THEN
835: x_return_status := FND_API.G_RET_STS_ERROR;
836: IF PG_DEBUG in ('Y', 'C') THEN
837: msc_sch_wb.atp_debug('error in get_from_temp_table' || sqlerrm);
838: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'Invalid Objects found');
839: END IF;
840: RAISE MSC_ATP_PUB.ATP_INVALID_OBJECTS_FOUND;
841:
834: WHEN MSC_ATP_PUB.ATP_INVALID_OBJECTS_FOUND THEN
835: x_return_status := FND_API.G_RET_STS_ERROR;
836: IF PG_DEBUG in ('Y', 'C') THEN
837: msc_sch_wb.atp_debug('error in get_from_temp_table' || sqlerrm);
838: msc_sch_wb.atp_debug('get_from_temp_table: ' || 'Invalid Objects found');
839: END IF;
840: RAISE MSC_ATP_PUB.ATP_INVALID_OBJECTS_FOUND;
841:
842: WHEN OTHERS THEN
841:
842: WHEN OTHERS THEN
843: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
844: IF PG_DEBUG in ('Y', 'C') THEN
845: msc_sch_wb.atp_debug('error in get_from_temp_table' || sqlerrm);
846: END IF;
847: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
848:
849: END get_from_temp_table;
888: -- this takes care of the case when call is made for rows already
889: -- processed. Eg. change orders case
890: IF (v_dummy <> 0) THEN
891: IF PG_DEBUG in ('Y', 'C') THEN
892: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' Calling API 02 ');
893: END IF;
894:
895: return(INV_EXTATP_GRP.G_ALL_SUCCESS);
896: END IF;
995:
996: -- Update mtl_demand_interface with the right return values
997: -- call atp module
998: IF PG_DEBUG in ('Y', 'C') THEN
999: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' Calling API '||x_atp_rec.Inventory_Item_Id.COUNT);
1000: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 0 '||x_atp_rec.inventory_item_id(1));
1001: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 1 '||x_atp_rec.Source_Organization_Id(1));
1002: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 2 '||x_atp_rec.Identifier(1));
1003: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 3 '||x_atp_rec.Calling_Module(1));
996: -- Update mtl_demand_interface with the right return values
997: -- call atp module
998: IF PG_DEBUG in ('Y', 'C') THEN
999: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' Calling API '||x_atp_rec.Inventory_Item_Id.COUNT);
1000: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 0 '||x_atp_rec.inventory_item_id(1));
1001: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 1 '||x_atp_rec.Source_Organization_Id(1));
1002: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 2 '||x_atp_rec.Identifier(1));
1003: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 3 '||x_atp_rec.Calling_Module(1));
1004: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 4 '||x_atp_rec.Quantity_Ordered(1));
997: -- call atp module
998: IF PG_DEBUG in ('Y', 'C') THEN
999: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' Calling API '||x_atp_rec.Inventory_Item_Id.COUNT);
1000: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 0 '||x_atp_rec.inventory_item_id(1));
1001: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 1 '||x_atp_rec.Source_Organization_Id(1));
1002: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 2 '||x_atp_rec.Identifier(1));
1003: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 3 '||x_atp_rec.Calling_Module(1));
1004: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 4 '||x_atp_rec.Quantity_Ordered(1));
1005: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 5 '||x_atp_rec.Quantity_UOM(1));
998: IF PG_DEBUG in ('Y', 'C') THEN
999: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' Calling API '||x_atp_rec.Inventory_Item_Id.COUNT);
1000: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 0 '||x_atp_rec.inventory_item_id(1));
1001: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 1 '||x_atp_rec.Source_Organization_Id(1));
1002: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 2 '||x_atp_rec.Identifier(1));
1003: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 3 '||x_atp_rec.Calling_Module(1));
1004: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 4 '||x_atp_rec.Quantity_Ordered(1));
1005: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 5 '||x_atp_rec.Quantity_UOM(1));
1006: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 6 '||x_atp_rec.Requested_Ship_Date(1));
999: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' Calling API '||x_atp_rec.Inventory_Item_Id.COUNT);
1000: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 0 '||x_atp_rec.inventory_item_id(1));
1001: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 1 '||x_atp_rec.Source_Organization_Id(1));
1002: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 2 '||x_atp_rec.Identifier(1));
1003: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 3 '||x_atp_rec.Calling_Module(1));
1004: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 4 '||x_atp_rec.Quantity_Ordered(1));
1005: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 5 '||x_atp_rec.Quantity_UOM(1));
1006: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 6 '||x_atp_rec.Requested_Ship_Date(1));
1007: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 7 '||x_atp_rec.Latest_Acceptable_Date(1));
1000: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 0 '||x_atp_rec.inventory_item_id(1));
1001: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 1 '||x_atp_rec.Source_Organization_Id(1));
1002: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 2 '||x_atp_rec.Identifier(1));
1003: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 3 '||x_atp_rec.Calling_Module(1));
1004: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 4 '||x_atp_rec.Quantity_Ordered(1));
1005: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 5 '||x_atp_rec.Quantity_UOM(1));
1006: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 6 '||x_atp_rec.Requested_Ship_Date(1));
1007: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 7 '||x_atp_rec.Latest_Acceptable_Date(1));
1008: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 8 '||x_atp_rec.Action(1));
1001: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 1 '||x_atp_rec.Source_Organization_Id(1));
1002: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 2 '||x_atp_rec.Identifier(1));
1003: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 3 '||x_atp_rec.Calling_Module(1));
1004: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 4 '||x_atp_rec.Quantity_Ordered(1));
1005: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 5 '||x_atp_rec.Quantity_UOM(1));
1006: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 6 '||x_atp_rec.Requested_Ship_Date(1));
1007: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 7 '||x_atp_rec.Latest_Acceptable_Date(1));
1008: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 8 '||x_atp_rec.Action(1));
1009: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 9 '||x_atp_rec.Insert_Flag(1));
1002: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 2 '||x_atp_rec.Identifier(1));
1003: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 3 '||x_atp_rec.Calling_Module(1));
1004: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 4 '||x_atp_rec.Quantity_Ordered(1));
1005: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 5 '||x_atp_rec.Quantity_UOM(1));
1006: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 6 '||x_atp_rec.Requested_Ship_Date(1));
1007: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 7 '||x_atp_rec.Latest_Acceptable_Date(1));
1008: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 8 '||x_atp_rec.Action(1));
1009: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 9 '||x_atp_rec.Insert_Flag(1));
1010: END IF;
1003: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 3 '||x_atp_rec.Calling_Module(1));
1004: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 4 '||x_atp_rec.Quantity_Ordered(1));
1005: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 5 '||x_atp_rec.Quantity_UOM(1));
1006: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 6 '||x_atp_rec.Requested_Ship_Date(1));
1007: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 7 '||x_atp_rec.Latest_Acceptable_Date(1));
1008: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 8 '||x_atp_rec.Action(1));
1009: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 9 '||x_atp_rec.Insert_Flag(1));
1010: END IF;
1011:
1004: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 4 '||x_atp_rec.Quantity_Ordered(1));
1005: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 5 '||x_atp_rec.Quantity_UOM(1));
1006: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 6 '||x_atp_rec.Requested_Ship_Date(1));
1007: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 7 '||x_atp_rec.Latest_Acceptable_Date(1));
1008: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 8 '||x_atp_rec.Action(1));
1009: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 9 '||x_atp_rec.Insert_Flag(1));
1010: END IF;
1011:
1012: x_session_id := p_session_id;
1005: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 5 '||x_atp_rec.Quantity_UOM(1));
1006: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 6 '||x_atp_rec.Requested_Ship_Date(1));
1007: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 7 '||x_atp_rec.Latest_Acceptable_Date(1));
1008: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 8 '||x_atp_rec.Action(1));
1009: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 9 '||x_atp_rec.Insert_Flag(1));
1010: END IF;
1011:
1012: x_session_id := p_session_id;
1013:
1022: x_msg_data,
1023: x_msg_count);
1024:
1025: IF PG_DEBUG in ('Y', 'C') THEN
1026: msc_sch_wb.atp_debug('Call_ATP_11: ' || 'x_atp_rec_out.Ship_Date:'
1027: || to_char(x_atp_rec_out.Ship_Date(1)) );
1028: msc_sch_wb.atp_debug('Call_ATP_11: ' || 'x_atp_rec_out.Available_Quantity:'
1029: || to_char(x_atp_rec_out.Available_Quantity(1)) );
1030: msc_sch_wb.atp_debug('Call_ATP_11: ' || 'x_atp_rec_out.Requested_Date_Quantity:'
1024:
1025: IF PG_DEBUG in ('Y', 'C') THEN
1026: msc_sch_wb.atp_debug('Call_ATP_11: ' || 'x_atp_rec_out.Ship_Date:'
1027: || to_char(x_atp_rec_out.Ship_Date(1)) );
1028: msc_sch_wb.atp_debug('Call_ATP_11: ' || 'x_atp_rec_out.Available_Quantity:'
1029: || to_char(x_atp_rec_out.Available_Quantity(1)) );
1030: msc_sch_wb.atp_debug('Call_ATP_11: ' || 'x_atp_rec_out.Requested_Date_Quantity:'
1031: || to_char(x_atp_rec_out.Requested_Date_Quantity(1)) );
1032: END IF;
1026: msc_sch_wb.atp_debug('Call_ATP_11: ' || 'x_atp_rec_out.Ship_Date:'
1027: || to_char(x_atp_rec_out.Ship_Date(1)) );
1028: msc_sch_wb.atp_debug('Call_ATP_11: ' || 'x_atp_rec_out.Available_Quantity:'
1029: || to_char(x_atp_rec_out.Available_Quantity(1)) );
1030: msc_sch_wb.atp_debug('Call_ATP_11: ' || 'x_atp_rec_out.Requested_Date_Quantity:'
1031: || to_char(x_atp_rec_out.Requested_Date_Quantity(1)) );
1032: END IF;
1033:
1034:
1041: WHERE rowid = Chartorowid(X_atp_rec_out.row_id(j));
1042: END LOOP;
1043:
1044: IF PG_DEBUG in ('Y', 'C') THEN
1045: msc_sch_wb.atp_debug('Call_ATP_11: ' || 'Errpr :'||x_msg_data);
1046: END IF;
1047: ELSE
1048:
1049: IF x_atp_rec_out.Inventory_Item_Id.COUNT > 0 THEN
1047: ELSE
1048:
1049: IF x_atp_rec_out.Inventory_Item_Id.COUNT > 0 THEN
1050: IF PG_DEBUG in ('Y', 'C') THEN
1051: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' atp_rec_out count '||x_atp_rec_out.ship_date.COUNT);
1052: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 00 '||x_atp_rec_out.row_id(1));
1053: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 00 '||x_atp_rec_out.requested_date_quantity(1));
1054: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 11 '||x_atp_rec_out.ship_date(1));
1055: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 22 '||x_atp_rec_out.available_quantity(1));
1048:
1049: IF x_atp_rec_out.Inventory_Item_Id.COUNT > 0 THEN
1050: IF PG_DEBUG in ('Y', 'C') THEN
1051: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' atp_rec_out count '||x_atp_rec_out.ship_date.COUNT);
1052: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 00 '||x_atp_rec_out.row_id(1));
1053: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 00 '||x_atp_rec_out.requested_date_quantity(1));
1054: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 11 '||x_atp_rec_out.ship_date(1));
1055: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 22 '||x_atp_rec_out.available_quantity(1));
1056: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 33 '||x_atp_rec_out.group_ship_date(1));
1049: IF x_atp_rec_out.Inventory_Item_Id.COUNT > 0 THEN
1050: IF PG_DEBUG in ('Y', 'C') THEN
1051: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' atp_rec_out count '||x_atp_rec_out.ship_date.COUNT);
1052: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 00 '||x_atp_rec_out.row_id(1));
1053: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 00 '||x_atp_rec_out.requested_date_quantity(1));
1054: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 11 '||x_atp_rec_out.ship_date(1));
1055: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 22 '||x_atp_rec_out.available_quantity(1));
1056: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 33 '||x_atp_rec_out.group_ship_date(1));
1057: END IF;
1050: IF PG_DEBUG in ('Y', 'C') THEN
1051: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' atp_rec_out count '||x_atp_rec_out.ship_date.COUNT);
1052: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 00 '||x_atp_rec_out.row_id(1));
1053: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 00 '||x_atp_rec_out.requested_date_quantity(1));
1054: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 11 '||x_atp_rec_out.ship_date(1));
1055: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 22 '||x_atp_rec_out.available_quantity(1));
1056: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 33 '||x_atp_rec_out.group_ship_date(1));
1057: END IF;
1058: END IF;
1051: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' atp_rec_out count '||x_atp_rec_out.ship_date.COUNT);
1052: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 00 '||x_atp_rec_out.row_id(1));
1053: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 00 '||x_atp_rec_out.requested_date_quantity(1));
1054: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 11 '||x_atp_rec_out.ship_date(1));
1055: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 22 '||x_atp_rec_out.available_quantity(1));
1056: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 33 '||x_atp_rec_out.group_ship_date(1));
1057: END IF;
1058: END IF;
1059:
1052: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 00 '||x_atp_rec_out.row_id(1));
1053: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 00 '||x_atp_rec_out.requested_date_quantity(1));
1054: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 11 '||x_atp_rec_out.ship_date(1));
1055: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 22 '||x_atp_rec_out.available_quantity(1));
1056: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' 33 '||x_atp_rec_out.group_ship_date(1));
1057: END IF;
1058: END IF;
1059:
1060: IF x_atp_rec_out.Inventory_Item_Id.COUNT > 0 THEN
1059:
1060: IF x_atp_rec_out.Inventory_Item_Id.COUNT > 0 THEN
1061: FOR j IN 1..x_atp_rec_out.Inventory_Item_Id.COUNT LOOP
1062: IF PG_DEBUG in ('Y', 'C') THEN
1063: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' atp_rec_out '||j);
1064: END IF;
1065: -- FORALL j IN 1..x_atp_rec_out.Inventory_Item_Id.COUNT
1066: -- For all was giving wierd problems in Updating date variables.
1067:
1066: -- For all was giving wierd problems in Updating date variables.
1067:
1068: -- ?? Infinite_time_fence_date is being updated in inlatp.ppc
1069: IF PG_DEBUG in ('Y', 'C') THEN
1070: msc_sch_wb.atp_debug('Call_ATP_11: ' || 'christine, request date atp q is'||x_Atp_rec_out.requested_date_quantity(j));
1071: END IF;
1072: UPDATE mtl_demand_interface
1073: SET Request_Date_ATP_Quantity = x_Atp_rec_out.requested_date_quantity(j),
1074: Request_ATP_Date = To_date(To_char(X_atp_rec_out.ship_date(j), 'J'),'J'),
1083:
1084: IF x_atp_supply_demand.Inventory_Item_Id.COUNT > 0 THEN
1085:
1086: IF PG_DEBUG in ('Y', 'C') THEN
1087: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' atp_sd count '||x_atp_supply_demand.Inventory_Item_Id.COUNT);
1088: END IF;
1089:
1090: FOR j IN 1..x_atp_supply_demand.inventory_item_id.COUNT LOOP
1091: IF PG_DEBUG in ('Y', 'C') THEN
1088: END IF;
1089:
1090: FOR j IN 1..x_atp_supply_demand.inventory_item_id.COUNT LOOP
1091: IF PG_DEBUG in ('Y', 'C') THEN
1092: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' atp_sd '||j);
1093: END IF;
1094: INSERT INTO MTL_SUPPLY_DEMAND_TEMP
1095: (
1096: RECORD_TYPE,
1137: END LOOP;
1138: END IF;
1139: IF x_atp_period.inventory_item_id.COUNT > 0 THEN
1140: IF PG_DEBUG in ('Y', 'C') THEN
1141: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' atp_period count '||x_atp_period.Inventory_Item_Id.COUNT);
1142: END IF;
1143:
1144: FOR j IN 1..x_atp_period.inventory_item_id.COUNT LOOP
1145: IF PG_DEBUG in ('Y', 'C') THEN
1142: END IF;
1143:
1144: FOR j IN 1..x_atp_period.inventory_item_id.COUNT LOOP
1145: IF PG_DEBUG in ('Y', 'C') THEN
1146: msc_sch_wb.atp_debug('Call_ATP_11: ' || ' atp period '||j);
1147: END IF;
1148: INSERT INTO MTL_SUPPLY_DEMAND_TEMP
1149: (
1150: ATP_PERIOD_START_DATE,
1224: mast_rec.task_number.extend(1);
1225: EXCEPTION
1226: WHEN OTHERS THEN
1227: IF PG_DEBUG in ('Y', 'C') THEN
1228: msc_sch_wb.atp_debug('Excp in extend_mast : '||Substr(Sqlerrm,1,100));
1229: END IF;
1230: END extend_mast;
1231:
1232:
1262: mast_rec.task_number.trim(1);
1263: EXCEPTION
1264: WHEN OTHERS THEN
1265: IF PG_DEBUG in ('Y', 'C') THEN
1266: msc_sch_wb.atp_debug('Excp in trim_mast : '||Substr(Sqlerrm,1,100));
1267: END IF;
1268: END trim_mast;
1269:
1270: -- Bug 2974324. Redundant test procedure removed from here
1288:
1289: BEGIN
1290:
1291: IF PG_DEBUG in ('Y', 'C') THEN
1292: msc_sch_wb.atp_debug('****Begin put_into_bom_temp_table ****');
1293: END IF;
1294: -- initialize API returm status to success
1295: x_return_status := FND_API.G_RET_STS_SUCCESS;
1296:
1307: ELSE
1308: sql_stmt := 'DELETE msc_bom_temp'||l_dynstring|| ' WHERE session_id = :session_id';
1309:
1310: IF PG_DEBUG in ('Y', 'C') THEN
1311: msc_sch_wb.atp_debug('put_into_bom_temp_table: ' || 'sql_stmt : '||sql_stmt);
1312: END IF;
1313:
1314: EXECUTE IMMEDIATE sql_stmt using p_session_id;
1315: END IF;
1314: EXECUTE IMMEDIATE sql_stmt using p_session_id;
1315: END IF;
1316:
1317: IF PG_DEBUG in ('Y', 'C') THEN
1318: msc_sch_wb.atp_debug('put_into_bom_temp_table: ' || 'After deleting from msc_bom_temp table');
1319: END IF;
1320:
1321: j := p_atp_bom_rec.assembly_identifier.FIRST;
1322: IF PG_DEBUG in ('Y', 'C') THEN
1319: END IF;
1320:
1321: j := p_atp_bom_rec.assembly_identifier.FIRST;
1322: IF PG_DEBUG in ('Y', 'C') THEN
1323: msc_sch_wb.atp_debug('put_into_bom_temp_table: ' || 'j = '||j);
1324: END IF;
1325:
1326: -- bug 2974324. Changed the dynamic SQL to static if db_link is null
1327: IF p_dblink IS NOT NULL THEN
1327: IF p_dblink IS NOT NULL THEN
1328:
1329: WHILE j IS NOT NULL LOOP
1330: IF PG_DEBUG in ('Y', 'C') THEN
1331: msc_sch_wb.atp_debug('put_into_bom_temp_table: ' || 'in loop j = '||j ||' : '|| 'item_id : ' ||
1332: p_atp_bom_rec.assembly_item_id(j) || ' : '||
1333: 'comp item_id : ' ||p_atp_bom_rec.component_item_id(j)||
1334: ' atp flag : ' || p_atp_bom_rec.atp_check(j));
1335: END IF;
1373: )';
1374:
1375:
1376: IF PG_DEBUG in ('Y', 'C') THEN
1377: msc_sch_wb.atp_debug('put_into_bom_temp_table: ' || 'after insert into bom_temp');
1378: END IF;
1379:
1380: EXECUTE IMMEDIATE sql_stmt using
1381: p_session_id,
1442: END IF; -- bug 2974324. Changed the dynamic SQL to static if db_link is null
1443:
1444:
1445: IF PG_DEBUG in ('Y', 'C') THEN
1446: msc_sch_wb.atp_debug('****End put_into_bom_temp_table ****');
1447: END IF;
1448: EXCEPTION
1449: WHEN OTHERS THEN
1450: IF PG_DEBUG in ('Y', 'C') THEN
1447: END IF;
1448: EXCEPTION
1449: WHEN OTHERS THEN
1450: IF PG_DEBUG in ('Y', 'C') THEN
1451: msc_sch_wb.atp_debug(' Error in put_into_bom_temp_table '||substr(sqlerrm,1,100));
1452: END IF;
1453: x_msg_data := substr(sqlerrm,1,100);
1454: x_return_status := FND_API.G_RET_STS_ERROR;
1455: END put_into_bom_temp_table;
1469:
1470: IF p_atp_period.level.COUNT > 0 THEN
1471:
1472: IF PG_DEBUG in ('Y', 'C') THEN
1473: msc_sch_wb.atp_debug('PROCEDURE Put_Period_Data');
1474: msc_sch_wb.atp_debug('Put_Period_Data: ' || ' period records '||p_atp_period.level.COUNT);
1475: END IF;
1476:
1477: l_user_id := FND_GLOBAL.user_id;
1470: IF p_atp_period.level.COUNT > 0 THEN
1471:
1472: IF PG_DEBUG in ('Y', 'C') THEN
1473: msc_sch_wb.atp_debug('PROCEDURE Put_Period_Data');
1474: msc_sch_wb.atp_debug('Put_Period_Data: ' || ' period records '||p_atp_period.level.COUNT);
1475: END IF;
1476:
1477: l_user_id := FND_GLOBAL.user_id;
1478: l_sysdate := sysdate;
1558: );
1559:
1560: ELSE -- IF x_dblink IS NULL THEN
1561: IF PG_DEBUG in ('Y', 'C') THEN
1562: msc_sch_wb.atp_debug(' XXX Put_Period_Data should not be called with dblink');
1563: END IF;
1564:
1565: -- dsting: added stuff for creation_date, created_by,
1566: -- last_update_date, last_updated_by, last_update_login
1647: -- Parse cursor handler for sql_stmt
1648: DBMS_SQL.PARSE(cur_handler, sql_stmt, DBMS_SQL.NATIVE);
1649:
1650: IF PG_DEBUG in ('Y', 'C') THEN
1651: msc_sch_wb.atp_debug('Put_Period_Data: ' || 'enter put_into_temp_table :just before execute');
1652: END IF;
1653:
1654: FOR j IN 1..p_atp_period.level.COUNT LOOP
1655:
1694:
1695: END LOOP;
1696:
1697: IF PG_DEBUG in ('Y', 'C') THEN
1698: msc_sch_wb.atp_debug('Put_Period_Data: ' || 'enter put_into_temp_table :after execute');
1699: END IF;
1700:
1701: -- Close the cursor in case it is open
1702: IF DBMS_SQL.IS_OPEN(cur_handler) THEN
1723: -- put it back into source.
1724:
1725: l_user_id := FND_GLOBAL.USER_ID;
1726: IF PG_DEBUG in ('Y', 'C') THEN
1727: msc_sch_wb.atp_debug('Put_Pegging_data: ' || 'p_dblink = ' ||p_dblink);
1728: END IF;
1729:
1730: IF p_dblink is not null THEN
1731:
1729:
1730: IF p_dblink is not null THEN
1731:
1732: IF PG_DEBUG in ('Y', 'C') THEN
1733: msc_sch_wb.atp_debug('Put_Pegging_data: ' || 'inserting pegging into source side');
1734: END IF;
1735: -- Bug 1761545, added component_identifier in pegging for MATO
1736:
1737: -- dsting: added creation_date, created_by,
1836: l_user_id,
1837: p_session_id;
1838:
1839: IF PG_DEBUG in ('Y', 'C') THEN
1840: msc_sch_wb.atp_debug('Put_Pegging_data: ' || 'inserted pegging into source side');
1841: END IF;
1842:
1843:
1844: -- after the insert is done, delete the pegging records
1893: ---s_cto_rearch
1894: IF l_count > 0 THEN
1895: IF p_mode = RESULTS_MODE THEN
1896: IF PG_DEBUG in ('Y', 'C') THEN
1897: msc_sch_wb.atp_debug('Put_Scheduling_data in results mode: ' || ' output records '|| l_count );
1898: END IF;
1899: MSC_ATP_UTILS.Put_sch_data_result_mode(p_atp_rec, p_dblink, p_session_id);
1900: ELSE
1901: MSC_ATP_UTILS.Put_sch_Data_Request_mode(p_atp_rec, p_session_id);
1914:
1915: BEGIN
1916:
1917: IF PG_DEBUG in ('Y', 'C') THEN
1918: msc_sch_wb.atp_debug('PROCEDURE Retrieve_Period_And_SD_Data');
1919: END IF;
1920:
1921: -----------------
1922: -- Period Data --
1984: where session_id = p_session_id
1985: and record_type = 3);
1986:
1987: IF PG_DEBUG in ('Y', 'C') THEN
1988: msc_sch_wb.atp_debug('Retrieve_Period_and_SD_Data: ' || ' Rows period data: ' || SQL%ROWCOUNT);
1989: END IF;
1990:
1991: -------------
1992: -- SD Data --
2059: and record_type = 3);
2060:
2061:
2062: IF PG_DEBUG in ('Y', 'C') THEN
2063: msc_sch_wb.atp_debug('Retrieve_Period_and_SD_Data: ' || ' Rows SD data: ' || SQL%ROWCOUNT);
2064: END IF;
2065:
2066: END Retrieve_Period_and_SD_Data;
2067:
2208:
2209: BEGIN
2210:
2211: IF PG_DEBUG in ('Y', 'C') THEN
2212: msc_sch_wb.atp_debug('Transfer_mrp_atp_details_temp: ' || 'PROCEDURE Transfer_SD_And_Period_Data');
2213: END IF;
2214:
2215: IF p_dblink IS NOT NULL THEN
2216: -- transfer period (record_type 1) and s/d (2) and pegging (3) data
2215: IF p_dblink IS NOT NULL THEN
2216: -- transfer period (record_type 1) and s/d (2) and pegging (3) data
2217: -- that appear in the pegging tree
2218: IF PG_DEBUG in ('Y', 'C') THEN
2219: msc_sch_wb.atp_debug('Transfer_mrp_atp_details_temp: ' || 'apps_ver: ' || MSC_ATP_PVT.G_APPS_VER);
2220: END IF;
2221:
2222: sql_stmt := 'Insert into mrp_atp_details_temp@' || p_dblink || ' (';
2223:
2236: and pegging_id in (Select pegging_id from mrp_atp_details_temp
2237: where session_id = :p_session_id
2238: and record_type = 3)';
2239: IF PG_DEBUG in ('Y', 'C') THEN
2240: msc_sch_wb.atp_debug('Transfer_mrp_atp_details_temp: ' || 'dsting: '||sql_stmt);
2241: END IF;
2242: execute immediate sql_stmt using p_session_id , p_session_id;
2243:
2244: IF PG_DEBUG in ('Y', 'C') THEN
2241: END IF;
2242: execute immediate sql_stmt using p_session_id , p_session_id;
2243:
2244: IF PG_DEBUG in ('Y', 'C') THEN
2245: msc_sch_wb.atp_debug('Transfer_mrp_atp_details_temp: ' || 'dsting: '|| SQL%ROWCOUNT);
2246: END IF;
2247: END IF;
2248:
2249: END Transfer_mrp_atp_details_temp;
2264: who_cols VARCHAR2(100);
2265: t1 NUMBER;
2266: BEGIN
2267: IF PG_DEBUG in ('Y', 'C') THEN
2268: msc_sch_wb.atp_debug('PROCEDURE Copy_MRP_SD_Recs');
2269: msc_sch_wb.atp_debug('Copy_MRP_SD_Recs: ' || ' p_old_pegging_id: ' || p_old_pegging_id);
2270: msc_sch_wb.atp_debug('Copy_MRP_SD_Recs: ' || ' p_pegging_id: ' || p_pegging_id);
2271: END IF;
2272:
2265: t1 NUMBER;
2266: BEGIN
2267: IF PG_DEBUG in ('Y', 'C') THEN
2268: msc_sch_wb.atp_debug('PROCEDURE Copy_MRP_SD_Recs');
2269: msc_sch_wb.atp_debug('Copy_MRP_SD_Recs: ' || ' p_old_pegging_id: ' || p_old_pegging_id);
2270: msc_sch_wb.atp_debug('Copy_MRP_SD_Recs: ' || ' p_pegging_id: ' || p_pegging_id);
2271: END IF;
2272:
2273: INSERT INTO mrp_atp_details_temp (
2266: BEGIN
2267: IF PG_DEBUG in ('Y', 'C') THEN
2268: msc_sch_wb.atp_debug('PROCEDURE Copy_MRP_SD_Recs');
2269: msc_sch_wb.atp_debug('Copy_MRP_SD_Recs: ' || ' p_old_pegging_id: ' || p_old_pegging_id);
2270: msc_sch_wb.atp_debug('Copy_MRP_SD_Recs: ' || ' p_pegging_id: ' || p_pegging_id);
2271: END IF;
2272:
2273: INSERT INTO mrp_atp_details_temp (
2274: session_id,
2349: where pegging_id = p_old_pegging_id
2350: and record_type = 2;
2351:
2352: IF PG_DEBUG in ('Y', 'C') THEN
2353: msc_sch_wb.atp_debug('Copy_MRP_SD_Recs: ' || ' Num rows copied: ' || SQL%ROWCOUNT);
2354: END IF;
2355:
2356: END Copy_MRP_SD_Recs;
2357:
2373:
2374: IF l_dynstring is not null then
2375: ---distributed database:
2376: IF PG_DEBUG in ('Y', 'C') THEN
2377: msc_sch_wb.atp_debug('Process_Supply_Demand_details: ' || 'Distributed environment. Put from dest to source table');
2378: END IF;
2379: sql_stmt := 'Insert into mrp_atp_details_temp' || l_dynstring ||
2380: '(select * from mrp_atp_details_temp
2381: where session_id = :p_session_id
2387:
2388: ELSE --- IF p_dblink is not null then
2389: --- non-distributed environment
2390: IF PG_DEBUG in ('Y', 'C') THEN
2391: msc_sch_wb.atp_debug('Process_Supply_Demand_details: ' || 'Non Distributed env. Put SD details from temp table to pl/sql tables');
2392: END IF;
2393: j := 1;
2394: SELECT ORDER_LINE_ID
2395: ,PEGGING_ID
2490: l_user_id := FND_GLOBAL.USER_ID;
2491:
2492: IF p_atp_supply_demand.level.COUNT > 0 THEN
2493: IF PG_DEBUG in ('Y', 'C') THEN
2494: msc_sch_wb.atp_debug('Put_SD_Data: ' || ' SD records '||p_atp_supply_demand.level.COUNT);
2495: msc_sch_wb.atp_debug('XXX should not have sd records in Put_SD_Data');
2496: END IF;
2497:
2498: IF p_dblink IS NULL THEN
2491:
2492: IF p_atp_supply_demand.level.COUNT > 0 THEN
2493: IF PG_DEBUG in ('Y', 'C') THEN
2494: msc_sch_wb.atp_debug('Put_SD_Data: ' || ' SD records '||p_atp_supply_demand.level.COUNT);
2495: msc_sch_wb.atp_debug('XXX should not have sd records in Put_SD_Data');
2496: END IF;
2497:
2498: IF p_dblink IS NULL THEN
2499:
2665: , :last_update_login
2666: )';
2667:
2668: IF PG_DEBUG in ('Y', 'C') THEN
2669: msc_sch_wb.atp_debug('Put_SD_Data: ' || 'enter put_into_temp_table in between values and execute ');
2670: END IF;
2671:
2672: -- Obtain cursor handler for sql_stmt
2673: cur_handler := DBMS_SQL.OPEN_CURSOR;
2716: rows_processed := DBMS_SQL.EXECUTE(cur_handler);
2717:
2718: END LOOP;
2719: IF PG_DEBUG in ('Y', 'C') THEN
2720: msc_sch_wb.atp_debug('Put_SD_Data: ' || 'enter put_into_temp_table :20');
2721: END IF;
2722:
2723: -- Close the cursor in case it is open
2724: IF DBMS_SQL.IS_OPEN(cur_handler) THEN
2734: Action IN NUMBER) --3720018
2735: IS
2736: BEGIN
2737: IF PG_DEBUG in ('Y', 'C') THEN
2738: msc_sch_wb.atp_debug('Inside Update_Line_Item_Properties');
2739: msc_sch_wb.atp_debug('Update item properties');
2740: END IF;
2741: update mrp_atp_schedule_temp mast
2742: --bug 4078703: Populate atp_lead time as this lead time is required
2735: IS
2736: BEGIN
2737: IF PG_DEBUG in ('Y', 'C') THEN
2738: msc_sch_wb.atp_debug('Inside Update_Line_Item_Properties');
2739: msc_sch_wb.atp_debug('Update item properties');
2740: END IF;
2741: update mrp_atp_schedule_temp mast
2742: --bug 4078703: Populate atp_lead time as this lead time is required
2743: --on OM sales order lies to support misc. functionalities in inv and
2768: and (mast.source_organization_id is not null
2769: or mast.validation_org is not null);
2770:
2771: IF PG_DEBUG in ('Y', 'C') THEN
2772: msc_sch_wb.atp_debug('After updating item properties');
2773: msc_sch_wb.atp_debug('Rows updated := ' || SQL%ROWCOUNT);
2774: END IF;
2775:
2776: --3720018, this query will update old_source_organization_id and old_demand_class
2769: or mast.validation_org is not null);
2770:
2771: IF PG_DEBUG in ('Y', 'C') THEN
2772: msc_sch_wb.atp_debug('After updating item properties');
2773: msc_sch_wb.atp_debug('Rows updated := ' || SQL%ROWCOUNT);
2774: END IF;
2775:
2776: --3720018, this query will update old_source_organization_id and old_demand_class
2777: -- in case of atp inquiry for a scheduled line from sales order pad
2787: where mast.Old_Source_Organization_Id is NULL and
2788: mast.session_id = p_session_id;
2789: END IF;
2790: IF PG_DEBUG in ('Y', 'C') THEN
2791: msc_sch_wb.atp_debug('After updating old_source_organization_id and old_demand_class');
2792: msc_sch_wb.atp_debug('Rows updated := ' || SQL%ROWCOUNT);
2793: END IF;
2794: -- 3720018
2795:
2788: mast.session_id = p_session_id;
2789: END IF;
2790: IF PG_DEBUG in ('Y', 'C') THEN
2791: msc_sch_wb.atp_debug('After updating old_source_organization_id and old_demand_class');
2792: msc_sch_wb.atp_debug('Rows updated := ' || SQL%ROWCOUNT);
2793: END IF;
2794: -- 3720018
2795:
2796: END Update_Line_item_properties;
2806:
2807: begin
2808:
2809: IF PG_DEBUG in ('Y', 'C') THEN
2810: msc_sch_wb.atp_debug('enter Put_Sch_data_Request_Mode');
2811: END IF;
2812:
2813: l_user_id := FND_GLOBAL.USER_ID;
2814: l_count := p_atp_rec.inventory_item_id.count;
2817: --bug 3378648: delete only ATP relevent data
2818: and status_flag in (1,2, 99);
2819:
2820: IF PG_DEBUG in ('Y', 'C') THEN
2821: msc_sch_wb.atp_debug('***** After Deleting data for old session ****');
2822: END IF;
2823:
2824: l_sequence_number.Extend(l_count);
2825:
2823:
2824: l_sequence_number.Extend(l_count);
2825:
2826: IF PG_DEBUG in ('Y', 'C') THEN
2827: msc_sch_wb.atp_debug('After Extending Sequence array');
2828: END IF;
2829: IF nvl(p_atp_rec.calling_module(1), -1) in (-1, 724,-99) THEN
2830: FOR j in 1..l_count LOOP
2831: l_sequence_number(j) := j;
2830: FOR j in 1..l_count LOOP
2831: l_sequence_number(j) := j;
2832: END LOOP;
2833: IF PG_DEBUG in ('Y', 'C') THEN
2834: msc_sch_wb.atp_debug('l_sequence_number.count := ' || l_sequence_number.count);
2835: msc_sch_wb.atp_debug('l_count := ' || l_count);
2836: END IF;
2837: END IF;
2838:
2831: l_sequence_number(j) := j;
2832: END LOOP;
2833: IF PG_DEBUG in ('Y', 'C') THEN
2834: msc_sch_wb.atp_debug('l_sequence_number.count := ' || l_sequence_number.count);
2835: msc_sch_wb.atp_debug('l_count := ' || l_count);
2836: END IF;
2837: END IF;
2838:
2839:
3076: -- if source organzation_id is provided then atp_flag is inserted as null
3077: --If we have invalid org-item combination then atp_flag will remain null
3078: -- else it will be updated from atp_flag of nvl(src_ord, validation_org)
3079: IF PG_DEBUG in ('Y', 'C') THEN
3080: msc_sch_wb.atp_debug('After Inserting the data in request mode');
3081: msc_sch_wb.atp_debug('rows inserted = ' || SQL%ROWCOUNT);
3082: END IF;
3083:
3084: IF MSC_ATP_PVT.G_CALLING_MODULE <> 724 THEN
3077: --If we have invalid org-item combination then atp_flag will remain null
3078: -- else it will be updated from atp_flag of nvl(src_ord, validation_org)
3079: IF PG_DEBUG in ('Y', 'C') THEN
3080: msc_sch_wb.atp_debug('After Inserting the data in request mode');
3081: msc_sch_wb.atp_debug('rows inserted = ' || SQL%ROWCOUNT);
3082: END IF;
3083:
3084: IF MSC_ATP_PVT.G_CALLING_MODULE <> 724 THEN
3085: /*
3105: and (mast.source_organization_id is not null
3106: or mast.validation_org is not null);
3107:
3108: IF PG_DEBUG in ('Y', 'C') THEN
3109: msc_sch_wb.atp_debug('After updating item properties');
3110: msc_sch_wb.atp_debug('Rows updated := ' || SQL%ROWCOUNT);
3111: END IF;
3112: */
3113: MSC_ATP_UTILS.Update_Line_item_properties(p_session_id, p_atp_rec.action(1)); --3720018
3106: or mast.validation_org is not null);
3107:
3108: IF PG_DEBUG in ('Y', 'C') THEN
3109: msc_sch_wb.atp_debug('After updating item properties');
3110: msc_sch_wb.atp_debug('Rows updated := ' || SQL%ROWCOUNT);
3111: END IF;
3112: */
3113: MSC_ATP_UTILS.Update_Line_item_properties(p_session_id, p_atp_rec.action(1)); --3720018
3114: /*
3117: --add condition to fiter based on atp query
3118: --removing the condition below to suport OE flag for all modules.
3119: --and (MSC_ATP_PVT.G_CALLING_MODULE IN (-1, 660)) THEN
3120: IF PG_DEBUG in ('Y', 'C') THEN
3121: msc_sch_wb.atp_debug('Check if OE flag has been turned on or not');
3122: END IF;
3123: select count(*)
3124: into l_count
3125: from mrp_atp_schedule_temp mast
3128: and status_flag = 99
3129: and mast.OE_FLAG = 'Y';
3130:
3131: IF PG_DEBUG in ('Y', 'C') THEN
3132: msc_sch_wb.atp_debug('l_count for OE Flag := ' || l_count);
3133: END IF;
3134:
3135: IF l_count > 0 then
3136:
3151: and status_flag = 99
3152: and mast.OE_FLAG = 'Y';
3153:
3154: IF PG_DEBUG in ('Y', 'C') THEN
3155: msc_sch_wb.atp_debug('After updating OE Flag ');
3156: END IF;
3157:
3158: END IF;
3159:
3159:
3160: -- END IF; */
3161: ELSE
3162: IF PG_DEBUG in ('Y', 'C') THEN
3163: msc_sch_wb.atp_debug('Call from destination Instance. No need to update atp flags or oe flags');
3164: END IF;
3165: END IF;
3166: IF PG_DEBUG in ('Y', 'C') THEN
3167: msc_sch_wb.atp_debug('exit Put_Sch_data_Request_Mode');
3163: msc_sch_wb.atp_debug('Call from destination Instance. No need to update atp flags or oe flags');
3164: END IF;
3165: END IF;
3166: IF PG_DEBUG in ('Y', 'C') THEN
3167: msc_sch_wb.atp_debug('exit Put_Sch_data_Request_Mode');
3168: END IF;
3169: EXCEPTION
3170: WHEN OTHERS THEN
3171: msc_sch_wb.atp_debug('Something wrong in Put_Sch_data_Request_Mode');
3167: msc_sch_wb.atp_debug('exit Put_Sch_data_Request_Mode');
3168: END IF;
3169: EXCEPTION
3170: WHEN OTHERS THEN
3171: msc_sch_wb.atp_debug('Something wrong in Put_Sch_data_Request_Mode');
3172: msc_sch_wb.atp_debug('Sql Err := ' || sqlerrm);
3173:
3174: END Put_Sch_Data_Request_Mode;
3175:
3168: END IF;
3169: EXCEPTION
3170: WHEN OTHERS THEN
3171: msc_sch_wb.atp_debug('Something wrong in Put_Sch_data_Request_Mode');
3172: msc_sch_wb.atp_debug('Sql Err := ' || sqlerrm);
3173:
3174: END Put_Sch_Data_Request_Mode;
3175:
3176: Procedure Put_Sch_data_result_mode(p_atp_rec IN MRP_ATP_PUB.atp_rec_typ,
3202: BEGIN
3203:
3204:
3205: IF PG_DEBUG in ('Y', 'C') THEN
3206: msc_sch_wb.atp_debug('enter Put_Sch_data_result_mode');
3207: msc_sch_wb.atp_debug('G_INCLUDED_ITEM_IS_PRESENT :=' || MSC_ATP_CTO.G_INCLUDED_ITEM_IS_PRESENT);
3208: END IF;
3209:
3210: -- bug 2974324. Set l_status_flag to 2 here.
3203:
3204:
3205: IF PG_DEBUG in ('Y', 'C') THEN
3206: msc_sch_wb.atp_debug('enter Put_Sch_data_result_mode');
3207: msc_sch_wb.atp_debug('G_INCLUDED_ITEM_IS_PRESENT :=' || MSC_ATP_CTO.G_INCLUDED_ITEM_IS_PRESENT);
3208: END IF;
3209:
3210: -- bug 2974324. Set l_status_flag to 2 here.
3211: l_status_flag := SYS_NO;
3211: l_status_flag := SYS_NO;
3212: l_count := p_atp_rec.inventory_item_id.count;
3213:
3214:
3215: msc_sch_wb.atp_debug('l_count := '|| l_count);
3216: /*l_sequence_number.extend(l_count);
3217: FOR j in 1..l_count LOOP
3218: l_sequence_number(j) := j;
3219: END LOOP; */
3217: FOR j in 1..l_count LOOP
3218: l_sequence_number(j) := j;
3219: END LOOP; */
3220: IF PG_DEBUG in ('Y', 'C') THEN
3221: msc_sch_wb.atp_debug(' insert data for Call from other modules');
3222: FOR j in 1..l_count LOOP
3223: msc_sch_wb.atp_debug('j');
3224: msc_sch_wb.atp_debug('Identifier := ' || p_atp_rec.identifier(j));
3225: msc_sch_wb.atp_debug('Mandatory flag := ' || p_atp_rec.mandatory_item_flag(j));
3219: END LOOP; */
3220: IF PG_DEBUG in ('Y', 'C') THEN
3221: msc_sch_wb.atp_debug(' insert data for Call from other modules');
3222: FOR j in 1..l_count LOOP
3223: msc_sch_wb.atp_debug('j');
3224: msc_sch_wb.atp_debug('Identifier := ' || p_atp_rec.identifier(j));
3225: msc_sch_wb.atp_debug('Mandatory flag := ' || p_atp_rec.mandatory_item_flag(j));
3226: msc_sch_wb.atp_debug('sequence number := ' || p_atp_rec.sequence_number(j));
3227: msc_sch_wb.atp_debug('atp_lead_time := ' || p_atp_rec.atp_lead_time(j));
3220: IF PG_DEBUG in ('Y', 'C') THEN
3221: msc_sch_wb.atp_debug(' insert data for Call from other modules');
3222: FOR j in 1..l_count LOOP
3223: msc_sch_wb.atp_debug('j');
3224: msc_sch_wb.atp_debug('Identifier := ' || p_atp_rec.identifier(j));
3225: msc_sch_wb.atp_debug('Mandatory flag := ' || p_atp_rec.mandatory_item_flag(j));
3226: msc_sch_wb.atp_debug('sequence number := ' || p_atp_rec.sequence_number(j));
3227: msc_sch_wb.atp_debug('atp_lead_time := ' || p_atp_rec.atp_lead_time(j));
3228:
3221: msc_sch_wb.atp_debug(' insert data for Call from other modules');
3222: FOR j in 1..l_count LOOP
3223: msc_sch_wb.atp_debug('j');
3224: msc_sch_wb.atp_debug('Identifier := ' || p_atp_rec.identifier(j));
3225: msc_sch_wb.atp_debug('Mandatory flag := ' || p_atp_rec.mandatory_item_flag(j));
3226: msc_sch_wb.atp_debug('sequence number := ' || p_atp_rec.sequence_number(j));
3227: msc_sch_wb.atp_debug('atp_lead_time := ' || p_atp_rec.atp_lead_time(j));
3228:
3229: END LOOP;
3222: FOR j in 1..l_count LOOP
3223: msc_sch_wb.atp_debug('j');
3224: msc_sch_wb.atp_debug('Identifier := ' || p_atp_rec.identifier(j));
3225: msc_sch_wb.atp_debug('Mandatory flag := ' || p_atp_rec.mandatory_item_flag(j));
3226: msc_sch_wb.atp_debug('sequence number := ' || p_atp_rec.sequence_number(j));
3227: msc_sch_wb.atp_debug('atp_lead_time := ' || p_atp_rec.atp_lead_time(j));
3228:
3229: END LOOP;
3230: END IF;
3223: msc_sch_wb.atp_debug('j');
3224: msc_sch_wb.atp_debug('Identifier := ' || p_atp_rec.identifier(j));
3225: msc_sch_wb.atp_debug('Mandatory flag := ' || p_atp_rec.mandatory_item_flag(j));
3226: msc_sch_wb.atp_debug('sequence number := ' || p_atp_rec.sequence_number(j));
3227: msc_sch_wb.atp_debug('atp_lead_time := ' || p_atp_rec.atp_lead_time(j));
3228:
3229: END LOOP;
3230: END IF;
3231:
3338: NVL(p_atp_rec.source_organization_id(j), -1);
3339: --and sequence_number = p_atp_rec.sequence_number(j);
3340: --add condition for inv id and seq id
3341: IF PG_DEBUG in ('Y', 'C') THEN
3342: msc_sch_wb.atp_debug('After Updating the table');
3343: msc_sch_wb.atp_debug('Rows Updated := ' || SQL%ROWCOUNT);
3344: END IF;
3345:
3346: IF MSC_ATP_CTO.G_INCLUDED_ITEM_IS_PRESENT =1 THEN
3339: --and sequence_number = p_atp_rec.sequence_number(j);
3340: --add condition for inv id and seq id
3341: IF PG_DEBUG in ('Y', 'C') THEN
3342: msc_sch_wb.atp_debug('After Updating the table');
3343: msc_sch_wb.atp_debug('Rows Updated := ' || SQL%ROWCOUNT);
3344: END IF;
3345:
3346: IF MSC_ATP_CTO.G_INCLUDED_ITEM_IS_PRESENT =1 THEN
3347: ---included items are present. Insert them into table
3345:
3346: IF MSC_ATP_CTO.G_INCLUDED_ITEM_IS_PRESENT =1 THEN
3347: ---included items are present. Insert them into table
3348: IF PG_DEBUG in ('Y', 'C') THEN
3349: msc_sch_wb.atp_debug('Included Items are present');
3350: END IF;
3351: --couldn't find a wayt to insert data selectively from
3352: -- pl/sql table to temp table. Therefore, copying the records for the time being.
3353: FOR j in 1..p_atp_rec.inventory_item_id.count LOOP
3352: -- pl/sql table to temp table. Therefore, copying the records for the time being.
3353: FOR j in 1..p_atp_rec.inventory_item_id.count LOOP
3354: IF NVL(p_atp_rec.mandatory_item_flag(j), 2) = 1 THEN
3355: IF PG_DEBUG in ('Y', 'C') THEN
3356: msc_sch_wb.atp_debug('Add Included item for line := ' || j);
3357: END IF;
3358: MSC_SATP_FUNC.Assign_Atp_Input_Rec(p_atp_rec,
3359: j,
3360: l_atp_rec,
3362: END IF;
3363: END LOOP;
3364:
3365: IF PG_DEBUG in ('Y', 'C') THEN
3366: msc_sch_wb.atp_debug('Number of included items := ' || l_atp_rec.inventory_item_id.count);
3367: END IF;
3368: l_count := l_atp_rec.inventory_item_id.count;
3369: FORALL j in 1..l_count
3370: INSERT INTO mrp_atp_schedule_temp
3520: l_atp_rec.first_valid_ship_arrival_date(j)
3521: );
3522: --where NVL(p_atp_rec.mandatory_item_flag(j), 2) = 1;
3523: IF PG_DEBUG in ('Y', 'C') THEN
3524: msc_sch_wb.atp_debug('Number of Rows Inserted := ' || SQL%ROWCOUNT);
3525: END IF;
3526: END IF; --- IF MSC_ATP_CTO.G_INCLUDED_ITEM_IS_PRESENT =1 THEN
3527:
3528:
3533: --For global ATP we get multiple lines with same line_id. as a result update was failing.
3534: IF MSC_ATP_CTO.G_MODEL_IS_PRESENT = 1 and p_atp_rec.action(1) <> 100 THEN
3535:
3536: IF PG_DEBUG in ('Y', 'C') THEN
3537: msc_sch_wb.atp_debug('Model is present, update model component data');
3538: END IF;
3539: --bug 3295956: cascade ship method and delivery lead time from model to components
3540: -- Cascade info from model to components based on cascade_model_info_to_comp attribute. This is for istore.
3541: /* Update mrp_atp_schedule_temp mast_1
3561: where mast_1.session_id = p_session_id
3562: and mast_1.ato_model_line_id is not null
3563: and mast_1.order_line_id <> mast_1.ato_model_line_id;
3564: IF PG_DEBUG in ('Y', 'C') THEN
3565: msc_sch_wb.atp_debug('Number of Rows updated := ' || SQL%ROWCOUNT);
3566: END IF;
3567: */
3568:
3569: ---update plan_id on msc_cto_bom and msc_cto_sources for 24x7
3575: )
3576: where mcb.session_id = p_session_id;
3577:
3578: IF PG_DEBUG in ('Y', 'C') THEN
3579: msc_sch_wb.atp_debug('Number of Rows updated n msc_cto_bom := ' || SQL%ROWCOUNT);
3580: END IF;
3581:
3582: update msc_cto_sources mcs
3583: set plan_id = (select plan_id
3587: )
3588: where mcs.session_id = p_session_id;
3589:
3590: IF PG_DEBUG in ('Y', 'C') THEN
3591: msc_sch_wb.atp_debug('Number of Rows updated in msc_cto_sources := ' || SQL%ROWCOUNT);
3592: END IF;
3593: END IF;
3594:
3595:
3600: RESULTS_MODE);
3601: END IF;
3602:
3603: IF PG_DEBUG in ('Y', 'C') THEN
3604: msc_sch_wb.atp_debug('exit Put_Sch_data_Result_Mode');
3605: END IF;
3606:
3607: END Put_Sch_Data_Result_Mode;
3608:
3619: l_source_dblink varchar2(128);
3620: BEGIN
3621:
3622: IF PG_DEBUG in ('Y', 'C') THEN
3623: msc_sch_wb.atp_debug('enter Transfer_Scheduling_data');
3624: END IF;
3625:
3626: IF p_mode = RESULTS_MODE THEN
3627: l_status_flag := 2;
3637: l_dest_dblink := '@' || p_dblink;
3638: END IF;
3639:
3640: IF PG_DEBUG in ('Y', 'C') THEN
3641: msc_sch_wb.atp_debug('Before deleting old data');
3642: END IF;
3643:
3644: /* bug 3378649: delete any data locally
3645: --delete any old data
3651:
3652: EXECUTE IMMEDIATE l_sql_stmt USING p_session_id;
3653: ELSE
3654: IF PG_DEBUG in ('Y', 'C') THEN
3655: msc_sch_wb.atp_debug('deleting old data in local table');
3656: END IF;
3657:
3658: DELETE FROM MRP_ATP_SCHEDULE_TEMP
3659: WHERE session_id = p_session_id
3661: END IF;
3662: */
3663:
3664: IF PG_DEBUG in ('Y', 'C') THEN
3665: msc_sch_wb.atp_debug('Number of rows deleted := ' || SQL%ROWCOUNT);
3666: msc_sch_wb.atp_debug('After deleting old data');
3667: msc_sch_wb.atp_debug('l_status_flag := ' || l_status_flag);
3668: msc_sch_wb.atp_debug('l_tnsfer_sts_flag := ' || l_tnsfer_sts_flag);
3669: END IF;
3662: */
3663:
3664: IF PG_DEBUG in ('Y', 'C') THEN
3665: msc_sch_wb.atp_debug('Number of rows deleted := ' || SQL%ROWCOUNT);
3666: msc_sch_wb.atp_debug('After deleting old data');
3667: msc_sch_wb.atp_debug('l_status_flag := ' || l_status_flag);
3668: msc_sch_wb.atp_debug('l_tnsfer_sts_flag := ' || l_tnsfer_sts_flag);
3669: END IF;
3670:
3663:
3664: IF PG_DEBUG in ('Y', 'C') THEN
3665: msc_sch_wb.atp_debug('Number of rows deleted := ' || SQL%ROWCOUNT);
3666: msc_sch_wb.atp_debug('After deleting old data');
3667: msc_sch_wb.atp_debug('l_status_flag := ' || l_status_flag);
3668: msc_sch_wb.atp_debug('l_tnsfer_sts_flag := ' || l_tnsfer_sts_flag);
3669: END IF;
3670:
3671: l_sql_stmt :=
3664: IF PG_DEBUG in ('Y', 'C') THEN
3665: msc_sch_wb.atp_debug('Number of rows deleted := ' || SQL%ROWCOUNT);
3666: msc_sch_wb.atp_debug('After deleting old data');
3667: msc_sch_wb.atp_debug('l_status_flag := ' || l_status_flag);
3668: msc_sch_wb.atp_debug('l_tnsfer_sts_flag := ' || l_tnsfer_sts_flag);
3669: END IF;
3670:
3671: l_sql_stmt :=
3672: 'Insert into mrp_atp_schedule_temp' || L_source_DBLINK ||
3926: and status_flag = ' || l_tnsfer_sts_flag ;
3927:
3928:
3929: IF PG_DEBUG in ('Y', 'C') THEN
3930: msc_sch_wb.atp_debug('Transfer_Scheduling_data: ' || l_sql_stmt);
3931: END IF;
3932: EXECUTE IMMEDIATE l_sql_stmt USING p_session_id;
3933:
3934: IF PG_DEBUG in ('Y', 'C') THEN
3931: END IF;
3932: EXECUTE IMMEDIATE l_sql_stmt USING p_session_id;
3933:
3934: IF PG_DEBUG in ('Y', 'C') THEN
3935: msc_sch_wb.atp_debug('Rows Transfered: ' || SQL%ROWCOUNT);
3936: END IF;
3937:
3938:
3939: IF PG_DEBUG in ('Y', 'C') THEN
3936: END IF;
3937:
3938:
3939: IF PG_DEBUG in ('Y', 'C') THEN
3940: msc_sch_wb.atp_debug('exit Transfer_Scheduling_data');
3941: END IF;
3942: EXCEPTION
3943: WHEN OTHERS THEN
3944: IF PG_DEBUG in ('Y', 'C') THEN
3941: END IF;
3942: EXCEPTION
3943: WHEN OTHERS THEN
3944: IF PG_DEBUG in ('Y', 'C') THEN
3945: msc_sch_wb.atp_debug('Error Occured while transfering the data accros db link');
3946: msc_sch_wb.atp_debug('errro := ' ||SQLERRM);
3947: END IF;
3948: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3949:
3942: EXCEPTION
3943: WHEN OTHERS THEN
3944: IF PG_DEBUG in ('Y', 'C') THEN
3945: msc_sch_wb.atp_debug('Error Occured while transfering the data accros db link');
3946: msc_sch_wb.atp_debug('errro := ' ||SQLERRM);
3947: END IF;
3948: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3949:
3950: END Transfer_Scheduling_data;
3963: RETURN l_truncated_demand ;
3964: EXCEPTION
3965: WHEN OTHERS THEN
3966: IF PG_DEBUG in ('Y', 'C') THEN
3967: msc_sch_wb.atp_debug('Error in function Truncate_Demand: '||sqlerrm);
3968: END IF;
3969: END Truncate_Demand;
3970:
3971: