127:
128: END ADD_HEADER;
129:
130: --Procedure looks up for READYTOLOG records in jtf_fm_request_history_all. Calls api to move line records to jtf_fm_processed for this request_id and then creates an interaction string for the lines
131: PROCEDURE Log_Interaction_History(P_COMMIT IN VARCHAR2 := FND_API.G_FALSE,
132: p_server_id IN NUMBER,
133: x_request_id out nocopy NUMBER,
134: x_return_status out nocopy varchar2,
135: x_msg_count out nocopy number,
217: FND_MSG_PUB.Add;
218: END IF;
219:
220: -- Initialize API return status to success
221: x_return_status := FND_API.G_RET_STS_SUCCESS;
222:
223: l_spacechar := ' ';
224: l_quote := '"';
225:
239: JTF_FM_INT_REQUEST_PKG.move_request(l_header_rec.hist_req_id,l_log_interaction, l_return_status,l_msg_count,l_msg_data) ;
240:
241: EXCEPTION
242:
243: WHEN FND_API.G_EXC_ERROR THEN
244: ROLLBACK TO moverequest;
245:
246: x_request_id := l_header_rec.hist_req_id;
247: x_return_status := FND_API.g_ret_sts_error ;
243: WHEN FND_API.G_EXC_ERROR THEN
244: ROLLBACK TO moverequest;
245:
246: x_request_id := l_header_rec.hist_req_id;
247: x_return_status := FND_API.g_ret_sts_error ;
248: FND_MSG_PUB.Count_AND_Get
249: ( p_count => x_msg_count,
250: p_data => x_msg_data,
251: p_encoded => FND_API.G_FALSE
247: x_return_status := FND_API.g_ret_sts_error ;
248: FND_MSG_PUB.Count_AND_Get
249: ( p_count => x_msg_count,
250: p_data => x_msg_data,
251: p_encoded => FND_API.G_FALSE
252: );
253:
254: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
255: ROLLBACK TO moverequest;
250: p_data => x_msg_data,
251: p_encoded => FND_API.G_FALSE
252: );
253:
254: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
255: ROLLBACK TO moverequest;
256:
257: x_request_id := l_header_rec.hist_req_id;
258: x_return_status := FND_API.g_ret_sts_unexp_error ;
254: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
255: ROLLBACK TO moverequest;
256:
257: x_request_id := l_header_rec.hist_req_id;
258: x_return_status := FND_API.g_ret_sts_unexp_error ;
259: FND_MSG_PUB.Count_AND_Get
260: ( p_count => x_msg_count,
261: p_data => x_msg_data,
262: p_encoded => FND_API.G_FALSE
258: x_return_status := FND_API.g_ret_sts_unexp_error ;
259: FND_MSG_PUB.Count_AND_Get
260: ( p_count => x_msg_count,
261: p_data => x_msg_data,
262: p_encoded => FND_API.G_FALSE
263: );
264:
265: WHEN OTHERS THEN
266: ROLLBACK TO moverequest;
264:
265: WHEN OTHERS THEN
266: ROLLBACK TO moverequest;
267:
268: x_return_status := FND_API.g_ret_sts_unexp_error ;
269: IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR )
270: THEN
271: null;
272: END IF;
272: END IF;
273: FND_MSG_PUB.Count_AND_Get
274: ( p_count => x_msg_count,
275: p_data => x_msg_data,
276: p_encoded => FND_API.G_FALSE
277: );
278:
279:
280: end;
292: if resource_cur%NOTFOUND then
293: raise RESOURCE_NOT_FOUND_EXCEPTION;
294: end if;
295:
296: if ((upper(l_log_interaction) = 'YES') AND (l_return_status = FND_API.G_RET_STS_SUCCESS ))then
297: dbms_lob.createtemporary(l_interaction_clob, TRUE,DBMS_LOB.SESSION);
298: dbms_lob.open(l_interaction_clob, dbms_lob.lob_readwrite);
299:
300: --Header
375: end if;
376:
377: end loop;
378:
379: ELSIF(l_return_status = FND_API.G_RET_STS_ERROR) THEN
380: RAISE FND_API.G_EXC_ERROR;
381: ELSE
382: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
383: END IF;
376:
377: end loop;
378:
379: ELSIF(l_return_status = FND_API.G_RET_STS_ERROR) THEN
380: RAISE FND_API.G_EXC_ERROR;
381: ELSE
382: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
383: END IF;
384:
378:
379: ELSIF(l_return_status = FND_API.G_RET_STS_ERROR) THEN
380: RAISE FND_API.G_EXC_ERROR;
381: ELSE
382: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
383: END IF;
384:
385: --Enqueue for interaction created from less than 1000 records
386: if l_counter < TOTAL_INTERACTIONS THEN
415: Update_history(l_header_rec.hist_req_id, 'FAILURE');
416: end if;
417:
418:
419: IF p_commit = FND_API.g_true then
420: COMMIT WORK;
421: END IF;
422:
423: x_return_status := 'S';
425:
426: FND_MSG_PUB.Count_AND_Get
427: ( p_count => x_msg_count,
428: p_data => x_msg_data,
429: p_encoded => FND_API.G_FALSE );
430:
431:
432: EXCEPTION
433:
440: Update_history(l_header_rec.hist_req_id, 'IHFAILED');
441: commit;
442:
443: x_request_id := l_header_rec.hist_req_id;
444: x_return_status := FND_API.g_ret_sts_error ;
445: x_msg_count := 1;
446: x_msg_data := 'No valid resource id for this user';
447:
448: WHEN FND_API.G_EXC_ERROR THEN
444: x_return_status := FND_API.g_ret_sts_error ;
445: x_msg_count := 1;
446: x_msg_data := 'No valid resource id for this user';
447:
448: WHEN FND_API.G_EXC_ERROR THEN
449: ROLLBACK TO Log_interactionrequest;
450:
451: --remove header from the jtf_fm_status_all table
452: Remove_from_status(l_header_rec.hist_req_id);
454: Update_history(l_header_rec.hist_req_id, 'IHFAILED');
455: commit;
456:
457: x_request_id := l_header_rec.hist_req_id;
458: x_return_status := FND_API.g_ret_sts_error ;
459: FND_MSG_PUB.Count_AND_Get
460: ( p_count => x_msg_count,
461: p_data => x_msg_data,
462: p_encoded => FND_API.G_FALSE
458: x_return_status := FND_API.g_ret_sts_error ;
459: FND_MSG_PUB.Count_AND_Get
460: ( p_count => x_msg_count,
461: p_data => x_msg_data,
462: p_encoded => FND_API.G_FALSE
463: );
464:
465: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
466: ROLLBACK TO Log_interactionrequest;
461: p_data => x_msg_data,
462: p_encoded => FND_API.G_FALSE
463: );
464:
465: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
466: ROLLBACK TO Log_interactionrequest;
467:
468: --remove header from the jtf_fm_status_all table
469: Remove_from_status(l_header_rec.hist_req_id);
471: Update_history(l_header_rec.hist_req_id, 'IHFAILED');
472: commit;
473:
474: x_request_id := l_header_rec.hist_req_id;
475: x_return_status := FND_API.g_ret_sts_unexp_error ;
476: FND_MSG_PUB.Count_AND_Get
477: ( p_count => x_msg_count,
478: p_data => x_msg_data,
479: p_encoded => FND_API.G_FALSE
475: x_return_status := FND_API.g_ret_sts_unexp_error ;
476: FND_MSG_PUB.Count_AND_Get
477: ( p_count => x_msg_count,
478: p_data => x_msg_data,
479: p_encoded => FND_API.G_FALSE
480: );
481:
482: WHEN OTHERS THEN
483: ROLLBACK TO Log_interactionrequest;
487:
488: Update_history(l_header_rec.hist_req_id, 'IHFAILED');
489: commit;
490:
491: x_return_status := FND_API.g_ret_sts_unexp_error ;
492: IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR )
493: THEN
494: null;
495: END IF;
495: END IF;
496: FND_MSG_PUB.Count_AND_Get
497: ( p_count => x_msg_count,
498: p_data => x_msg_data,
499: p_encoded => FND_API.G_FALSE
500: );
501:
502: END Log_Interaction_History;
503: