[Home] [Help]
PACKAGE BODY: APPS.WSH_FLEXFIELD_UTILS
Source
1 PACKAGE BODY WSH_FLEXFIELD_UTILS as
2 /* $Header: WSHFFUTB.pls 120.1.12000000.3 2007/03/30 09:36:11 nchellam ship $ */
3
4 -- Private Type Definintions
5
6 TYPE Default_DFF_Attributes_Rec IS RECORD (table_name Varchar2(30),
7 default_context Varchar2(150),
8 first_segment Number,
9 last_segment Number,
10 update_flag Varchar2(1));
11
12 TYPE DFF_Check_Req_Rec IS RECORD (table_name Varchar2(30),
13 context_req_flag Varchar2(1),
14 seg_req_flag Varchar2(1));
15
16
17 TYPE Context_Check_Req_Rec IS RECORD (table_name Varchar2(30),
18 context Varchar2(30),
19 first_segment Number,
20 last_segment Number);
21
22 TYPE Attribute_Rec IS RECORD(segment_value Varchar2(150),
23 attribute_index Number);
24
25
26 TYPE Attribute_Rec_Tab IS TABLE OF Attribute_Rec INDEX BY BINARY_INTEGER;
27
28 TYPE Context_Check_Req_Tab IS TABLE OF Context_Check_Req_Rec INDEX BY BINARY_INTEGER;
29
30 TYPE DFF_Check_Req_Tab IS TABLE OF DFF_Check_Req_Rec INDEX BY BINARY_INTEGER;
31
32 TYPE Def_DFF_Attr_Rec_Tab IS TABLE OF Default_DFF_Attributes_Rec INDEX BY BINARY_INTEGER;
33
34 -- Global Variables
35
36 g_def_attribute_values Attribute_Rec_Tab;
37 g_req_attribute_values Attribute_Rec_Tab;
38 g_validate_context Context_Check_Req_Tab;
39 g_check_req DFF_Check_Req_Tab;
40 g_def_attributes Def_DFF_Attr_Rec_Tab;
41
42
43 /****
44 PROCEDURE get_flexfield has been copied from
45 AFFFDDUB.pls 115.2 2001/05/23 00:57:34 golgun ship
46 and has been modified to include the
47 context_required_flag in the flexfield info
48 record - dflex_dr
49 *****/
50
51
52 --
53 G_PKG_NAME CONSTANT VARCHAR2(50) := 'WSH_FLEXFIELD_UTILS';
54 --
55 PROCEDURE get_flexfield(appl_short_name IN fnd_application.application_short_name%TYPE,
56 flexfield_name IN fnd_descriptive_flexs_vl.descriptive_flexfield_name%TYPE,
57 flexfield OUT NOCOPY fnd_dflex.dflex_r,
58 flexinfo OUT NOCOPY wsh_flexfield_utils.dflex_dr)
59 IS
60 ffld fnd_dflex.dflex_r;
61 dflex wsh_flexfield_utils.dflex_dr;
62
63 CURSOR c_get_flexname IS
64 SELECT /* $Header: WSHFFUTB.pls 120.1.12000000.3 2007/03/30 09:36:11 nchellam ship $ */
65 a.application_id, df.descriptive_flexfield_name
66 FROM fnd_application_vl a, fnd_descriptive_flexs_vl df
67 WHERE a.application_short_name = appl_short_name
68 AND a.application_id = df.application_id
69 AND df.descriptive_flexfield_name = flexfield_name;
70
71
72 CURSOR c_get_flex_properties IS
73 SELECT /* $Header: WSHFFUTB.pls 120.1.12000000.3 2007/03/30 09:36:11 nchellam ship $ */
74 df.title, df.application_table_name, a.application_short_name,
75 df.description, df.concatenated_segment_delimiter,
76 df.default_context_field_name, df.default_context_value,
77 protected_flag,
78 form_context_prompt, context_column_name, df.context_required_flag
79 FROM fnd_application_vl a, fnd_descriptive_flexs_vl df
80 WHERE df.application_id = ffld.application_id
81 AND df.descriptive_flexfield_name = ffld.flexfield_name
82 AND a.application_id = df.table_application_id;
83
84
85
86 --
87 l_debug_on BOOLEAN;
88 --
89 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'GET_FLEXFIELD';
90 --
91 BEGIN
92
93 --
94 -- Debug Statements
95 --
96 --
97 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
98 --
99 IF l_debug_on IS NULL
100 THEN
101 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
102 END IF;
103 --
104 IF l_debug_on THEN
105 WSH_DEBUG_SV.push(l_module_name);
106 WSH_DEBUG_SV.log(l_module_name,'APPL_SHORT_NAME',appl_short_name);
107 WSH_DEBUG_SV.log(l_module_name,'FLEXFIELD_NAME',flexfield_name);
108
109 END IF;
110 --
111 OPEN c_get_flexname;
112 FETCH c_get_flexname
113 INTO ffld;
114 IF c_get_flexname%ISOPEN THEN
115 CLOSE c_get_flexname;
116 END IF;
117
118 OPEN c_get_flex_properties;
119 FETCH c_get_flex_properties
120 INTO dflex;
121 IF c_get_flex_properties%ISOPEN THEN
122 CLOSE c_get_flex_properties;
123 END IF;
124
125 flexfield := ffld;
126 flexinfo := dflex;
127
128
129 --
130 -- Debug Statements
131 --
132 IF l_debug_on THEN
133 WSH_DEBUG_SV.pop(l_module_name);
134 END IF;
135 --
136 END get_flexfield;
137
138
139 FUNCTION Cache_DFF_Segments(p_table_name IN VARCHAR2,
140 x_return_status OUT NOCOPY VARCHAR2)
141 RETURN BINARY_INTEGER IS
142 l_table_name Varchar2(30);
143 l_flexfield fnd_dflex.dflex_r;
144 l_flexinfo dflex_dr;
145 l_contexts fnd_dflex.contexts_dr;
146 l_segments fnd_dflex.segments_dr;
147 l_glbl_segments fnd_dflex.segments_dr;
148 i BINARY_INTEGER;
149 j BINARY_INTEGER;
150 k BINARY_INTEGER;
151 n NUMBER;
152 l_found BOOLEAN := FALSE;
153
154 Invalid_Table EXCEPTION;
155
156 --
157 l_debug_on BOOLEAN;
158 --
159 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'CACHE_DFF_SEGMENTS';
160 --
161 BEGIN
162
163 --
164 -- Debug Statements
165 --
166 --
167 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
168 --
169 IF l_debug_on IS NULL
170 THEN
171 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
172 END IF;
173 --
174 IF l_debug_on THEN
175 WSH_DEBUG_SV.push(l_module_name);
176 --
177 WSH_DEBUG_SV.log(l_module_name,'P_TABLE_NAME',P_TABLE_NAME);
178 END IF;
179 --
180 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
181
182 l_table_name := UPPER(p_table_name);
183
184 -- 2530743 : Commenting this as this Fn./Proc. will be needed for other DFFs too
185 -- IF l_table_name <> 'WSH_NEW_DELIVERIES' THEN
186 -- RAISE Invalid_Table;
187 -- END IF;
188
189 IF g_def_attributes.count <> 0 THEN
190
191 -- Check if parameters have already been fetched
192 FOR i IN g_def_attributes.FIRST..g_def_attributes.LAST LOOP
193 IF g_def_attributes(i).table_name = l_table_name THEN
194 l_found := TRUE;
195 j := i;
196 EXIT;
197 END IF;
198 END LOOP;
199
200 IF l_found THEN
201 --
202 -- Debug Statements
203 --
204 IF l_debug_on THEN
205 WSH_DEBUG_SV.pop(l_module_name);
206 END IF;
207 --
208 RETURN j;
209 END IF;
210
211 END IF;
212
213
214 get_flexfield(appl_short_name => 'WSH',
215 flexfield_name => l_table_name,
216 flexfield => l_flexfield,
217 flexinfo => l_flexinfo);
218
219 fnd_dflex.get_contexts(flexfield => l_flexfield,
220 contexts => l_contexts);
221
222 fnd_dflex.get_segments(context => fnd_dflex.make_context(flexfield => l_flexfield,
223 context_code => l_flexinfo.default_context_value),
224 segments => l_segments,
225 enabled_only => TRUE);
226
227 fnd_dflex.get_segments(context => fnd_dflex.make_context(flexfield => l_flexfield,
228 context_code => l_contexts.context_code(l_contexts.global_context)),
229 segments => l_glbl_segments,
230 enabled_only => TRUE);
231
232
233 IF g_def_attributes.count = 0 THEN
234 j := 1;
235 g_def_attributes(j).first_segment := 1;
236
237 ELSE
238 j := g_def_attributes.LAST + 1;
239 g_def_attributes(j).first_segment := g_def_attributes(j-1).last_segment + 1;
240 END IF;
241
242 g_def_attributes(j).table_name := l_table_name;
243 g_def_attributes(j).default_context := l_flexinfo.default_context_value;
244
245 k := 0;
246 FOR i IN 1..l_segments.nsegments LOOP
247 IF l_segments.default_value(i) IS NOT NULL THEN
248 k := k + 1;
249 g_def_attribute_values(g_def_attributes(j).first_segment + k - 1).attribute_index := (to_number(substr(l_segments.application_column_name(i),10)));
250 g_def_attribute_values(g_def_attributes(j).first_segment + k - 1).segment_value := l_segments.default_value(i);
251 END IF;
252 END LOOP;
253
254 -- Added for bug 2353335
255 --BugFix 4995455 replaced global context with default
256 FND_FLEX_DESCVAL.set_context_value(l_flexinfo.default_context_value);
257
258 FOR i IN 1..l_glbl_segments.nsegments LOOP
259 fnd_flex_descval.set_column_value(l_glbl_segments.application_column_name(i),'');
260 END LOOP;
261
262 --BugFix 4995455 added for loop to populate the default segement
263 FOR i IN 1..l_segments.nsegments LOOP
264 fnd_flex_descval.set_column_value(l_segments.application_column_name(i),'');
265 END LOOP;
266
267 -- Bug# 5603974: Considering Automotive TP DFF attributes also.
268 --Before call to validate');
269 IF FND_FLEX_DESCVAL.validate_desccols( 'WSH', l_table_name, 'D', SYSDATE) then
270 --{
271 n := fnd_flex_descval.segment_count;
272 FOR i in 1..n LOOP
273 --{
274 IF l_debug_on THEN
275 WSH_DEBUG_SV.log(l_module_name,'fnd_flex_descval.segment_column_name(i))',fnd_flex_descval.segment_column_name(i));
276 END if;
277 IF( upper(substr(fnd_flex_descval.segment_column_name(i), 1, 2)) = 'TP' ) THEN
278 --{
279 IF( upper(substr(fnd_flex_descval.segment_column_name(i), 1, 12))
280 = 'TP_ATTRIBUTE' AND upper(fnd_flex_descval.segment_column_name(i))
281 <> 'TP_ATTRIBUTE_CATEGORY') Then
282 k := k + 1;
283 g_def_attribute_values(g_def_attributes(j).first_segment + k - 1).attribute_index := (to_number(substr(fnd_flex_descval.segment_column_name(i),13)));
284 -- bug 5948562, segment value - used for display, segment id - should be stored in db to prevent any format issues.
285 g_def_attribute_values(g_def_attributes(j).first_segment + k - 1).segment_value := fnd_flex_descval.segment_id(i);
286 END IF;
287
288 ELSE
289 IF( upper(substr(fnd_flex_descval.segment_column_name(i), 1, 9))
290 = 'ATTRIBUTE' AND upper(fnd_flex_descval.segment_column_name(i))
291 <> 'ATTRIBUTE_CATEGORY') Then
292
293 k := k + 1;
294 g_def_attribute_values(g_def_attributes(j).first_segment + k - 1).attribute_index := (to_number(substr(fnd_flex_descval.segment_column_name(i),10)));
295 IF l_debug_on THEN
296 WSH_DEBUG_SV.log(l_module_name,'The segments value is',fnd_flex_descval.segment_value(i));
297 WSH_DEBUG_SV.log(l_module_name,'The segment id is',fnd_flex_descval.segment_id(i));
298 END IF;
299 -- bug 5948562, segment value - used for display, segment id - should be stored in db to prevent any format issues.
300 g_def_attribute_values(g_def_attributes(j).first_segment + k - 1).segment_value := fnd_flex_descval.segment_id(i);
301 END IF;
302 --}TP check
303 END IF;
304 --}
305 END LOOP;
306 ELSE
307 IF l_debug_on THEN
308 WSH_DEBUG_SV.log(l_module_name,'ERROR_SEGMENT',fnd_flex_descval.error_segment);
309 WSH_DEBUG_SV.log(l_module_name,'ERROR_MESSAGE',fnd_flex_descval.error_message);
310 END IF;
311 --} validate_desccols
312 END IF;
313 -- End of fix for bug 2353335
314
315 g_def_attributes(j).last_segment := g_def_attributes(j).first_segment + k - 1;
316
317 IF g_def_attributes(j).default_context IS NOT NULL THEN
318 g_def_attributes(j).update_flag := 'Y';
319 ELSE
320 IF g_def_attributes(j).last_segment >= g_def_attributes(j).first_segment THEN
321 g_def_attributes(j).update_flag := 'Y';
322 END IF;
323 END IF;
324
325 --
326 -- Debug Statements
327 --
328 IF l_debug_on THEN
329 WSH_DEBUG_SV.pop(l_module_name);
330 END IF;
331 --
332 RETURN j;
333 EXCEPTION
334
335 WHEN Invalid_Table THEN
336 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
337 FND_MESSAGE.Set_Name('WSH', 'WSH_INVALID_TABLE');
338 FND_MESSAGE.Set_Token('TABLE', p_table_name);
339 WSH_UTIL_CORE.Add_Message(x_return_status);
340 --
341 -- Debug Statements
342 --
343 IF l_debug_on THEN
344 WSH_DEBUG_SV.logmsg(l_module_name,'INVALID_TABLE exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
345 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:INVALID_TABLE');
346 END IF;
347 --
348 -- Debug Statements
349 --
350 IF l_debug_on THEN
351 WSH_DEBUG_SV.pop(l_module_name);
352 END IF;
353 --
354 RETURN NULL;
355 --
356 WHEN Others THEN
357 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
358 WSH_UTIL_CORE.add_message (x_return_status);
359 WSH_UTIL_CORE.default_handler('WSH_FLEXFIELD_UTILS.e_DFF_Segments');
360 --
361 --
362 -- Debug Statements
363 --
364 IF l_debug_on THEN
365 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
366 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
367 END IF;
368 --
369 -- Debug Statements
370 --
371 IF l_debug_on THEN
372 WSH_DEBUG_SV.pop(l_module_name);
373 END IF;
374 --
375 RETURN NULL;
376
377 END Cache_DFF_Segments;
378
379
380
381 PROCEDURE Get_DFF_Defaults
382 (p_flexfield_name IN VARCHAR2,
383 p_default_values OUT NOCOPY FlexfieldAttributeTabType,
384 p_default_context OUT NOCOPY VARCHAR2,
385 p_update_flag OUT NOCOPY VARCHAR2,
386 x_return_status OUT NOCOPY VARCHAR2) IS
387
388
389 j BINARY_INTEGER;
390 i BINARY_INTEGER;
391
392
393 --
394 l_debug_on BOOLEAN;
395 --
396 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'GET_DFF_DEFAULTS';
397 --
398 BEGIN
399 --
400 -- Debug Statements
401 --
402 --
403 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
404 --
405 IF l_debug_on IS NULL
406 THEN
407 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
408 END IF;
409 --
410 IF l_debug_on THEN
411 WSH_DEBUG_SV.push(l_module_name);
412 --
413 WSH_DEBUG_SV.log(l_module_name,'P_FLEXFIELD_NAME',P_FLEXFIELD_NAME);
414 END IF;
415 --
416 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
417
418 For i in 1..15 LOOP
419 p_default_values(i) := NULL;
420 End LOOP;
421 j := Cache_DFF_Segments(p_table_name => p_flexfield_name,
422 x_return_status => x_return_status);
423
424 IF x_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS THEN
425 --
426 -- Debug Statements
427 --
428 IF l_debug_on THEN
429 WSH_DEBUG_SV.pop(l_module_name);
430 END IF;
431 --
432 return;
433 END IF;
434
435
436 p_default_context := g_def_attributes(j).default_context;
437 p_update_flag := g_def_attributes(j).update_flag;
438
439 FOR i IN g_def_attributes(j).first_segment.. g_def_attributes(j).last_segment LOOP
440 p_default_values(g_def_attribute_values(i).attribute_index):= g_def_attribute_values(i).segment_value;
441 END LOOP;
442
443
444 --
445 -- Debug Statements
446 --
447 IF l_debug_on THEN
448 WSH_DEBUG_SV.pop(l_module_name);
449 END IF;
450 --
451 EXCEPTION
452 WHEN Others THEN
453 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
454 WSH_UTIL_CORE.add_message (x_return_status);
455 WSH_UTIL_CORE.default_handler('WSH_FLEXFIELD_UTILS.Get_DFF_Defaults');
456
457
458 --
459 -- Debug Statements
460 --
461 IF l_debug_on THEN
462 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
463 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
464 END IF;
465 --
466 END Get_DFF_Defaults;
467
468
469 PROCEDURE Write_DFF_Attributes(p_table_name IN VARCHAR2,
470 p_primary_id IN NUMBER,
471 x_return_status OUT NOCOPY VARCHAR2) IS
472
473 context VARCHAR2(150);
474 update_flag VARCHAR2(1);
475 attributes FlexfieldAttributeTabType;
476 flexfield_name VARCHAR2(30);
477 delivery_name VARCHAR(30);
478 j BINARY_INTEGER;
479 i BINARY_INTEGER;
480
481 Invalid_Table EXCEPTION;
482
483
484 --
485 l_debug_on BOOLEAN;
486 --
487 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'WRITE_DFF_ATTRIBUTES';
488 --
489 BEGIN
490 --
491 -- Debug Statements
492 --
493 --
494 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
495 --
496 IF l_debug_on IS NULL
497 THEN
498 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
499 END IF;
500 --
501 IF l_debug_on THEN
502 WSH_DEBUG_SV.push(l_module_name);
503 --
504 WSH_DEBUG_SV.log(l_module_name,'P_TABLE_NAME',P_TABLE_NAME);
505 WSH_DEBUG_SV.log(l_module_name,'P_PRIMARY_ID',P_PRIMARY_ID);
506 END IF;
507 --
508 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
509 flexfield_name := p_table_name;
510
511 Get_DFF_Defaults(p_flexfield_name => flexfield_name,
512 p_default_values => attributes,
513 p_default_context => context,
514 p_update_flag => update_flag,
515 x_return_status => x_return_status);
516
517 IF x_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS THEN
518 --
519 -- Debug Statements
520 --
521 IF l_debug_on THEN
522 WSH_DEBUG_SV.pop(l_module_name);
523 END IF;
524 --
525 return;
526 END IF;
527
528 IF update_flag = 'Y' THEN
529
530 IF (UPPER(p_table_name) = 'WSH_NEW_DELIVERIES') THEN
531 UPDATE wsh_new_deliveries
532 SET Attribute_Category = context,
533 Attribute1 = attributes(1),
534 Attribute2 = attributes(2),
535 Attribute3 = attributes(3),
536 Attribute4 = attributes(4),
537 Attribute5 = attributes(5),
538 Attribute6 = attributes(6),
539 Attribute7 = attributes(7),
540 Attribute8 = attributes(8),
541 Attribute9 = attributes(9),
542 Attribute10 = attributes(10),
543 Attribute11 = attributes(11),
544 Attribute12 = attributes(12),
545 Attribute13 = attributes(13),
546 Attribute14 = attributes(14),
547 Attribute15 = attributes(15),
548 last_update_date = SYSDATE,
549 last_updated_by = FND_GLOBAL.USER_ID,
550 last_update_login = FND_GLOBAL.LOGIN_ID
551 WHERE delivery_id = p_primary_id;
552 ELSIF (UPPER(p_table_name) = 'WSH_TRIPS') THEN -- bug 5948562, for additional trip information DFF
553
554 UPDATE wsh_trips
555 SET Attribute_Category = context,
556 Attribute1 = attributes(1),
557 Attribute2 = attributes(2),
558 Attribute3 = attributes(3),
559 Attribute4 = attributes(4),
560 Attribute5 = attributes(5),
561 Attribute6 = attributes(6),
562 Attribute7 = attributes(7),
563 Attribute8 = attributes(8),
564 Attribute9 = attributes(9),
565 Attribute10 = attributes(10),
566 Attribute11 = attributes(11),
567 Attribute12 = attributes(12),
568 Attribute13 = attributes(13),
569 Attribute14 = attributes(14),
570 Attribute15 = attributes(15),
571 last_update_date = SYSDATE,
572 last_updated_by = FND_GLOBAL.USER_ID,
573 last_update_login = FND_GLOBAL.LOGIN_ID
574 WHERE trip_id = p_primary_id;
575 ELSE
576 RAISE Invalid_Table;
577 END IF;
578
579 END IF;
580
581 --
582 -- Debug Statements
583 --
584 IF l_debug_on THEN
585 WSH_DEBUG_SV.pop(l_module_name);
586 END IF;
587 --
588 EXCEPTION
589 WHEN Invalid_Table THEN
590 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
591 FND_MESSAGE.Set_Name('WSH', 'WSH_INVALID_TABLE');
592 FND_MESSAGE.Set_Token('TABLE', p_table_name);
593 WSH_UTIL_CORE.Add_Message(x_return_status);
594 --
595 -- Debug Statements
596 --
597 IF l_debug_on THEN
598 WSH_DEBUG_SV.logmsg(l_module_name,'INVALID_TABLE exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
599 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:INVALID_TABLE');
600 END IF;
601 --
602 WHEN Others THEN
603 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
604 WSH_UTIL_CORE.add_message (x_return_status);
605 WSH_UTIL_CORE.default_handler('WSH_FLEXFIELD_UTILS.Write_DFF_Attributes');
606
607 --
608 -- Debug Statements
609 --
610 IF l_debug_on THEN
611 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
612 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
613 END IF;
614 --
615 END Write_DFF_Attributes;
616
617
618 PROCEDURE Read_Table_Attributes(p_table_name IN VARCHAR2,
619 p_primary_id IN NUMBER,
620 p_attributes OUT NOCOPY FlexfieldAttributeTabType,
621 p_context OUT NOCOPY VARCHAR2,
622 x_return_status OUT NOCOPY VARCHAR2) IS
623
624 l_attribute1 VARCHAR2(150);
625 l_attribute2 VARCHAR2(150);
626 l_attribute3 VARCHAR2(150);
627 l_attribute4 VARCHAR2(150);
628 l_attribute5 VARCHAR2(150);
629 l_attribute6 VARCHAR2(150);
630 l_attribute7 VARCHAR2(150);
631 l_attribute8 VARCHAR2(150);
632 l_attribute9 VARCHAR2(150);
633 l_attribute10 VARCHAR2(150);
634 l_attribute11 VARCHAR2(150);
635 l_attribute12 VARCHAR2(150);
636 l_attribute13 VARCHAR2(150);
637 l_attribute14 VARCHAR2(150);
638 l_attribute15 VARCHAR2(150);
639 l_context VARCHAR2(150);
640
641 cursor c_wnd_attributes(c_delivery_id NUMBER) is
642 select attribute_category, attribute1, attribute2, attribute3, attribute4, attribute5, attribute6, attribute7,
643 attribute8, attribute9, attribute10, attribute11, attribute12, attribute13, attribute14, attribute15
644 from wsh_new_deliveries
645 where delivery_id = c_delivery_id;
646
647 -- Cussor added for Bug 3118519
648 cursor c_wdd_attributes(c_delivery_detail_id NUMBER) is
649 SELECT attribute_category,
650 attribute1, attribute2, attribute3, attribute4, attribute5,
651 attribute6, attribute7, attribute8, attribute9, attribute10,
652 attribute11, attribute12, attribute13, attribute14, attribute15
653 FROM wsh_delivery_details
654 WHERE delivery_detail_id = c_delivery_detail_id;
655
656 Invalid_Table EXCEPTION;
657 Invalid_Delivery EXCEPTION;
658
659 -- Exception added for Bug 3118519
660 Invalid_Del_Detail EXCEPTION;
661
662 --
663 l_debug_on BOOLEAN;
664 --
665 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'READ_TABLE_ATTRIBUTES';
666 --
667 BEGIN
668
669 --
670 -- Debug Statements
671 --
672 --
673 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
674 --
675 IF l_debug_on IS NULL
676 THEN
677 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
678 END IF;
679 --
680 IF l_debug_on THEN
681 WSH_DEBUG_SV.push(l_module_name);
682 --
683 WSH_DEBUG_SV.log(l_module_name,'P_TABLE_NAME',P_TABLE_NAME);
684 WSH_DEBUG_SV.log(l_module_name,'P_PRIMARY_ID',P_PRIMARY_ID);
685 END IF;
686 --
687 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
688
689 IF (UPPER(p_table_name) = 'WSH_NEW_DELIVERIES') THEN
690
691 open c_wnd_attributes(p_primary_id);
692 fetch c_wnd_attributes into
693 l_context, l_attribute1, l_attribute2, l_attribute3, l_attribute4, l_attribute5,
694 l_attribute6, l_attribute7, l_attribute8, l_attribute9, l_attribute10,
695 l_attribute11, l_attribute12, l_attribute13, l_attribute14, l_attribute15;
696
697 IF c_wnd_attributes%NOTFOUND THEN
698 RAISE Invalid_Delivery;
699 END IF;
700
701 IF c_wnd_attributes%ISOPEN THEN
702 CLOSE c_wnd_attributes;
703 END IF;
704
705 p_context := l_context;
706 p_attributes(1) := l_attribute1;
707 p_attributes(2) := l_attribute2;
708 p_attributes(3) := l_attribute3;
709 p_attributes(4) := l_attribute4;
710 p_attributes(5) := l_attribute5;
711 p_attributes(6) := l_attribute6;
712 p_attributes(7) := l_attribute7;
713 p_attributes(8) := l_attribute8;
714 p_attributes(9) := l_attribute9;
715 p_attributes(10) := l_attribute10;
716 p_attributes(11) := l_attribute11;
717 p_attributes(12) := l_attribute12;
718 p_attributes(13) := l_attribute13;
719 p_attributes(14) := l_attribute14;
720 p_attributes(15) := l_attribute15;
721
722 -- ELSE Condition added for Bug 3118519.
723 ELSIF ( UPPER(p_table_name) = 'WSH_DELIVERY_DETAILS' ) THEN
724
725 open c_wdd_attributes(p_primary_id);
726 fetch c_wdd_attributes into
727 l_context,
728 l_attribute1, l_attribute2, l_attribute3, l_attribute4, l_attribute5,
729 l_attribute6, l_attribute7, l_attribute8, l_attribute9, l_attribute10,
730 l_attribute11, l_attribute12, l_attribute13, l_attribute14, l_attribute15;
731
732 IF c_wdd_attributes%NOTFOUND THEN
733 RAISE Invalid_Del_Detail;
734 END IF;
735
736 IF c_wdd_attributes%ISOPEN THEN
737 CLOSE c_wdd_attributes;
738 END IF;
739
740 p_context := l_context;
741 p_attributes(1) := l_attribute1;
742 p_attributes(2) := l_attribute2;
743 p_attributes(3) := l_attribute3;
744 p_attributes(4) := l_attribute4;
745 p_attributes(5) := l_attribute5;
746 p_attributes(6) := l_attribute6;
747 p_attributes(7) := l_attribute7;
748 p_attributes(8) := l_attribute8;
749 p_attributes(9) := l_attribute9;
750 p_attributes(10) := l_attribute10;
751 p_attributes(11) := l_attribute11;
752 p_attributes(12) := l_attribute12;
753 p_attributes(13) := l_attribute13;
754 p_attributes(14) := l_attribute14;
755 p_attributes(15) := l_attribute15;
756
757 ELSE
758
759 RAISE Invalid_Table;
760
761 END IF;
762
763 --
764 -- Debug Statements
765 --
766 IF l_debug_on THEN
767 WSH_DEBUG_SV.pop(l_module_name);
768 END IF;
769 --
770 EXCEPTION
771 WHEN Invalid_Delivery THEN
772 IF c_wnd_attributes%ISOPEN THEN
773 CLOSE c_wnd_attributes;
774 END IF;
775 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
776 FND_MESSAGE.Set_Name('WSH', 'WSH_INVALID_DELIVERY');
777 FND_MESSAGE.Set_Token('DELIVERY', p_primary_id);
778 WSH_UTIL_CORE.Add_Message(x_return_status);
779 --
780 -- Debug Statements
781 --
782 IF l_debug_on THEN
783 WSH_DEBUG_SV.logmsg(l_module_name,'INVALID_DELIVERY exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
784 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:INVALID_DELIVERY');
785 END IF;
786 --
787 -- Exception Handling added for Bug 3118519.
788 WHEN Invalid_Del_Detail THEN
789 IF c_wdd_attributes%ISOPEN THEN
790 CLOSE c_wdd_attributes;
791 END IF;
792 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
793 FND_MESSAGE.Set_Name('WSH', 'WSH_DET_INVALID_DETAIL');
794 FND_MESSAGE.Set_Token('DETAIL_ID', p_primary_id);
795 WSH_UTIL_CORE.Add_Message(x_return_status);
796 --
797 -- Debug Statements
798 --
799 IF l_debug_on THEN
800 WSH_DEBUG_SV.logmsg(l_module_name,'INVALID_DEL_DETAIL exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
801 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:INVALID_DEL_DETAIL');
802 END IF;
803 --
804 WHEN Invalid_Table THEN
805 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
806 FND_MESSAGE.Set_Name('WSH', 'WSH_INVALID_TABLE');
807 FND_MESSAGE.Set_Token('TABLE', p_table_name);
808 WSH_UTIL_CORE.Add_Message(x_return_status);
809 --
810 -- Debug Statements
811 --
812 IF l_debug_on THEN
813 WSH_DEBUG_SV.logmsg(l_module_name,'INVALID_TABLE exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
814 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:INVALID_TABLE');
815 END IF;
816 --
817 WHEN Others THEN
818 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
819 WSH_UTIL_CORE.add_message (x_return_status);
820 WSH_UTIL_CORE.default_handler('WSH_FLEXFIELD_UTILS.Get_Attribute_Values');
821
822 --
823 -- Debug Statements
824 --
825 IF l_debug_on THEN
826 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
827 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
828 END IF;
829 --
830 END Read_Table_Attributes;
831
832
833 FUNCTION Check_DFF_Req (p_table_name IN VARCHAR2,
834 x_return_status OUT NOCOPY VARCHAR2)
835 RETURN BINARY_INTEGER IS
836 l_table_name Varchar2(30);
837 l_flexfield fnd_dflex.dflex_r;
838 l_flexinfo dflex_dr;
839 l_contexts fnd_dflex.contexts_dr;
840 l_segments fnd_dflex.segments_dr;
841 l_glbl_segments fnd_dflex.segments_dr;
842 i BINARY_INTEGER;
843 j BINARY_INTEGER;
844 l_found BOOLEAN := FALSE;
845
846 Invalid_Table EXCEPTION;
847
848 --
849 l_debug_on BOOLEAN;
850 --
851 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'CHECK_DFF_REQ';
852 --
853 BEGIN
854
855 --
856 -- Debug Statements
857 --
858 --
859 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
860 --
861 IF l_debug_on IS NULL
862 THEN
863 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
864 END IF;
865 --
866 IF l_debug_on THEN
867 WSH_DEBUG_SV.push(l_module_name);
868 --
869 WSH_DEBUG_SV.log(l_module_name,'P_TABLE_NAME',P_TABLE_NAME);
870 END IF;
871 --
872 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
873
874 l_table_name := UPPER(p_table_name);
875
876 -- 2530743 : Commenting this as this Fn./Proc. will be needed for other DFFs too
877 -- IF l_table_name <> 'WSH_NEW_DELIVERIES' THEN
878 -- RAISE Invalid_Table;
879 -- END IF;
880
881 IF g_check_req.count <> 0 THEN
882
883 -- Check if parameters have already been fetched
884 FOR i IN g_check_req.FIRST..g_check_req.LAST LOOP
885 IF g_check_req(i).table_name = l_table_name THEN
886 l_found := TRUE;
887 j := i;
888 EXIT;
889 END IF;
890 END LOOP;
891
892 IF l_found THEN
893 --
894 -- Debug Statements
895 --
896 IF l_debug_on THEN
897 WSH_DEBUG_SV.pop(l_module_name);
898 END IF;
899 --
900 RETURN j;
901 END IF;
902
903 END IF;
904
905 IF g_check_req.count = 0 THEN
906 j := 1;
907 ELSE
908 j := g_check_req.last + 1;
909 END IF;
910
911 g_check_req(j).table_name := l_table_name;
912
913 get_flexfield(appl_short_name => 'WSH',
914 flexfield_name => l_table_name,
915 flexfield => l_flexfield,
916 flexinfo => l_flexinfo);
917
918 fnd_dflex.get_contexts(flexfield => l_flexfield,
919 contexts => l_contexts);
920
921 IF l_flexinfo.context_required = 'Y' THEN
922 g_check_req(j).context_req_flag := 'Y';
923 END IF;
924 <<outer_loop>>
925 FOR i IN 1..l_contexts.ncontexts LOOP
926 IF l_contexts.is_enabled(i) THEN
927
928 fnd_dflex.get_segments(context => fnd_dflex.make_context(flexfield => l_flexfield,
929 context_code => l_contexts.context_code(i)),
930 segments => l_segments,
931 enabled_only => TRUE);
932
933 FOR i IN 1..l_segments.nsegments LOOP
934 IF l_segments.is_required(i) THEN
935 g_check_req(j).seg_req_flag := 'Y';
936 EXIT outer_loop;
937 END IF;
938 END LOOP;
939 END IF;
940 END LOOP;
941
942 --
943 -- Debug Statements
944 --
945 IF l_debug_on THEN
946 WSH_DEBUG_SV.pop(l_module_name);
947 END IF;
948 --
949 RETURN j;
950
951 EXCEPTION
952
953 WHEN Invalid_Table THEN
954 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
955 FND_MESSAGE.Set_Name('WSH', 'WSH_INVALID_TABLE');
956 FND_MESSAGE.Set_Token('TABLE', p_table_name);
957 WSH_UTIL_CORE.Add_Message(x_return_status);
958 --
959 -- Debug Statements
960 --
961 IF l_debug_on THEN
962 WSH_DEBUG_SV.pop(l_module_name);
963 END IF;
964 --
965 RETURN NULL;
966
967 --
968 -- Debug Statements
969 --
970 IF l_debug_on THEN
971 WSH_DEBUG_SV.logmsg(l_module_name,'INVALID_TABLE exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
972 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:INVALID_TABLE');
973 END IF;
974 --
975 WHEN Others THEN
976 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
977 WSH_UTIL_CORE.add_message (x_return_status);
978 WSH_UTIL_CORE.default_handler('WSH_FLEXFIELD_UTILS.Check_DFF_Req');
979 --
980 -- Debug Statements
981 --
982 IF l_debug_on THEN
983 WSH_DEBUG_SV.pop(l_module_name);
984 END IF;
985 --
986 RETURN NULL;
987
988
989 --
990 -- Debug Statements
991 --
992 IF l_debug_on THEN
993 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
994 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
995 END IF;
996 --
997 END Check_DFF_Req;
998
999
1000 FUNCTION Cache_Context_Req (p_table_name IN VARCHAR2,
1001 p_context IN VARCHAR2,
1002 x_return_status OUT NOCOPY VARCHAR2)
1003 RETURN BINARY_INTEGER IS
1004 l_table_name Varchar2(30);
1005 l_flexfield fnd_dflex.dflex_r;
1006 l_flexinfo dflex_dr;
1007 l_contexts fnd_dflex.contexts_dr;
1008 l_segments fnd_dflex.segments_dr;
1009 l_glbl_segments fnd_dflex.segments_dr;
1010 i BINARY_INTEGER;
1011 j BINARY_INTEGER;
1012 k BINARY_INTEGER;
1013 l_found BOOLEAN := FALSE;
1014
1015 Invalid_Table EXCEPTION;
1016
1017 --
1018 l_debug_on BOOLEAN;
1019 --
1020 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'CACHE_CONTEXT_REQ';
1021 --
1022 BEGIN
1023
1024 --
1025 -- Debug Statements
1026 --
1027 --
1028 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
1029 --
1030 IF l_debug_on IS NULL
1031 THEN
1032 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
1033 END IF;
1034 --
1035 IF l_debug_on THEN
1036 WSH_DEBUG_SV.push(l_module_name);
1037 --
1038 WSH_DEBUG_SV.log(l_module_name,'P_TABLE_NAME',P_TABLE_NAME);
1039 WSH_DEBUG_SV.log(l_module_name,'P_CONTEXT',P_CONTEXT);
1040 END IF;
1041 --
1042 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
1043
1044 l_table_name := UPPER(p_table_name);
1045
1046 -- 2530743 : Commenting this as this Fn./Proc. will be needed for other DFFs too
1047 -- IF l_table_name <> 'WSH_NEW_DELIVERIES' THEN
1048 -- RAISE Invalid_Table;
1049 -- END IF;
1050
1051 IF g_validate_context.count <> 0 THEN
1052
1053 -- Check if parameters have already been fetched
1054 FOR i IN g_validate_context.FIRST..g_validate_context.LAST LOOP
1055 IF g_validate_context(i).table_name = l_table_name AND g_validate_context(i).context = NVL(p_context,'GLOBAL') THEN
1056 l_found := TRUE;
1057 j := i;
1058 EXIT;
1059 END IF;
1060 END LOOP;
1061
1062 IF l_found THEN
1063 --
1064 -- Debug Statements
1065 --
1066 IF l_debug_on THEN
1067 WSH_DEBUG_SV.pop(l_module_name);
1068 END IF;
1069 --
1070 RETURN j;
1071 END IF;
1072
1073 END IF;
1074
1075 get_flexfield(appl_short_name => 'WSH',
1076 flexfield_name => l_table_name,
1077 flexfield => l_flexfield,
1078 flexinfo => l_flexinfo);
1079
1080 fnd_dflex.get_contexts(flexfield => l_flexfield,
1081 contexts => l_contexts);
1082
1083
1084 fnd_dflex.get_segments(context => fnd_dflex.make_context(flexfield => l_flexfield,
1085 context_code => p_context),
1086 segments => l_segments,
1087 enabled_only => TRUE);
1088
1089 fnd_dflex.get_segments(context => fnd_dflex.make_context(flexfield => l_flexfield,
1090 context_code => l_contexts.context_code(l_contexts.global_context)),
1091 segments => l_glbl_segments,
1092 enabled_only => TRUE);
1093
1094 IF g_validate_context.count = 0 THEN
1095 j := 1;
1096 g_validate_context(1).first_segment := 1;
1097
1098 ELSE
1099 j := g_validate_context.LAST + 1;
1100 g_validate_context(j).first_segment := g_validate_context(j-1).last_segment + 1;
1101 END IF;
1102
1103 g_validate_context(j).table_name := l_table_name;
1104 g_validate_context(j).context := NVL(p_context,'GLOBAL');
1105
1106 k := 0;
1107 IF NVL(p_context,'GLOBAL') <> 'GLOBAL' THEN
1108 FOR i IN 1..l_segments.nsegments LOOP
1109 IF l_segments.is_required(i) THEN
1110 k := k + 1;
1111 g_req_attribute_values(g_validate_context(j).first_segment + k - 1).attribute_index := (to_number(substr(l_segments.application_column_name(i),10)));
1112 g_req_attribute_values(g_validate_context(j).first_segment + k - 1).segment_value := 'Y';
1113 END IF;
1114 END LOOP;
1115 END IF;
1116
1117 FOR i IN 1..l_glbl_segments.nsegments LOOP
1118 IF l_glbl_segments.is_required(i) THEN
1119 k := k + 1;
1120 g_req_attribute_values(g_validate_context(j).first_segment + k - 1).attribute_index := (to_number(substr(l_glbl_segments.application_column_name(i),10)));
1121 g_req_attribute_values(g_validate_context(j).first_segment + k - 1).segment_value := 'Y';
1122 END IF;
1123 END LOOP;
1124
1125 g_validate_context(j).last_segment := g_validate_context(j).first_segment + k - 1;
1126
1127 --
1128 -- Debug Statements
1129 --
1130 IF l_debug_on THEN
1131 WSH_DEBUG_SV.pop(l_module_name);
1132 END IF;
1133 --
1134 RETURN j;
1135
1136 EXCEPTION
1137 WHEN Invalid_Table THEN
1138 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1139 FND_MESSAGE.Set_Name('WSH', 'WSH_INVALID_TABLE');
1140 FND_MESSAGE.Set_Token('TABLE', p_table_name);
1141 WSH_UTIL_CORE.Add_Message(x_return_status);
1142 --
1143 --
1144 -- Debug Statements
1145 --
1146 IF l_debug_on THEN
1147 WSH_DEBUG_SV.logmsg(l_module_name,'INVALID_TABLE exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
1148 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:INVALID_TABLE');
1149 END IF;
1150 --
1151 -- Debug Statements
1152 --
1153 IF l_debug_on THEN
1154 WSH_DEBUG_SV.pop(l_module_name);
1155 END IF;
1156 --
1157 RETURN NULL;
1158
1159 WHEN Others THEN
1160 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
1161 WSH_UTIL_CORE.add_message (x_return_status);
1162 WSH_UTIL_CORE.default_handler('WSH_FLEXFIELD_UTILS.Cache_Context_Req');
1163 --
1164 --
1165 -- Debug Statements
1166 --
1167 IF l_debug_on THEN
1168 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
1169 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
1170 END IF;
1171 --
1172 -- Debug Statements
1173 --
1174 IF l_debug_on THEN
1175 WSH_DEBUG_SV.pop(l_module_name);
1176 END IF;
1177 --
1178 RETURN NULL;
1179
1180
1181 END Cache_Context_Req;
1182
1183 PROCEDURE Validate_DFF(
1184 p_table_name IN VARCHAR2,
1185 p_primary_id IN NUMBER,
1186 x_return_status OUT NOCOPY VARCHAR2
1187 ) IS
1188
1189 i BINARY_INTEGER;
1190 j BINARY_INTEGER;
1191 k BINARY_INTEGER;
1192 attributes FlexfieldAttributeTabType;
1193 l_token VARCHAR2(2000);
1194 context VARCHAR2(150);
1195
1196 Required_Attributes_Empty EXCEPTION;
1197
1198 --
1199 l_debug_on BOOLEAN;
1200 --
1201 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'VALIDATE_DFF';
1202 --
1203 BEGIN
1204
1205 --
1206 -- Debug Statements
1207 --
1208 --
1209 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
1210 --
1211 IF l_debug_on IS NULL
1212 THEN
1213 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
1214 END IF;
1215 --
1216 IF l_debug_on THEN
1217 WSH_DEBUG_SV.push(l_module_name);
1218 --
1219 WSH_DEBUG_SV.log(l_module_name,'P_TABLE_NAME',P_TABLE_NAME);
1220 WSH_DEBUG_SV.log(l_module_name,'P_PRIMARY_ID',P_PRIMARY_ID);
1221 END IF;
1222 --
1223 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
1224 IF (p_table_name = 'WSH_NEW_DELIVERIES') THEN
1225 l_token := FND_MESSAGE.Get_String('WSH', 'WSH_DELIVERY_DFF_TITLE');
1226 END IF;
1227
1228 j := Check_DFF_Req(p_table_name => p_table_name,
1229 x_return_status => x_return_status);
1230
1231 IF x_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS THEN
1232 --
1233 -- Debug Statements
1234 --
1235 IF l_debug_on THEN
1236 WSH_DEBUG_SV.pop(l_module_name);
1237 END IF;
1238 --
1239 return;
1240 END IF;
1241
1242
1243 IF g_check_req(j).seg_req_flag = 'Y' OR g_check_req(j).context_req_flag = 'Y' THEN
1244
1245
1246 Read_Table_Attributes(p_table_name => p_table_name,
1247 p_primary_id => p_primary_id,
1248 p_attributes => attributes,
1249 p_context => context,
1250 x_return_status => x_return_status);
1251
1252 IF x_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS THEN
1253 --
1254 -- Debug Statements
1255 --
1256 IF l_debug_on THEN
1257 WSH_DEBUG_SV.pop(l_module_name);
1258 END IF;
1259 --
1260 return;
1261 END IF;
1262
1263
1264 IF context IS NULL THEN
1265 IF g_check_req(j).context_req_flag = 'Y' THEN
1266 RAISE Required_Attributes_Empty;
1267 END IF;
1268 END IF;
1269
1270 IF g_check_req(j).seg_req_flag = 'Y' THEN
1271 k := Cache_Context_Req(p_table_name => p_table_name ,
1272 p_context => context,
1273 x_return_status => x_return_status);
1274
1275
1276
1277 FOR i IN g_validate_context(k).first_segment .. g_validate_context(k).last_segment LOOP
1278
1279 IF attributes(g_req_attribute_values(i).attribute_index) IS NULL THEN
1280 RAISE Required_Attributes_Empty;
1281 END IF;
1282 END LOOP;
1283 END IF;
1284
1285 END IF;
1286
1287 --
1288 -- Debug Statements
1289 --
1290 IF l_debug_on THEN
1291 WSH_DEBUG_SV.pop(l_module_name);
1292 END IF;
1293 --
1294 EXCEPTION
1295 WHEN Required_Attributes_Empty THEN
1296 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1297 -- IF condition Added for Bug 3118519
1298 IF ( UPPER(p_table_name) = 'WSH_NEW_DELIVERIES' ) THEN
1299 FND_MESSAGE.Set_Name('WSH', 'WSH_DFF_ATTRIBUTE_EMPTY');
1300 FND_MESSAGE.Set_Token('DFF_TITLE', l_token);
1301 WSH_UTIL_CORE.Add_Message(x_return_status);
1302 END IF;
1303 --
1304 -- Debug Statements
1305 --
1306 IF l_debug_on THEN
1307 WSH_DEBUG_SV.logmsg(l_module_name,'REQUIRED_ATTRIBUTES_EMPTY exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
1308 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:REQUIRED_ATTRIBUTES_EMPTY');
1309 END IF;
1310 --
1311 WHEN Others THEN
1312 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
1313 WSH_UTIL_CORE.add_message (x_return_status);
1314 WSH_UTIL_CORE.default_handler('WSH_FLEXFIELD_UTILS.Validate_DFF');
1315 --
1316 -- Debug Statements
1317 --
1318 IF l_debug_on THEN
1319 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
1320 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
1321 END IF;
1322 --
1323 END Validate_DFF;
1324
1325 END WSH_FLEXFIELD_UTILS;