17: -- 7. Raises an exception if the access name is null
18: ---------------------------------------------------------------------
19: PROCEDURE save_display_context(
20: p_api_version IN NUMBER,
21: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
22: p_commit IN VARCHAR2 := FND_API.g_false,
23: x_return_status OUT VARCHAR2,
24: x_msg_count OUT NUMBER,
25: x_msg_data OUT VARCHAR2,
18: ---------------------------------------------------------------------
19: PROCEDURE save_display_context(
20: p_api_version IN NUMBER,
21: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
22: p_commit IN VARCHAR2 := FND_API.g_false,
23: x_return_status OUT VARCHAR2,
24: x_msg_count OUT NUMBER,
25: x_msg_data OUT VARCHAR2,
26: p_display_context_rec IN OUT DISPLAY_CONTEXT_REC_TYPE
44:
45: --------------------- initialize -----------------------
46: SAVEPOINT save_display_context;
47:
48: IF NOT FND_API.compatible_api_call(
49: g_api_version,
50: p_api_version,
51: l_api_name,
52: g_pkg_name
50: p_api_version,
51: l_api_name,
52: g_pkg_name
53: ) THEN
54: RAISE FND_API.g_exc_unexpected_error;
55: END IF;
56:
57:
58: IF FND_API.to_boolean(p_init_msg_list) THEN
54: RAISE FND_API.g_exc_unexpected_error;
55: END IF;
56:
57:
58: IF FND_API.to_boolean(p_init_msg_list) THEN
59: FND_MSG_PUB.initialize;
60: END IF;
61:
62:
59: FND_MSG_PUB.initialize;
60: END IF;
61:
62:
63: x_return_status := FND_API.G_RET_STS_SUCCESS;
64:
65: -- Check if the context type is valid
66: IF jtf_dspmgrvalidation_grp.check_valid_context_type(p_display_context_rec.context_type) = false
67: then
64:
65: -- Check if the context type is valid
66: IF jtf_dspmgrvalidation_grp.check_valid_context_type(p_display_context_rec.context_type) = false
67: then
68: raise FND_API.g_exc_error;
69: end if;
70:
71:
72: --- Check if the context_id exists if not null
77: if jtf_dspmgrvalidation_grp.check_context_exists(p_display_context_rec.context_id,
78: p_display_context_rec.context_type,
79: p_display_context_rec.Object_version_Number)
80: = false then
81: raise FND_API.g_exc_error;
82: end if;
83:
84: l_operation_type:='UPDATE';
85:
100: p_display_context_rec.context_type,
101: p_display_context_rec.context_id)
102: then
103: ---dbms_output.put_line('Access name already exists' );
104: raise FND_API.g_exc_error;
105: end if;
106: ---dbms_output.put_line('Passed unique Access name ' );
107: else
108: ---dbms_output.put_line('Access name cannot be null' );
111:
112:
113: --- Check if the deliverable id exists if deliverable is not null, else ignore.
114: IF p_display_context_rec.default_deliverable_id is not null and
115: p_display_context_rec.default_deliverable_id <> FND_API.g_miss_num
116: then
117: IF jtf_dspmgrvalidation_grp.check_deliverable_type_exists(p_display_context_rec.Default_deliverable_id ,
118: p_display_context_rec.context_type)
119: then
118: p_display_context_rec.context_type)
119: then
120: l_deliverable_id := p_display_context_rec.Default_deliverable_id;
121: else
122: raise FND_API.g_exc_error;
123: END IF;
124: end if;
125:
126:
218: --- Update the TL table
219:
220: update JTF_DSP_CONTEXT_TL set
221: NAME = decode( p_display_context_rec.display_name,
222: FND_API.G_MISS_CHAR, NAME, p_display_context_rec.display_name),
223: DESCRIPTION = decode( p_display_context_rec.description,
224: FND_API.G_MISS_CHAR, DESCRIPTION, p_display_context_rec.description),
225: LAST_UPDATE_DATE = SYSDATE,
226: LAST_UPDATED_BY = FND_GLOBAL.user_id,
220: update JTF_DSP_CONTEXT_TL set
221: NAME = decode( p_display_context_rec.display_name,
222: FND_API.G_MISS_CHAR, NAME, p_display_context_rec.display_name),
223: DESCRIPTION = decode( p_display_context_rec.description,
224: FND_API.G_MISS_CHAR, DESCRIPTION, p_display_context_rec.description),
225: LAST_UPDATE_DATE = SYSDATE,
226: LAST_UPDATED_BY = FND_GLOBAL.user_id,
227: LAST_UPDATE_LOGIN = FND_GLOBAL.user_id,
228: OBJECT_VERSION_NUMBER= p_display_context_rec.object_version_number +1 ,
234:
235: ---dbms_output.put_line('Operation is successful ' );
236: --- Check if the caller requested to commit ,
237: --- If p_commit set to true, commit the transaction
238: IF FND_API.to_boolean(p_commit) THEN
239: COMMIT;
240: END IF;
241:
242: x_return_status := FND_API.G_RET_STS_SUCCESS;
238: IF FND_API.to_boolean(p_commit) THEN
239: COMMIT;
240: END IF;
241:
242: x_return_status := FND_API.G_RET_STS_SUCCESS;
243:
244: FND_MSG_PUB.count_and_get(
245: p_encoded => FND_API.g_false,
246: p_count => x_msg_count,
241:
242: x_return_status := FND_API.G_RET_STS_SUCCESS;
243:
244: FND_MSG_PUB.count_and_get(
245: p_encoded => FND_API.g_false,
246: p_count => x_msg_count,
247: p_data => x_msg_data
248: );
249:
248: );
249:
250: EXCEPTION
251:
252: WHEN FND_API.g_exc_error THEN
253: ROLLBACK TO save_display_context;
254: x_return_status := FND_API.g_ret_sts_error;
255: FND_MSG_PUB.count_and_get(
256: p_encoded => FND_API.g_false,
250: EXCEPTION
251:
252: WHEN FND_API.g_exc_error THEN
253: ROLLBACK TO save_display_context;
254: x_return_status := FND_API.g_ret_sts_error;
255: FND_MSG_PUB.count_and_get(
256: p_encoded => FND_API.g_false,
257: p_count => x_msg_count,
258: p_data => x_msg_data
252: WHEN FND_API.g_exc_error THEN
253: ROLLBACK TO save_display_context;
254: x_return_status := FND_API.g_ret_sts_error;
255: FND_MSG_PUB.count_and_get(
256: p_encoded => FND_API.g_false,
257: p_count => x_msg_count,
258: p_data => x_msg_data
259: );
260:
257: p_count => x_msg_count,
258: p_data => x_msg_data
259: );
260:
261: WHEN FND_API.g_exc_unexpected_error THEN
262: ROLLBACK TO save_display_context;
263: x_return_status := FND_API.g_ret_sts_unexp_error ;
264: FND_MSG_PUB.count_and_get(
265: p_encoded => FND_API.g_false,
259: );
260:
261: WHEN FND_API.g_exc_unexpected_error THEN
262: ROLLBACK TO save_display_context;
263: x_return_status := FND_API.g_ret_sts_unexp_error ;
264: FND_MSG_PUB.count_and_get(
265: p_encoded => FND_API.g_false,
266: p_count => x_msg_count,
267: p_data => x_msg_data
261: WHEN FND_API.g_exc_unexpected_error THEN
262: ROLLBACK TO save_display_context;
263: x_return_status := FND_API.g_ret_sts_unexp_error ;
264: FND_MSG_PUB.count_and_get(
265: p_encoded => FND_API.g_false,
266: p_count => x_msg_count,
267: p_data => x_msg_data
268: );
269:
268: );
269:
270: WHEN jtf_dspmgrvalidation_grp.context_accname_req_exception THEN
271: ROLLBACK TO save_display_context;
272: x_return_status := FND_API.g_ret_sts_error;
273: FND_MESSAGE.set_name('JTF','JTF_DSP_CONTEXT_ACCNAME_REQ');
274: FND_MSG_PUB.ADD;
275: FND_MSG_PUB.count_and_get(
276: p_encoded => FND_API.g_false,
272: x_return_status := FND_API.g_ret_sts_error;
273: FND_MESSAGE.set_name('JTF','JTF_DSP_CONTEXT_ACCNAME_REQ');
274: FND_MSG_PUB.ADD;
275: FND_MSG_PUB.count_and_get(
276: p_encoded => FND_API.g_false,
277: p_count => x_msg_count,
278: p_data => x_msg_data
279: );
280:
279: );
280:
281: WHEN OTHERS THEN
282: ROLLBACK TO save_display_context;
283: x_return_status := FND_API.g_ret_sts_unexp_error ;
284: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
285: THEN
286: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
287: END IF;
285: THEN
286: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
287: END IF;
288: FND_MSG_PUB.count_and_get(
289: p_encoded => FND_API.g_false,
290: p_count => x_msg_count,
291: p_data => x_msg_data
292: );
293:
304: -- from TL tables
305: --------------------------------------------------------------------
306: PROCEDURE delete_display_context(
307: p_api_version IN NUMBER,
308: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
309: p_commit IN VARCHAR2 := FND_API.g_false,
310: x_return_status OUT VARCHAR2,
311: x_msg_count OUT NUMBER,
312: x_msg_data OUT VARCHAR2,
305: --------------------------------------------------------------------
306: PROCEDURE delete_display_context(
307: p_api_version IN NUMBER,
308: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
309: p_commit IN VARCHAR2 := FND_API.g_false,
310: x_return_status OUT VARCHAR2,
311: x_msg_count OUT NUMBER,
312: x_msg_data OUT VARCHAR2,
313: p_display_context_rec IN OUT DISPLAY_CONTEXT_REC_TYPE
321:
322: --------------------- initialize -----------------------
323: SAVEPOINT delete_display_context;
324:
325: IF NOT FND_API.compatible_api_call(
326: g_api_version,
327: p_api_version,
328: l_api_name,
329: g_pkg_name
327: p_api_version,
328: l_api_name,
329: g_pkg_name
330: ) THEN
331: RAISE FND_API.g_exc_unexpected_error;
332: END IF;
333:
334: IF FND_API.to_boolean(p_init_msg_list) THEN
335: FND_MSG_PUB.initialize;
330: ) THEN
331: RAISE FND_API.g_exc_unexpected_error;
332: END IF;
333:
334: IF FND_API.to_boolean(p_init_msg_list) THEN
335: FND_MSG_PUB.initialize;
336: END IF;
337:
338: x_return_status := FND_API.G_RET_STS_SUCCESS;
334: IF FND_API.to_boolean(p_init_msg_list) THEN
335: FND_MSG_PUB.initialize;
336: END IF;
337:
338: x_return_status := FND_API.G_RET_STS_SUCCESS;
339:
340: --- Check if the context_id exists
341: IF p_display_context_rec.context_id <> FND_API.g_miss_num
342: and p_display_context_rec.context_id is not null
337:
338: x_return_status := FND_API.G_RET_STS_SUCCESS;
339:
340: --- Check if the context_id exists
341: IF p_display_context_rec.context_id <> FND_API.g_miss_num
342: and p_display_context_rec.context_id is not null
343: THEN
344:
345: -- Check if the context_id is valid
346: if jtf_dspmgrvalidation_grp.check_context_exists(p_display_context_rec.context_id,
347: p_display_context_rec.context_type,
348: p_display_context_rec.Object_version_Number)
349: = false then
350: raise FND_API.g_exc_error;
351: end if;
352:
353: DELETE FROM JTF_DSP_CONTEXT_B WHERE
354: CONTEXT_ID = p_display_context_rec.context_id AND
364: JTF_LogicalContent_GRP.delete_context(p_display_context_rec.context_id);
365:
366: JTF_DSP_SECTION_GRP.Update_Dsp_Context_To_Null(
367: p_api_version,
368: FND_API.g_false,
369: FND_API.g_false,
370: FND_API.G_VALID_LEVEL_FULL,
371: p_display_context_rec.context_id,
372: x_return_status,
365:
366: JTF_DSP_SECTION_GRP.Update_Dsp_Context_To_Null(
367: p_api_version,
368: FND_API.g_false,
369: FND_API.g_false,
370: FND_API.G_VALID_LEVEL_FULL,
371: p_display_context_rec.context_id,
372: x_return_status,
373: x_msg_count,
366: JTF_DSP_SECTION_GRP.Update_Dsp_Context_To_Null(
367: p_api_version,
368: FND_API.g_false,
369: FND_API.g_false,
370: FND_API.G_VALID_LEVEL_FULL,
371: p_display_context_rec.context_id,
372: x_return_status,
373: x_msg_count,
374: x_msg_data
376:
377: else
378: FND_MESSAGE.set_name('JTF','JTF_DSP_CONTEXT_ID_REQ');
379: FND_MSG_PUB.ADD;
380: raise FND_API.g_exc_error;
381: END IF;
382:
383:
384: x_return_status := FND_API.G_RET_STS_SUCCESS;
380: raise FND_API.g_exc_error;
381: END IF;
382:
383:
384: x_return_status := FND_API.G_RET_STS_SUCCESS;
385:
386: --- Check if the caller requested to commit ,
387: --- If p_commit set to true, commit the transaction
388: IF FND_API.to_boolean(p_commit) THEN
384: x_return_status := FND_API.G_RET_STS_SUCCESS;
385:
386: --- Check if the caller requested to commit ,
387: --- If p_commit set to true, commit the transaction
388: IF FND_API.to_boolean(p_commit) THEN
389: COMMIT;
390: END IF;
391:
392: FND_MSG_PUB.count_and_get(
389: COMMIT;
390: END IF;
391:
392: FND_MSG_PUB.count_and_get(
393: p_encoded => FND_API.g_false,
394: p_count => x_msg_count,
395: p_data => x_msg_data
396: );
397:
397:
398:
399: EXCEPTION
400:
401: WHEN FND_API.g_exc_error THEN
402: ROLLBACK TO delete_display_context;
403: x_return_status := FND_API.g_ret_sts_error;
404: FND_MSG_PUB.count_and_get(
405: p_encoded => FND_API.g_false,
399: EXCEPTION
400:
401: WHEN FND_API.g_exc_error THEN
402: ROLLBACK TO delete_display_context;
403: x_return_status := FND_API.g_ret_sts_error;
404: FND_MSG_PUB.count_and_get(
405: p_encoded => FND_API.g_false,
406: p_count => x_msg_count,
407: p_data => x_msg_data
401: WHEN FND_API.g_exc_error THEN
402: ROLLBACK TO delete_display_context;
403: x_return_status := FND_API.g_ret_sts_error;
404: FND_MSG_PUB.count_and_get(
405: p_encoded => FND_API.g_false,
406: p_count => x_msg_count,
407: p_data => x_msg_data
408: );
409:
406: p_count => x_msg_count,
407: p_data => x_msg_data
408: );
409:
410: WHEN FND_API.g_exc_unexpected_error THEN
411: ROLLBACK TO delete_display_context;
412: x_return_status := FND_API.g_ret_sts_unexp_error ;
413: FND_MSG_PUB.count_and_get(
414: p_encoded => FND_API.g_false,
408: );
409:
410: WHEN FND_API.g_exc_unexpected_error THEN
411: ROLLBACK TO delete_display_context;
412: x_return_status := FND_API.g_ret_sts_unexp_error ;
413: FND_MSG_PUB.count_and_get(
414: p_encoded => FND_API.g_false,
415: p_count => x_msg_count,
416: p_data => x_msg_data
410: WHEN FND_API.g_exc_unexpected_error THEN
411: ROLLBACK TO delete_display_context;
412: x_return_status := FND_API.g_ret_sts_unexp_error ;
413: FND_MSG_PUB.count_and_get(
414: p_encoded => FND_API.g_false,
415: p_count => x_msg_count,
416: p_data => x_msg_data
417: );
418:
418:
419:
420: WHEN OTHERS THEN
421: ROLLBACK TO delete_display_context;
422: x_return_status := FND_API.g_ret_sts_unexp_error ;
423: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
424: THEN
425: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
426: END IF;
424: THEN
425: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
426: END IF;
427: FND_MSG_PUB.count_and_get(
428: p_encoded => FND_API.g_false,
429: p_count => x_msg_count,
430: p_data => x_msg_data
431: );
432:
435:
436: ---------------------------------------------------------------
437: -- NOTES
438: -- 1. Raise exception if the p_api_version doesn't match.
439: -- 2. If context_delete is FND_API.g_true, then operation is
440: -- delete and delete_display_context is called with appropriate
441: -- parameters
442: -- 3. If the context_id is passed in the record, the existing display
443: -- context is updated.
441: -- parameters
442: -- 3. If the context_id is passed in the record, the existing display
443: -- context is updated.
444: -- 4. If the context_id is set to null, a new display context record
445: -- is inserted and context_delete is FND_API.g_false
446: -- 5. If the operation is an insert/update, save_display_context with
447: -- appropriate parameters is called
448: -- 6. Raises exception if the context_id does not exist for an update
449: -- operation
454: -- updated,deleted from TL tables depending on the operation (2,3)
455: --------------------------------------------------------------------
456: PROCEDURE save_delete_display_context(
457: p_api_version IN NUMBER,
458: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
459: p_commit IN VARCHAR2 := FND_API.g_false,
460: x_return_status OUT VARCHAR2,
461: x_msg_count OUT NUMBER,
462: x_msg_data OUT VARCHAR2,
455: --------------------------------------------------------------------
456: PROCEDURE save_delete_display_context(
457: p_api_version IN NUMBER,
458: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
459: p_commit IN VARCHAR2 := FND_API.g_false,
460: x_return_status OUT VARCHAR2,
461: x_msg_count OUT NUMBER,
462: x_msg_data OUT VARCHAR2,
463: p_display_context_tbl IN OUT DISPLAY_CONTEXT_TBL_TYPE
473: BEGIN
474: --------------------- initialize -----------------------
475: SAVEPOINT save_delete_display_context;
476:
477: IF NOT FND_API.compatible_api_call(
478: g_api_version,
479: p_api_version,
480: l_api_name,
481: g_pkg_name
479: p_api_version,
480: l_api_name,
481: g_pkg_name
482: ) THEN
483: RAISE FND_API.g_exc_unexpected_error;
484: END IF;
485:
486: IF FND_API.to_boolean(p_init_msg_list) THEN
487: FND_MSG_PUB.initialize;
482: ) THEN
483: RAISE FND_API.g_exc_unexpected_error;
484: END IF;
485:
486: IF FND_API.to_boolean(p_init_msg_list) THEN
487: FND_MSG_PUB.initialize;
488: END IF;
489:
490: x_return_status := FND_API.G_RET_STS_SUCCESS;
486: IF FND_API.to_boolean(p_init_msg_list) THEN
487: FND_MSG_PUB.initialize;
488: END IF;
489:
490: x_return_status := FND_API.G_RET_STS_SUCCESS;
491:
492: FOR l_index IN 1..p_display_context_tbl.COUNT
493: LOOP
494: ---
491:
492: FOR l_index IN 1..p_display_context_tbl.COUNT
493: LOOP
494: ---
495: IF p_display_context_tbl(l_index).context_delete = FND_API.g_true
496: then
497: delete_display_context(
498: p_api_version,
499: FND_API.g_false,
495: IF p_display_context_tbl(l_index).context_delete = FND_API.g_true
496: then
497: delete_display_context(
498: p_api_version,
499: FND_API.g_false,
500: FND_API.g_false,
501: l_return_status,
502: l_msg_count,
503: l_msg_data,
496: then
497: delete_display_context(
498: p_api_version,
499: FND_API.g_false,
500: FND_API.g_false,
501: l_return_status,
502: l_msg_count,
503: l_msg_data,
504: p_display_context_tbl(l_index));
505:
506: ---dbms_output.put_line('Return from delete_display_context:' || l_return_status);
507:
508:
509: ELSIF p_display_context_tbl(l_index).context_delete = FND_API.g_false
510: then
511: save_display_context(
512: p_api_version,
513: FND_API.g_false,
509: ELSIF p_display_context_tbl(l_index).context_delete = FND_API.g_false
510: then
511: save_display_context(
512: p_api_version,
513: FND_API.g_false,
514: FND_API.g_false,
515: l_return_status,
516: l_msg_count,
517: l_msg_data,
510: then
511: save_display_context(
512: p_api_version,
513: FND_API.g_false,
514: FND_API.g_false,
515: l_return_status,
516: l_msg_count,
517: l_msg_data,
518: p_display_context_tbl(l_index));
518: p_display_context_tbl(l_index));
519: ---dbms_output.put_line('Return from save_display_context:' || l_return_status);
520: END IF;
521:
522: if l_return_status <> FND_API.G_RET_STS_SUCCESS
523: then
524: x_return_status := l_return_status;
525: end if;
526:
527: END LOOP;
528:
529: --- Check if the caller requested to commit ,
530: --- If p_commit set to true, commit the transaction
531: IF FND_API.to_boolean(p_commit) THEN
532: COMMIT;
533: END IF;
534:
535: FND_MSG_PUB.count_and_get(
532: COMMIT;
533: END IF;
534:
535: FND_MSG_PUB.count_and_get(
536: p_encoded => FND_API.g_false,
537: p_count => x_msg_count,
538: p_data => x_msg_data
539: );
540: EXCEPTION
538: p_data => x_msg_data
539: );
540: EXCEPTION
541:
542: WHEN FND_API.g_exc_unexpected_error THEN
543: ROLLBACK TO save_delete_display_context;
544: x_return_status := FND_API.g_ret_sts_unexp_error ;
545: FND_MSG_PUB.count_and_get(
546: p_encoded => FND_API.g_false,
540: EXCEPTION
541:
542: WHEN FND_API.g_exc_unexpected_error THEN
543: ROLLBACK TO save_delete_display_context;
544: x_return_status := FND_API.g_ret_sts_unexp_error ;
545: FND_MSG_PUB.count_and_get(
546: p_encoded => FND_API.g_false,
547: p_count => x_msg_count,
548: p_data => x_msg_data
542: WHEN FND_API.g_exc_unexpected_error THEN
543: ROLLBACK TO save_delete_display_context;
544: x_return_status := FND_API.g_ret_sts_unexp_error ;
545: FND_MSG_PUB.count_and_get(
546: p_encoded => FND_API.g_false,
547: p_count => x_msg_count,
548: p_data => x_msg_data
549: );
550:
550:
551:
552: WHEN OTHERS THEN
553: ROLLBACK TO save_delete_display_context;
554: x_return_status := FND_API.g_ret_sts_unexp_error ;
555:
556: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
557: THEN
558: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
557: THEN
558: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
559: END IF;
560: FND_MSG_PUB.count_and_get(
561: p_encoded => FND_API.g_false,
562: p_count => x_msg_count,
563: p_data => x_msg_data
564: );
565: END save_delete_display_context;
579: BEGIN
580:
581: SAVEPOINT delete_deliverable;
582:
583: if p_deliverable_id <> FND_API.g_miss_num or p_deliverable_id is not null
584: then
585: -- Set the deliverable id to null for any display context
586: update JTF_DSP_CONTEXT_B set item_id = null where
587: item_id = p_deliverable_id;