12:
13: TYPE type_cursor IS REF CURSOR;
14: so_cursor type_cursor;
15: sql_stmt varchar2(2000);
16: x_return_status varchar2(1) :=FND_API.G_RET_STS_SUCCESS;
17: x_crm_return_status varchar2(1) :=FND_API.G_RET_STS_SUCCESS;
18: a number;
19: p_so_table OE_SCHEDULE_GRP.Sch_Tbl_Type;
20: p_crm_so_table AHL_LTP_ASCP_ORDERS_PVT.Sched_Orders_Tbl;
13: TYPE type_cursor IS REF CURSOR;
14: so_cursor type_cursor;
15: sql_stmt varchar2(2000);
16: x_return_status varchar2(1) :=FND_API.G_RET_STS_SUCCESS;
17: x_crm_return_status varchar2(1) :=FND_API.G_RET_STS_SUCCESS;
18: a number;
19: p_so_table OE_SCHEDULE_GRP.Sch_Tbl_Type;
20: p_crm_so_table AHL_LTP_ASCP_ORDERS_PVT.Sched_Orders_Tbl;
21:
186:
187: IF p_crm_so_table.count >0 then
188: AHL_LTP_ASCP_ORDERS_PVT.Update_Scheduling_Results(
189: 1.0,
190: FND_API.g_false,
191: FND_API.g_false,
192: FND_API.g_valid_level_full,
193: p_crm_so_table,
194: x_crm_return_status);
187: IF p_crm_so_table.count >0 then
188: AHL_LTP_ASCP_ORDERS_PVT.Update_Scheduling_Results(
189: 1.0,
190: FND_API.g_false,
191: FND_API.g_false,
192: FND_API.g_valid_level_full,
193: p_crm_so_table,
194: x_crm_return_status);
195: commit;
188: AHL_LTP_ASCP_ORDERS_PVT.Update_Scheduling_Results(
189: 1.0,
190: FND_API.g_false,
191: FND_API.g_false,
192: FND_API.g_valid_level_full,
193: p_crm_so_table,
194: x_crm_return_status);
195: commit;
196: END IF;
197:
198:
199: -- send workflow notification for the failed so
200: for a in 1..so_count loop
201: if nvl(p_so_table(a).x_return_status, FND_API.G_RET_STS_ERROR) <>
202: FND_API.G_RET_STS_SUCCESS or
203: p_so_table(a).x_override_atp_date_code = 'Y' then
204: sql_stmt:=
205: ' update msc_sales_order_interface'||p_dblink||
198:
199: -- send workflow notification for the failed so
200: for a in 1..so_count loop
201: if nvl(p_so_table(a).x_return_status, FND_API.G_RET_STS_ERROR) <>
202: FND_API.G_RET_STS_SUCCESS or
203: p_so_table(a).x_override_atp_date_code = 'Y' then
204: sql_stmt:=
205: ' update msc_sales_order_interface'||p_dblink||
206: ' set return_status = :p_status '||
206: ' set return_status = :p_status '||
207: ' where sr_instance_id = :p_instance_id '||
208: ' and batch_id = :p_batch_id '||
209: ' and line_id = :p_line_id ';
210: if nvl(p_so_table(a).x_return_status, FND_API.G_RET_STS_ERROR) <>
211: FND_API.G_RET_STS_SUCCESS then
212: FND_FILE.PUT_LINE(FND_FILE.LOG,'update fails for line id '||p_so_table(a).line_id||', om return status ='||p_so_table(a).x_return_status);
213: p_status := 2; -- fails
214: retcode :=2;
207: ' where sr_instance_id = :p_instance_id '||
208: ' and batch_id = :p_batch_id '||
209: ' and line_id = :p_line_id ';
210: if nvl(p_so_table(a).x_return_status, FND_API.G_RET_STS_ERROR) <>
211: FND_API.G_RET_STS_SUCCESS then
212: FND_FILE.PUT_LINE(FND_FILE.LOG,'update fails for line id '||p_so_table(a).line_id||', om return status ='||p_so_table(a).x_return_status);
213: p_status := 2; -- fails
214: retcode :=2;
215: else
224: end if;
225:
226: end loop;
227:
228: IF nvl(x_crm_return_status, FND_API.G_RET_STS_ERROR) <>
229: FND_API.G_RET_STS_SUCCESS THEN
230: p_status := 2; -- fails
231: retcode :=2;
232: sql_stmt:=
225:
226: end loop;
227:
228: IF nvl(x_crm_return_status, FND_API.G_RET_STS_ERROR) <>
229: FND_API.G_RET_STS_SUCCESS THEN
230: p_status := 2; -- fails
231: retcode :=2;
232: sql_stmt:=
233: ' update msc_sales_order_interface'||p_dblink||