44:
45: -- Initialize message list if p_init_msg_list is set to TRUE
46:
47: IF FND_API.to_Boolean(p_init_msg_list) THEN
48: FND_MSG_PUB.initialize;
49: END IF;
50:
51:
52: -- Initialize p_return_status
62: -- check that necessary in parameters are present
63: if (p_template is null or
64: p_related_template is null) then
65:
66: if FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) then
67: -- add message: Required API parameters are missing
68: FND_MESSAGE.SET_NAME('ICX','ICX_API_MISS_PARAM');
69: FND_MSG_PUB.Add;
70: end if;
65:
66: if FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) then
67: -- add message: Required API parameters are missing
68: FND_MESSAGE.SET_NAME('ICX','ICX_API_MISS_PARAM');
69: FND_MSG_PUB.Add;
70: end if;
71: RAISE FND_API.G_EXC_ERROR;
72: end if;
73:
82: from po_reqexpress_headers
83: where express_name = p_template;
84:
85: if l_count <> 1 then
86: if FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) then
87: -- add message: Category Set ID is invalid
88: FND_MESSAGE.SET_NAME('ICX','ICX_INVALID_ENTRY');
89: FND_MESSAGE.SET_TOKEN('INVALID_TOKEN',l_prompts(1));
90: FND_MSG_PUB.Add;
86: if FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) then
87: -- add message: Category Set ID is invalid
88: FND_MESSAGE.SET_NAME('ICX','ICX_INVALID_ENTRY');
89: FND_MESSAGE.SET_TOKEN('INVALID_TOKEN',l_prompts(1));
90: FND_MSG_PUB.Add;
91: end if;
92: l_validation_error := TRUE;
93: end if; -- check template
94:
98: from po_reqexpress_headers
99: where express_name = p_related_template;
100:
101: if l_count <> 1 then
102: if FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) then
103: -- add message: Category ID is invalid
104: FND_MESSAGE.SET_NAME('ICX','ICX_INVALID_ENTRY');
105: FND_MESSAGE.SET_TOKEN('INVALID_TOKEN',l_prompts(2));
106: FND_MSG_PUB.Add;
102: if FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) then
103: -- add message: Category ID is invalid
104: FND_MESSAGE.SET_NAME('ICX','ICX_INVALID_ENTRY');
105: FND_MESSAGE.SET_TOKEN('INVALID_TOKEN',l_prompts(2));
106: FND_MSG_PUB.Add;
107: end if;
108: l_validation_error := TRUE;
109: end if; -- check related template
110:
111:
112: -- check that template and related template are not the same
113: if (p_relationship_type <> 'TOP' and
114: p_template = p_related_template) then
115: if FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) then
116: -- add message: Related Template may not be the same as
117: -- its parent template
118: FND_MESSAGE.SET_NAME('ICX','ICX_TMP_PARENT');
119: FND_MSG_PUB.Add;
115: if FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) then
116: -- add message: Related Template may not be the same as
117: -- its parent template
118: FND_MESSAGE.SET_NAME('ICX','ICX_TMP_PARENT');
119: FND_MSG_PUB.Add;
120: end if;
121: l_validation_error := TRUE;
122: end if;
123:
129: where express_name = p_template
130: and related_express_name = p_related_template;
131:
132: if l_count > 0 then
133: if FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) then
134: -- add message: TEMPLATE is already a top template
135: FND_MESSAGE.SET_NAME('ICX','ICX_TMP_TOP');
136: FND_MESSAGE.SET_TOKEN('TEMPLATE',p_template);
137: FND_MSG_PUB.Add;
133: if FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) then
134: -- add message: TEMPLATE is already a top template
135: FND_MESSAGE.SET_NAME('ICX','ICX_TMP_TOP');
136: FND_MESSAGE.SET_TOKEN('TEMPLATE',p_template);
137: FND_MSG_PUB.Add;
138: end if;
139: l_validation_error := TRUE;
140: end if;
141: end if;
148: where express_name = p_template
149: and related_express_name = p_related_template;
150:
151: if l_count > 0 then
152: if FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) then
153: -- add message: This template relationship already exists
154: FND_MESSAGE.SET_NAME('ICX','ICX_TMP_DUP_RELATION');
155: FND_MSG_PUB.Add;
156: end if;
151: if l_count > 0 then
152: if FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) then
153: -- add message: This template relationship already exists
154: FND_MESSAGE.SET_NAME('ICX','ICX_TMP_DUP_RELATION');
155: FND_MSG_PUB.Add;
156: end if;
157: l_validation_error := TRUE;
158: end if;
159: end if;
166: and enabled_flag = 'Y'
167: and lookup_code = p_relationship_type;
168:
169: if l_count <> 1 then
170: if FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) then
171: -- add message: Relation is not valid
172: FND_MESSAGE.SET_NAME('ICX','ICX_INVALID_ENTRY');
173: FND_MESSAGE.SET_TOKEN('INVALID_TOKEN',l_prompts(3));
174: FND_MSG_PUB.Add;
170: if FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) then
171: -- add message: Relation is not valid
172: FND_MESSAGE.SET_NAME('ICX','ICX_INVALID_ENTRY');
173: FND_MESSAGE.SET_TOKEN('INVALID_TOKEN',l_prompts(3));
174: FND_MSG_PUB.Add;
175: end if;
176: l_validation_error := TRUE;
177: end if;
178:
223:
224:
225: -- Get message count and if 1, return message data
226:
227: FND_MSG_PUB.Count_And_Get
228: (p_count => p_msg_count,
229: p_data => p_msg_data
230: );
231:
237: p_return_status := FND_API.G_RET_STS_ERROR;
238:
239: -- Get message count and if 1, return message data
240:
241: FND_MSG_PUB.Count_And_Get
242: (p_count => p_msg_count,
243: p_data => p_msg_data
244: );
245:
248: p_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
249:
250: -- Get message count and if 1, return message data
251:
252: FND_MSG_PUB.Count_And_Get
253: (p_count => p_msg_count,
254: p_data => p_msg_data
255: );
256:
257: WHEN OTHERS THEN
258:
259: p_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
260:
261: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
262: FND_MSG_PUB.Build_Exc_Msg
263: ( G_PKG_NAME ,
264: 'Insert_Relation'
265: );
258:
259: p_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
260:
261: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
262: FND_MSG_PUB.Build_Exc_Msg
263: ( G_PKG_NAME ,
264: 'Insert_Relation'
265: );
266: END IF;
266: END IF;
267:
268: -- Get message count and if 1, return message data
269:
270: FND_MSG_PUB.Count_And_Get
271: (p_count => p_msg_count,
272: p_data => p_msg_data
273: );
274:
319:
320: -- Initialize message list if p_init_msg_list is set to TRUE
321:
322: IF FND_API.to_Boolean(p_init_msg_list) THEN
323: FND_MSG_PUB.initialize;
324: END IF;
325:
326:
327: -- Initialize p_return_status
339: -- check that necessary in parameters are present
340: if (p_template is null or
341: p_related_template is null) then
342:
343: if FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) then
344: -- add message: Required API parameters are missing
345: FND_MESSAGE.SET_NAME('ICX','ICX_API_MISS_PARAM');
346: FND_MSG_PUB.Add;
347: end if;
342:
343: if FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) then
344: -- add message: Required API parameters are missing
345: FND_MESSAGE.SET_NAME('ICX','ICX_API_MISS_PARAM');
346: FND_MSG_PUB.Add;
347: end if;
348: RAISE FND_API.G_EXC_ERROR;
349: end if;
350:
375:
376:
377: -- Get message count and if 1, return message data
378:
379: FND_MSG_PUB.Count_And_Get
380: (p_count => p_msg_count,
381: p_data => p_msg_data
382: );
383:
387: WHEN NO_DATA_FOUND THEN
388:
389: p_return_status := FND_API.G_RET_STS_ERROR;
390:
391: if FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) then
392: -- add message: Relation to delete does not exist
393: FND_MESSAGE.SET_NAME('ICX','ICX_CAT_DELETE');
394: FND_MSG_PUB.Add;
395: end if;
390:
391: if FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) then
392: -- add message: Relation to delete does not exist
393: FND_MESSAGE.SET_NAME('ICX','ICX_CAT_DELETE');
394: FND_MSG_PUB.Add;
395: end if;
396:
397: -- Get message count and if 1, return message data
398:
395: end if;
396:
397: -- Get message count and if 1, return message data
398:
399: FND_MSG_PUB.Count_And_Get
400: (p_count => p_msg_count,
401: p_data => p_msg_data
402: );
403:
406: p_return_status := FND_API.G_RET_STS_ERROR;
407:
408: -- Get message count and if 1, return message data
409:
410: FND_MSG_PUB.Count_And_Get
411: (p_count => p_msg_count,
412: p_data => p_msg_data
413: );
414:
417: p_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
418:
419: -- Get message count and if 1, return message data
420:
421: FND_MSG_PUB.Count_And_Get
422: (p_count => p_msg_count,
423: p_data => p_msg_data
424: );
425:
426: WHEN OTHERS THEN
427:
428: p_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
429:
430: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
431: FND_MSG_PUB.Build_Exc_Msg
432: ( G_PKG_NAME ,
433: 'Delete_Relation'
434: );
427:
428: p_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
429:
430: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
431: FND_MSG_PUB.Build_Exc_Msg
432: ( G_PKG_NAME ,
433: 'Delete_Relation'
434: );
435: END IF;
435: END IF;
436:
437: -- Get message count and if 1, return message data
438:
439: FND_MSG_PUB.Count_And_Get
440: (p_count => p_msg_count,
441: p_data => p_msg_data
442: );
443: