DBA Data[Home] [Help]

PACKAGE BODY: APPS.GME_VALIDATE_FLEX_FLD_PVT

Source


1 PACKAGE BODY gme_validate_flex_fld_pvt AS
2    /* $Header: GMEVVFFB.pls 120.4 2006/03/09 05:41:51 svgonugu noship $ */
3    g_debug                VARCHAR2 (5)  := fnd_profile.VALUE ('AFLOG_LEVEL');
4    g_pkg_name    CONSTANT VARCHAR2 (30) := 'GME_API_VALIDATE_FLEX_FIELD';
5 
6    /* FPBug#4395561  commented out following line
7    g_flex_validate_prof   NUMBER
8                 := NVL (fnd_profile.VALUE ('GME_VALIDATE_FLEX_ON_SERVER'), 0); */
9 
10     /*======================================================================
11    -- NAME
12    -- validate_flex_batch_header
13    --
14    -- DESCRIPTION
15    --    This procedure will validate the BATCH_FLEX, descriptive flex field on the
16    --    batch header using serverside flex field validation package FND_FLEX_DESCVAL.
17    --
18    -- SYNOPSIS:
19 
20         validate_flex_batch_header(p_batch_header => a_batch_header,
21                                    x_batch_header => b_batch_header,
22                                    x_return_status =>l_return_status);
23    -- HISTORY
24    -- A.Sriram    19-FEB-2004     Created --BUG#3406639
25 
26    -- G. Muratore 05-MAY-2004     Bug 3575735
27    --  New profile added to control whether or not this procedure should be
28    --  executed. A problem occurs when there is a flexfield of value set type,
29    --  that has a where clause using a block field on the form.
30    ======================================================================= */
31    PROCEDURE validate_flex_batch_header (
32       p_batch_header    IN              gme_batch_header%ROWTYPE
33      ,x_batch_header    IN OUT NOCOPY   gme_batch_header%ROWTYPE
34      ,x_return_status   OUT NOCOPY      VARCHAR2)
35    IS
36       l_attribute_category   VARCHAR2 (240);
37       appl_short_name        VARCHAR2 (30)              := 'GME';
38       desc_flex_name         VARCHAR2 (30)              := 'BATCH_FLEX';
39       values_or_ids          VARCHAR2 (10)              := 'I';
40       validation_date        DATE                       := SYSDATE;
41       error_msg              VARCHAR2 (5000);
42       validation_error       EXCEPTION;
43       header_fetch_error     EXCEPTION;
44       l_field_value          VARCHAR2 (240);
45       l_field_name           VARCHAR2 (100);
46       n                      NUMBER                     := 0;
47       l_batch_header_row     gme_batch_header%ROWTYPE;
48    BEGIN
49       /* Set return status to success initially */
50       x_return_status := fnd_api.g_ret_sts_success;
51 
52       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
53          gme_debug.put_line (   'Check if flexfield is enabled : '
54                              || desc_flex_name);
55       END IF;
56 
57       OPEN cur_get_appl_id;
58 
59       FETCH cur_get_appl_id
60        INTO pkg_application_id;
61 
62       CLOSE cur_get_appl_id;
63 
64       IF NOT fnd_flex_apis.is_descr_setup (pkg_application_id, desc_flex_name) THEN
65          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
66             gme_debug.put_line
67                          ('Flexfield is not enabled, No validation required.');
68          END IF;
69 
70          RETURN;
71       END IF;
72 
73       /* Bug 3575735 - Do not run this validation if it is set to N. */
74       /* It should only be set to N if it is a value set flexfield   */
75       /* with a where clause using block fields from the form.       */
76       IF gme_common_pvt.g_flex_validate_prof = 0 THEN
77          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
78             gme_debug.put_line
79                      ('GME Flexfield is not enabled, No validation required.');
80          END IF;
81 
82          RETURN;
83       END IF;
84 
85       IF NOT gme_batch_header_dbl.fetch_row (p_batch_header
86                                             ,l_batch_header_row) THEN
87          RAISE header_fetch_error;
88       END IF;
89 
90       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
91          gme_debug.put_line (   'Validation of the Flex field : '
92                              || desc_flex_name);
93          gme_debug.put_line
94             ('Assignment of the attribute Category And Attribute Values to Local Variables');
95       END IF;
96 
97       l_attribute_category := p_batch_header.attribute_category;
98 
99       IF p_batch_header.attribute_category IS NULL THEN
100          l_attribute_category :=
101                               NVL (l_batch_header_row.attribute_category, '');
102       ELSIF p_batch_header.attribute_category = fnd_api.g_miss_char THEN
103          l_attribute_category := '';
104       END IF;
105 
106       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
107          gme_debug.put_line
108             ('setting set column values for the context value,for Global Data Elements and for context code.');
109       END IF;
110 
111       fnd_flex_descval.set_context_value (l_attribute_category);
112 
113       IF p_batch_header.attribute1 IS NULL THEN
114          fnd_flex_descval.set_column_value
115                                         ('ATTRIBUTE1'
116                                         ,NVL (l_batch_header_row.attribute1
117                                              ,'') );
118       ELSIF p_batch_header.attribute1 = fnd_api.g_miss_char THEN
119          fnd_flex_descval.set_column_value ('ATTRIBUTE1', '');
120       ELSE
121          fnd_flex_descval.set_column_value ('ATTRIBUTE1'
122                                            ,p_batch_header.attribute1);
123       END IF;
124 
125       IF p_batch_header.attribute2 IS NULL THEN
126          fnd_flex_descval.set_column_value
127                                         ('ATTRIBUTE2'
128                                         ,NVL (l_batch_header_row.attribute2
129                                              ,'') );
130       ELSIF p_batch_header.attribute2 = fnd_api.g_miss_char THEN
131          fnd_flex_descval.set_column_value ('ATTRIBUTE2', '');
132       ELSE
133          fnd_flex_descval.set_column_value ('ATTRIBUTE2'
134                                            ,p_batch_header.attribute2);
135       END IF;
136 
137       IF p_batch_header.attribute3 IS NULL THEN
138          fnd_flex_descval.set_column_value
139                                         ('ATTRIBUTE3'
140                                         ,NVL (l_batch_header_row.attribute3
141                                              ,'') );
142       ELSIF p_batch_header.attribute3 = fnd_api.g_miss_char THEN
143          fnd_flex_descval.set_column_value ('ATTRIBUTE3', '');
144       ELSE
145          fnd_flex_descval.set_column_value ('ATTRIBUTE3'
146                                            ,p_batch_header.attribute3);
147       END IF;
148 
149       IF p_batch_header.attribute4 IS NULL THEN
150          fnd_flex_descval.set_column_value
151                                         ('ATTRIBUTE4'
152                                         ,NVL (l_batch_header_row.attribute4
153                                              ,'') );
154       ELSIF p_batch_header.attribute4 = fnd_api.g_miss_char THEN
155          fnd_flex_descval.set_column_value ('ATTRIBUTE4', '');
156       ELSE
157          fnd_flex_descval.set_column_value ('ATTRIBUTE4'
158                                            ,p_batch_header.attribute4);
159       END IF;
160 
161       IF p_batch_header.attribute5 IS NULL THEN
162          fnd_flex_descval.set_column_value
163                                         ('ATTRIBUTE5'
164                                         ,NVL (l_batch_header_row.attribute5
165                                              ,'') );
166       ELSIF p_batch_header.attribute5 = fnd_api.g_miss_char THEN
167          fnd_flex_descval.set_column_value ('ATTRIBUTE5', '');
168       ELSE
169          fnd_flex_descval.set_column_value ('ATTRIBUTE5'
170                                            ,p_batch_header.attribute5);
171       END IF;
172 
173       IF p_batch_header.attribute6 IS NULL THEN
174          fnd_flex_descval.set_column_value
175                                         ('ATTRIBUTE6'
176                                         ,NVL (l_batch_header_row.attribute6
177                                              ,'') );
178       ELSIF p_batch_header.attribute6 = fnd_api.g_miss_char THEN
179          fnd_flex_descval.set_column_value ('ATTRIBUTE6', '');
180       ELSE
181          fnd_flex_descval.set_column_value ('ATTRIBUTE6'
182                                            ,p_batch_header.attribute6);
183       END IF;
184 
185       IF p_batch_header.attribute7 IS NULL THEN
186          fnd_flex_descval.set_column_value
187                                         ('ATTRIBUTE7'
188                                         ,NVL (l_batch_header_row.attribute7
189                                              ,'') );
190       ELSIF p_batch_header.attribute7 = fnd_api.g_miss_char THEN
191          fnd_flex_descval.set_column_value ('ATTRIBUTE7', '');
192       ELSE
193          fnd_flex_descval.set_column_value ('ATTRIBUTE7'
194                                            ,p_batch_header.attribute7);
195       END IF;
196 
197       IF p_batch_header.attribute8 IS NULL THEN
198          fnd_flex_descval.set_column_value
199                                         ('ATTRIBUTE8'
200                                         ,NVL (l_batch_header_row.attribute8
201                                              ,'') );
202       ELSIF p_batch_header.attribute8 = fnd_api.g_miss_char THEN
203          fnd_flex_descval.set_column_value ('ATTRIBUTE8', '');
204       ELSE
205          fnd_flex_descval.set_column_value ('ATTRIBUTE8'
206                                            ,p_batch_header.attribute8);
207       END IF;
208 
209       IF p_batch_header.attribute9 IS NULL THEN
210          fnd_flex_descval.set_column_value
211                                         ('ATTRIBUTE9'
212                                         ,NVL (l_batch_header_row.attribute9
213                                              ,'') );
214       ELSIF p_batch_header.attribute9 = fnd_api.g_miss_char THEN
215          fnd_flex_descval.set_column_value ('ATTRIBUTE9', '');
216       ELSE
217          fnd_flex_descval.set_column_value ('ATTRIBUTE9'
218                                            ,p_batch_header.attribute9);
219       END IF;
220 
221       IF p_batch_header.attribute10 IS NULL THEN
222          fnd_flex_descval.set_column_value
223                                        ('ATTRIBUTE10'
224                                        ,NVL (l_batch_header_row.attribute10
225                                             ,'') );
226       ELSIF p_batch_header.attribute10 = fnd_api.g_miss_char THEN
227          fnd_flex_descval.set_column_value ('ATTRIBUTE10', '');
228       ELSE
229          fnd_flex_descval.set_column_value ('ATTRIBUTE10'
230                                            ,p_batch_header.attribute10);
231       END IF;
232 
233       IF p_batch_header.attribute11 IS NULL THEN
234          fnd_flex_descval.set_column_value
235                                        ('ATTRIBUTE11'
236                                        ,NVL (l_batch_header_row.attribute11
237                                             ,'') );
238       ELSIF p_batch_header.attribute1 = fnd_api.g_miss_char THEN
239          fnd_flex_descval.set_column_value ('ATTRIBUTE11', '');
240       ELSE
241          fnd_flex_descval.set_column_value ('ATTRIBUTE11'
242                                            ,p_batch_header.attribute11);
243       END IF;
244 
245       IF p_batch_header.attribute12 IS NULL THEN
246          fnd_flex_descval.set_column_value
247                                        ('ATTRIBUTE12'
248                                        ,NVL (l_batch_header_row.attribute12
249                                             ,'') );
250       ELSIF p_batch_header.attribute12 = fnd_api.g_miss_char THEN
251          fnd_flex_descval.set_column_value ('ATTRIBUTE12', '');
252       ELSE
253          fnd_flex_descval.set_column_value ('ATTRIBUTE12'
254                                            ,p_batch_header.attribute12);
255       END IF;
256 
257       IF p_batch_header.attribute13 IS NULL THEN
258          fnd_flex_descval.set_column_value
259                                        ('ATTRIBUTE13'
260                                        ,NVL (l_batch_header_row.attribute13
261                                             ,'') );
262       ELSIF p_batch_header.attribute13 = fnd_api.g_miss_char THEN
263          fnd_flex_descval.set_column_value ('ATTRIBUTE13', '');
264       ELSE
265          fnd_flex_descval.set_column_value ('ATTRIBUTE13'
266                                            ,p_batch_header.attribute13);
267       END IF;
268 
269       IF p_batch_header.attribute14 IS NULL THEN
270          fnd_flex_descval.set_column_value
271                                        ('ATTRIBUTE14'
272                                        ,NVL (l_batch_header_row.attribute14
273                                             ,'') );
274       ELSIF p_batch_header.attribute14 = fnd_api.g_miss_char THEN
275          fnd_flex_descval.set_column_value ('ATTRIBUTE14', '');
276       ELSE
277          fnd_flex_descval.set_column_value ('ATTRIBUTE14'
278                                            ,p_batch_header.attribute14);
279       END IF;
280 
281       IF p_batch_header.attribute15 IS NULL THEN
282          fnd_flex_descval.set_column_value
283                                        ('ATTRIBUTE15'
284                                        ,NVL (l_batch_header_row.attribute15
285                                             ,'') );
286       ELSIF p_batch_header.attribute15 = fnd_api.g_miss_char THEN
287          fnd_flex_descval.set_column_value ('ATTRIBUTE15', '');
288       ELSE
289          fnd_flex_descval.set_column_value ('ATTRIBUTE15'
290                                            ,p_batch_header.attribute15);
291       END IF;
292 
293       IF p_batch_header.attribute16 IS NULL THEN
294          fnd_flex_descval.set_column_value
295                                        ('ATTRIBUTE16'
296                                        ,NVL (l_batch_header_row.attribute16
297                                             ,'') );
298       ELSIF p_batch_header.attribute16 = fnd_api.g_miss_char THEN
299          fnd_flex_descval.set_column_value ('ATTRIBUTE16', '');
300       ELSE
301          fnd_flex_descval.set_column_value ('ATTRIBUTE16'
302                                            ,p_batch_header.attribute16);
303       END IF;
304 
305       IF p_batch_header.attribute17 IS NULL THEN
306          fnd_flex_descval.set_column_value
307                                        ('ATTRIBUTE17'
308                                        ,NVL (l_batch_header_row.attribute17
309                                             ,'') );
310       ELSIF p_batch_header.attribute17 = fnd_api.g_miss_char THEN
311          fnd_flex_descval.set_column_value ('ATTRIBUTE17', '');
312       ELSE
313          fnd_flex_descval.set_column_value ('ATTRIBUTE17'
314                                            ,p_batch_header.attribute17);
315       END IF;
316 
317       IF p_batch_header.attribute18 IS NULL THEN
318          fnd_flex_descval.set_column_value
319                                        ('ATTRIBUTE18'
320                                        ,NVL (l_batch_header_row.attribute18
321                                             ,'') );
322       ELSIF p_batch_header.attribute18 = fnd_api.g_miss_char THEN
323          fnd_flex_descval.set_column_value ('ATTRIBUTE18', '');
324       ELSE
325          fnd_flex_descval.set_column_value ('ATTRIBUTE18'
326                                            ,p_batch_header.attribute18);
327       END IF;
328 
329       IF p_batch_header.attribute19 IS NULL THEN
330          fnd_flex_descval.set_column_value
331                                        ('ATTRIBUTE19'
332                                        ,NVL (l_batch_header_row.attribute19
333                                             ,'') );
334       ELSIF p_batch_header.attribute19 = fnd_api.g_miss_char THEN
335          fnd_flex_descval.set_column_value ('ATTRIBUTE19', '');
336       ELSE
337          fnd_flex_descval.set_column_value ('ATTRIBUTE19'
338                                            ,p_batch_header.attribute19);
339       END IF;
340 
341       IF p_batch_header.attribute20 IS NULL THEN
342          fnd_flex_descval.set_column_value
343                                        ('ATTRIBUTE20'
344                                        ,NVL (l_batch_header_row.attribute20
345                                             ,'') );
346       ELSIF p_batch_header.attribute20 = fnd_api.g_miss_char THEN
347          fnd_flex_descval.set_column_value ('ATTRIBUTE20', '');
348       ELSE
349          fnd_flex_descval.set_column_value ('ATTRIBUTE20'
350                                            ,p_batch_header.attribute20);
351       END IF;
352 
353       IF p_batch_header.attribute21 IS NULL THEN
354          fnd_flex_descval.set_column_value
355                                        ('ATTRIBUTE21'
356                                        ,NVL (l_batch_header_row.attribute21
357                                             ,'') );
358       ELSIF p_batch_header.attribute21 = fnd_api.g_miss_char THEN
359          fnd_flex_descval.set_column_value ('ATTRIBUTE21', '');
360       ELSE
361          fnd_flex_descval.set_column_value ('ATTRIBUTE21'
362                                            ,p_batch_header.attribute21);
363       END IF;
364 
365       IF p_batch_header.attribute22 IS NULL THEN
366          fnd_flex_descval.set_column_value
367                                        ('ATTRIBUTE22'
368                                        ,NVL (l_batch_header_row.attribute22
369                                             ,'') );
370       ELSIF p_batch_header.attribute22 = fnd_api.g_miss_char THEN
371          fnd_flex_descval.set_column_value ('ATTRIBUTE22', '');
372       ELSE
373          fnd_flex_descval.set_column_value ('ATTRIBUTE22'
374                                            ,p_batch_header.attribute22);
375       END IF;
376 
377       IF p_batch_header.attribute23 IS NULL THEN
378          fnd_flex_descval.set_column_value
379                                        ('ATTRIBUTE23'
380                                        ,NVL (l_batch_header_row.attribute23
381                                             ,'') );
382       ELSIF p_batch_header.attribute23 = fnd_api.g_miss_char THEN
383          fnd_flex_descval.set_column_value ('ATTRIBUTE23', '');
384       ELSE
385          fnd_flex_descval.set_column_value ('ATTRIBUTE23'
386                                            ,p_batch_header.attribute23);
387       END IF;
388 
389       IF p_batch_header.attribute24 IS NULL THEN
390          fnd_flex_descval.set_column_value
391                                        ('ATTRIBUTE24'
392                                        ,NVL (l_batch_header_row.attribute24
393                                             ,'') );
394       ELSIF p_batch_header.attribute24 = fnd_api.g_miss_char THEN
395          fnd_flex_descval.set_column_value ('ATTRIBUTE24', '');
396       ELSE
397          fnd_flex_descval.set_column_value ('ATTRIBUTE24'
398                                            ,p_batch_header.attribute24);
399       END IF;
400 
401       IF p_batch_header.attribute25 IS NULL THEN
402          fnd_flex_descval.set_column_value
403                                        ('ATTRIBUTE25'
404                                        ,NVL (l_batch_header_row.attribute25
405                                             ,'') );
406       ELSIF p_batch_header.attribute25 = fnd_api.g_miss_char THEN
407          fnd_flex_descval.set_column_value ('ATTRIBUTE25', '');
408       ELSE
409          fnd_flex_descval.set_column_value ('ATTRIBUTE25'
410                                            ,p_batch_header.attribute25);
411       END IF;
412 
413       IF p_batch_header.attribute26 IS NULL THEN
414          fnd_flex_descval.set_column_value
415                                        ('ATTRIBUTE26'
416                                        ,NVL (l_batch_header_row.attribute26
417                                             ,'') );
418       ELSIF p_batch_header.attribute26 = fnd_api.g_miss_char THEN
419          fnd_flex_descval.set_column_value ('ATTRIBUTE26', '');
420       ELSE
421          fnd_flex_descval.set_column_value ('ATTRIBUTE26'
422                                            ,p_batch_header.attribute26);
423       END IF;
424 
425       IF p_batch_header.attribute27 IS NULL THEN
426          fnd_flex_descval.set_column_value
427                                        ('ATTRIBUTE27'
428                                        ,NVL (l_batch_header_row.attribute27
429                                             ,'') );
430       ELSIF p_batch_header.attribute27 = fnd_api.g_miss_char THEN
431          fnd_flex_descval.set_column_value ('ATTRIBUTE27', '');
432       ELSE
433          fnd_flex_descval.set_column_value ('ATTRIBUTE27'
434                                            ,p_batch_header.attribute27);
435       END IF;
436 
437       IF p_batch_header.attribute28 IS NULL THEN
438          fnd_flex_descval.set_column_value
439                                        ('ATTRIBUTE28'
440                                        ,NVL (l_batch_header_row.attribute28
441                                             ,'') );
442       ELSIF p_batch_header.attribute28 = fnd_api.g_miss_char THEN
443          fnd_flex_descval.set_column_value ('ATTRIBUTE28', '');
444       ELSE
445          fnd_flex_descval.set_column_value ('ATTRIBUTE28'
446                                            ,p_batch_header.attribute28);
447       END IF;
448 
449       IF p_batch_header.attribute29 IS NULL THEN
450          fnd_flex_descval.set_column_value
451                                        ('ATTRIBUTE29'
452                                        ,NVL (l_batch_header_row.attribute29
453                                             ,'') );
454       ELSIF p_batch_header.attribute29 = fnd_api.g_miss_char THEN
455          fnd_flex_descval.set_column_value ('ATTRIBUTE29', '');
456       ELSE
457          fnd_flex_descval.set_column_value ('ATTRIBUTE29'
458                                            ,p_batch_header.attribute29);
459       END IF;
460 
461       IF p_batch_header.attribute30 IS NULL THEN
462          fnd_flex_descval.set_column_value
463                                        ('ATTRIBUTE30'
464                                        ,NVL (l_batch_header_row.attribute30
465                                             ,'') );
466       ELSIF p_batch_header.attribute30 = fnd_api.g_miss_char THEN
467          fnd_flex_descval.set_column_value ('ATTRIBUTE30', '');
468       ELSE
469          fnd_flex_descval.set_column_value ('ATTRIBUTE30'
470                                            ,p_batch_header.attribute30);
471       END IF;
472 
473       IF p_batch_header.attribute31 IS NULL THEN
474          fnd_flex_descval.set_column_value
475                                        ('ATTRIBUTE31'
476                                        ,NVL (l_batch_header_row.attribute31
477                                             ,'') );
478       ELSIF p_batch_header.attribute31 = fnd_api.g_miss_char THEN
479          fnd_flex_descval.set_column_value ('ATTRIBUTE31', '');
480       ELSE
481          fnd_flex_descval.set_column_value ('ATTRIBUTE31'
482                                            ,p_batch_header.attribute31);
483       END IF;
484 
485       IF p_batch_header.attribute32 IS NULL THEN
486          fnd_flex_descval.set_column_value
487                                        ('ATTRIBUTE32'
488                                        ,NVL (l_batch_header_row.attribute32
489                                             ,'') );
490       ELSIF p_batch_header.attribute32 = fnd_api.g_miss_char THEN
491          fnd_flex_descval.set_column_value ('ATTRIBUTE32', '');
492       ELSE
493          fnd_flex_descval.set_column_value ('ATTRIBUTE32'
494                                            ,p_batch_header.attribute32);
495       END IF;
496 
497       IF p_batch_header.attribute33 IS NULL THEN
498          fnd_flex_descval.set_column_value
499                                        ('ATTRIBUTE33'
500                                        ,NVL (l_batch_header_row.attribute33
501                                             ,'') );
502       ELSIF p_batch_header.attribute33 = fnd_api.g_miss_char THEN
503          fnd_flex_descval.set_column_value ('ATTRIBUTE33', '');
504       ELSE
505          fnd_flex_descval.set_column_value ('ATTRIBUTE33'
506                                            ,p_batch_header.attribute33);
507       END IF;
508 
509       IF p_batch_header.attribute34 IS NULL THEN
510          fnd_flex_descval.set_column_value
511                                        ('ATTRIBUTE34'
512                                        ,NVL (l_batch_header_row.attribute34
513                                             ,'') );
514       ELSIF p_batch_header.attribute34 = fnd_api.g_miss_char THEN
515          fnd_flex_descval.set_column_value ('ATTRIBUTE34', '');
516       ELSE
517          fnd_flex_descval.set_column_value ('ATTRIBUTE34'
518                                            ,p_batch_header.attribute34);
519       END IF;
520 
521       IF p_batch_header.attribute35 IS NULL THEN
522          fnd_flex_descval.set_column_value
523                                        ('ATTRIBUTE35'
524                                        ,NVL (l_batch_header_row.attribute35
525                                             ,'') );
526       ELSIF p_batch_header.attribute35 = fnd_api.g_miss_char THEN
527          fnd_flex_descval.set_column_value ('ATTRIBUTE35', '');
528       ELSE
529          fnd_flex_descval.set_column_value ('ATTRIBUTE35'
530                                            ,p_batch_header.attribute35);
531       END IF;
532 
533       IF p_batch_header.attribute36 IS NULL THEN
534          fnd_flex_descval.set_column_value
535                                        ('ATTRIBUTE36'
536                                        ,NVL (l_batch_header_row.attribute36
537                                             ,'') );
538       ELSIF p_batch_header.attribute36 = fnd_api.g_miss_char THEN
539          fnd_flex_descval.set_column_value ('ATTRIBUTE36', '');
540       ELSE
541          fnd_flex_descval.set_column_value ('ATTRIBUTE36'
542                                            ,p_batch_header.attribute36);
543       END IF;
544 
545       IF p_batch_header.attribute37 IS NULL THEN
546          fnd_flex_descval.set_column_value
547                                        ('ATTRIBUTE37'
548                                        ,NVL (l_batch_header_row.attribute37
549                                             ,'') );
550       ELSIF p_batch_header.attribute37 = fnd_api.g_miss_char THEN
551          fnd_flex_descval.set_column_value ('ATTRIBUTE37', '');
552       ELSE
553          fnd_flex_descval.set_column_value ('ATTRIBUTE37'
554                                            ,p_batch_header.attribute37);
555       END IF;
556 
557       IF p_batch_header.attribute38 IS NULL THEN
558          fnd_flex_descval.set_column_value
559                                        ('ATTRIBUTE38'
560                                        ,NVL (l_batch_header_row.attribute38
561                                             ,'') );
562       ELSIF p_batch_header.attribute38 = fnd_api.g_miss_char THEN
563          fnd_flex_descval.set_column_value ('ATTRIBUTE38', '');
564       ELSE
565          fnd_flex_descval.set_column_value ('ATTRIBUTE38'
566                                            ,p_batch_header.attribute38);
567       END IF;
568 
569       IF p_batch_header.attribute39 IS NULL THEN
570          fnd_flex_descval.set_column_value
571                                        ('ATTRIBUTE39'
572                                        ,NVL (l_batch_header_row.attribute39
573                                             ,'') );
574       ELSIF p_batch_header.attribute39 = fnd_api.g_miss_char THEN
575          fnd_flex_descval.set_column_value ('ATTRIBUTE39', '');
576       ELSE
577          fnd_flex_descval.set_column_value ('ATTRIBUTE39'
578                                            ,p_batch_header.attribute39);
579       END IF;
580 
581       IF p_batch_header.attribute40 IS NULL THEN
582          fnd_flex_descval.set_column_value
583                                        ('ATTRIBUTE40'
584                                        ,NVL (l_batch_header_row.attribute40
585                                             ,'') );
586       ELSIF p_batch_header.attribute40 = fnd_api.g_miss_char THEN
587          fnd_flex_descval.set_column_value ('ATTRIBUTE40', '');
588       ELSE
589          fnd_flex_descval.set_column_value ('ATTRIBUTE40'
590                                            ,p_batch_header.attribute40);
591       END IF;
592 
593       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
594          gme_debug.put_line ('Calling FND_FLEX_DESCVAL.validate_desccols ');
595       END IF;
596 
597       IF fnd_flex_descval.validate_desccols
598                                           (appl_short_name      => appl_short_name
599                                           ,desc_flex_name       => desc_flex_name
600                                           ,values_or_ids        => values_or_ids
601                                           ,validation_date      => validation_date) THEN
602          --SUCCESS
603          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
604             gme_debug.put_line ('Validation Success. ');
605          END IF;
606 
607          x_return_status := fnd_api.g_ret_sts_success;
608          n := fnd_flex_descval.segment_count;
609 
610          /*Now let us copy back the storage value  */
611          FOR i IN 1 .. n LOOP
612             IF fnd_flex_descval.segment_column_name (i) =
613                                                          'ATTRIBUTE_CATEGORY' THEN
614                x_batch_header.attribute_category :=
615                                               fnd_flex_descval.segment_id (i);
616             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE1' THEN
617                x_batch_header.attribute1 := fnd_flex_descval.segment_id (i);
618             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE2' THEN
619                x_batch_header.attribute2 := fnd_flex_descval.segment_id (i);
620             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE3' THEN
621                x_batch_header.attribute3 := fnd_flex_descval.segment_id (i);
622             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE4' THEN
623                x_batch_header.attribute4 := fnd_flex_descval.segment_id (i);
624             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE5' THEN
625                x_batch_header.attribute5 := fnd_flex_descval.segment_id (i);
626             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE6' THEN
627                x_batch_header.attribute6 := fnd_flex_descval.segment_id (i);
628             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE7' THEN
629                x_batch_header.attribute7 := fnd_flex_descval.segment_id (i);
630             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE8' THEN
631                x_batch_header.attribute8 := fnd_flex_descval.segment_id (i);
632             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE9' THEN
633                x_batch_header.attribute9 := fnd_flex_descval.segment_id (i);
634             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE10' THEN
635                x_batch_header.attribute10 := fnd_flex_descval.segment_id (i);
636             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE11' THEN
637                x_batch_header.attribute11 := fnd_flex_descval.segment_id (i);
638             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE12' THEN
639                x_batch_header.attribute12 := fnd_flex_descval.segment_id (i);
640             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE13' THEN
641                x_batch_header.attribute13 := fnd_flex_descval.segment_id (i);
642             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE14' THEN
643                x_batch_header.attribute14 := fnd_flex_descval.segment_id (i);
644             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE15' THEN
645                x_batch_header.attribute15 := fnd_flex_descval.segment_id (i);
646             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE16' THEN
647                x_batch_header.attribute16 := fnd_flex_descval.segment_id (i);
648             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE17' THEN
649                x_batch_header.attribute17 := fnd_flex_descval.segment_id (i);
650             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE18' THEN
651                x_batch_header.attribute18 := fnd_flex_descval.segment_id (i);
652             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE19' THEN
653                x_batch_header.attribute19 := fnd_flex_descval.segment_id (i);
654             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE20' THEN
655                x_batch_header.attribute20 := fnd_flex_descval.segment_id (i);
656             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE21' THEN
657                x_batch_header.attribute21 := fnd_flex_descval.segment_id (i);
658             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE22' THEN
659                x_batch_header.attribute22 := fnd_flex_descval.segment_id (i);
660             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE23' THEN
661                x_batch_header.attribute23 := fnd_flex_descval.segment_id (i);
662             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE24' THEN
663                x_batch_header.attribute24 := fnd_flex_descval.segment_id (i);
664             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE25' THEN
665                x_batch_header.attribute25 := fnd_flex_descval.segment_id (i);
666             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE26' THEN
667                x_batch_header.attribute26 := fnd_flex_descval.segment_id (i);
668             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE27' THEN
669                x_batch_header.attribute27 := fnd_flex_descval.segment_id (i);
670             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE28' THEN
671                x_batch_header.attribute28 := fnd_flex_descval.segment_id (i);
672             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE29' THEN
673                x_batch_header.attribute29 := fnd_flex_descval.segment_id (i);
674             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE30' THEN
675                x_batch_header.attribute30 := fnd_flex_descval.segment_id (i);
676             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE31' THEN
677                x_batch_header.attribute31 := fnd_flex_descval.segment_id (i);
678             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE32' THEN
679                x_batch_header.attribute32 := fnd_flex_descval.segment_id (i);
680             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE33' THEN
681                x_batch_header.attribute33 := fnd_flex_descval.segment_id (i);
682             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE34' THEN
683                x_batch_header.attribute34 := fnd_flex_descval.segment_id (i);
684             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE35' THEN
685                x_batch_header.attribute35 := fnd_flex_descval.segment_id (i);
686             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE36' THEN
687                x_batch_header.attribute36 := fnd_flex_descval.segment_id (i);
688             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE37' THEN
689                x_batch_header.attribute37 := fnd_flex_descval.segment_id (i);
690             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE38' THEN
691                x_batch_header.attribute38 := fnd_flex_descval.segment_id (i);
692             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE39' THEN
693                x_batch_header.attribute39 := fnd_flex_descval.segment_id (i);
694             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE40' THEN
695                x_batch_header.attribute40 := fnd_flex_descval.segment_id (i);
696             END IF;
697          END LOOP;
698       ELSE
699          error_msg := fnd_flex_descval.error_message;
700 
701          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
702             gme_debug.put_line ('Validation Ends With Error(s) :');
703             gme_debug.put_line ('Error :' || error_msg);
704          END IF;
705 
706          gme_common_pvt.log_message ('FLEX-USER DEFINED ERROR'
707                                     ,'MSG'
708                                     ,error_msg);
709          RAISE validation_error;
710       END IF;
711 
712       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
713          gme_debug.put_line (   'Validation completed for the Flex field : '
714                              || desc_flex_name);
715       END IF;
716    EXCEPTION
717       WHEN validation_error THEN
718          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
719             gme_debug.put_line
720                  (   'Validation completed with errors for the Flex field : '
721                   || desc_flex_name);
722          END IF;
723 
724          x_return_status := fnd_api.g_ret_sts_error;
725       WHEN header_fetch_error THEN
726          x_return_status := fnd_api.g_ret_sts_error;
727       WHEN OTHERS THEN
728          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
729             gme_debug.put_line (   g_pkg_name
730                                 || '.'
731                                 || desc_flex_name
732                                 || ': '
733                                 || 'in unexpected error');
734          END IF;
735 
736          x_return_status := fnd_api.g_ret_sts_unexp_error;
737          fnd_msg_pub.add_exc_msg (g_pkg_name, desc_flex_name);
738    END validate_flex_batch_header;
739 
740     /*======================================================================
741    -- NAME
742    -- validate_flex_batch_step
743    --
744    -- DESCRIPTION
745    --    This procedure will validate the BATCH_STEPS_DTL_FLEX, descriptive flex field
746    --    for batch steps using serverside flex field validation package FND_FLEX_DESCVAL.
747    --
748    -- SYNOPSIS:
749 
750         validate_flex_batch_step  (p_batch_step => a_batch_step,
751                                    x_batch_step => b_batch_step,
752                                    x_return_status =>l_return_status);
753    -- HISTORY
754    -- A.Sriram    19-FEB-2004     Created --  BUG#3406639
755 
756    -- G. Muratore 05-MAY-2004     Bug 3575735
757    --  New profile added to control whether or not this procedure should be
758    --  executed. A problem occurs when there is a flexfield of value set type,
759    --  that has a where clause using a block field on the form.
760    --
761    -- G. Muratore 25-MAY-2004     Bug 3649415
762    --  This is a follow up fix to bug 3575735.
763    --  The flex field data entered by the user on the form is still saved even
764    --  if the profile says not to validate it on the server side.
765    --  Additional fix 3556979. The code will no longer fail during insert.
766    --
767    -- G. Muratore 11-JUN-2004     Bug 3681718
768    --  This is a follow up fix to bug 3649415.
769    --  Only flex field data will be overwritten in x_material_detail parameter.
770      ======================================================================= */
771    PROCEDURE validate_flex_batch_step (
772       p_batch_step      IN              gme_batch_steps%ROWTYPE
773      ,x_batch_step      IN OUT NOCOPY   gme_batch_steps%ROWTYPE
774      ,x_return_status   OUT NOCOPY      VARCHAR2)
775    IS
776       l_attribute_category   VARCHAR2 (240);
777       appl_short_name        VARCHAR2 (30)             := 'GME';
778       desc_flex_name         VARCHAR2 (30)          := 'BATCH_STEPS_DTL_FLEX';
779       values_or_ids          VARCHAR2 (10)             := 'I';
780       validation_date        DATE                      := SYSDATE;
781       error_msg              VARCHAR2 (5000);
782       validation_error       EXCEPTION;
783       step_fetch_error       EXCEPTION;
784       l_field_value          VARCHAR2 (240);
785       l_field_name           VARCHAR2 (100);
786       n                      NUMBER                    := 0;
787       l_batch_step_row       gme_batch_steps%ROWTYPE;
788       --3556979
789       l_exists               NUMBER;
790       l_dummy                BOOLEAN;
791 
792       CURSOR cur_record_exists (v_rec_id NUMBER)
793       IS
794          SELECT 1
795            FROM gme_batch_steps
796           WHERE batchstep_id = v_rec_id;
797    BEGIN
798       /* Set return status to success initially */
799       x_return_status := fnd_api.g_ret_sts_success;
800 
801       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
802          gme_debug.put_line (   'Check if flexfield is enabled : '
803                              || desc_flex_name);
804       END IF;
805 
806       OPEN cur_get_appl_id;
807 
808       FETCH cur_get_appl_id
809        INTO pkg_application_id;
810 
811       CLOSE cur_get_appl_id;
812 
813       IF NOT fnd_flex_apis.is_descr_setup (pkg_application_id, desc_flex_name) THEN
814          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
815             gme_debug.put_line
816                          ('Flexfield is not enabled, No validation required.');
817          END IF;
818 
819          RETURN;
820       END IF;
821 
822       -- 3556979 Check if record being worked on already exists
823       OPEN cur_record_exists (p_batch_step.batchstep_id);
824 
825       FETCH cur_record_exists
826        INTO l_exists;
827 
828       IF cur_record_exists%NOTFOUND THEN
829          l_batch_step_row := p_batch_step;
830       ELSE
831          l_dummy :=
832                gme_batch_steps_dbl.fetch_row (p_batch_step, l_batch_step_row);
833       END IF;
834 
835       CLOSE cur_record_exists;
836 
837       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
838          gme_debug.put_line (   'Validation of the Flex field : '
839                              || desc_flex_name);
840          gme_debug.put_line
841             ('Assignment of the attribute Category And Attribute Values to Local Variables');
842       END IF;
843 
844       /* Bug 3649415 - Retain all current flexfield values in l_batch_step_row.     */
845       /* This will allow us to pass back the correct row with all the proper values */
846       /* in the event the flex field validation on the server side is off.          */
847       /* All the following if statements will now retain that data.                 */
848       IF p_batch_step.attribute_category IS NULL THEN
849          l_attribute_category :=
850                                 NVL (l_batch_step_row.attribute_category, '');
851       ELSIF p_batch_step.attribute_category = fnd_api.g_miss_char THEN
852          l_attribute_category := '';
853       ELSE
854          l_attribute_category := p_batch_step.attribute_category;
855       END IF;
856 
857       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
858          gme_debug.put_line
859             ('setting set column values for the context value,for Global Data Elements and for context code.');
860       END IF;
861 
862       fnd_flex_descval.set_context_value (l_attribute_category);
863       l_batch_step_row.attribute_category := l_attribute_category;
864 
865       IF p_batch_step.attribute1 IS NULL THEN
866          fnd_flex_descval.set_column_value
867                                           ('ATTRIBUTE1'
868                                           ,NVL (l_batch_step_row.attribute1
869                                                ,'') );
870       ELSIF p_batch_step.attribute1 = fnd_api.g_miss_char THEN
871          fnd_flex_descval.set_column_value ('ATTRIBUTE1', '');
872          l_batch_step_row.attribute1 := '';
873       ELSE
874          fnd_flex_descval.set_column_value ('ATTRIBUTE1'
875                                            ,p_batch_step.attribute1);
876          l_batch_step_row.attribute1 := p_batch_step.attribute1;
877       END IF;
878 
879       IF p_batch_step.attribute2 IS NULL THEN
880          fnd_flex_descval.set_column_value
881                                           ('ATTRIBUTE2'
882                                           ,NVL (l_batch_step_row.attribute2
883                                                ,'') );
884       ELSIF p_batch_step.attribute2 = fnd_api.g_miss_char THEN
885          fnd_flex_descval.set_column_value ('ATTRIBUTE2', '');
886          l_batch_step_row.attribute2 := '';
887       ELSE
888          fnd_flex_descval.set_column_value ('ATTRIBUTE2'
889                                            ,p_batch_step.attribute2);
890          l_batch_step_row.attribute2 := p_batch_step.attribute2;
891       END IF;
892 
893       IF p_batch_step.attribute3 IS NULL THEN
894          fnd_flex_descval.set_column_value
895                                           ('ATTRIBUTE3'
896                                           ,NVL (l_batch_step_row.attribute3
897                                                ,'') );
898       ELSIF p_batch_step.attribute3 = fnd_api.g_miss_char THEN
899          fnd_flex_descval.set_column_value ('ATTRIBUTE3', '');
900          l_batch_step_row.attribute3 := '';
901       ELSE
902          fnd_flex_descval.set_column_value ('ATTRIBUTE3'
903                                            ,p_batch_step.attribute3);
904          l_batch_step_row.attribute3 := p_batch_step.attribute3;
905       END IF;
906 
907       IF p_batch_step.attribute4 IS NULL THEN
908          fnd_flex_descval.set_column_value
909                                           ('ATTRIBUTE4'
910                                           ,NVL (l_batch_step_row.attribute4
911                                                ,'') );
912       ELSIF p_batch_step.attribute4 = fnd_api.g_miss_char THEN
913          fnd_flex_descval.set_column_value ('ATTRIBUTE4', '');
914          l_batch_step_row.attribute4 := '';
915       ELSE
916          fnd_flex_descval.set_column_value ('ATTRIBUTE4'
917                                            ,p_batch_step.attribute4);
918          l_batch_step_row.attribute4 := p_batch_step.attribute4;
919       END IF;
920 
921       IF p_batch_step.attribute5 IS NULL THEN
922          fnd_flex_descval.set_column_value
923                                           ('ATTRIBUTE5'
924                                           ,NVL (l_batch_step_row.attribute5
925                                                ,'') );
926       ELSIF p_batch_step.attribute5 = fnd_api.g_miss_char THEN
927          fnd_flex_descval.set_column_value ('ATTRIBUTE5', '');
928          l_batch_step_row.attribute5 := '';
929       ELSE
930          fnd_flex_descval.set_column_value ('ATTRIBUTE5'
931                                            ,p_batch_step.attribute5);
932          l_batch_step_row.attribute5 := p_batch_step.attribute5;
933       END IF;
934 
935       IF p_batch_step.attribute6 IS NULL THEN
936          fnd_flex_descval.set_column_value
937                                           ('ATTRIBUTE6'
938                                           ,NVL (l_batch_step_row.attribute6
939                                                ,'') );
940       ELSIF p_batch_step.attribute6 = fnd_api.g_miss_char THEN
941          fnd_flex_descval.set_column_value ('ATTRIBUTE6', '');
942          l_batch_step_row.attribute6 := '';
943       ELSE
944          fnd_flex_descval.set_column_value ('ATTRIBUTE6'
945                                            ,p_batch_step.attribute6);
946          l_batch_step_row.attribute6 := p_batch_step.attribute6;
947       END IF;
948 
949       IF p_batch_step.attribute7 IS NULL THEN
950          fnd_flex_descval.set_column_value
951                                           ('ATTRIBUTE7'
952                                           ,NVL (l_batch_step_row.attribute7
953                                                ,'') );
954       ELSIF p_batch_step.attribute7 = fnd_api.g_miss_char THEN
955          fnd_flex_descval.set_column_value ('ATTRIBUTE7', '');
956          l_batch_step_row.attribute7 := '';
957       ELSE
958          fnd_flex_descval.set_column_value ('ATTRIBUTE7'
959                                            ,p_batch_step.attribute7);
960          l_batch_step_row.attribute7 := p_batch_step.attribute7;
961       END IF;
962 
963       IF p_batch_step.attribute8 IS NULL THEN
964          fnd_flex_descval.set_column_value
965                                           ('ATTRIBUTE8'
966                                           ,NVL (l_batch_step_row.attribute8
967                                                ,'') );
968       ELSIF p_batch_step.attribute8 = fnd_api.g_miss_char THEN
969          fnd_flex_descval.set_column_value ('ATTRIBUTE8', '');
970          l_batch_step_row.attribute8 := '';
971       ELSE
972          fnd_flex_descval.set_column_value ('ATTRIBUTE8'
973                                            ,p_batch_step.attribute8);
974          l_batch_step_row.attribute8 := p_batch_step.attribute8;
975       END IF;
976 
977       IF p_batch_step.attribute9 IS NULL THEN
978          fnd_flex_descval.set_column_value
979                                           ('ATTRIBUTE9'
980                                           ,NVL (l_batch_step_row.attribute9
981                                                ,'') );
982       ELSIF p_batch_step.attribute9 = fnd_api.g_miss_char THEN
983          fnd_flex_descval.set_column_value ('ATTRIBUTE9', '');
984          l_batch_step_row.attribute9 := '';
985       ELSE
986          fnd_flex_descval.set_column_value ('ATTRIBUTE9'
987                                            ,p_batch_step.attribute9);
988          l_batch_step_row.attribute9 := p_batch_step.attribute9;
989       END IF;
990 
991       IF p_batch_step.attribute10 IS NULL THEN
992          fnd_flex_descval.set_column_value
993                                          ('ATTRIBUTE10'
994                                          ,NVL (l_batch_step_row.attribute10
995                                               ,'') );
996       ELSIF p_batch_step.attribute10 = fnd_api.g_miss_char THEN
997          fnd_flex_descval.set_column_value ('ATTRIBUTE10', '');
998          l_batch_step_row.attribute10 := '';
999       ELSE
1000          fnd_flex_descval.set_column_value ('ATTRIBUTE10'
1001                                            ,p_batch_step.attribute10);
1002          l_batch_step_row.attribute10 := p_batch_step.attribute10;
1003       END IF;
1004 
1005       IF p_batch_step.attribute11 IS NULL THEN
1006          fnd_flex_descval.set_column_value
1007                                          ('ATTRIBUTE11'
1008                                          ,NVL (l_batch_step_row.attribute11
1009                                               ,'') );
1010       ELSIF p_batch_step.attribute11 = fnd_api.g_miss_char THEN
1011          fnd_flex_descval.set_column_value ('ATTRIBUTE11', '');
1012          l_batch_step_row.attribute11 := '';
1013       ELSE
1014          fnd_flex_descval.set_column_value ('ATTRIBUTE11'
1015                                            ,p_batch_step.attribute11);
1016          l_batch_step_row.attribute11 := p_batch_step.attribute11;
1017       END IF;
1018 
1019       IF p_batch_step.attribute12 IS NULL THEN
1020          fnd_flex_descval.set_column_value
1021                                          ('ATTRIBUTE12'
1022                                          ,NVL (l_batch_step_row.attribute12
1023                                               ,'') );
1024       ELSIF p_batch_step.attribute12 = fnd_api.g_miss_char THEN
1025          fnd_flex_descval.set_column_value ('ATTRIBUTE12', '');
1026          l_batch_step_row.attribute12 := '';
1027       ELSE
1028          fnd_flex_descval.set_column_value ('ATTRIBUTE12'
1029                                            ,p_batch_step.attribute12);
1030          l_batch_step_row.attribute12 := p_batch_step.attribute12;
1031       END IF;
1032 
1033       IF p_batch_step.attribute13 IS NULL THEN
1034          fnd_flex_descval.set_column_value
1035                                          ('ATTRIBUTE13'
1036                                          ,NVL (l_batch_step_row.attribute13
1037                                               ,'') );
1038       ELSIF p_batch_step.attribute13 = fnd_api.g_miss_char THEN
1039          fnd_flex_descval.set_column_value ('ATTRIBUTE13', '');
1040          l_batch_step_row.attribute13 := '';
1041       ELSE
1042          fnd_flex_descval.set_column_value ('ATTRIBUTE13'
1043                                            ,p_batch_step.attribute13);
1044          l_batch_step_row.attribute13 := p_batch_step.attribute13;
1045       END IF;
1046 
1047       IF p_batch_step.attribute14 IS NULL THEN
1048          fnd_flex_descval.set_column_value
1049                                          ('ATTRIBUTE14'
1050                                          ,NVL (l_batch_step_row.attribute14
1051                                               ,'') );
1052       ELSIF p_batch_step.attribute14 = fnd_api.g_miss_char THEN
1053          fnd_flex_descval.set_column_value ('ATTRIBUTE14', '');
1054          l_batch_step_row.attribute14 := '';
1055       ELSE
1056          fnd_flex_descval.set_column_value ('ATTRIBUTE14'
1057                                            ,p_batch_step.attribute14);
1058          l_batch_step_row.attribute14 := p_batch_step.attribute14;
1059       END IF;
1060 
1061       IF p_batch_step.attribute15 IS NULL THEN
1062          fnd_flex_descval.set_column_value
1063                                          ('ATTRIBUTE15'
1064                                          ,NVL (l_batch_step_row.attribute15
1065                                               ,'') );
1066       ELSIF p_batch_step.attribute15 = fnd_api.g_miss_char THEN
1067          fnd_flex_descval.set_column_value ('ATTRIBUTE15', '');
1068          l_batch_step_row.attribute15 := '';
1069       ELSE
1070          fnd_flex_descval.set_column_value ('ATTRIBUTE15'
1071                                            ,p_batch_step.attribute15);
1072          l_batch_step_row.attribute15 := p_batch_step.attribute15;
1073       END IF;
1074 
1075       IF p_batch_step.attribute16 IS NULL THEN
1076          fnd_flex_descval.set_column_value
1077                                          ('ATTRIBUTE16'
1078                                          ,NVL (l_batch_step_row.attribute16
1079                                               ,'') );
1080       ELSIF p_batch_step.attribute16 = fnd_api.g_miss_char THEN
1081          fnd_flex_descval.set_column_value ('ATTRIBUTE16', '');
1082          l_batch_step_row.attribute16 := '';
1083       ELSE
1084          fnd_flex_descval.set_column_value ('ATTRIBUTE16'
1085                                            ,p_batch_step.attribute16);
1086          l_batch_step_row.attribute16 := p_batch_step.attribute16;
1087       END IF;
1088 
1089       IF p_batch_step.attribute17 IS NULL THEN
1090          fnd_flex_descval.set_column_value
1091                                          ('ATTRIBUTE17'
1092                                          ,NVL (l_batch_step_row.attribute17
1093                                               ,'') );
1094       ELSIF p_batch_step.attribute17 = fnd_api.g_miss_char THEN
1095          fnd_flex_descval.set_column_value ('ATTRIBUTE17', '');
1096          l_batch_step_row.attribute17 := '';
1097       ELSE
1098          fnd_flex_descval.set_column_value ('ATTRIBUTE17'
1099                                            ,p_batch_step.attribute17);
1100          l_batch_step_row.attribute17 := p_batch_step.attribute17;
1101       END IF;
1102 
1103       IF p_batch_step.attribute18 IS NULL THEN
1104          fnd_flex_descval.set_column_value
1105                                          ('ATTRIBUTE18'
1106                                          ,NVL (l_batch_step_row.attribute18
1107                                               ,'') );
1108       ELSIF p_batch_step.attribute18 = fnd_api.g_miss_char THEN
1109          fnd_flex_descval.set_column_value ('ATTRIBUTE18', '');
1110          l_batch_step_row.attribute18 := '';
1111       ELSE
1112          fnd_flex_descval.set_column_value ('ATTRIBUTE18'
1113                                            ,p_batch_step.attribute18);
1114          l_batch_step_row.attribute18 := p_batch_step.attribute18;
1115       END IF;
1116 
1117       IF p_batch_step.attribute19 IS NULL THEN
1118          fnd_flex_descval.set_column_value
1119                                          ('ATTRIBUTE19'
1120                                          ,NVL (l_batch_step_row.attribute19
1121                                               ,'') );
1122       ELSIF p_batch_step.attribute19 = fnd_api.g_miss_char THEN
1123          fnd_flex_descval.set_column_value ('ATTRIBUTE19', '');
1124          l_batch_step_row.attribute19 := '';
1125       ELSE
1126          fnd_flex_descval.set_column_value ('ATTRIBUTE19'
1127                                            ,p_batch_step.attribute19);
1128          l_batch_step_row.attribute19 := p_batch_step.attribute19;
1129       END IF;
1130 
1131       IF p_batch_step.attribute20 IS NULL THEN
1132          fnd_flex_descval.set_column_value
1133                                          ('ATTRIBUTE20'
1134                                          ,NVL (l_batch_step_row.attribute20
1135                                               ,'') );
1136       ELSIF p_batch_step.attribute20 = fnd_api.g_miss_char THEN
1137          fnd_flex_descval.set_column_value ('ATTRIBUTE20', '');
1138          l_batch_step_row.attribute20 := '';
1139       ELSE
1140          fnd_flex_descval.set_column_value ('ATTRIBUTE20'
1141                                            ,p_batch_step.attribute20);
1142          l_batch_step_row.attribute20 := p_batch_step.attribute20;
1143       END IF;
1144 
1145       IF p_batch_step.attribute21 IS NULL THEN
1146          fnd_flex_descval.set_column_value
1147                                          ('ATTRIBUTE21'
1148                                          ,NVL (l_batch_step_row.attribute21
1149                                               ,'') );
1150       ELSIF p_batch_step.attribute21 = fnd_api.g_miss_char THEN
1151          fnd_flex_descval.set_column_value ('ATTRIBUTE21', '');
1152          l_batch_step_row.attribute21 := '';
1153       ELSE
1154          fnd_flex_descval.set_column_value ('ATTRIBUTE21'
1155                                            ,p_batch_step.attribute21);
1156          l_batch_step_row.attribute21 := p_batch_step.attribute21;
1157       END IF;
1158 
1159       IF p_batch_step.attribute22 IS NULL THEN
1160          fnd_flex_descval.set_column_value
1161                                          ('ATTRIBUTE22'
1162                                          ,NVL (l_batch_step_row.attribute22
1163                                               ,'') );
1164       ELSIF p_batch_step.attribute22 = fnd_api.g_miss_char THEN
1165          fnd_flex_descval.set_column_value ('ATTRIBUTE22', '');
1166          l_batch_step_row.attribute22 := '';
1167       ELSE
1168          fnd_flex_descval.set_column_value ('ATTRIBUTE22'
1169                                            ,p_batch_step.attribute22);
1170          l_batch_step_row.attribute22 := p_batch_step.attribute22;
1171       END IF;
1172 
1173       IF p_batch_step.attribute23 IS NULL THEN
1174          fnd_flex_descval.set_column_value
1175                                          ('ATTRIBUTE23'
1176                                          ,NVL (l_batch_step_row.attribute23
1177                                               ,'') );
1178       ELSIF p_batch_step.attribute23 = fnd_api.g_miss_char THEN
1179          fnd_flex_descval.set_column_value ('ATTRIBUTE23', '');
1180          l_batch_step_row.attribute23 := '';
1181       ELSE
1182          fnd_flex_descval.set_column_value ('ATTRIBUTE23'
1183                                            ,p_batch_step.attribute23);
1184          l_batch_step_row.attribute23 := p_batch_step.attribute23;
1185       END IF;
1186 
1187       IF p_batch_step.attribute24 IS NULL THEN
1188          fnd_flex_descval.set_column_value
1189                                          ('ATTRIBUTE24'
1190                                          ,NVL (l_batch_step_row.attribute24
1191                                               ,'') );
1192       ELSIF p_batch_step.attribute24 = fnd_api.g_miss_char THEN
1193          fnd_flex_descval.set_column_value ('ATTRIBUTE24', '');
1194          l_batch_step_row.attribute24 := '';
1195       ELSE
1196          fnd_flex_descval.set_column_value ('ATTRIBUTE24'
1197                                            ,p_batch_step.attribute24);
1198          l_batch_step_row.attribute24 := p_batch_step.attribute24;
1199       END IF;
1200 
1201       IF p_batch_step.attribute25 IS NULL THEN
1202          fnd_flex_descval.set_column_value
1203                                          ('ATTRIBUTE25'
1204                                          ,NVL (l_batch_step_row.attribute25
1205                                               ,'') );
1206       ELSIF p_batch_step.attribute25 = fnd_api.g_miss_char THEN
1207          fnd_flex_descval.set_column_value ('ATTRIBUTE25', '');
1208          l_batch_step_row.attribute25 := '';
1209       ELSE
1210          fnd_flex_descval.set_column_value ('ATTRIBUTE25'
1211                                            ,p_batch_step.attribute25);
1212          l_batch_step_row.attribute25 := p_batch_step.attribute25;
1213       END IF;
1214 
1215       IF p_batch_step.attribute26 IS NULL THEN
1216          fnd_flex_descval.set_column_value
1217                                          ('ATTRIBUTE26'
1218                                          ,NVL (l_batch_step_row.attribute26
1219                                               ,'') );
1220       ELSIF p_batch_step.attribute26 = fnd_api.g_miss_char THEN
1221          fnd_flex_descval.set_column_value ('ATTRIBUTE26', '');
1222          l_batch_step_row.attribute26 := '';
1223       ELSE
1224          fnd_flex_descval.set_column_value ('ATTRIBUTE26'
1225                                            ,p_batch_step.attribute26);
1226          l_batch_step_row.attribute26 := p_batch_step.attribute26;
1227       END IF;
1228 
1229       IF p_batch_step.attribute27 IS NULL THEN
1230          fnd_flex_descval.set_column_value
1231                                          ('ATTRIBUTE27'
1232                                          ,NVL (l_batch_step_row.attribute27
1233                                               ,'') );
1234       ELSIF p_batch_step.attribute27 = fnd_api.g_miss_char THEN
1235          fnd_flex_descval.set_column_value ('ATTRIBUTE27', '');
1236          l_batch_step_row.attribute27 := '';
1237       ELSE
1238          fnd_flex_descval.set_column_value ('ATTRIBUTE27'
1239                                            ,p_batch_step.attribute27);
1240          l_batch_step_row.attribute27 := p_batch_step.attribute27;
1241       END IF;
1242 
1243       IF p_batch_step.attribute28 IS NULL THEN
1244          fnd_flex_descval.set_column_value
1245                                          ('ATTRIBUTE28'
1246                                          ,NVL (l_batch_step_row.attribute28
1247                                               ,'') );
1248       ELSIF p_batch_step.attribute28 = fnd_api.g_miss_char THEN
1249          fnd_flex_descval.set_column_value ('ATTRIBUTE28', '');
1250          l_batch_step_row.attribute28 := '';
1251       ELSE
1252          fnd_flex_descval.set_column_value ('ATTRIBUTE28'
1253                                            ,p_batch_step.attribute28);
1254          l_batch_step_row.attribute28 := p_batch_step.attribute28;
1255       END IF;
1256 
1257       IF p_batch_step.attribute29 IS NULL THEN
1258          fnd_flex_descval.set_column_value
1259                                          ('ATTRIBUTE29'
1260                                          ,NVL (l_batch_step_row.attribute29
1261                                               ,'') );
1262       ELSIF p_batch_step.attribute29 = fnd_api.g_miss_char THEN
1263          fnd_flex_descval.set_column_value ('ATTRIBUTE29', '');
1264          l_batch_step_row.attribute29 := '';
1265       ELSE
1266          fnd_flex_descval.set_column_value ('ATTRIBUTE29'
1267                                            ,p_batch_step.attribute29);
1268          l_batch_step_row.attribute29 := p_batch_step.attribute29;
1269       END IF;
1270 
1271       IF p_batch_step.attribute30 IS NULL THEN
1272          fnd_flex_descval.set_column_value
1273                                          ('ATTRIBUTE30'
1274                                          ,NVL (l_batch_step_row.attribute30
1275                                               ,'') );
1276       ELSIF p_batch_step.attribute30 = fnd_api.g_miss_char THEN
1277          fnd_flex_descval.set_column_value ('ATTRIBUTE30', '');
1278          l_batch_step_row.attribute30 := '';
1279       ELSE
1280          fnd_flex_descval.set_column_value ('ATTRIBUTE30'
1281                                            ,p_batch_step.attribute30);
1282          l_batch_step_row.attribute30 := p_batch_step.attribute30;
1283       END IF;
1284 
1285       /* Bug 3649415 - Do not run this validation if it is set to N. */
1286       /* It should only be set to N if it is a value set flexfield   */
1287       /* with a where clause using block fields from the form.       */
1288       /* Pass back all flexfield values w/ no validation.            */
1289       IF gme_common_pvt.g_flex_validate_prof = 0 THEN
1290          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1291             gme_debug.put_line
1292                      ('GME Flexfield is not enabled, No validation required.');
1293          END IF;
1294 
1295          /* Bug 3681718 - Only update flex field columns in x_ OUT parameter. */
1296          x_batch_step.attribute_category :=
1297                                            l_batch_step_row.attribute_category;
1298          x_batch_step.attribute1 := l_batch_step_row.attribute1;
1299          x_batch_step.attribute2 := l_batch_step_row.attribute2;
1300          x_batch_step.attribute3 := l_batch_step_row.attribute3;
1301          x_batch_step.attribute4 := l_batch_step_row.attribute4;
1302          x_batch_step.attribute5 := l_batch_step_row.attribute5;
1303          x_batch_step.attribute6 := l_batch_step_row.attribute6;
1304          x_batch_step.attribute7 := l_batch_step_row.attribute7;
1305          x_batch_step.attribute8 := l_batch_step_row.attribute8;
1306          x_batch_step.attribute9 := l_batch_step_row.attribute9;
1307          x_batch_step.attribute10 := l_batch_step_row.attribute10;
1308          x_batch_step.attribute11 := l_batch_step_row.attribute11;
1309          x_batch_step.attribute12 := l_batch_step_row.attribute12;
1310          x_batch_step.attribute13 := l_batch_step_row.attribute13;
1311          x_batch_step.attribute14 := l_batch_step_row.attribute14;
1312          x_batch_step.attribute15 := l_batch_step_row.attribute15;
1313          x_batch_step.attribute16 := l_batch_step_row.attribute16;
1314          x_batch_step.attribute17 := l_batch_step_row.attribute17;
1315          x_batch_step.attribute18 := l_batch_step_row.attribute18;
1316          x_batch_step.attribute19 := l_batch_step_row.attribute19;
1317          x_batch_step.attribute20 := l_batch_step_row.attribute20;
1318          x_batch_step.attribute21 := l_batch_step_row.attribute21;
1319          x_batch_step.attribute22 := l_batch_step_row.attribute22;
1320          x_batch_step.attribute23 := l_batch_step_row.attribute23;
1321          x_batch_step.attribute24 := l_batch_step_row.attribute24;
1322          x_batch_step.attribute25 := l_batch_step_row.attribute25;
1323          x_batch_step.attribute26 := l_batch_step_row.attribute26;
1324          x_batch_step.attribute27 := l_batch_step_row.attribute27;
1325          x_batch_step.attribute28 := l_batch_step_row.attribute28;
1326          x_batch_step.attribute29 := l_batch_step_row.attribute29;
1327          x_batch_step.attribute30 := l_batch_step_row.attribute30;
1328          RETURN;
1329       END IF;
1330 
1331       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1332          gme_debug.put_line ('Calling FND_FLEX_DESCVAL.validate_desccols ');
1333       END IF;
1334 
1335       IF fnd_flex_descval.validate_desccols
1336                                           (appl_short_name      => appl_short_name
1337                                           ,desc_flex_name       => desc_flex_name
1338                                           ,values_or_ids        => values_or_ids
1339                                           ,validation_date      => validation_date) THEN
1340          --SUCCESS
1341          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1342             gme_debug.put_line ('Validation Success ');
1343          END IF;
1344 
1345          x_return_status := fnd_api.g_ret_sts_success;
1346          n := fnd_flex_descval.segment_count;
1347 
1348          /*Now let us copy back the storage value  */
1349          FOR i IN 1 .. n LOOP
1350             IF fnd_flex_descval.segment_column_name (i) =
1351                                                          'ATTRIBUTE_CATEGORY' THEN
1352                x_batch_step.attribute_category :=
1353                                               fnd_flex_descval.segment_id (i);
1354             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE1' THEN
1355                x_batch_step.attribute1 := fnd_flex_descval.segment_id (i);
1356             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE2' THEN
1357                x_batch_step.attribute2 := fnd_flex_descval.segment_id (i);
1358             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE3' THEN
1359                x_batch_step.attribute3 := fnd_flex_descval.segment_id (i);
1360             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE4' THEN
1361                x_batch_step.attribute4 := fnd_flex_descval.segment_id (i);
1362             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE5' THEN
1363                x_batch_step.attribute5 := fnd_flex_descval.segment_id (i);
1364             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE6' THEN
1365                x_batch_step.attribute6 := fnd_flex_descval.segment_id (i);
1366             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE7' THEN
1367                x_batch_step.attribute7 := fnd_flex_descval.segment_id (i);
1368             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE8' THEN
1369                x_batch_step.attribute8 := fnd_flex_descval.segment_id (i);
1370             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE9' THEN
1371                x_batch_step.attribute9 := fnd_flex_descval.segment_id (i);
1372             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE10' THEN
1373                x_batch_step.attribute10 := fnd_flex_descval.segment_id (i);
1374             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE11' THEN
1375                x_batch_step.attribute11 := fnd_flex_descval.segment_id (i);
1376             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE12' THEN
1377                x_batch_step.attribute12 := fnd_flex_descval.segment_id (i);
1378             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE13' THEN
1379                x_batch_step.attribute13 := fnd_flex_descval.segment_id (i);
1380             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE14' THEN
1381                x_batch_step.attribute14 := fnd_flex_descval.segment_id (i);
1382             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE15' THEN
1383                x_batch_step.attribute15 := fnd_flex_descval.segment_id (i);
1384             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE16' THEN
1385                x_batch_step.attribute16 := fnd_flex_descval.segment_id (i);
1386             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE17' THEN
1387                x_batch_step.attribute17 := fnd_flex_descval.segment_id (i);
1388             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE18' THEN
1389                x_batch_step.attribute18 := fnd_flex_descval.segment_id (i);
1390             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE19' THEN
1391                x_batch_step.attribute19 := fnd_flex_descval.segment_id (i);
1392             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE20' THEN
1393                x_batch_step.attribute20 := fnd_flex_descval.segment_id (i);
1394             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE21' THEN
1395                x_batch_step.attribute21 := fnd_flex_descval.segment_id (i);
1396             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE22' THEN
1397                x_batch_step.attribute22 := fnd_flex_descval.segment_id (i);
1398             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE23' THEN
1399                x_batch_step.attribute23 := fnd_flex_descval.segment_id (i);
1400             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE24' THEN
1401                x_batch_step.attribute24 := fnd_flex_descval.segment_id (i);
1402             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE25' THEN
1403                x_batch_step.attribute25 := fnd_flex_descval.segment_id (i);
1404             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE26' THEN
1405                x_batch_step.attribute26 := fnd_flex_descval.segment_id (i);
1406             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE27' THEN
1407                x_batch_step.attribute27 := fnd_flex_descval.segment_id (i);
1408             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE28' THEN
1409                x_batch_step.attribute28 := fnd_flex_descval.segment_id (i);
1410             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE29' THEN
1411                x_batch_step.attribute29 := fnd_flex_descval.segment_id (i);
1412             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE30' THEN
1413                x_batch_step.attribute30 := fnd_flex_descval.segment_id (i);
1414             END IF;
1415          END LOOP;
1416       ELSE
1417          error_msg := fnd_flex_descval.error_message;
1418 
1419          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1420             gme_debug.put_line ('Validation Ends With Error(s) :');
1421             gme_debug.put_line ('Error :' || error_msg);
1422          END IF;
1423 
1424          gme_common_pvt.log_message ('FLEX-USER DEFINED ERROR'
1425                                     ,'MSG'
1426                                     ,error_msg);
1427          RAISE validation_error;
1428       END IF;
1429 
1430       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1431          gme_debug.put_line (   'Validation completed for the Flex field : '
1432                              || desc_flex_name);
1433       END IF;
1434    EXCEPTION
1435       WHEN validation_error THEN
1436          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1437             gme_debug.put_line
1438                  (   'Validation completed with errors for the Flex field : '
1439                   || desc_flex_name);
1440          END IF;
1441 
1442          x_return_status := fnd_api.g_ret_sts_error;
1443       WHEN step_fetch_error THEN
1444          x_return_status := fnd_api.g_ret_sts_error;
1445       WHEN OTHERS THEN
1446          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1447             gme_debug.put_line (   g_pkg_name
1448                                 || '.'
1449                                 || desc_flex_name
1450                                 || ': '
1451                                 || 'in unexpected error');
1452          END IF;
1453 
1454          x_return_status := fnd_api.g_ret_sts_unexp_error;
1455          fnd_msg_pub.add_exc_msg (g_pkg_name, desc_flex_name);
1456    END validate_flex_batch_step;
1457 
1458     /*======================================================================
1459    -- NAME
1460    -- validate_flex_step_activities
1461    --
1462    -- DESCRIPTION
1463    --  This procedure will validate the GME_BATCH_STEP_ACTIVITIES_FLEX, descriptive flex field
1464    --  for batch step activities using serverside flex field validation package FND_FLEX_DESCVAL.
1465    --
1466    -- SYNOPSIS:
1467 
1468         validate_flex_step_activities  (p_step_activities => a_step_activities,
1469                                        x_step_activities => b_step_activities,
1470                                        x_return_status =>l_return_status);
1471    -- HISTORY
1472    -- A.Sriram    19-FEB-2004     Created -- BUG#3406639
1473 
1474    -- G. Muratore 05-MAY-2004     Bug 3575735
1475    --  New profile added to control whether or not this procedure should be
1476    --  executed. A problem occurs when there is a flexfield of value set type,
1477    --  that has a where clause using a block field on the form.
1478    --
1479    -- G. Muratore 25-MAY-2004     Bug 3649415
1480    --  This is a follow up fix to bug 3575735.
1481    --  The flex field data entered by the user on the form is still saved even
1482    --  if the profile says not to validate it on the server side.
1483    --  Additional fix 3556979. The code will no longer fail during insert.
1484    --
1485    -- G. Muratore 11-JUN-2004     Bug 3681718
1486    --  This is a follow up fix to bug 3649415.
1487    --  Only flex field data will be overwritten in x_material_detail parameter.
1488    ======================================================================= */
1489    PROCEDURE validate_flex_step_activities (
1490       p_step_activities   IN              gme_batch_step_activities%ROWTYPE
1491      ,x_step_activities   IN OUT NOCOPY   gme_batch_step_activities%ROWTYPE
1492      ,x_return_status     OUT NOCOPY      VARCHAR2)
1493    IS
1494       l_attribute_category    VARCHAR2 (240);
1495       appl_short_name         VARCHAR2 (30)                       := 'GME';
1496       desc_flex_name          VARCHAR2 (30)
1497                                           := 'GME_BATCH_STEP_ACTIVITIES_FLEX';
1498       values_or_ids           VARCHAR2 (10)                       := 'I';
1499       validation_date         DATE                                := SYSDATE;
1500       error_msg               VARCHAR2 (5000);
1501       validation_error        EXCEPTION;
1502       step_fetch_error        EXCEPTION;
1503       l_field_value           VARCHAR2 (240);
1504       l_field_name            VARCHAR2 (100);
1505       n                       NUMBER                              := 0;
1506       l_step_activities_row   gme_batch_step_activities%ROWTYPE;
1507       --3556979
1508       l_exists                NUMBER;
1509       l_dummy                 BOOLEAN;
1510 
1511       CURSOR cur_record_exists (v_rec_id NUMBER)
1512       IS
1513          SELECT 1
1514            FROM gme_batch_step_activities
1515           WHERE batchstep_activity_id = v_rec_id;
1516    BEGIN
1517       /* Set return status to success initially */
1518       x_return_status := fnd_api.g_ret_sts_success;
1519 
1520       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1521          gme_debug.put_line (   'Check if flexfield is enabled : '
1522                              || desc_flex_name);
1523       END IF;
1524 
1525       OPEN cur_get_appl_id;
1526 
1527       FETCH cur_get_appl_id
1528        INTO pkg_application_id;
1529 
1530       CLOSE cur_get_appl_id;
1531 
1532       IF NOT fnd_flex_apis.is_descr_setup (pkg_application_id, desc_flex_name) THEN
1533          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1534             gme_debug.put_line
1535                          ('Flexfield is not enabled, No validation required.');
1536          END IF;
1537 
1538          RETURN;
1539       END IF;
1540 
1541       -- 3556979 Check if record being worked on already exists
1542       OPEN cur_record_exists (p_step_activities.batchstep_activity_id);
1543 
1544       FETCH cur_record_exists
1545        INTO l_exists;
1546 
1547       IF cur_record_exists%NOTFOUND THEN
1548          l_step_activities_row := p_step_activities;
1549       ELSE
1550          l_dummy :=
1551             gme_batch_step_activities_dbl.fetch_row (p_step_activities
1552                                                     ,l_step_activities_row);
1553       END IF;
1554 
1555       CLOSE cur_record_exists;
1556 
1557       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1558          gme_debug.put_line (   'Validation of the Flex field : '
1559                              || desc_flex_name);
1560          gme_debug.put_line
1561             ('Assignment of the attribute Category And Attribute Values to Local Variables');
1562       END IF;
1563 
1564       /* Bug 3649415 - Retain all current flexfield values in l_step_activities_row.*/
1565       /* This will allow us to pass back the correct row with all the proper values */
1566       /* in the event the flex field validation on the server side is off.          */
1567       /* All the following if statements will now retain that data.                 */
1568       IF p_step_activities.attribute_category IS NULL THEN
1569          l_attribute_category :=
1570                            NVL (l_step_activities_row.attribute_category, '');
1571       ELSIF p_step_activities.attribute_category = fnd_api.g_miss_char THEN
1572          l_attribute_category := '';
1573       ELSE
1574          l_attribute_category := p_step_activities.attribute_category;
1575       END IF;
1576 
1577       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1578          gme_debug.put_line
1579             ('setting set column values for the context value,for Global Data Elements and for context code.');
1580       END IF;
1581 
1582       fnd_flex_descval.set_context_value (l_attribute_category);
1583       l_step_activities_row.attribute_category := l_attribute_category;
1584 
1585       IF p_step_activities.attribute1 IS NULL THEN
1586          fnd_flex_descval.set_column_value
1587                                      ('ATTRIBUTE1'
1588                                      ,NVL (l_step_activities_row.attribute1
1589                                           ,'') );
1590       ELSIF p_step_activities.attribute1 = fnd_api.g_miss_char THEN
1591          fnd_flex_descval.set_column_value ('ATTRIBUTE1', '');
1592          l_step_activities_row.attribute1 := '';
1593       ELSE
1594          fnd_flex_descval.set_column_value ('ATTRIBUTE1'
1595                                            ,p_step_activities.attribute1);
1596          l_step_activities_row.attribute1 := p_step_activities.attribute1;
1597       END IF;
1598 
1599       IF p_step_activities.attribute2 IS NULL THEN
1600          fnd_flex_descval.set_column_value
1601                                      ('ATTRIBUTE2'
1602                                      ,NVL (l_step_activities_row.attribute2
1603                                           ,'') );
1604       ELSIF p_step_activities.attribute2 = fnd_api.g_miss_char THEN
1605          fnd_flex_descval.set_column_value ('ATTRIBUTE2', '');
1606          l_step_activities_row.attribute2 := '';
1607       ELSE
1608          fnd_flex_descval.set_column_value ('ATTRIBUTE2'
1609                                            ,p_step_activities.attribute2);
1610          l_step_activities_row.attribute2 := p_step_activities.attribute2;
1611       END IF;
1612 
1613       IF p_step_activities.attribute3 IS NULL THEN
1614          fnd_flex_descval.set_column_value
1615                                      ('ATTRIBUTE3'
1616                                      ,NVL (l_step_activities_row.attribute3
1617                                           ,'') );
1618       ELSIF p_step_activities.attribute3 = fnd_api.g_miss_char THEN
1619          fnd_flex_descval.set_column_value ('ATTRIBUTE3', '');
1620          l_step_activities_row.attribute3 := '';
1621       ELSE
1622          fnd_flex_descval.set_column_value ('ATTRIBUTE3'
1623                                            ,p_step_activities.attribute3);
1624          l_step_activities_row.attribute3 := p_step_activities.attribute3;
1625       END IF;
1626 
1627       IF p_step_activities.attribute4 IS NULL THEN
1628          fnd_flex_descval.set_column_value
1629                                      ('ATTRIBUTE4'
1630                                      ,NVL (l_step_activities_row.attribute4
1631                                           ,'') );
1632       ELSIF p_step_activities.attribute4 = fnd_api.g_miss_char THEN
1633          fnd_flex_descval.set_column_value ('ATTRIBUTE4', '');
1634          l_step_activities_row.attribute4 := '';
1635       ELSE
1636          fnd_flex_descval.set_column_value ('ATTRIBUTE4'
1637                                            ,p_step_activities.attribute4);
1638          l_step_activities_row.attribute4 := p_step_activities.attribute4;
1639       END IF;
1640 
1641       IF p_step_activities.attribute5 IS NULL THEN
1642          fnd_flex_descval.set_column_value
1643                                      ('ATTRIBUTE5'
1644                                      ,NVL (l_step_activities_row.attribute5
1645                                           ,'') );
1646       ELSIF p_step_activities.attribute5 = fnd_api.g_miss_char THEN
1647          fnd_flex_descval.set_column_value ('ATTRIBUTE5', '');
1648          l_step_activities_row.attribute5 := '';
1649       ELSE
1650          fnd_flex_descval.set_column_value ('ATTRIBUTE5'
1651                                            ,p_step_activities.attribute5);
1652          l_step_activities_row.attribute5 := p_step_activities.attribute5;
1653       END IF;
1654 
1655       IF p_step_activities.attribute6 IS NULL THEN
1656          fnd_flex_descval.set_column_value
1657                                      ('ATTRIBUTE6'
1658                                      ,NVL (l_step_activities_row.attribute6
1659                                           ,'') );
1660       ELSIF p_step_activities.attribute6 = fnd_api.g_miss_char THEN
1661          fnd_flex_descval.set_column_value ('ATTRIBUTE6', '');
1662          l_step_activities_row.attribute6 := '';
1663       ELSE
1664          fnd_flex_descval.set_column_value ('ATTRIBUTE6'
1665                                            ,p_step_activities.attribute6);
1666          l_step_activities_row.attribute6 := p_step_activities.attribute6;
1667       END IF;
1668 
1669       IF p_step_activities.attribute7 IS NULL THEN
1670          fnd_flex_descval.set_column_value
1671                                      ('ATTRIBUTE7'
1672                                      ,NVL (l_step_activities_row.attribute7
1673                                           ,'') );
1674       ELSIF p_step_activities.attribute7 = fnd_api.g_miss_char THEN
1675          fnd_flex_descval.set_column_value ('ATTRIBUTE7', '');
1676          l_step_activities_row.attribute7 := '';
1677       ELSE
1678          fnd_flex_descval.set_column_value ('ATTRIBUTE7'
1679                                            ,p_step_activities.attribute7);
1680          l_step_activities_row.attribute7 := p_step_activities.attribute7;
1681       END IF;
1682 
1683       IF p_step_activities.attribute8 IS NULL THEN
1684          fnd_flex_descval.set_column_value
1685                                      ('ATTRIBUTE8'
1686                                      ,NVL (l_step_activities_row.attribute8
1687                                           ,'') );
1688       ELSIF p_step_activities.attribute8 = fnd_api.g_miss_char THEN
1689          fnd_flex_descval.set_column_value ('ATTRIBUTE8', '');
1690          l_step_activities_row.attribute8 := '';
1691       ELSE
1692          fnd_flex_descval.set_column_value ('ATTRIBUTE8'
1693                                            ,p_step_activities.attribute8);
1694          l_step_activities_row.attribute8 := p_step_activities.attribute8;
1695       END IF;
1696 
1697       IF p_step_activities.attribute9 IS NULL THEN
1698          fnd_flex_descval.set_column_value
1699                                      ('ATTRIBUTE9'
1700                                      ,NVL (l_step_activities_row.attribute9
1701                                           ,'') );
1702       ELSIF p_step_activities.attribute9 = fnd_api.g_miss_char THEN
1703          fnd_flex_descval.set_column_value ('ATTRIBUTE9', '');
1704          l_step_activities_row.attribute9 := '';
1705       ELSE
1706          fnd_flex_descval.set_column_value ('ATTRIBUTE9'
1707                                            ,p_step_activities.attribute9);
1708          l_step_activities_row.attribute9 := p_step_activities.attribute9;
1709       END IF;
1710 
1711       IF p_step_activities.attribute10 IS NULL THEN
1712          fnd_flex_descval.set_column_value
1713                                     ('ATTRIBUTE10'
1714                                     ,NVL (l_step_activities_row.attribute10
1715                                          ,'') );
1716       ELSIF p_step_activities.attribute10 = fnd_api.g_miss_char THEN
1717          fnd_flex_descval.set_column_value ('ATTRIBUTE10', '');
1718          l_step_activities_row.attribute10 := '';
1719       ELSE
1720          fnd_flex_descval.set_column_value ('ATTRIBUTE10'
1721                                            ,p_step_activities.attribute10);
1722          l_step_activities_row.attribute10 := p_step_activities.attribute10;
1723       END IF;
1724 
1725       IF p_step_activities.attribute11 IS NULL THEN
1726          fnd_flex_descval.set_column_value
1727                                     ('ATTRIBUTE11'
1728                                     ,NVL (l_step_activities_row.attribute11
1729                                          ,'') );
1730       ELSIF p_step_activities.attribute11 = fnd_api.g_miss_char THEN
1731          fnd_flex_descval.set_column_value ('ATTRIBUTE11', '');
1732          l_step_activities_row.attribute11 := '';
1733       ELSE
1734          fnd_flex_descval.set_column_value ('ATTRIBUTE11'
1735                                            ,p_step_activities.attribute11);
1736          l_step_activities_row.attribute11 := p_step_activities.attribute11;
1737       END IF;
1738 
1739       IF p_step_activities.attribute12 IS NULL THEN
1740          fnd_flex_descval.set_column_value
1741                                     ('ATTRIBUTE12'
1742                                     ,NVL (l_step_activities_row.attribute12
1743                                          ,'') );
1744       ELSIF p_step_activities.attribute12 = fnd_api.g_miss_char THEN
1745          fnd_flex_descval.set_column_value ('ATTRIBUTE12', '');
1746          l_step_activities_row.attribute12 := '';
1747       ELSE
1748          fnd_flex_descval.set_column_value ('ATTRIBUTE12'
1749                                            ,p_step_activities.attribute12);
1750          l_step_activities_row.attribute12 := p_step_activities.attribute12;
1751       END IF;
1752 
1753       IF p_step_activities.attribute13 IS NULL THEN
1754          fnd_flex_descval.set_column_value
1755                                     ('ATTRIBUTE13'
1756                                     ,NVL (l_step_activities_row.attribute13
1757                                          ,'') );
1758       ELSIF p_step_activities.attribute13 = fnd_api.g_miss_char THEN
1759          fnd_flex_descval.set_column_value ('ATTRIBUTE13', '');
1760          l_step_activities_row.attribute13 := '';
1761       ELSE
1762          fnd_flex_descval.set_column_value ('ATTRIBUTE13'
1763                                            ,p_step_activities.attribute13);
1764          l_step_activities_row.attribute13 := p_step_activities.attribute13;
1765       END IF;
1766 
1767       IF p_step_activities.attribute14 IS NULL THEN
1768          fnd_flex_descval.set_column_value
1769                                     ('ATTRIBUTE14'
1770                                     ,NVL (l_step_activities_row.attribute14
1771                                          ,'') );
1772       ELSIF p_step_activities.attribute14 = fnd_api.g_miss_char THEN
1773          fnd_flex_descval.set_column_value ('ATTRIBUTE14', '');
1774          l_step_activities_row.attribute14 := '';
1775       ELSE
1776          fnd_flex_descval.set_column_value ('ATTRIBUTE14'
1777                                            ,p_step_activities.attribute14);
1778          l_step_activities_row.attribute14 := p_step_activities.attribute14;
1779       END IF;
1780 
1781       IF p_step_activities.attribute15 IS NULL THEN
1782          fnd_flex_descval.set_column_value
1783                                     ('ATTRIBUTE15'
1784                                     ,NVL (l_step_activities_row.attribute15
1785                                          ,'') );
1786       ELSIF p_step_activities.attribute15 = fnd_api.g_miss_char THEN
1787          fnd_flex_descval.set_column_value ('ATTRIBUTE15', '');
1788          l_step_activities_row.attribute15 := '';
1789       ELSE
1790          fnd_flex_descval.set_column_value ('ATTRIBUTE15'
1791                                            ,p_step_activities.attribute15);
1792          l_step_activities_row.attribute15 := p_step_activities.attribute15;
1793       END IF;
1794 
1795       IF p_step_activities.attribute16 IS NULL THEN
1796          fnd_flex_descval.set_column_value
1797                                     ('ATTRIBUTE16'
1798                                     ,NVL (l_step_activities_row.attribute16
1799                                          ,'') );
1800       ELSIF p_step_activities.attribute16 = fnd_api.g_miss_char THEN
1801          fnd_flex_descval.set_column_value ('ATTRIBUTE16', '');
1802          l_step_activities_row.attribute16 := '';
1803       ELSE
1804          fnd_flex_descval.set_column_value ('ATTRIBUTE16'
1805                                            ,p_step_activities.attribute16);
1806          l_step_activities_row.attribute16 := p_step_activities.attribute16;
1807       END IF;
1808 
1809       IF p_step_activities.attribute17 IS NULL THEN
1810          fnd_flex_descval.set_column_value
1811                                     ('ATTRIBUTE17'
1812                                     ,NVL (l_step_activities_row.attribute17
1813                                          ,'') );
1814       ELSIF p_step_activities.attribute17 = fnd_api.g_miss_char THEN
1815          fnd_flex_descval.set_column_value ('ATTRIBUTE17', '');
1816          l_step_activities_row.attribute17 := '';
1817       ELSE
1818          fnd_flex_descval.set_column_value ('ATTRIBUTE17'
1819                                            ,p_step_activities.attribute17);
1820          l_step_activities_row.attribute17 := p_step_activities.attribute17;
1821       END IF;
1822 
1823       IF p_step_activities.attribute18 IS NULL THEN
1824          fnd_flex_descval.set_column_value
1825                                     ('ATTRIBUTE18'
1826                                     ,NVL (l_step_activities_row.attribute18
1827                                          ,'') );
1828       ELSIF p_step_activities.attribute18 = fnd_api.g_miss_char THEN
1829          fnd_flex_descval.set_column_value ('ATTRIBUTE18', '');
1830          l_step_activities_row.attribute18 := '';
1831       ELSE
1832          fnd_flex_descval.set_column_value ('ATTRIBUTE18'
1833                                            ,p_step_activities.attribute18);
1834          l_step_activities_row.attribute18 := p_step_activities.attribute18;
1835       END IF;
1836 
1837       IF p_step_activities.attribute19 IS NULL THEN
1838          fnd_flex_descval.set_column_value
1839                                     ('ATTRIBUTE19'
1840                                     ,NVL (l_step_activities_row.attribute19
1841                                          ,'') );
1842       ELSIF p_step_activities.attribute19 = fnd_api.g_miss_char THEN
1843          fnd_flex_descval.set_column_value ('ATTRIBUTE19', '');
1844          l_step_activities_row.attribute19 := '';
1845       ELSE
1846          fnd_flex_descval.set_column_value ('ATTRIBUTE19'
1847                                            ,p_step_activities.attribute19);
1848          l_step_activities_row.attribute19 := p_step_activities.attribute19;
1849       END IF;
1850 
1851       IF p_step_activities.attribute20 IS NULL THEN
1852          fnd_flex_descval.set_column_value
1853                                     ('ATTRIBUTE20'
1854                                     ,NVL (l_step_activities_row.attribute20
1855                                          ,'') );
1856       ELSIF p_step_activities.attribute20 = fnd_api.g_miss_char THEN
1857          fnd_flex_descval.set_column_value ('ATTRIBUTE20', '');
1858          l_step_activities_row.attribute20 := '';
1859       ELSE
1860          fnd_flex_descval.set_column_value ('ATTRIBUTE20'
1861                                            ,p_step_activities.attribute20);
1862          l_step_activities_row.attribute20 := p_step_activities.attribute20;
1863       END IF;
1864 
1865       IF p_step_activities.attribute21 IS NULL THEN
1866          fnd_flex_descval.set_column_value
1867                                     ('ATTRIBUTE21'
1868                                     ,NVL (l_step_activities_row.attribute21
1869                                          ,'') );
1870       ELSIF p_step_activities.attribute21 = fnd_api.g_miss_char THEN
1871          fnd_flex_descval.set_column_value ('ATTRIBUTE21', '');
1872          l_step_activities_row.attribute21 := '';
1873       ELSE
1874          fnd_flex_descval.set_column_value ('ATTRIBUTE21'
1875                                            ,p_step_activities.attribute21);
1876          l_step_activities_row.attribute21 := p_step_activities.attribute21;
1877       END IF;
1878 
1879       IF p_step_activities.attribute22 IS NULL THEN
1880          fnd_flex_descval.set_column_value
1881                                     ('ATTRIBUTE22'
1882                                     ,NVL (l_step_activities_row.attribute22
1883                                          ,'') );
1884       ELSIF p_step_activities.attribute22 = fnd_api.g_miss_char THEN
1885          fnd_flex_descval.set_column_value ('ATTRIBUTE22', '');
1886          l_step_activities_row.attribute22 := '';
1887       ELSE
1888          fnd_flex_descval.set_column_value ('ATTRIBUTE22'
1889                                            ,p_step_activities.attribute22);
1890          l_step_activities_row.attribute22 := p_step_activities.attribute22;
1891       END IF;
1892 
1893       IF p_step_activities.attribute23 IS NULL THEN
1894          fnd_flex_descval.set_column_value
1895                                     ('ATTRIBUTE23'
1896                                     ,NVL (l_step_activities_row.attribute23
1897                                          ,'') );
1898       ELSIF p_step_activities.attribute23 = fnd_api.g_miss_char THEN
1899          fnd_flex_descval.set_column_value ('ATTRIBUTE23', '');
1900          l_step_activities_row.attribute23 := '';
1901       ELSE
1902          fnd_flex_descval.set_column_value ('ATTRIBUTE23'
1903                                            ,p_step_activities.attribute23);
1904          l_step_activities_row.attribute23 := p_step_activities.attribute23;
1905       END IF;
1906 
1907       IF p_step_activities.attribute24 IS NULL THEN
1908          fnd_flex_descval.set_column_value
1909                                     ('ATTRIBUTE24'
1910                                     ,NVL (l_step_activities_row.attribute24
1911                                          ,'') );
1912       ELSIF p_step_activities.attribute24 = fnd_api.g_miss_char THEN
1913          fnd_flex_descval.set_column_value ('ATTRIBUTE24', '');
1914          l_step_activities_row.attribute24 := '';
1915       ELSE
1916          fnd_flex_descval.set_column_value ('ATTRIBUTE24'
1917                                            ,p_step_activities.attribute24);
1918          l_step_activities_row.attribute24 := p_step_activities.attribute24;
1919       END IF;
1920 
1921       IF p_step_activities.attribute25 IS NULL THEN
1922          fnd_flex_descval.set_column_value
1923                                     ('ATTRIBUTE25'
1924                                     ,NVL (l_step_activities_row.attribute25
1925                                          ,'') );
1926       ELSIF p_step_activities.attribute25 = fnd_api.g_miss_char THEN
1927          fnd_flex_descval.set_column_value ('ATTRIBUTE25', '');
1928          l_step_activities_row.attribute25 := '';
1929       ELSE
1930          fnd_flex_descval.set_column_value ('ATTRIBUTE25'
1931                                            ,p_step_activities.attribute25);
1932          l_step_activities_row.attribute25 := p_step_activities.attribute25;
1933       END IF;
1934 
1935       IF p_step_activities.attribute26 IS NULL THEN
1936          fnd_flex_descval.set_column_value
1937                                     ('ATTRIBUTE26'
1938                                     ,NVL (l_step_activities_row.attribute26
1939                                          ,'') );
1940       ELSIF p_step_activities.attribute26 = fnd_api.g_miss_char THEN
1941          fnd_flex_descval.set_column_value ('ATTRIBUTE26', '');
1942          l_step_activities_row.attribute26 := '';
1943       ELSE
1944          fnd_flex_descval.set_column_value ('ATTRIBUTE26'
1945                                            ,p_step_activities.attribute26);
1946          l_step_activities_row.attribute26 := p_step_activities.attribute26;
1947       END IF;
1948 
1949       IF p_step_activities.attribute27 IS NULL THEN
1950          fnd_flex_descval.set_column_value
1951                                     ('ATTRIBUTE27'
1952                                     ,NVL (l_step_activities_row.attribute27
1953                                          ,'') );
1954       ELSIF p_step_activities.attribute27 = fnd_api.g_miss_char THEN
1955          fnd_flex_descval.set_column_value ('ATTRIBUTE27', '');
1956          l_step_activities_row.attribute27 := '';
1957       ELSE
1958          fnd_flex_descval.set_column_value ('ATTRIBUTE27'
1959                                            ,p_step_activities.attribute27);
1960          l_step_activities_row.attribute27 := p_step_activities.attribute27;
1961       END IF;
1962 
1963       IF p_step_activities.attribute28 IS NULL THEN
1964          fnd_flex_descval.set_column_value
1965                                     ('ATTRIBUTE28'
1966                                     ,NVL (l_step_activities_row.attribute28
1967                                          ,'') );
1968       ELSIF p_step_activities.attribute28 = fnd_api.g_miss_char THEN
1969          fnd_flex_descval.set_column_value ('ATTRIBUTE28', '');
1970          l_step_activities_row.attribute28 := '';
1971       ELSE
1972          fnd_flex_descval.set_column_value ('ATTRIBUTE28'
1973                                            ,p_step_activities.attribute28);
1974          l_step_activities_row.attribute28 := p_step_activities.attribute28;
1975       END IF;
1976 
1977       IF p_step_activities.attribute29 IS NULL THEN
1978          fnd_flex_descval.set_column_value
1979                                     ('ATTRIBUTE29'
1980                                     ,NVL (l_step_activities_row.attribute29
1981                                          ,'') );
1982       ELSIF p_step_activities.attribute29 = fnd_api.g_miss_char THEN
1983          fnd_flex_descval.set_column_value ('ATTRIBUTE29', '');
1984          l_step_activities_row.attribute29 := '';
1985       ELSE
1986          fnd_flex_descval.set_column_value ('ATTRIBUTE29'
1987                                            ,p_step_activities.attribute29);
1988          l_step_activities_row.attribute29 := p_step_activities.attribute29;
1989       END IF;
1990 
1991       IF p_step_activities.attribute30 IS NULL THEN
1992          fnd_flex_descval.set_column_value
1993                                     ('ATTRIBUTE30'
1994                                     ,NVL (l_step_activities_row.attribute30
1995                                          ,'') );
1996       ELSIF p_step_activities.attribute30 = fnd_api.g_miss_char THEN
1997          fnd_flex_descval.set_column_value ('ATTRIBUTE30', '');
1998          l_step_activities_row.attribute30 := '';
1999       ELSE
2000          fnd_flex_descval.set_column_value ('ATTRIBUTE30'
2001                                            ,p_step_activities.attribute30);
2002          l_step_activities_row.attribute30 := p_step_activities.attribute30;
2003       END IF;
2004 
2005       /* Bug 3649415 - Do not run this validation if it is set to N. */
2006       /* It should only be set to N if it is a value set flexfield   */
2007       /* with a where clause using block fields from the form.       */
2008       /* Pass back all flexfield values w/ no validation.            */
2009       IF gme_common_pvt.g_flex_validate_prof = 0 THEN
2010          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2011             gme_debug.put_line
2012                      ('GME Flexfield is not enabled, No validation required.');
2013          END IF;
2014 
2015          /* Bug 3681718 - Only update flex field columns in x_ OUT parameter. */
2016          x_step_activities.attribute_category :=
2017                                       l_step_activities_row.attribute_category;
2018          x_step_activities.attribute1 := l_step_activities_row.attribute1;
2019          x_step_activities.attribute2 := l_step_activities_row.attribute2;
2020          x_step_activities.attribute3 := l_step_activities_row.attribute3;
2021          x_step_activities.attribute4 := l_step_activities_row.attribute4;
2022          x_step_activities.attribute5 := l_step_activities_row.attribute5;
2023          x_step_activities.attribute6 := l_step_activities_row.attribute6;
2024          x_step_activities.attribute7 := l_step_activities_row.attribute7;
2025          x_step_activities.attribute8 := l_step_activities_row.attribute8;
2026          x_step_activities.attribute9 := l_step_activities_row.attribute9;
2027          x_step_activities.attribute10 := l_step_activities_row.attribute10;
2028          x_step_activities.attribute11 := l_step_activities_row.attribute11;
2029          x_step_activities.attribute12 := l_step_activities_row.attribute12;
2030          x_step_activities.attribute13 := l_step_activities_row.attribute13;
2031          x_step_activities.attribute14 := l_step_activities_row.attribute14;
2032          x_step_activities.attribute15 := l_step_activities_row.attribute15;
2033          x_step_activities.attribute16 := l_step_activities_row.attribute16;
2034          x_step_activities.attribute17 := l_step_activities_row.attribute17;
2035          x_step_activities.attribute18 := l_step_activities_row.attribute18;
2036          x_step_activities.attribute19 := l_step_activities_row.attribute19;
2037          x_step_activities.attribute20 := l_step_activities_row.attribute20;
2038          x_step_activities.attribute21 := l_step_activities_row.attribute21;
2039          x_step_activities.attribute22 := l_step_activities_row.attribute22;
2040          x_step_activities.attribute23 := l_step_activities_row.attribute23;
2041          x_step_activities.attribute24 := l_step_activities_row.attribute24;
2042          x_step_activities.attribute25 := l_step_activities_row.attribute25;
2043          x_step_activities.attribute26 := l_step_activities_row.attribute26;
2044          x_step_activities.attribute27 := l_step_activities_row.attribute27;
2045          x_step_activities.attribute28 := l_step_activities_row.attribute28;
2046          x_step_activities.attribute29 := l_step_activities_row.attribute29;
2047          x_step_activities.attribute30 := l_step_activities_row.attribute30;
2048          RETURN;
2049       END IF;
2050 
2051       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2052          gme_debug.put_line ('Calling FND_FLEX_DESCVAL.validate_desccols ');
2053       END IF;
2054 
2055       IF fnd_flex_descval.validate_desccols
2056                                           (appl_short_name      => appl_short_name
2057                                           ,desc_flex_name       => desc_flex_name
2058                                           ,values_or_ids        => values_or_ids
2059                                           ,validation_date      => validation_date) THEN
2060          --SUCCESS
2061          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2062             gme_debug.put_line ('Validation Success ');
2063          END IF;
2064 
2065          x_return_status := fnd_api.g_ret_sts_success;
2066          n := fnd_flex_descval.segment_count;
2067 
2068          /*Now let us copy back the storage value  */
2069          FOR i IN 1 .. n LOOP
2070             IF fnd_flex_descval.segment_column_name (i) =
2071                                                          'ATTRIBUTE_CATEGORY' THEN
2072                x_step_activities.attribute_category :=
2073                                               fnd_flex_descval.segment_id (i);
2074             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE1' THEN
2075                x_step_activities.attribute1 :=
2076                                               fnd_flex_descval.segment_id (i);
2077             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE2' THEN
2078                x_step_activities.attribute2 :=
2079                                               fnd_flex_descval.segment_id (i);
2080             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE3' THEN
2081                x_step_activities.attribute3 :=
2082                                               fnd_flex_descval.segment_id (i);
2083             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE4' THEN
2084                x_step_activities.attribute4 :=
2085                                               fnd_flex_descval.segment_id (i);
2086             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE5' THEN
2087                x_step_activities.attribute5 :=
2088                                               fnd_flex_descval.segment_id (i);
2089             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE6' THEN
2090                x_step_activities.attribute6 :=
2091                                               fnd_flex_descval.segment_id (i);
2092             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE7' THEN
2093                x_step_activities.attribute7 :=
2094                                               fnd_flex_descval.segment_id (i);
2095             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE8' THEN
2096                x_step_activities.attribute8 :=
2097                                               fnd_flex_descval.segment_id (i);
2098             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE9' THEN
2099                x_step_activities.attribute9 :=
2100                                               fnd_flex_descval.segment_id (i);
2101             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE10' THEN
2102                x_step_activities.attribute10 :=
2103                                               fnd_flex_descval.segment_id (i);
2104             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE11' THEN
2105                x_step_activities.attribute11 :=
2106                                               fnd_flex_descval.segment_id (i);
2107             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE12' THEN
2108                x_step_activities.attribute12 :=
2109                                               fnd_flex_descval.segment_id (i);
2110             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE13' THEN
2111                x_step_activities.attribute13 :=
2112                                               fnd_flex_descval.segment_id (i);
2113             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE14' THEN
2114                x_step_activities.attribute14 :=
2115                                               fnd_flex_descval.segment_id (i);
2116             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE15' THEN
2117                x_step_activities.attribute15 :=
2118                                               fnd_flex_descval.segment_id (i);
2119             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE16' THEN
2120                x_step_activities.attribute16 :=
2121                                               fnd_flex_descval.segment_id (i);
2122             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE17' THEN
2123                x_step_activities.attribute17 :=
2124                                               fnd_flex_descval.segment_id (i);
2125             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE18' THEN
2126                x_step_activities.attribute18 :=
2127                                               fnd_flex_descval.segment_id (i);
2128             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE19' THEN
2129                x_step_activities.attribute19 :=
2130                                               fnd_flex_descval.segment_id (i);
2131             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE20' THEN
2132                x_step_activities.attribute20 :=
2133                                               fnd_flex_descval.segment_id (i);
2134             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE21' THEN
2135                x_step_activities.attribute21 :=
2136                                               fnd_flex_descval.segment_id (i);
2137             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE22' THEN
2138                x_step_activities.attribute22 :=
2139                                               fnd_flex_descval.segment_id (i);
2140             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE23' THEN
2141                x_step_activities.attribute23 :=
2142                                               fnd_flex_descval.segment_id (i);
2143             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE24' THEN
2144                x_step_activities.attribute24 :=
2145                                               fnd_flex_descval.segment_id (i);
2146             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE25' THEN
2147                x_step_activities.attribute25 :=
2148                                               fnd_flex_descval.segment_id (i);
2149             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE26' THEN
2150                x_step_activities.attribute26 :=
2151                                               fnd_flex_descval.segment_id (i);
2152             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE27' THEN
2153                x_step_activities.attribute27 :=
2154                                               fnd_flex_descval.segment_id (i);
2155             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE28' THEN
2156                x_step_activities.attribute28 :=
2157                                               fnd_flex_descval.segment_id (i);
2158             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE29' THEN
2159                x_step_activities.attribute29 :=
2160                                               fnd_flex_descval.segment_id (i);
2161             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE30' THEN
2162                x_step_activities.attribute30 :=
2163                                               fnd_flex_descval.segment_id (i);
2164             END IF;
2165          END LOOP;
2166       ELSE
2167          error_msg := fnd_flex_descval.error_message;
2168 
2169          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2170             gme_debug.put_line ('Validation Ends With Error(s) :');
2171             gme_debug.put_line ('Error :' || error_msg);
2172          END IF;
2173 
2174          gme_common_pvt.log_message ('FLEX-USER DEFINED ERROR'
2175                                     ,'MSG'
2176                                     ,error_msg);
2177          RAISE validation_error;
2178       END IF;
2179 
2180       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2181          gme_debug.put_line (   'Validation completed for the Flex field : '
2182                              || desc_flex_name);
2183       END IF;
2184    EXCEPTION
2185       WHEN validation_error THEN
2186          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2187             gme_debug.put_line
2188                  (   'Validation completed with errors for the Flex field : '
2189                   || desc_flex_name);
2190          END IF;
2191 
2192          x_return_status := fnd_api.g_ret_sts_error;
2193       WHEN step_fetch_error THEN
2194          x_return_status := fnd_api.g_ret_sts_error;
2195       WHEN OTHERS THEN
2196          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2197             gme_debug.put_line (   g_pkg_name
2198                                 || '.'
2199                                 || desc_flex_name
2200                                 || ': '
2201                                 || 'in unexpected error');
2202          END IF;
2203 
2204          x_return_status := fnd_api.g_ret_sts_unexp_error;
2205          fnd_msg_pub.add_exc_msg (g_pkg_name, desc_flex_name);
2206    END validate_flex_step_activities;
2207 
2208     /*======================================================================
2209    -- NAME
2210    -- validate_flex_step_resources
2211    --
2212    -- DESCRIPTION
2213    --   This procedure will validate the GME_BATCH_STEP_RESOURCES_FLEX, descriptive flex field
2214    --   for batch step resources using serverside flex field validation package FND_FLEX_DESCVAL.
2215    --
2216    -- SYNOPSIS:
2217 
2218         validate_flex_step_resources  (p_step_resources => a_step_resources,
2219                                        x_step_resources => b_step_resources,
2220                                        x_return_status =>l_return_status);
2221    -- HISTORY
2222    -- A.Sriram    19-FEB-2004     Created -- BUG#3406639
2223 
2224    -- G. Muratore 05-MAY-2004     Bug 3575735
2225    --  New profile added to control whether or not this procedure should be
2226    --  executed. A problem occurs when there is a flexfield of value set type,
2227    --  that has a where clause using a block field on the form.
2228    --
2229    -- G. Muratore 25-MAY-2004     Bug 3649415
2230    --  This is a follow up fix to bug 3575735.
2231    --  The flex field data entered by the user on the form is still saved even
2232    --  if the profile says not to validate it on the server side.
2233    --  Additional fix 3556979. The code will no longer fail during insert.
2234    --
2235    -- G. Muratore 11-JUN-2004     Bug 3681718
2236    --  This is a follow up fix to bug 3649415.
2237    --  Only flex field data will be overwritten in x_material_detail parameter.
2238 
2239    --- 16-March-2005  Punit Kumar Convergence changes
2240    ======================================================================= */
2241    PROCEDURE validate_flex_step_resources (
2242       p_step_resources   IN              gme_batch_step_resources%ROWTYPE
2243      ,x_step_resources   IN OUT NOCOPY   gme_batch_step_resources%ROWTYPE
2244      ,x_return_status    OUT NOCOPY      VARCHAR2)
2245    IS
2246       l_attribute_category   VARCHAR2 (240);
2247       appl_short_name        VARCHAR2 (30)                      := 'GME';
2248       desc_flex_name         VARCHAR2 (30) := 'GME_BATCH_STEP_RESOURCES_FLEX';
2249       values_or_ids          VARCHAR2 (10)                      := 'I';
2250       validation_date        DATE                               := SYSDATE;
2251       error_msg              VARCHAR2 (5000);
2252       validation_error       EXCEPTION;
2253       step_fetch_error       EXCEPTION;
2254       l_field_value          VARCHAR2 (240);
2255       l_field_name           VARCHAR2 (100);
2256       n                      NUMBER                             := 0;
2257       l_step_resource_row    gme_batch_step_resources%ROWTYPE;
2258       --3556979
2259       l_exists               NUMBER;
2260       l_dummy                BOOLEAN;
2261 
2262       CURSOR cur_record_exists (v_rec_id NUMBER)
2263       IS
2264          SELECT 1
2265            FROM gme_batch_step_resources
2266           WHERE batchstep_resource_id = v_rec_id;
2267    BEGIN
2268       /* Set return status to success initially */
2269       x_return_status := fnd_api.g_ret_sts_success;
2270 
2271       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2272          gme_debug.put_line (   'Check if flexfield is enabled : '
2273                              || desc_flex_name);
2274       END IF;
2275 
2276       OPEN cur_get_appl_id;
2277 
2278       FETCH cur_get_appl_id
2279        INTO pkg_application_id;
2280 
2281       CLOSE cur_get_appl_id;
2282 
2283       IF NOT fnd_flex_apis.is_descr_setup (pkg_application_id, desc_flex_name) THEN
2284          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2285             gme_debug.put_line
2286                          ('Flexfield is not enabled, No validation required.');
2287          END IF;
2288 
2289          RETURN;
2290       END IF;
2291 
2292       -- 3556979 Check if record being worked on already exists
2293       OPEN cur_record_exists (p_step_resources.batchstep_resource_id);
2294 
2295       FETCH cur_record_exists
2296        INTO l_exists;
2297 
2298       IF cur_record_exists%NOTFOUND THEN
2299          l_step_resource_row := p_step_resources;
2300       ELSE
2301          l_dummy :=
2302             gme_batch_step_resources_dbl.fetch_row (p_step_resources
2303                                                    ,l_step_resource_row);
2304       END IF;
2305 
2306       CLOSE cur_record_exists;
2307 
2308       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2309          gme_debug.put_line (   'Validation of the Flex field : '
2310                              || desc_flex_name);
2311          gme_debug.put_line
2312             ('Assignment of the attribute Category And Attribute Values to Local Variables');
2313       END IF;
2314 
2315       x_step_resources := p_step_resources;
2316 
2317       /* Bug 3649415 - Retain all current flexfield values in l_step_resource_row.  */
2318       /* This will allow us to pass back the correct row with all the proper values */
2319       /* in the event the flex field validation on the server side is off.          */
2320       /* All the following if statements will now retain that data.                 */
2321       IF p_step_resources.attribute_category IS NULL THEN
2322          l_attribute_category :=
2323                              NVL (l_step_resource_row.attribute_category, '');
2324       ELSIF p_step_resources.attribute_category = fnd_api.g_miss_char THEN
2325          l_attribute_category := '';
2326       ELSE
2327          l_attribute_category := p_step_resources.attribute_category;
2328       END IF;
2329 
2330       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2331          gme_debug.put_line
2332             ('setting set column values for the context value,for Global Data Elements and for context code.');
2333       END IF;
2334 
2335       fnd_flex_descval.set_context_value (l_attribute_category);
2336       l_step_resource_row.attribute_category := l_attribute_category;
2337 
2338       IF p_step_resources.attribute1 IS NULL THEN
2339          fnd_flex_descval.set_column_value
2340                                        ('ATTRIBUTE1'
2341                                        ,NVL (l_step_resource_row.attribute1
2342                                             ,'') );
2343       ELSIF p_step_resources.attribute1 = fnd_api.g_miss_char THEN
2344          fnd_flex_descval.set_column_value ('ATTRIBUTE1', '');
2345          l_step_resource_row.attribute1 := '';
2346       ELSE
2347          fnd_flex_descval.set_column_value ('ATTRIBUTE1'
2348                                            ,p_step_resources.attribute1);
2349          l_step_resource_row.attribute1 := p_step_resources.attribute1;
2350       END IF;
2351 
2352       IF p_step_resources.attribute2 IS NULL THEN
2353          fnd_flex_descval.set_column_value
2354                                        ('ATTRIBUTE2'
2355                                        ,NVL (l_step_resource_row.attribute2
2356                                             ,'') );
2357       ELSIF p_step_resources.attribute2 = fnd_api.g_miss_char THEN
2358          fnd_flex_descval.set_column_value ('ATTRIBUTE2', '');
2359          l_step_resource_row.attribute2 := '';
2360       ELSE
2361          fnd_flex_descval.set_column_value ('ATTRIBUTE2'
2362                                            ,p_step_resources.attribute2);
2363          l_step_resource_row.attribute2 := p_step_resources.attribute2;
2364       END IF;
2365 
2366       IF p_step_resources.attribute3 IS NULL THEN
2367          fnd_flex_descval.set_column_value
2368                                        ('ATTRIBUTE3'
2369                                        ,NVL (l_step_resource_row.attribute3
2370                                             ,'') );
2371       ELSIF p_step_resources.attribute3 = fnd_api.g_miss_char THEN
2372          fnd_flex_descval.set_column_value ('ATTRIBUTE3', '');
2373          l_step_resource_row.attribute3 := '';
2374       ELSE
2375          fnd_flex_descval.set_column_value ('ATTRIBUTE3'
2376                                            ,p_step_resources.attribute3);
2377          l_step_resource_row.attribute3 := p_step_resources.attribute3;
2378       END IF;
2379 
2380       IF p_step_resources.attribute4 IS NULL THEN
2381          fnd_flex_descval.set_column_value
2382                                        ('ATTRIBUTE4'
2383                                        ,NVL (l_step_resource_row.attribute4
2384                                             ,'') );
2385       ELSIF p_step_resources.attribute4 = fnd_api.g_miss_char THEN
2386          fnd_flex_descval.set_column_value ('ATTRIBUTE4', '');
2387          l_step_resource_row.attribute4 := '';
2388       ELSE
2389          fnd_flex_descval.set_column_value ('ATTRIBUTE4'
2390                                            ,p_step_resources.attribute4);
2391          l_step_resource_row.attribute4 := p_step_resources.attribute4;
2392       END IF;
2393 
2394       IF p_step_resources.attribute5 IS NULL THEN
2395          fnd_flex_descval.set_column_value
2396                                        ('ATTRIBUTE5'
2397                                        ,NVL (l_step_resource_row.attribute5
2398                                             ,'') );
2399       ELSIF p_step_resources.attribute5 = fnd_api.g_miss_char THEN
2400          fnd_flex_descval.set_column_value ('ATTRIBUTE5', '');
2401          l_step_resource_row.attribute5 := '';
2402       ELSE
2403          fnd_flex_descval.set_column_value ('ATTRIBUTE5'
2404                                            ,p_step_resources.attribute5);
2405          l_step_resource_row.attribute5 := p_step_resources.attribute5;
2406       END IF;
2407 
2408       IF p_step_resources.attribute6 IS NULL THEN
2409          fnd_flex_descval.set_column_value
2410                                        ('ATTRIBUTE6'
2411                                        ,NVL (l_step_resource_row.attribute6
2412                                             ,'') );
2413       ELSIF p_step_resources.attribute6 = fnd_api.g_miss_char THEN
2414          fnd_flex_descval.set_column_value ('ATTRIBUTE6', '');
2415          l_step_resource_row.attribute6 := '';
2416       ELSE
2417          fnd_flex_descval.set_column_value ('ATTRIBUTE6'
2418                                            ,p_step_resources.attribute6);
2419          l_step_resource_row.attribute6 := p_step_resources.attribute6;
2420       END IF;
2421 
2422       IF p_step_resources.attribute7 IS NULL THEN
2423          fnd_flex_descval.set_column_value
2424                                        ('ATTRIBUTE7'
2425                                        ,NVL (l_step_resource_row.attribute7
2426                                             ,'') );
2427       ELSIF p_step_resources.attribute7 = fnd_api.g_miss_char THEN
2428          fnd_flex_descval.set_column_value ('ATTRIBUTE7', '');
2429          l_step_resource_row.attribute7 := '';
2430       ELSE
2431          fnd_flex_descval.set_column_value ('ATTRIBUTE7'
2432                                            ,p_step_resources.attribute7);
2433          l_step_resource_row.attribute7 := p_step_resources.attribute7;
2434       END IF;
2435 
2436       IF p_step_resources.attribute8 IS NULL THEN
2437          fnd_flex_descval.set_column_value
2438                                        ('ATTRIBUTE8'
2439                                        ,NVL (l_step_resource_row.attribute8
2440                                             ,'') );
2441       ELSIF p_step_resources.attribute8 = fnd_api.g_miss_char THEN
2442          fnd_flex_descval.set_column_value ('ATTRIBUTE8', '');
2443          l_step_resource_row.attribute8 := '';
2444       ELSE
2445          fnd_flex_descval.set_column_value ('ATTRIBUTE8'
2446                                            ,p_step_resources.attribute8);
2447          l_step_resource_row.attribute8 := p_step_resources.attribute8;
2448       END IF;
2449 
2450       IF p_step_resources.attribute9 IS NULL THEN
2451          fnd_flex_descval.set_column_value
2452                                        ('ATTRIBUTE9'
2453                                        ,NVL (l_step_resource_row.attribute9
2454                                             ,'') );
2455       ELSIF p_step_resources.attribute9 = fnd_api.g_miss_char THEN
2456          fnd_flex_descval.set_column_value ('ATTRIBUTE9', '');
2457          l_step_resource_row.attribute9 := '';
2458       ELSE
2459          fnd_flex_descval.set_column_value ('ATTRIBUTE9'
2460                                            ,p_step_resources.attribute9);
2461          l_step_resource_row.attribute9 := p_step_resources.attribute9;
2462       END IF;
2463 
2464       IF p_step_resources.attribute10 IS NULL THEN
2465          fnd_flex_descval.set_column_value
2466                                       ('ATTRIBUTE10'
2467                                       ,NVL (l_step_resource_row.attribute10
2468                                            ,'') );
2469       ELSIF p_step_resources.attribute10 = fnd_api.g_miss_char THEN
2470          fnd_flex_descval.set_column_value ('ATTRIBUTE10', '');
2471          l_step_resource_row.attribute10 := '';
2472       ELSE
2473          fnd_flex_descval.set_column_value ('ATTRIBUTE10'
2474                                            ,p_step_resources.attribute10);
2475          l_step_resource_row.attribute10 := p_step_resources.attribute10;
2476       END IF;
2477 
2478       IF p_step_resources.attribute11 IS NULL THEN
2479          fnd_flex_descval.set_column_value
2480                                       ('ATTRIBUTE11'
2481                                       ,NVL (l_step_resource_row.attribute11
2482                                            ,'') );
2483       ELSIF p_step_resources.attribute11 = fnd_api.g_miss_char THEN
2484          fnd_flex_descval.set_column_value ('ATTRIBUTE11', '');
2485          l_step_resource_row.attribute11 := '';
2486       ELSE
2487          fnd_flex_descval.set_column_value ('ATTRIBUTE11'
2488                                            ,p_step_resources.attribute11);
2489          l_step_resource_row.attribute11 := p_step_resources.attribute11;
2490       END IF;
2491 
2492       IF p_step_resources.attribute12 IS NULL THEN
2493          fnd_flex_descval.set_column_value
2494                                       ('ATTRIBUTE12'
2495                                       ,NVL (l_step_resource_row.attribute12
2496                                            ,'') );
2497       ELSIF p_step_resources.attribute12 = fnd_api.g_miss_char THEN
2498          fnd_flex_descval.set_column_value ('ATTRIBUTE12', '');
2499          l_step_resource_row.attribute12 := '';
2500       ELSE
2501          fnd_flex_descval.set_column_value ('ATTRIBUTE12'
2502                                            ,p_step_resources.attribute12);
2503          l_step_resource_row.attribute12 := p_step_resources.attribute12;
2504       END IF;
2505 
2506       IF p_step_resources.attribute13 IS NULL THEN
2507          fnd_flex_descval.set_column_value
2508                                       ('ATTRIBUTE13'
2509                                       ,NVL (l_step_resource_row.attribute13
2510                                            ,'') );
2511       ELSIF p_step_resources.attribute13 = fnd_api.g_miss_char THEN
2512          fnd_flex_descval.set_column_value ('ATTRIBUTE13', '');
2513          l_step_resource_row.attribute13 := '';
2514       ELSE
2515          fnd_flex_descval.set_column_value ('ATTRIBUTE13'
2516                                            ,p_step_resources.attribute13);
2517          l_step_resource_row.attribute13 := p_step_resources.attribute13;
2518       END IF;
2519 
2520       IF p_step_resources.attribute14 IS NULL THEN
2521          fnd_flex_descval.set_column_value
2522                                       ('ATTRIBUTE14'
2523                                       ,NVL (l_step_resource_row.attribute14
2524                                            ,'') );
2525       ELSIF p_step_resources.attribute14 = fnd_api.g_miss_char THEN
2526          fnd_flex_descval.set_column_value ('ATTRIBUTE14', '');
2527          l_step_resource_row.attribute14 := '';
2528       ELSE
2529          fnd_flex_descval.set_column_value ('ATTRIBUTE14'
2530                                            ,p_step_resources.attribute14);
2531          l_step_resource_row.attribute14 := p_step_resources.attribute14;
2532       END IF;
2533 
2534       IF p_step_resources.attribute15 IS NULL THEN
2535          fnd_flex_descval.set_column_value
2536                                       ('ATTRIBUTE15'
2537                                       ,NVL (l_step_resource_row.attribute15
2538                                            ,'') );
2539       ELSIF p_step_resources.attribute15 = fnd_api.g_miss_char THEN
2540          fnd_flex_descval.set_column_value ('ATTRIBUTE15', '');
2541          l_step_resource_row.attribute15 := '';
2542       ELSE
2543          fnd_flex_descval.set_column_value ('ATTRIBUTE15'
2544                                            ,p_step_resources.attribute15);
2545          l_step_resource_row.attribute15 := p_step_resources.attribute15;
2546       END IF;
2547 
2548       IF p_step_resources.attribute16 IS NULL THEN
2549          fnd_flex_descval.set_column_value
2550                                       ('ATTRIBUTE16'
2551                                       ,NVL (l_step_resource_row.attribute16
2552                                            ,'') );
2553       ELSIF p_step_resources.attribute16 = fnd_api.g_miss_char THEN
2554          fnd_flex_descval.set_column_value ('ATTRIBUTE16', '');
2555          l_step_resource_row.attribute16 := '';
2556       ELSE
2557          fnd_flex_descval.set_column_value ('ATTRIBUTE16'
2558                                            ,p_step_resources.attribute16);
2559          l_step_resource_row.attribute16 := p_step_resources.attribute16;
2560       END IF;
2561 
2562       IF p_step_resources.attribute17 IS NULL THEN
2563          fnd_flex_descval.set_column_value
2564                                       ('ATTRIBUTE17'
2565                                       ,NVL (l_step_resource_row.attribute17
2566                                            ,'') );
2567       ELSIF p_step_resources.attribute17 = fnd_api.g_miss_char THEN
2568          fnd_flex_descval.set_column_value ('ATTRIBUTE17', '');
2569          l_step_resource_row.attribute17 := '';
2570       ELSE
2571          fnd_flex_descval.set_column_value ('ATTRIBUTE17'
2572                                            ,p_step_resources.attribute17);
2573          l_step_resource_row.attribute17 := p_step_resources.attribute17;
2574       END IF;
2575 
2576       IF p_step_resources.attribute18 IS NULL THEN
2577          fnd_flex_descval.set_column_value
2578                                       ('ATTRIBUTE18'
2579                                       ,NVL (l_step_resource_row.attribute18
2580                                            ,'') );
2581       ELSIF p_step_resources.attribute18 = fnd_api.g_miss_char THEN
2582          fnd_flex_descval.set_column_value ('ATTRIBUTE18', '');
2583          l_step_resource_row.attribute18 := '';
2584       ELSE
2585          fnd_flex_descval.set_column_value ('ATTRIBUTE18'
2586                                            ,p_step_resources.attribute18);
2587          l_step_resource_row.attribute18 := p_step_resources.attribute18;
2588       END IF;
2589 
2590       IF p_step_resources.attribute19 IS NULL THEN
2591          fnd_flex_descval.set_column_value
2592                                       ('ATTRIBUTE19'
2593                                       ,NVL (l_step_resource_row.attribute19
2594                                            ,'') );
2595       ELSIF p_step_resources.attribute19 = fnd_api.g_miss_char THEN
2596          fnd_flex_descval.set_column_value ('ATTRIBUTE19', '');
2597          l_step_resource_row.attribute19 := '';
2598       ELSE
2599          fnd_flex_descval.set_column_value ('ATTRIBUTE19'
2600                                            ,p_step_resources.attribute19);
2601          l_step_resource_row.attribute19 := p_step_resources.attribute19;
2602       END IF;
2603 
2604       IF p_step_resources.attribute20 IS NULL THEN
2605          fnd_flex_descval.set_column_value
2606                                       ('ATTRIBUTE20'
2607                                       ,NVL (l_step_resource_row.attribute20
2608                                            ,'') );
2609       ELSIF p_step_resources.attribute20 = fnd_api.g_miss_char THEN
2610          fnd_flex_descval.set_column_value ('ATTRIBUTE20', '');
2611          l_step_resource_row.attribute20 := '';
2612       ELSE
2613          fnd_flex_descval.set_column_value ('ATTRIBUTE20'
2614                                            ,p_step_resources.attribute20);
2615          l_step_resource_row.attribute20 := p_step_resources.attribute20;
2616       END IF;
2617 
2618       IF p_step_resources.attribute21 IS NULL THEN
2619          fnd_flex_descval.set_column_value
2620                                       ('ATTRIBUTE21'
2621                                       ,NVL (l_step_resource_row.attribute21
2622                                            ,'') );
2623       ELSIF p_step_resources.attribute21 = fnd_api.g_miss_char THEN
2624          fnd_flex_descval.set_column_value ('ATTRIBUTE21', '');
2625          l_step_resource_row.attribute21 := '';
2626       ELSE
2627          fnd_flex_descval.set_column_value ('ATTRIBUTE21'
2628                                            ,p_step_resources.attribute21);
2629          l_step_resource_row.attribute21 := p_step_resources.attribute21;
2630       END IF;
2631 
2632       IF p_step_resources.attribute22 IS NULL THEN
2633          fnd_flex_descval.set_column_value
2634                                       ('ATTRIBUTE22'
2635                                       ,NVL (l_step_resource_row.attribute22
2636                                            ,'') );
2637       ELSIF p_step_resources.attribute22 = fnd_api.g_miss_char THEN
2638          fnd_flex_descval.set_column_value ('ATTRIBUTE22', '');
2639          l_step_resource_row.attribute22 := '';
2640       ELSE
2641          fnd_flex_descval.set_column_value ('ATTRIBUTE22'
2642                                            ,p_step_resources.attribute22);
2643          l_step_resource_row.attribute22 := p_step_resources.attribute22;
2644       END IF;
2645 
2646       IF p_step_resources.attribute23 IS NULL THEN
2647          fnd_flex_descval.set_column_value
2648                                       ('ATTRIBUTE23'
2649                                       ,NVL (l_step_resource_row.attribute23
2650                                            ,'') );
2651       ELSIF p_step_resources.attribute23 = fnd_api.g_miss_char THEN
2652          fnd_flex_descval.set_column_value ('ATTRIBUTE23', '');
2653          l_step_resource_row.attribute23 := '';
2654       ELSE
2655          fnd_flex_descval.set_column_value ('ATTRIBUTE23'
2656                                            ,p_step_resources.attribute23);
2657          l_step_resource_row.attribute23 := p_step_resources.attribute23;
2658       END IF;
2659 
2660       IF p_step_resources.attribute24 IS NULL THEN
2661          fnd_flex_descval.set_column_value
2662                                       ('ATTRIBUTE24'
2663                                       ,NVL (l_step_resource_row.attribute24
2664                                            ,'') );
2665       ELSIF p_step_resources.attribute24 = fnd_api.g_miss_char THEN
2666          fnd_flex_descval.set_column_value ('ATTRIBUTE24', '');
2667          l_step_resource_row.attribute24 := '';
2668       ELSE
2669          fnd_flex_descval.set_column_value ('ATTRIBUTE24'
2670                                            ,p_step_resources.attribute24);
2671          l_step_resource_row.attribute24 := p_step_resources.attribute24;
2672       END IF;
2673 
2674       IF p_step_resources.attribute25 IS NULL THEN
2675          fnd_flex_descval.set_column_value
2676                                       ('ATTRIBUTE25'
2677                                       ,NVL (l_step_resource_row.attribute25
2678                                            ,'') );
2679       ELSIF p_step_resources.attribute25 = fnd_api.g_miss_char THEN
2680          fnd_flex_descval.set_column_value ('ATTRIBUTE25', '');
2681          l_step_resource_row.attribute25 := '';
2682       ELSE
2683          fnd_flex_descval.set_column_value ('ATTRIBUTE25'
2684                                            ,p_step_resources.attribute25);
2685          l_step_resource_row.attribute25 := p_step_resources.attribute25;
2686       END IF;
2687 
2688       IF p_step_resources.attribute26 IS NULL THEN
2689          fnd_flex_descval.set_column_value
2690                                       ('ATTRIBUTE26'
2691                                       ,NVL (l_step_resource_row.attribute26
2692                                            ,'') );
2693       ELSIF p_step_resources.attribute26 = fnd_api.g_miss_char THEN
2694          fnd_flex_descval.set_column_value ('ATTRIBUTE26', '');
2695          l_step_resource_row.attribute26 := '';
2696       ELSE
2697          fnd_flex_descval.set_column_value ('ATTRIBUTE26'
2698                                            ,p_step_resources.attribute26);
2699          l_step_resource_row.attribute26 := p_step_resources.attribute26;
2700       END IF;
2701 
2702       IF p_step_resources.attribute27 IS NULL THEN
2703          fnd_flex_descval.set_column_value
2704                                       ('ATTRIBUTE27'
2705                                       ,NVL (l_step_resource_row.attribute27
2706                                            ,'') );
2707       ELSIF p_step_resources.attribute27 = fnd_api.g_miss_char THEN
2708          fnd_flex_descval.set_column_value ('ATTRIBUTE27', '');
2709          l_step_resource_row.attribute27 := '';
2710       ELSE
2711          fnd_flex_descval.set_column_value ('ATTRIBUTE27'
2712                                            ,p_step_resources.attribute27);
2713          l_step_resource_row.attribute27 := p_step_resources.attribute27;
2714       END IF;
2715 
2716       IF p_step_resources.attribute28 IS NULL THEN
2717          fnd_flex_descval.set_column_value
2718                                       ('ATTRIBUTE28'
2719                                       ,NVL (l_step_resource_row.attribute28
2720                                            ,'') );
2721       ELSIF p_step_resources.attribute28 = fnd_api.g_miss_char THEN
2722          fnd_flex_descval.set_column_value ('ATTRIBUTE28', '');
2723          l_step_resource_row.attribute28 := '';
2724       ELSE
2725          fnd_flex_descval.set_column_value ('ATTRIBUTE28'
2726                                            ,p_step_resources.attribute28);
2727          l_step_resource_row.attribute28 := p_step_resources.attribute28;
2728       END IF;
2729 
2730       IF p_step_resources.attribute29 IS NULL THEN
2731          fnd_flex_descval.set_column_value
2732                                       ('ATTRIBUTE29'
2733                                       ,NVL (l_step_resource_row.attribute29
2734                                            ,'') );
2735       ELSIF p_step_resources.attribute29 = fnd_api.g_miss_char THEN
2736          fnd_flex_descval.set_column_value ('ATTRIBUTE29', '');
2737          l_step_resource_row.attribute29 := '';
2738       ELSE
2739          fnd_flex_descval.set_column_value ('ATTRIBUTE29'
2740                                            ,p_step_resources.attribute29);
2741          l_step_resource_row.attribute29 := p_step_resources.attribute29;
2742       END IF;
2743 
2744       IF p_step_resources.attribute30 IS NULL THEN
2745          fnd_flex_descval.set_column_value
2746                                       ('ATTRIBUTE30'
2747                                       ,NVL (l_step_resource_row.attribute30
2748                                            ,'') );
2749       ELSIF p_step_resources.attribute30 = fnd_api.g_miss_char THEN
2750          fnd_flex_descval.set_column_value ('ATTRIBUTE30', '');
2751          l_step_resource_row.attribute30 := '';
2752       ELSE
2753          fnd_flex_descval.set_column_value ('ATTRIBUTE30'
2754                                            ,p_step_resources.attribute30);
2755          l_step_resource_row.attribute30 := p_step_resources.attribute30;
2756       END IF;
2757 
2758       /* Bug 3649415 - Do not run this validation if it is set to N. */
2759       /* It should only be set to N if it is a value set flexfield   */
2760       /* with a where clause using block fields from the form.       */
2761       /* Pass back all flexfield values w/ no validation.            */
2762       IF gme_common_pvt.g_flex_validate_prof = 0 THEN
2763          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2764             gme_debug.put_line
2765                      ('GME Flexfield is not enabled, No validation required.');
2766          END IF;
2767 
2768          /* Bug 3681718 - Only update flex field columns in x_ OUT parameter. */
2769          x_step_resources.attribute_category :=
2770                                         l_step_resource_row.attribute_category;
2771          x_step_resources.attribute1 := l_step_resource_row.attribute1;
2772          x_step_resources.attribute2 := l_step_resource_row.attribute2;
2773          x_step_resources.attribute3 := l_step_resource_row.attribute3;
2774          x_step_resources.attribute4 := l_step_resource_row.attribute4;
2775          x_step_resources.attribute5 := l_step_resource_row.attribute5;
2776          x_step_resources.attribute6 := l_step_resource_row.attribute6;
2777          x_step_resources.attribute7 := l_step_resource_row.attribute7;
2778          x_step_resources.attribute8 := l_step_resource_row.attribute8;
2779          x_step_resources.attribute9 := l_step_resource_row.attribute9;
2780          x_step_resources.attribute10 := l_step_resource_row.attribute10;
2781          x_step_resources.attribute11 := l_step_resource_row.attribute11;
2782          x_step_resources.attribute12 := l_step_resource_row.attribute12;
2783          x_step_resources.attribute13 := l_step_resource_row.attribute13;
2784          x_step_resources.attribute14 := l_step_resource_row.attribute14;
2785          x_step_resources.attribute15 := l_step_resource_row.attribute15;
2786          x_step_resources.attribute16 := l_step_resource_row.attribute16;
2787          x_step_resources.attribute17 := l_step_resource_row.attribute17;
2788          x_step_resources.attribute18 := l_step_resource_row.attribute18;
2789          x_step_resources.attribute19 := l_step_resource_row.attribute19;
2790          x_step_resources.attribute20 := l_step_resource_row.attribute20;
2791          x_step_resources.attribute21 := l_step_resource_row.attribute21;
2792          x_step_resources.attribute22 := l_step_resource_row.attribute22;
2793          x_step_resources.attribute23 := l_step_resource_row.attribute23;
2794          x_step_resources.attribute24 := l_step_resource_row.attribute24;
2795          x_step_resources.attribute25 := l_step_resource_row.attribute25;
2796          x_step_resources.attribute26 := l_step_resource_row.attribute26;
2797          x_step_resources.attribute27 := l_step_resource_row.attribute27;
2798          x_step_resources.attribute28 := l_step_resource_row.attribute28;
2799          x_step_resources.attribute29 := l_step_resource_row.attribute29;
2800          x_step_resources.attribute30 := l_step_resource_row.attribute30;
2801          RETURN;
2802       END IF;
2803 
2804       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2805          gme_debug.put_line ('Calling FND_FLEX_DESCVAL.validate_desccols ');
2806       END IF;
2807 
2808       IF fnd_flex_descval.validate_desccols
2809                                           (appl_short_name      => appl_short_name
2810                                           ,desc_flex_name       => desc_flex_name
2811                                           ,values_or_ids        => values_or_ids
2812                                           ,validation_date      => validation_date) THEN
2813          --SUCCESS
2814          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2815             gme_debug.put_line ('Validation Success ');
2816          END IF;
2817 
2818          x_return_status := fnd_api.g_ret_sts_success;
2819          n := fnd_flex_descval.segment_count;
2820 
2821          /*Now let us copy back the storage value  */
2822          FOR i IN 1 .. n LOOP
2823             IF fnd_flex_descval.segment_column_name (i) =
2824                                                          'ATTRIBUTE_CATEGORY' THEN
2825                x_step_resources.attribute_category :=
2826                                               fnd_flex_descval.segment_id (i);
2827             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE1' THEN
2828                x_step_resources.attribute1 := fnd_flex_descval.segment_id (i);
2829             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE2' THEN
2830                x_step_resources.attribute2 := fnd_flex_descval.segment_id (i);
2831             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE3' THEN
2832                x_step_resources.attribute3 := fnd_flex_descval.segment_id (i);
2833             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE4' THEN
2834                x_step_resources.attribute4 := fnd_flex_descval.segment_id (i);
2835             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE5' THEN
2836                x_step_resources.attribute5 := fnd_flex_descval.segment_id (i);
2837             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE6' THEN
2838                x_step_resources.attribute6 := fnd_flex_descval.segment_id (i);
2839             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE7' THEN
2840                x_step_resources.attribute7 := fnd_flex_descval.segment_id (i);
2841             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE8' THEN
2842                x_step_resources.attribute8 := fnd_flex_descval.segment_id (i);
2843             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE9' THEN
2844                x_step_resources.attribute9 := fnd_flex_descval.segment_id (i);
2845             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE10' THEN
2846                x_step_resources.attribute10 :=
2847                                               fnd_flex_descval.segment_id (i);
2848             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE11' THEN
2849                x_step_resources.attribute11 :=
2850                                               fnd_flex_descval.segment_id (i);
2851             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE12' THEN
2852                x_step_resources.attribute12 :=
2853                                               fnd_flex_descval.segment_id (i);
2854             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE13' THEN
2855                x_step_resources.attribute13 :=
2856                                               fnd_flex_descval.segment_id (i);
2857             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE14' THEN
2858                x_step_resources.attribute14 :=
2859                                               fnd_flex_descval.segment_id (i);
2860             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE15' THEN
2861                x_step_resources.attribute15 :=
2862                                               fnd_flex_descval.segment_id (i);
2863             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE16' THEN
2864                x_step_resources.attribute16 :=
2865                                               fnd_flex_descval.segment_id (i);
2866             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE17' THEN
2867                x_step_resources.attribute17 :=
2868                                               fnd_flex_descval.segment_id (i);
2869             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE18' THEN
2870                x_step_resources.attribute18 :=
2871                                               fnd_flex_descval.segment_id (i);
2872             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE19' THEN
2873                x_step_resources.attribute19 :=
2874                                               fnd_flex_descval.segment_id (i);
2875             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE20' THEN
2876                x_step_resources.attribute20 :=
2877                                               fnd_flex_descval.segment_id (i);
2878             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE21' THEN
2879                x_step_resources.attribute21 :=
2880                                               fnd_flex_descval.segment_id (i);
2881             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE22' THEN
2882                x_step_resources.attribute22 :=
2883                                               fnd_flex_descval.segment_id (i);
2884             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE23' THEN
2885                x_step_resources.attribute23 :=
2886                                               fnd_flex_descval.segment_id (i);
2887             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE24' THEN
2888                x_step_resources.attribute24 :=
2889                                               fnd_flex_descval.segment_id (i);
2890             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE25' THEN
2891                x_step_resources.attribute25 :=
2892                                               fnd_flex_descval.segment_id (i);
2893             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE26' THEN
2894                x_step_resources.attribute26 :=
2895                                               fnd_flex_descval.segment_id (i);
2896             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE27' THEN
2897                x_step_resources.attribute27 :=
2898                                               fnd_flex_descval.segment_id (i);
2899             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE28' THEN
2900                x_step_resources.attribute28 :=
2901                                               fnd_flex_descval.segment_id (i);
2902             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE29' THEN
2903                x_step_resources.attribute29 :=
2904                                               fnd_flex_descval.segment_id (i);
2905             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE30' THEN
2906                x_step_resources.attribute30 :=
2907                                               fnd_flex_descval.segment_id (i);
2908             END IF;
2909          END LOOP;
2910       ELSE
2911          error_msg := fnd_flex_descval.error_message;
2912 
2913          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2914             gme_debug.put_line ('Validation Ends With Error(s) :');
2915             gme_debug.put_line ('Error :' || error_msg);
2916          END IF;
2917 
2918          gme_common_pvt.log_message ('FLEX-USER DEFINED ERROR'
2919                                     ,'MSG'
2920                                     ,error_msg);
2921          RAISE validation_error;
2922       END IF;
2923 
2924       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2925          gme_debug.put_line (   'Validation completed for the Flex field : '
2926                              || desc_flex_name);
2927       END IF;
2928    EXCEPTION
2929       WHEN validation_error THEN
2930          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2931             gme_debug.put_line
2932                  (   'Validation completed with errors for the Flex field : '
2933                   || desc_flex_name);
2934          END IF;
2935 
2936          x_return_status := fnd_api.g_ret_sts_error;
2937       WHEN step_fetch_error THEN
2938          x_return_status := fnd_api.g_ret_sts_error;
2939       WHEN OTHERS THEN
2940          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2941             gme_debug.put_line (   g_pkg_name
2942                                 || '.'
2943                                 || desc_flex_name
2944                                 || ': '
2945                                 || 'in unexpected error');
2946          END IF;
2947 
2948          x_return_status := fnd_api.g_ret_sts_unexp_error;
2949          fnd_msg_pub.add_exc_msg (g_pkg_name, desc_flex_name);
2950    END validate_flex_step_resources;
2951 
2952    /*======================================================================
2953    -- NAME
2954    -- validate_rsrc_txn_flex
2955    --
2956    -- DESCRIPTION
2957    --   This procedure will validate the GME_RESOURCE_TXN_FLEX, descriptive flex field
2958    --   for  resources txns using serverside flex field validation package FND_FLEX_DESCVAL.
2959    --
2960    -- HISTORY
2961 
2962    --- 16-March-2005  Punit Kumar Created new procedure
2963    --- 20-OCT-2005 added new parameter
2964    ======================================================================= */
2965    PROCEDURE validate_rsrc_txn_flex (
2966       p_resource_txn_rec   IN              gme_resource_txns%ROWTYPE
2967      ,x_resource_txn_rec   IN OUT NOCOPY   gme_resource_txns%ROWTYPE
2968      ,x_return_status      OUT NOCOPY      VARCHAR2)
2969    IS
2970       l_attribute_category   VARCHAR2 (240);
2971       appl_short_name        VARCHAR2 (30)                      := 'GME';
2972       --FPBug#4395561 corrected desc_flex_name
2973       desc_flex_name         VARCHAR2 (30)                      := 'GME_RSRC_TXN_FLEX';
2974       values_or_ids          VARCHAR2 (10)                      := 'I';
2975       validation_date        DATE                               := SYSDATE;
2976       error_msg              VARCHAR2 (5000);
2977       validation_error       EXCEPTION;
2978       step_fetch_error       EXCEPTION;
2979       l_field_value          VARCHAR2 (240);
2980       l_field_name           VARCHAR2 (100);
2981       n                      NUMBER                             := 0;
2982       l_step_resource_row    gme_batch_step_resources%ROWTYPE;
2983       --3556979
2984       l_exists               NUMBER;
2985       l_dummy                BOOLEAN;
2986       /*start, Punit Kumar*/
2987       l_resource_txn_rec     gme_resource_txns%ROWTYPE;
2988 
2989       /*end */
2990       CURSOR cur_record_exists (v_rec_id NUMBER)
2991       IS
2992          SELECT 1
2993            FROM gme_resource_txns
2994           WHERE poc_trans_id = v_rec_id;
2995    BEGIN
2996       /* Set return status to success initially */
2997       x_return_status := fnd_api.g_ret_sts_success;
2998 
2999       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3000          gme_debug.put_line (   'Check if flexfield is enabled : '
3001                              || desc_flex_name);
3002       END IF;
3003 
3004       OPEN cur_get_appl_id;
3005 
3006       FETCH cur_get_appl_id
3007        INTO pkg_application_id;
3008 
3009       CLOSE cur_get_appl_id;
3010 
3011       IF NOT fnd_flex_apis.is_descr_setup (pkg_application_id, desc_flex_name) THEN
3012          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3013             gme_debug.put_line
3014                          ('Flexfield is not enabled, No validation required.');
3015          END IF;
3016 
3017          RETURN;
3018       END IF;
3019 
3020       OPEN cur_record_exists (p_resource_txn_rec.poc_trans_id);
3021 
3022       FETCH cur_record_exists
3023        INTO l_exists;
3024 
3025       IF cur_record_exists%NOTFOUND THEN
3026          l_resource_txn_rec := p_resource_txn_rec;
3027       ELSE
3028          l_dummy :=
3029             gme_resource_txns_dbl.fetch_row (p_resource_txn_rec
3030                                             ,l_resource_txn_rec);
3031       END IF;
3032 
3033       CLOSE cur_record_exists;
3034 
3035       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3036          gme_debug.put_line (   'Validation of the Flex field : '
3037                              || desc_flex_name);
3038          gme_debug.put_line
3039             ('Assignment of the attribute Category And Attribute Values to Local Variables');
3040       END IF;
3041 
3042       IF p_resource_txn_rec.attribute_category IS NULL THEN
3043          l_attribute_category := l_resource_txn_rec.attribute_category;
3044       ELSIF p_resource_txn_rec.attribute_category = fnd_api.g_miss_char THEN
3045          l_attribute_category := '';
3046       ELSE
3047          l_attribute_category := p_resource_txn_rec.attribute_category;
3048       END IF;
3049 
3050       /* end */
3051       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3052          gme_debug.put_line
3053             ('setting set column values for the context value,for Global Data Elements and for context code.');
3054       END IF;
3055 
3056       fnd_flex_descval.set_context_value (l_attribute_category);
3057       l_resource_txn_rec.attribute_category := l_attribute_category;
3058 
3059       IF p_resource_txn_rec.attribute1 IS NULL THEN
3060          fnd_flex_descval.set_column_value ('ATTRIBUTE1'
3061                                            ,l_resource_txn_rec.attribute1);
3062       ELSIF p_resource_txn_rec.attribute1 = fnd_api.g_miss_char THEN
3063          fnd_flex_descval.set_column_value ('ATTRIBUTE1', '');
3064          l_resource_txn_rec.attribute1 := '';
3065       ELSE
3066          fnd_flex_descval.set_column_value ('ATTRIBUTE1'
3067                                            ,p_resource_txn_rec.attribute1);
3068          l_resource_txn_rec.attribute1 := p_resource_txn_rec.attribute1;
3069       END IF;
3070 
3071       IF p_resource_txn_rec.attribute2 IS NULL THEN
3072          fnd_flex_descval.set_column_value ('ATTRIBUTE2'
3073                                            ,l_resource_txn_rec.attribute2);
3074       ELSIF p_resource_txn_rec.attribute2 = fnd_api.g_miss_char THEN
3075          fnd_flex_descval.set_column_value ('ATTRIBUTE2', '');
3076          l_resource_txn_rec.attribute2 := '';
3077       ELSE
3078          fnd_flex_descval.set_column_value ('ATTRIBUTE2'
3079                                            ,p_resource_txn_rec.attribute2);
3080          l_resource_txn_rec.attribute2 := p_resource_txn_rec.attribute2;
3081       END IF;
3082 
3083       IF p_resource_txn_rec.attribute3 IS NULL THEN
3084          fnd_flex_descval.set_column_value ('ATTRIBUTE3'
3085                                            ,l_resource_txn_rec.attribute3);
3086       ELSIF p_resource_txn_rec.attribute3 = fnd_api.g_miss_char THEN
3087          fnd_flex_descval.set_column_value ('ATTRIBUTE3', '');
3088          l_resource_txn_rec.attribute3 := '';
3089       ELSE
3090          fnd_flex_descval.set_column_value ('ATTRIBUTE3'
3091                                            ,p_resource_txn_rec.attribute3);
3092          l_resource_txn_rec.attribute3 := p_resource_txn_rec.attribute3;
3093       END IF;
3094 
3095       IF p_resource_txn_rec.attribute4 IS NULL THEN
3096          fnd_flex_descval.set_column_value ('ATTRIBUTE4'
3097                                            ,l_resource_txn_rec.attribute4);
3098       ELSIF p_resource_txn_rec.attribute4 = fnd_api.g_miss_char THEN
3099          fnd_flex_descval.set_column_value ('ATTRIBUTE4', '');
3100          l_resource_txn_rec.attribute4 := '';
3101       ELSE
3102          fnd_flex_descval.set_column_value ('ATTRIBUTE4'
3103                                            ,p_resource_txn_rec.attribute4);
3104          l_resource_txn_rec.attribute4 := p_resource_txn_rec.attribute4;
3105       END IF;
3106 
3107       IF p_resource_txn_rec.attribute5 IS NULL THEN
3108          fnd_flex_descval.set_column_value ('ATTRIBUTE5'
3109                                            ,l_resource_txn_rec.attribute5);
3110       ELSIF p_resource_txn_rec.attribute5 = fnd_api.g_miss_char THEN
3111          fnd_flex_descval.set_column_value ('ATTRIBUTE5', '');
3112          l_resource_txn_rec.attribute5 := '';
3113       ELSE
3114          fnd_flex_descval.set_column_value ('ATTRIBUTE5'
3115                                            ,p_resource_txn_rec.attribute5);
3116          l_resource_txn_rec.attribute5 := p_resource_txn_rec.attribute5;
3117       END IF;
3118 
3119       IF p_resource_txn_rec.attribute6 IS NULL THEN
3120          fnd_flex_descval.set_column_value ('ATTRIBUTE6'
3121                                            ,l_resource_txn_rec.attribute6);
3122       ELSIF p_resource_txn_rec.attribute6 = fnd_api.g_miss_char THEN
3123          fnd_flex_descval.set_column_value ('ATTRIBUTE6', '');
3124          l_resource_txn_rec.attribute6 := '';
3125       ELSE
3126          fnd_flex_descval.set_column_value ('ATTRIBUTE6'
3127                                            ,p_resource_txn_rec.attribute6);
3128          l_resource_txn_rec.attribute6 := p_resource_txn_rec.attribute6;
3129       END IF;
3130 
3131       IF p_resource_txn_rec.attribute7 IS NULL THEN
3132          fnd_flex_descval.set_column_value ('ATTRIBUTE7'
3133                                            ,l_resource_txn_rec.attribute7);
3134       ELSIF p_resource_txn_rec.attribute7 = fnd_api.g_miss_char THEN
3135          fnd_flex_descval.set_column_value ('ATTRIBUTE7', '');
3136          l_resource_txn_rec.attribute7 := '';
3137       ELSE
3138          fnd_flex_descval.set_column_value ('ATTRIBUTE7'
3139                                            ,p_resource_txn_rec.attribute7);
3140          l_resource_txn_rec.attribute7 := p_resource_txn_rec.attribute7;
3141       END IF;
3142 
3143       IF p_resource_txn_rec.attribute8 IS NULL THEN
3144          fnd_flex_descval.set_column_value ('ATTRIBUTE8'
3145                                            ,l_resource_txn_rec.attribute8);
3146       ELSIF p_resource_txn_rec.attribute8 = fnd_api.g_miss_char THEN
3147          fnd_flex_descval.set_column_value ('ATTRIBUTE8', '');
3148          l_resource_txn_rec.attribute8 := '';
3149       ELSE
3150          fnd_flex_descval.set_column_value ('ATTRIBUTE8'
3151                                            ,p_resource_txn_rec.attribute8);
3152          l_resource_txn_rec.attribute8 := p_resource_txn_rec.attribute8;
3153       END IF;
3154 
3155       IF p_resource_txn_rec.attribute9 IS NULL THEN
3156          fnd_flex_descval.set_column_value ('ATTRIBUTE9'
3157                                            ,l_resource_txn_rec.attribute9);
3158       ELSIF p_resource_txn_rec.attribute9 = fnd_api.g_miss_char THEN
3159          fnd_flex_descval.set_column_value ('ATTRIBUTE9', '');
3160          l_resource_txn_rec.attribute9 := '';
3161       ELSE
3162          fnd_flex_descval.set_column_value ('ATTRIBUTE9'
3163                                            ,p_resource_txn_rec.attribute9);
3164          l_resource_txn_rec.attribute9 := p_resource_txn_rec.attribute9;
3165       END IF;
3166 
3167       IF p_resource_txn_rec.attribute10 IS NULL THEN
3168          fnd_flex_descval.set_column_value ('ATTRIBUTE10'
3169                                            ,l_resource_txn_rec.attribute10);
3170       ELSIF p_resource_txn_rec.attribute10 = fnd_api.g_miss_char THEN
3171          fnd_flex_descval.set_column_value ('ATTRIBUTE10', '');
3172          l_resource_txn_rec.attribute10 := '';
3173       ELSE
3174          fnd_flex_descval.set_column_value ('ATTRIBUTE10'
3175                                            ,p_resource_txn_rec.attribute10);
3176          l_resource_txn_rec.attribute10 := p_resource_txn_rec.attribute10;
3177       END IF;
3178 
3179       IF p_resource_txn_rec.attribute11 IS NULL THEN
3180          fnd_flex_descval.set_column_value ('ATTRIBUTE11'
3181                                            ,l_resource_txn_rec.attribute11);
3182       ELSIF p_resource_txn_rec.attribute11 = fnd_api.g_miss_char THEN
3183          fnd_flex_descval.set_column_value ('ATTRIBUTE11', '');
3184          l_resource_txn_rec.attribute11 := '';
3185       ELSE
3186          fnd_flex_descval.set_column_value ('ATTRIBUTE11'
3187                                            ,p_resource_txn_rec.attribute11);
3188          l_resource_txn_rec.attribute11 := p_resource_txn_rec.attribute11;
3189       END IF;
3190 
3191       IF p_resource_txn_rec.attribute12 IS NULL THEN
3192          fnd_flex_descval.set_column_value ('ATTRIBUTE12'
3193                                            ,l_resource_txn_rec.attribute12);
3194       ELSIF p_resource_txn_rec.attribute12 = fnd_api.g_miss_char THEN
3195          fnd_flex_descval.set_column_value ('ATTRIBUTE12', '');
3196          l_resource_txn_rec.attribute12 := '';
3197       ELSE
3198          fnd_flex_descval.set_column_value ('ATTRIBUTE12'
3199                                            ,p_resource_txn_rec.attribute12);
3200          l_resource_txn_rec.attribute12 := p_resource_txn_rec.attribute12;
3201       END IF;
3202 
3203       IF p_resource_txn_rec.attribute13 IS NULL THEN
3204          fnd_flex_descval.set_column_value ('ATTRIBUTE13'
3205                                            ,l_resource_txn_rec.attribute13);
3206       ELSIF p_resource_txn_rec.attribute13 = fnd_api.g_miss_char THEN
3207          fnd_flex_descval.set_column_value ('ATTRIBUTE13', '');
3208          l_resource_txn_rec.attribute13 := '';
3209       ELSE
3210          fnd_flex_descval.set_column_value ('ATTRIBUTE13'
3211                                            ,p_resource_txn_rec.attribute13);
3212          l_resource_txn_rec.attribute13 := p_resource_txn_rec.attribute13;
3213       END IF;
3214 
3215       IF p_resource_txn_rec.attribute14 IS NULL THEN
3216          fnd_flex_descval.set_column_value ('ATTRIBUTE14'
3217                                            ,l_resource_txn_rec.attribute14);
3218       ELSIF p_resource_txn_rec.attribute1 = fnd_api.g_miss_char THEN
3219          fnd_flex_descval.set_column_value ('ATTRIBUTE14', '');
3220          l_resource_txn_rec.attribute14 := '';
3221       ELSE
3222          fnd_flex_descval.set_column_value ('ATTRIBUTE14'
3223                                            ,p_resource_txn_rec.attribute14);
3224          l_resource_txn_rec.attribute14 := p_resource_txn_rec.attribute14;
3225       END IF;
3226 
3227       IF p_resource_txn_rec.attribute15 IS NULL THEN
3228          fnd_flex_descval.set_column_value ('ATTRIBUTE15'
3229                                            ,l_resource_txn_rec.attribute15);
3230       ELSIF p_resource_txn_rec.attribute15 = fnd_api.g_miss_char THEN
3231          fnd_flex_descval.set_column_value ('ATTRIBUTE15', '');
3232          l_resource_txn_rec.attribute15 := '';
3233       ELSE
3234          fnd_flex_descval.set_column_value ('ATTRIBUTE15'
3235                                            ,p_resource_txn_rec.attribute15);
3236          l_resource_txn_rec.attribute15 := p_resource_txn_rec.attribute15;
3237       END IF;
3238 
3239       IF p_resource_txn_rec.attribute16 IS NULL THEN
3240          fnd_flex_descval.set_column_value ('ATTRIBUTE16'
3241                                            ,l_resource_txn_rec.attribute16);
3242       ELSIF p_resource_txn_rec.attribute16 = fnd_api.g_miss_char THEN
3243          fnd_flex_descval.set_column_value ('ATTRIBUTE16', '');
3244          l_resource_txn_rec.attribute16 := '';
3245       ELSE
3246          fnd_flex_descval.set_column_value ('ATTRIBUTE16'
3247                                            ,p_resource_txn_rec.attribute16);
3248          l_resource_txn_rec.attribute16 := p_resource_txn_rec.attribute16;
3249       END IF;
3250 
3251       IF p_resource_txn_rec.attribute17 IS NULL THEN
3252          fnd_flex_descval.set_column_value ('ATTRIBUTE17'
3253                                            ,l_resource_txn_rec.attribute17);
3254       ELSIF p_resource_txn_rec.attribute17 = fnd_api.g_miss_char THEN
3255          fnd_flex_descval.set_column_value ('ATTRIBUTE17', '');
3256          l_resource_txn_rec.attribute17 := '';
3257       ELSE
3258          fnd_flex_descval.set_column_value ('ATTRIBUTE17'
3259                                            ,p_resource_txn_rec.attribute17);
3260          l_resource_txn_rec.attribute17 := p_resource_txn_rec.attribute17;
3261       END IF;
3262 
3263       IF p_resource_txn_rec.attribute18 IS NULL THEN
3264          fnd_flex_descval.set_column_value ('ATTRIBUTE18'
3265                                            ,l_resource_txn_rec.attribute18);
3266       ELSIF p_resource_txn_rec.attribute18 = fnd_api.g_miss_char THEN
3267          fnd_flex_descval.set_column_value ('ATTRIBUTE18', '');
3268          l_resource_txn_rec.attribute18 := '';
3269       ELSE
3270          fnd_flex_descval.set_column_value ('ATTRIBUTE18'
3271                                            ,p_resource_txn_rec.attribute18);
3272          l_resource_txn_rec.attribute18 := p_resource_txn_rec.attribute18;
3273       END IF;
3274 
3275       IF p_resource_txn_rec.attribute19 IS NULL THEN
3276          fnd_flex_descval.set_column_value ('ATTRIBUTE19'
3277                                            ,l_resource_txn_rec.attribute19);
3278       ELSIF p_resource_txn_rec.attribute19 = fnd_api.g_miss_char THEN
3279          fnd_flex_descval.set_column_value ('ATTRIBUTE19', '');
3280          l_resource_txn_rec.attribute19 := '';
3281       ELSE
3282          fnd_flex_descval.set_column_value ('ATTRIBUTE19'
3283                                            ,p_resource_txn_rec.attribute19);
3284          l_resource_txn_rec.attribute19 := p_resource_txn_rec.attribute19;
3285       END IF;
3286 
3287       IF p_resource_txn_rec.attribute20 IS NULL THEN
3288          fnd_flex_descval.set_column_value ('ATTRIBUTE20'
3289                                            ,l_resource_txn_rec.attribute20);
3290       ELSIF p_resource_txn_rec.attribute20 = fnd_api.g_miss_char THEN
3291          fnd_flex_descval.set_column_value ('ATTRIBUTE20', '');
3292          l_resource_txn_rec.attribute20 := '';
3293       ELSE
3294          fnd_flex_descval.set_column_value ('ATTRIBUTE20'
3295                                            ,p_resource_txn_rec.attribute20);
3296          l_resource_txn_rec.attribute20 := p_resource_txn_rec.attribute20;
3297       END IF;
3298 
3299       IF p_resource_txn_rec.attribute21 IS NULL THEN
3300          fnd_flex_descval.set_column_value ('ATTRIBUTE21'
3301                                            ,l_resource_txn_rec.attribute21);
3302       ELSIF p_resource_txn_rec.attribute21 = fnd_api.g_miss_char THEN
3303          fnd_flex_descval.set_column_value ('ATTRIBUTE21', '');
3304          l_resource_txn_rec.attribute21 := '';
3305       ELSE
3306          fnd_flex_descval.set_column_value ('ATTRIBUTE21'
3307                                            ,p_resource_txn_rec.attribute21);
3308          l_resource_txn_rec.attribute21 := p_resource_txn_rec.attribute21;
3309       END IF;
3310 
3311       IF p_resource_txn_rec.attribute22 IS NULL THEN
3312          fnd_flex_descval.set_column_value ('ATTRIBUTE22'
3313                                            ,l_resource_txn_rec.attribute22);
3314       ELSIF p_resource_txn_rec.attribute22 = fnd_api.g_miss_char THEN
3315          fnd_flex_descval.set_column_value ('ATTRIBUTE22', '');
3316          l_resource_txn_rec.attribute22 := '';
3317       ELSE
3318          fnd_flex_descval.set_column_value ('ATTRIBUTE22'
3319                                            ,p_resource_txn_rec.attribute22);
3320          l_resource_txn_rec.attribute22 := p_resource_txn_rec.attribute22;
3321       END IF;
3322 
3323       IF p_resource_txn_rec.attribute23 IS NULL THEN
3324          fnd_flex_descval.set_column_value ('ATTRIBUTE23'
3325                                            ,l_resource_txn_rec.attribute23);
3326       ELSIF p_resource_txn_rec.attribute23 = fnd_api.g_miss_char THEN
3327          fnd_flex_descval.set_column_value ('ATTRIBUTE23', '');
3328          l_resource_txn_rec.attribute23 := '';
3329       ELSE
3330          fnd_flex_descval.set_column_value ('ATTRIBUTE23'
3331                                            ,p_resource_txn_rec.attribute23);
3332          l_resource_txn_rec.attribute23 := p_resource_txn_rec.attribute23;
3333       END IF;
3334 
3335       IF p_resource_txn_rec.attribute24 IS NULL THEN
3336          fnd_flex_descval.set_column_value ('ATTRIBUTE24'
3337                                            ,l_resource_txn_rec.attribute1);
3338       ELSIF p_resource_txn_rec.attribute24 = fnd_api.g_miss_char THEN
3339          fnd_flex_descval.set_column_value ('ATTRIBUTE24', '');
3340          l_resource_txn_rec.attribute1 := '';
3341       ELSE
3342          fnd_flex_descval.set_column_value ('ATTRIBUTE24'
3343                                            ,p_resource_txn_rec.attribute24);
3344          l_resource_txn_rec.attribute24 := p_resource_txn_rec.attribute24;
3345       END IF;
3346 
3347       IF p_resource_txn_rec.attribute25 IS NULL THEN
3348          fnd_flex_descval.set_column_value ('ATTRIBUTE25'
3349                                            ,l_resource_txn_rec.attribute25);
3350       ELSIF p_resource_txn_rec.attribute25 = fnd_api.g_miss_char THEN
3351          fnd_flex_descval.set_column_value ('ATTRIBUTE25', '');
3352          l_resource_txn_rec.attribute25 := '';
3353       ELSE
3354          fnd_flex_descval.set_column_value ('ATTRIBUTE25'
3355                                            ,p_resource_txn_rec.attribute25);
3356          l_resource_txn_rec.attribute25 := p_resource_txn_rec.attribute25;
3357       END IF;
3358 
3359       IF p_resource_txn_rec.attribute26 IS NULL THEN
3360          fnd_flex_descval.set_column_value ('ATTRIBUTE26'
3361                                            ,l_resource_txn_rec.attribute26);
3362       ELSIF p_resource_txn_rec.attribute26 = fnd_api.g_miss_char THEN
3363          fnd_flex_descval.set_column_value ('ATTRIBUTE26', '');
3364          l_resource_txn_rec.attribute26 := '';
3365       ELSE
3366          fnd_flex_descval.set_column_value ('ATTRIBUTE26'
3367                                            ,p_resource_txn_rec.attribute26);
3368          l_resource_txn_rec.attribute26 := p_resource_txn_rec.attribute26;
3369       END IF;
3370 
3371       IF p_resource_txn_rec.attribute27 IS NULL THEN
3372          fnd_flex_descval.set_column_value ('ATTRIBUTE27'
3373                                            ,l_resource_txn_rec.attribute27);
3374       ELSIF p_resource_txn_rec.attribute27 = fnd_api.g_miss_char THEN
3375          fnd_flex_descval.set_column_value ('ATTRIBUTE27', '');
3376          l_resource_txn_rec.attribute27 := '';
3377       ELSE
3378          fnd_flex_descval.set_column_value ('ATTRIBUTE27'
3379                                            ,p_resource_txn_rec.attribute27);
3380          l_resource_txn_rec.attribute27 := p_resource_txn_rec.attribute27;
3381       END IF;
3382 
3383       IF p_resource_txn_rec.attribute28 IS NULL THEN
3384          fnd_flex_descval.set_column_value ('ATTRIBUTE28'
3385                                            ,l_resource_txn_rec.attribute28);
3386       ELSIF p_resource_txn_rec.attribute28 = fnd_api.g_miss_char THEN
3387          fnd_flex_descval.set_column_value ('ATTRIBUTE28', '');
3388          l_resource_txn_rec.attribute28 := '';
3389       ELSE
3390          fnd_flex_descval.set_column_value ('ATTRIBUTE28'
3391                                            ,p_resource_txn_rec.attribute28);
3392          l_resource_txn_rec.attribute28 := p_resource_txn_rec.attribute28;
3393       END IF;
3394 
3395       IF p_resource_txn_rec.attribute29 IS NULL THEN
3396          fnd_flex_descval.set_column_value ('ATTRIBUTE29'
3397                                            ,l_resource_txn_rec.attribute29);
3398       ELSIF p_resource_txn_rec.attribute29 = fnd_api.g_miss_char THEN
3399          fnd_flex_descval.set_column_value ('ATTRIBUTE29', '');
3400          l_resource_txn_rec.attribute29 := '';
3401       ELSE
3402          fnd_flex_descval.set_column_value ('ATTRIBUTE29'
3403                                            ,p_resource_txn_rec.attribute29);
3404          l_resource_txn_rec.attribute29 := p_resource_txn_rec.attribute29;
3405       END IF;
3406 
3407       IF p_resource_txn_rec.attribute30 IS NULL THEN
3408          fnd_flex_descval.set_column_value ('ATTRIBUTE30'
3409                                            ,l_resource_txn_rec.attribute30);
3410       ELSIF p_resource_txn_rec.attribute30 = fnd_api.g_miss_char THEN
3411          fnd_flex_descval.set_column_value ('ATTRIBUTE30', '');
3412          l_resource_txn_rec.attribute30 := '';
3413       ELSE
3414          fnd_flex_descval.set_column_value ('ATTRIBUTE30'
3415                                            ,p_resource_txn_rec.attribute30);
3416          l_resource_txn_rec.attribute30 := p_resource_txn_rec.attribute30;
3417       END IF;
3418 
3419       --FPBug#4395561 modified following if condition to consider global flex field validate flag
3420       IF gme_common_pvt.g_flex_validate_prof = 0 THEN
3421          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3422             gme_debug.put_line
3423                      ('GME Flexfield is not enabled, No validation required.');
3424          END IF;
3425 
3426          x_resource_txn_rec.attribute_category :=
3427                                          l_resource_txn_rec.attribute_category;
3428          x_resource_txn_rec.attribute1 := l_resource_txn_rec.attribute1;
3429          x_resource_txn_rec.attribute2 := l_resource_txn_rec.attribute2;
3430          x_resource_txn_rec.attribute3 := l_resource_txn_rec.attribute3;
3431          x_resource_txn_rec.attribute4 := l_resource_txn_rec.attribute4;
3432          x_resource_txn_rec.attribute5 := l_resource_txn_rec.attribute5;
3433          x_resource_txn_rec.attribute6 := l_resource_txn_rec.attribute6;
3434          x_resource_txn_rec.attribute7 := l_resource_txn_rec.attribute7;
3435          x_resource_txn_rec.attribute8 := l_resource_txn_rec.attribute8;
3436          x_resource_txn_rec.attribute9 := l_resource_txn_rec.attribute9;
3437          x_resource_txn_rec.attribute10 := l_resource_txn_rec.attribute10;
3438          x_resource_txn_rec.attribute11 := l_resource_txn_rec.attribute11;
3439          x_resource_txn_rec.attribute12 := l_resource_txn_rec.attribute12;
3440          x_resource_txn_rec.attribute13 := l_resource_txn_rec.attribute13;
3441          x_resource_txn_rec.attribute14 := l_resource_txn_rec.attribute14;
3442          x_resource_txn_rec.attribute15 := l_resource_txn_rec.attribute15;
3443          x_resource_txn_rec.attribute16 := l_resource_txn_rec.attribute16;
3444          x_resource_txn_rec.attribute17 := l_resource_txn_rec.attribute17;
3445          x_resource_txn_rec.attribute18 := l_resource_txn_rec.attribute18;
3446          x_resource_txn_rec.attribute19 := l_resource_txn_rec.attribute19;
3447          x_resource_txn_rec.attribute20 := l_resource_txn_rec.attribute20;
3448          x_resource_txn_rec.attribute21 := l_resource_txn_rec.attribute21;
3449          x_resource_txn_rec.attribute22 := l_resource_txn_rec.attribute22;
3450          x_resource_txn_rec.attribute23 := l_resource_txn_rec.attribute23;
3451          x_resource_txn_rec.attribute24 := l_resource_txn_rec.attribute24;
3452          x_resource_txn_rec.attribute25 := l_resource_txn_rec.attribute25;
3453          x_resource_txn_rec.attribute26 := l_resource_txn_rec.attribute26;
3454          x_resource_txn_rec.attribute27 := l_resource_txn_rec.attribute27;
3455          x_resource_txn_rec.attribute28 := l_resource_txn_rec.attribute28;
3456          x_resource_txn_rec.attribute29 := l_resource_txn_rec.attribute29;
3457          x_resource_txn_rec.attribute30 := l_resource_txn_rec.attribute30;
3458          RETURN;
3459       END IF;
3460 
3461       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3462          gme_debug.put_line ('Calling FND_FLEX_DESCVAL.validate_desccols ');
3463       END IF;
3464 
3465       IF fnd_flex_descval.validate_desccols
3466                                           (appl_short_name      => appl_short_name
3467                                           ,desc_flex_name       => desc_flex_name
3468                                           ,values_or_ids        => values_or_ids
3469                                           ,validation_date      => validation_date) THEN
3470          --SUCCESS
3471          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3472             gme_debug.put_line ('Validation Success ');
3473          END IF;
3474 
3475          x_return_status := fnd_api.g_ret_sts_success;
3476          n := fnd_flex_descval.segment_count;
3477 
3478          /*Now let us copy back the storage value  */
3479          FOR i IN 1 .. n LOOP
3480             IF fnd_flex_descval.segment_column_name (i) =
3481                                                          'ATTRIBUTE_CATEGORY' THEN
3482                x_resource_txn_rec.attribute_category :=
3483                                               fnd_flex_descval.segment_id (i);
3484             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE1' THEN
3485                x_resource_txn_rec.attribute1 :=
3486                                               fnd_flex_descval.segment_id (i);
3487             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE2' THEN
3488                x_resource_txn_rec.attribute2 :=
3489                                               fnd_flex_descval.segment_id (i);
3490             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE3' THEN
3491                x_resource_txn_rec.attribute3 :=
3492                                               fnd_flex_descval.segment_id (i);
3493             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE4' THEN
3494                x_resource_txn_rec.attribute4 :=
3495                                               fnd_flex_descval.segment_id (i);
3496             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE5' THEN
3497                x_resource_txn_rec.attribute5 :=
3498                                               fnd_flex_descval.segment_id (i);
3499             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE6' THEN
3500                x_resource_txn_rec.attribute6 :=
3501                                               fnd_flex_descval.segment_id (i);
3502             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE7' THEN
3503                x_resource_txn_rec.attribute7 :=
3504                                               fnd_flex_descval.segment_id (i);
3505             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE8' THEN
3506                x_resource_txn_rec.attribute8 :=
3507                                               fnd_flex_descval.segment_id (i);
3508             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE9' THEN
3509                x_resource_txn_rec.attribute9 :=
3510                                               fnd_flex_descval.segment_id (i);
3511             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE10' THEN
3512                x_resource_txn_rec.attribute10 :=
3513                                               fnd_flex_descval.segment_id (i);
3514             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE11' THEN
3515                x_resource_txn_rec.attribute11 :=
3516                                               fnd_flex_descval.segment_id (i);
3517             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE12' THEN
3518                x_resource_txn_rec.attribute12 :=
3519                                               fnd_flex_descval.segment_id (i);
3520             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE13' THEN
3521                x_resource_txn_rec.attribute13 :=
3522                                               fnd_flex_descval.segment_id (i);
3523             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE14' THEN
3524                x_resource_txn_rec.attribute14 :=
3525                                               fnd_flex_descval.segment_id (i);
3526             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE15' THEN
3527                x_resource_txn_rec.attribute15 :=
3528                                               fnd_flex_descval.segment_id (i);
3529             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE16' THEN
3530                x_resource_txn_rec.attribute16 :=
3531                                               fnd_flex_descval.segment_id (i);
3532             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE17' THEN
3533                x_resource_txn_rec.attribute17 :=
3534                                               fnd_flex_descval.segment_id (i);
3535             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE18' THEN
3536                x_resource_txn_rec.attribute18 :=
3537                                               fnd_flex_descval.segment_id (i);
3538             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE19' THEN
3539                x_resource_txn_rec.attribute19 :=
3540                                               fnd_flex_descval.segment_id (i);
3541             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE20' THEN
3542                x_resource_txn_rec.attribute20 :=
3543                                               fnd_flex_descval.segment_id (i);
3544             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE21' THEN
3545                x_resource_txn_rec.attribute21 :=
3546                                               fnd_flex_descval.segment_id (i);
3547             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE22' THEN
3548                x_resource_txn_rec.attribute22 :=
3549                                               fnd_flex_descval.segment_id (i);
3550             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE23' THEN
3551                x_resource_txn_rec.attribute23 :=
3552                                               fnd_flex_descval.segment_id (i);
3553             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE24' THEN
3554                x_resource_txn_rec.attribute24 :=
3555                                               fnd_flex_descval.segment_id (i);
3556             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE25' THEN
3557                x_resource_txn_rec.attribute25 :=
3558                                               fnd_flex_descval.segment_id (i);
3559             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE26' THEN
3560                x_resource_txn_rec.attribute26 :=
3561                                               fnd_flex_descval.segment_id (i);
3562             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE27' THEN
3563                x_resource_txn_rec.attribute27 :=
3564                                               fnd_flex_descval.segment_id (i);
3565             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE28' THEN
3566                x_resource_txn_rec.attribute28 :=
3567                                               fnd_flex_descval.segment_id (i);
3568             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE29' THEN
3569                x_resource_txn_rec.attribute29 :=
3570                                               fnd_flex_descval.segment_id (i);
3571             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE30' THEN
3572                x_resource_txn_rec.attribute30 :=
3573                                               fnd_flex_descval.segment_id (i);
3574             END IF;
3575          END LOOP;
3576       ELSE
3577          error_msg := fnd_flex_descval.error_message;
3578 
3579          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3580             gme_debug.put_line ('Validation Ends With Error(s) :');
3581             gme_debug.put_line ('Error :' || error_msg);
3582          END IF;
3583 
3584          gme_common_pvt.log_message ('FLEX-USER DEFINED ERROR'
3585                                     ,'MSG'
3586                                     ,error_msg);
3587          RAISE validation_error;
3588       END IF;
3589 
3590       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3591          gme_debug.put_line (   'Validation completed for the Flex field : '
3592                              || desc_flex_name);
3593       END IF;
3594    EXCEPTION
3595       WHEN validation_error THEN
3596          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3597             gme_debug.put_line
3598                  (   'Validation completed with errors for the Flex field : '
3599                   || desc_flex_name);
3600          END IF;
3601 
3602          x_return_status := fnd_api.g_ret_sts_error;
3603       WHEN step_fetch_error THEN
3604          x_return_status := fnd_api.g_ret_sts_error;
3605       WHEN OTHERS THEN
3606          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3607             gme_debug.put_line (   g_pkg_name
3608                                 || '.'
3609                                 || desc_flex_name
3610                                 || ': '
3611                                 || 'in unexpected error');
3612          END IF;
3613 
3614          x_return_status := fnd_api.g_ret_sts_unexp_error;
3615          fnd_msg_pub.add_exc_msg (g_pkg_name, desc_flex_name);
3616    END validate_rsrc_txn_flex;
3617 
3618    /*end*/
3619 
3620    /*======================================================================
3621    -- NAME
3622    -- validate_flex_material_detials
3623    --
3624    -- DESCRIPTION
3625    --    This procedure will validate the BATCH_DTL_FLEX, descriptive flex field
3626    --    for batch material details using serverside flex field validation package FND_FLEX_DESCVAL.
3627    --
3628    -- SYNOPSIS:
3629 
3630          validate_flex_material_detials (
3631                         p_material_detail   => a_material_detail
3632                        ,x_material_detail   => b_material_detail
3633                        ,x_return_status     => l_return_status);
3634    --HISTORY
3635    --SivakumarG 07-MAR-2006 Bug#5078853
3636    -- rewritten the following procedure
3637    ======================================================================= */
3638 
3639    PROCEDURE validate_flex_material_details (
3640       p_material_detail_rec   IN              gme_material_details%ROWTYPE
3641      ,x_material_detail_rec   IN OUT NOCOPY   gme_material_details%ROWTYPE
3642      ,x_return_status         OUT NOCOPY      VARCHAR2)
3643    IS
3644       l_attribute_category    VARCHAR2 (240);
3645       appl_short_name         VARCHAR2 (30)                  := 'GME';
3646       desc_flex_name          VARCHAR2 (30)                  := 'BATCH_DTL_FLEX';
3647       values_or_ids           VARCHAR2 (10)                  := 'I';
3648       validation_date         DATE                           := SYSDATE;
3649       error_msg               VARCHAR2 (5000);
3650       l_field_value           VARCHAR2 (240);
3651       l_field_name            VARCHAR2 (100);
3652       n                       NUMBER;
3653       l_material_detail_rec   gme_material_details%ROWTYPE;
3654 
3655       validation_error        EXCEPTION;
3656       material_fetch_err      EXCEPTION;
3657    BEGIN
3658       /* Set return status to success initially */
3659       x_return_status := fnd_api.g_ret_sts_success;
3660 
3661       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3662          gme_debug.put_line (   'Check if flexfield is enabled : '
3663                              || desc_flex_name);
3664       END IF;
3665 
3666       OPEN cur_get_appl_id;
3667 
3668       FETCH cur_get_appl_id
3669        INTO pkg_application_id;
3670 
3671       CLOSE cur_get_appl_id;
3672 
3673       IF NOT fnd_flex_apis.is_descr_setup (pkg_application_id, desc_flex_name) THEN
3674          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3675             gme_debug.put_line
3676                          ('Flexfield is not enabled, No validation required.');
3677          END IF;
3678 
3679          RETURN;
3680       END IF;
3681 
3682       IF p_material_detail_rec.material_detail_id IS NOT NULL THEN
3683         IF NOT gme_material_details_dbl.fetch_row(p_material_detail_rec, l_material_detail_rec) THEN
3684          RAISE material_fetch_err;
3685         END IF;
3686       ELSE
3687         l_material_detail_rec := p_material_detail_rec;
3688       END IF;
3689 
3690       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3691          gme_debug.put_line (   'Validation of the Flex field : '
3692                              || desc_flex_name);
3693          gme_debug.put_line
3694             ('Assignment of the attribute Category And Attribute Values to Local Variables');
3695       END IF;
3696 
3697       IF p_material_detail_rec.attribute_category IS NULL THEN
3698          l_attribute_category :=
3699                            NVL (l_material_detail_rec.attribute_category, '');
3700       ELSIF p_material_detail_rec.attribute_category = fnd_api.g_miss_char THEN
3701          l_attribute_category := '';
3702       ELSE
3703          l_attribute_category := p_material_detail_rec.attribute_category;
3704       END IF;
3705 
3706       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3707          gme_debug.put_line
3708             ('setting set column values for the context value,for Global Data Elements and for context code.');
3709       END IF;
3710 
3711       fnd_flex_descval.set_context_value (l_attribute_category);
3712       l_material_detail_rec.attribute_category := l_attribute_category;
3713 
3714       IF p_material_detail_rec.attribute1 IS NULL THEN
3715          fnd_flex_descval.set_column_value
3716                                      ('ATTRIBUTE1'
3717                                      ,NVL (l_material_detail_rec.attribute1
3718                                           ,'') );
3719       ELSIF p_material_detail_rec.attribute1 = fnd_api.g_miss_char THEN
3720          fnd_flex_descval.set_column_value ('ATTRIBUTE1', '');
3721          l_material_detail_rec.attribute1 := '';
3722       ELSE
3723          fnd_flex_descval.set_column_value ('ATTRIBUTE1'
3724                                            ,p_material_detail_rec.attribute1);
3725          l_material_detail_rec.attribute1 := p_material_detail_rec.attribute1;
3726       END IF;
3727 
3728       IF p_material_detail_rec.attribute2 IS NULL THEN
3729          fnd_flex_descval.set_column_value
3730                                      ('ATTRIBUTE2'
3731                                      ,NVL (l_material_detail_rec.attribute2
3732                                           ,'') );
3733       ELSIF p_material_detail_rec.attribute2 = fnd_api.g_miss_char THEN
3734          fnd_flex_descval.set_column_value ('ATTRIBUTE2', '');
3735          l_material_detail_rec.attribute2 := '';
3736       ELSE
3737          fnd_flex_descval.set_column_value ('ATTRIBUTE2'
3738                                            ,p_material_detail_rec.attribute2);
3739          l_material_detail_rec.attribute2 := p_material_detail_rec.attribute2;
3740       END IF;
3741 
3742       IF p_material_detail_rec.attribute3 IS NULL THEN
3743          fnd_flex_descval.set_column_value
3744                                      ('ATTRIBUTE3'
3745                                      ,NVL (l_material_detail_rec.attribute3
3746                                           ,'') );
3747       ELSIF p_material_detail_rec.attribute3 = fnd_api.g_miss_char THEN
3748          fnd_flex_descval.set_column_value ('ATTRIBUTE3', '');
3749          l_material_detail_rec.attribute3 := '';
3750       ELSE
3751          fnd_flex_descval.set_column_value ('ATTRIBUTE3'
3752                                            ,p_material_detail_rec.attribute3);
3753          l_material_detail_rec.attribute3 := p_material_detail_rec.attribute3;
3754       END IF;
3755 
3756        IF p_material_detail_rec.attribute4 IS NULL THEN
3757          fnd_flex_descval.set_column_value
3758                                      ('ATTRIBUTE4'
3759                                      ,NVL (l_material_detail_rec.attribute4
3760                                           ,'') );
3761       ELSIF p_material_detail_rec.attribute4 = fnd_api.g_miss_char THEN
3762          fnd_flex_descval.set_column_value ('ATTRIBUTE3', '');
3763          l_material_detail_rec.attribute4 := '';
3764       ELSE
3765          fnd_flex_descval.set_column_value ('ATTRIBUTE4'
3766                                            ,p_material_detail_rec.attribute4);
3767          l_material_detail_rec.attribute4 := p_material_detail_rec.attribute4;
3768       END IF;
3769 
3770        IF p_material_detail_rec.attribute5 IS NULL THEN
3771          fnd_flex_descval.set_column_value
3772                                      ('ATTRIBUTE5'
3773                                      ,NVL (l_material_detail_rec.attribute5
3774                                           ,'') );
3775       ELSIF p_material_detail_rec.attribute5 = fnd_api.g_miss_char THEN
3776          fnd_flex_descval.set_column_value ('ATTRIBUTE5', '');
3777          l_material_detail_rec.attribute5 := '';
3778       ELSE
3779          fnd_flex_descval.set_column_value ('ATTRIBUTE5'
3780                                            ,p_material_detail_rec.attribute5);
3781          l_material_detail_rec.attribute5 := p_material_detail_rec.attribute5;
3782       END IF;
3783 
3784       IF p_material_detail_rec.attribute6 IS NULL THEN
3785          fnd_flex_descval.set_column_value
3786                                      ('ATTRIBUTE6'
3787                                      ,NVL (l_material_detail_rec.attribute6
3788                                           ,'') );
3789       ELSIF p_material_detail_rec.attribute6 = fnd_api.g_miss_char THEN
3790          fnd_flex_descval.set_column_value ('ATTRIBUTE6', '');
3791          l_material_detail_rec.attribute6 := '';
3792       ELSE
3793          fnd_flex_descval.set_column_value ('ATTRIBUTE6'
3794                                            ,p_material_detail_rec.attribute6);
3795          l_material_detail_rec.attribute6 := p_material_detail_rec.attribute6;
3796       END IF;
3797 
3798       IF p_material_detail_rec.attribute7 IS NULL THEN
3799          fnd_flex_descval.set_column_value
3800                                      ('ATTRIBUTE7'
3801                                      ,NVL (l_material_detail_rec.attribute7
3802                                           ,'') );
3803       ELSIF p_material_detail_rec.attribute7 = fnd_api.g_miss_char THEN
3804          fnd_flex_descval.set_column_value ('ATTRIBUTE7', '');
3805          l_material_detail_rec.attribute7 := '';
3806       ELSE
3807          fnd_flex_descval.set_column_value ('ATTRIBUTE7'
3808                                            ,p_material_detail_rec.attribute7);
3809          l_material_detail_rec.attribute7 := p_material_detail_rec.attribute7;
3810       END IF;
3811 
3812       IF p_material_detail_rec.attribute8 IS NULL THEN
3813          fnd_flex_descval.set_column_value
3814                                      ('ATTRIBUTE8'
3815                                      ,NVL (l_material_detail_rec.attribute8
3816                                           ,'') );
3817       ELSIF p_material_detail_rec.attribute8 = fnd_api.g_miss_char THEN
3818          fnd_flex_descval.set_column_value ('ATTRIBUTE8', '');
3819          l_material_detail_rec.attribute8 := '';
3820       ELSE
3821          fnd_flex_descval.set_column_value ('ATTRIBUTE8'
3822                                            ,p_material_detail_rec.attribute8);
3823          l_material_detail_rec.attribute8 := p_material_detail_rec.attribute8;
3824       END IF;
3825 
3826       IF p_material_detail_rec.attribute9 IS NULL THEN
3827          fnd_flex_descval.set_column_value
3828                                      ('ATTRIBUTE9'
3829                                      ,NVL (l_material_detail_rec.attribute9
3830                                           ,'') );
3831       ELSIF p_material_detail_rec.attribute9 = fnd_api.g_miss_char THEN
3832          fnd_flex_descval.set_column_value ('ATTRIBUTE9', '');
3833          l_material_detail_rec.attribute9 := '';
3834       ELSE
3835          fnd_flex_descval.set_column_value ('ATTRIBUTE9'
3836                                            ,p_material_detail_rec.attribute9);
3837          l_material_detail_rec.attribute9 := p_material_detail_rec.attribute9;
3838       END IF;
3839 
3840       IF p_material_detail_rec.attribute10 IS NULL THEN
3841          fnd_flex_descval.set_column_value
3842                                      ('ATTRIBUTE10'
3843                                      ,NVL (l_material_detail_rec.attribute10
3844                                           ,'') );
3845       ELSIF p_material_detail_rec.attribute10 = fnd_api.g_miss_char THEN
3846          fnd_flex_descval.set_column_value ('ATTRIBUTE10', '');
3847          l_material_detail_rec.attribute10 := '';
3848       ELSE
3849          fnd_flex_descval.set_column_value ('ATTRIBUTE10'
3850                                            ,p_material_detail_rec.attribute10);
3851          l_material_detail_rec.attribute10 := p_material_detail_rec.attribute10;
3852       END IF;
3853 
3854       IF p_material_detail_rec.attribute11 IS NULL THEN
3855          fnd_flex_descval.set_column_value
3856                                      ('ATTRIBUTE11'
3857                                      ,NVL (l_material_detail_rec.attribute11
3858                                           ,'') );
3859       ELSIF p_material_detail_rec.attribute11 = fnd_api.g_miss_char THEN
3860          fnd_flex_descval.set_column_value ('ATTRIBUTE11', '');
3861          l_material_detail_rec.attribute11 := '';
3862       ELSE
3863          fnd_flex_descval.set_column_value ('ATTRIBUTE11'
3864                                            ,p_material_detail_rec.attribute11);
3865          l_material_detail_rec.attribute11 := p_material_detail_rec.attribute11;
3866       END IF;
3867 
3868       IF p_material_detail_rec.attribute12 IS NULL THEN
3869          fnd_flex_descval.set_column_value
3870                                      ('ATTRIBUTE12'
3871                                      ,NVL (l_material_detail_rec.attribute12
3872                                           ,'') );
3873       ELSIF p_material_detail_rec.attribute12 = fnd_api.g_miss_char THEN
3874          fnd_flex_descval.set_column_value ('ATTRIBUTE12', '');
3875          l_material_detail_rec.attribute12 := '';
3876       ELSE
3877          fnd_flex_descval.set_column_value ('ATTRIBUTE12'
3878                                            ,p_material_detail_rec.attribute12);
3879          l_material_detail_rec.attribute12 := p_material_detail_rec.attribute12;
3880       END IF;
3881 
3882       IF p_material_detail_rec.attribute13 IS NULL THEN
3883          fnd_flex_descval.set_column_value
3884                                      ('ATTRIBUTE13'
3885                                      ,NVL (l_material_detail_rec.attribute13
3886                                           ,'') );
3887       ELSIF p_material_detail_rec.attribute13 = fnd_api.g_miss_char THEN
3888          fnd_flex_descval.set_column_value ('ATTRIBUTE13', '');
3889          l_material_detail_rec.attribute13 := '';
3890       ELSE
3891          fnd_flex_descval.set_column_value ('ATTRIBUTE13'
3892                                            ,p_material_detail_rec.attribute13);
3893          l_material_detail_rec.attribute13 := p_material_detail_rec.attribute13;
3894       END IF;
3895 
3896       IF p_material_detail_rec.attribute14 IS NULL THEN
3897          fnd_flex_descval.set_column_value
3898                                      ('ATTRIBUTE14'
3899                                      ,NVL (l_material_detail_rec.attribute14
3900                                           ,'') );
3901       ELSIF p_material_detail_rec.attribute14 = fnd_api.g_miss_char THEN
3902          fnd_flex_descval.set_column_value ('ATTRIBUTE14', '');
3903          l_material_detail_rec.attribute14 := '';
3904       ELSE
3905          fnd_flex_descval.set_column_value ('ATTRIBUTE14'
3906                                            ,p_material_detail_rec.attribute14);
3907          l_material_detail_rec.attribute14 := p_material_detail_rec.attribute14;
3908       END IF;
3909 
3910       IF p_material_detail_rec.attribute15 IS NULL THEN
3911          fnd_flex_descval.set_column_value
3912                                      ('ATTRIBUTE15'
3913                                      ,NVL (l_material_detail_rec.attribute15
3914                                           ,'') );
3915       ELSIF p_material_detail_rec.attribute15 = fnd_api.g_miss_char THEN
3916          fnd_flex_descval.set_column_value ('ATTRIBUTE15', '');
3917          l_material_detail_rec.attribute15 := '';
3918       ELSE
3919          fnd_flex_descval.set_column_value ('ATTRIBUTE15'
3920                                            ,p_material_detail_rec.attribute15);
3921          l_material_detail_rec.attribute15 := p_material_detail_rec.attribute15;
3922       END IF;
3923 
3924       IF p_material_detail_rec.attribute16 IS NULL THEN
3925          fnd_flex_descval.set_column_value
3926                                      ('ATTRIBUTE16'
3927                                      ,NVL (l_material_detail_rec.attribute16
3928                                           ,'') );
3929       ELSIF p_material_detail_rec.attribute16 = fnd_api.g_miss_char THEN
3930          fnd_flex_descval.set_column_value ('ATTRIBUTE16', '');
3931          l_material_detail_rec.attribute16 := '';
3932       ELSE
3933          fnd_flex_descval.set_column_value ('ATTRIBUTE16'
3934                                            ,p_material_detail_rec.attribute16);
3935          l_material_detail_rec.attribute16 := p_material_detail_rec.attribute16;
3936       END IF;
3937 
3938       IF p_material_detail_rec.attribute17 IS NULL THEN
3939          fnd_flex_descval.set_column_value
3940                                      ('ATTRIBUTE17'
3941                                      ,NVL (l_material_detail_rec.attribute17
3942                                           ,'') );
3943       ELSIF p_material_detail_rec.attribute17 = fnd_api.g_miss_char THEN
3944          fnd_flex_descval.set_column_value ('ATTRIBUTE17', '');
3945          l_material_detail_rec.attribute17 := '';
3946       ELSE
3947          fnd_flex_descval.set_column_value ('ATTRIBUTE17'
3948                                            ,p_material_detail_rec.attribute17);
3949          l_material_detail_rec.attribute17 := p_material_detail_rec.attribute17;
3950       END IF;
3951 
3952       IF p_material_detail_rec.attribute18 IS NULL THEN
3953          fnd_flex_descval.set_column_value
3954                                      ('ATTRIBUTE18'
3955                                      ,NVL (l_material_detail_rec.attribute18
3956                                           ,'') );
3957       ELSIF p_material_detail_rec.attribute18 = fnd_api.g_miss_char THEN
3958          fnd_flex_descval.set_column_value ('ATTRIBUTE18', '');
3959          l_material_detail_rec.attribute18 := '';
3960       ELSE
3961          fnd_flex_descval.set_column_value ('ATTRIBUTE18'
3962                                            ,p_material_detail_rec.attribute18);
3963          l_material_detail_rec.attribute18 := p_material_detail_rec.attribute18;
3964       END IF;
3965 
3966       IF p_material_detail_rec.attribute19 IS NULL THEN
3967          fnd_flex_descval.set_column_value
3968                                      ('ATTRIBUTE19'
3969                                      ,NVL (l_material_detail_rec.attribute19
3970                                           ,'') );
3971       ELSIF p_material_detail_rec.attribute19 = fnd_api.g_miss_char THEN
3972          fnd_flex_descval.set_column_value ('ATTRIBUTE19', '');
3973          l_material_detail_rec.attribute19 := '';
3974       ELSE
3975          fnd_flex_descval.set_column_value ('ATTRIBUTE19'
3976                                            ,p_material_detail_rec.attribute19);
3977          l_material_detail_rec.attribute19 := p_material_detail_rec.attribute19;
3978       END IF;
3979 
3980       IF p_material_detail_rec.attribute20 IS NULL THEN
3981          fnd_flex_descval.set_column_value
3982                                      ('ATTRIBUTE20'
3983                                      ,NVL (l_material_detail_rec.attribute20
3984                                           ,'') );
3985       ELSIF p_material_detail_rec.attribute20 = fnd_api.g_miss_char THEN
3986          fnd_flex_descval.set_column_value ('ATTRIBUTE20', '');
3987          l_material_detail_rec.attribute20 := '';
3988       ELSE
3989          fnd_flex_descval.set_column_value ('ATTRIBUTE20'
3990                                            ,p_material_detail_rec.attribute20);
3991          l_material_detail_rec.attribute20 := p_material_detail_rec.attribute20;
3992       END IF;
3993 
3994       IF p_material_detail_rec.attribute21 IS NULL THEN
3995          fnd_flex_descval.set_column_value
3996                                      ('ATTRIBUTE21'
3997                                      ,NVL (l_material_detail_rec.attribute21
3998                                           ,'') );
3999       ELSIF p_material_detail_rec.attribute21 = fnd_api.g_miss_char THEN
4000          fnd_flex_descval.set_column_value ('ATTRIBUTE21', '');
4001          l_material_detail_rec.attribute21 := '';
4002       ELSE
4003          fnd_flex_descval.set_column_value ('ATTRIBUTE21'
4004                                            ,p_material_detail_rec.attribute21);
4005          l_material_detail_rec.attribute21 := p_material_detail_rec.attribute21;
4006       END IF;
4007 
4008       IF p_material_detail_rec.attribute22 IS NULL THEN
4009          fnd_flex_descval.set_column_value
4010                                      ('ATTRIBUTE22'
4011                                      ,NVL (l_material_detail_rec.attribute22
4012                                           ,'') );
4013       ELSIF p_material_detail_rec.attribute22 = fnd_api.g_miss_char THEN
4014          fnd_flex_descval.set_column_value ('ATTRIBUTE22', '');
4015          l_material_detail_rec.attribute22 := '';
4016       ELSE
4017          fnd_flex_descval.set_column_value ('ATTRIBUTE22'
4018                                            ,p_material_detail_rec.attribute22);
4019          l_material_detail_rec.attribute22 := p_material_detail_rec.attribute22;
4020       END IF;
4021 
4022       IF p_material_detail_rec.attribute23 IS NULL THEN
4023          fnd_flex_descval.set_column_value
4024                                      ('ATTRIBUTE23'
4025                                      ,NVL (l_material_detail_rec.attribute23
4026                                           ,'') );
4027       ELSIF p_material_detail_rec.attribute23 = fnd_api.g_miss_char THEN
4028          fnd_flex_descval.set_column_value ('ATTRIBUTE23', '');
4029          l_material_detail_rec.attribute23 := '';
4030       ELSE
4031          fnd_flex_descval.set_column_value ('ATTRIBUTE23'
4032                                            ,p_material_detail_rec.attribute23);
4033          l_material_detail_rec.attribute23 := p_material_detail_rec.attribute23;
4034       END IF;
4035 
4036       IF p_material_detail_rec.attribute24 IS NULL THEN
4037          fnd_flex_descval.set_column_value
4038                                      ('ATTRIBUTE24'
4039                                      ,NVL (l_material_detail_rec.attribute24
4040                                           ,'') );
4041       ELSIF p_material_detail_rec.attribute24 = fnd_api.g_miss_char THEN
4042          fnd_flex_descval.set_column_value ('ATTRIBUTE24', '');
4043          l_material_detail_rec.attribute24 := '';
4044       ELSE
4045          fnd_flex_descval.set_column_value ('ATTRIBUTE24'
4046                                            ,p_material_detail_rec.attribute24);
4047          l_material_detail_rec.attribute24 := p_material_detail_rec.attribute24;
4048       END IF;
4049 
4050       IF p_material_detail_rec.attribute25 IS NULL THEN
4051          fnd_flex_descval.set_column_value
4052                                      ('ATTRIBUTE25'
4053                                      ,NVL (l_material_detail_rec.attribute25
4054                                           ,'') );
4055       ELSIF p_material_detail_rec.attribute25 = fnd_api.g_miss_char THEN
4056          fnd_flex_descval.set_column_value ('ATTRIBUTE25', '');
4057          l_material_detail_rec.attribute25 := '';
4058       ELSE
4059          fnd_flex_descval.set_column_value ('ATTRIBUTE25'
4060                                            ,p_material_detail_rec.attribute25);
4061          l_material_detail_rec.attribute25 := p_material_detail_rec.attribute25;
4062       END IF;
4063 
4064       IF p_material_detail_rec.attribute26 IS NULL THEN
4065          fnd_flex_descval.set_column_value
4066                                      ('ATTRIBUTE26'
4067                                      ,NVL (l_material_detail_rec.attribute26
4068                                           ,'') );
4069       ELSIF p_material_detail_rec.attribute26 = fnd_api.g_miss_char THEN
4070          fnd_flex_descval.set_column_value ('ATTRIBUTE26', '');
4071          l_material_detail_rec.attribute26 := '';
4072       ELSE
4073          fnd_flex_descval.set_column_value ('ATTRIBUTE26'
4074                                            ,p_material_detail_rec.attribute26);
4075          l_material_detail_rec.attribute26 := p_material_detail_rec.attribute26;
4076       END IF;
4077 
4078       IF p_material_detail_rec.attribute27 IS NULL THEN
4079          fnd_flex_descval.set_column_value
4080                                      ('ATTRIBUTE27'
4081                                      ,NVL (l_material_detail_rec.attribute27
4082                                           ,'') );
4083       ELSIF p_material_detail_rec.attribute27 = fnd_api.g_miss_char THEN
4084          fnd_flex_descval.set_column_value ('ATTRIBUTE27', '');
4085          l_material_detail_rec.attribute27 := '';
4086       ELSE
4087          fnd_flex_descval.set_column_value ('ATTRIBUTE27'
4088                                            ,p_material_detail_rec.attribute27);
4089          l_material_detail_rec.attribute27 := p_material_detail_rec.attribute27;
4090       END IF;
4091 
4092       IF p_material_detail_rec.attribute28 IS NULL THEN
4093          fnd_flex_descval.set_column_value
4094                                      ('ATTRIBUTE28'
4095                                      ,NVL (l_material_detail_rec.attribute28
4096                                           ,'') );
4097       ELSIF p_material_detail_rec.attribute28 = fnd_api.g_miss_char THEN
4098          fnd_flex_descval.set_column_value ('ATTRIBUTE28', '');
4099          l_material_detail_rec.attribute28 := '';
4100       ELSE
4101          fnd_flex_descval.set_column_value ('ATTRIBUTE28'
4102                                            ,p_material_detail_rec.attribute28);
4103          l_material_detail_rec.attribute28 := p_material_detail_rec.attribute28;
4104       END IF;
4105 
4106       IF p_material_detail_rec.attribute29 IS NULL THEN
4107          fnd_flex_descval.set_column_value
4108                                      ('ATTRIBUTE29'
4109                                      ,NVL (l_material_detail_rec.attribute29
4110                                           ,'') );
4111       ELSIF p_material_detail_rec.attribute29 = fnd_api.g_miss_char THEN
4112          fnd_flex_descval.set_column_value ('ATTRIBUTE29', '');
4113          l_material_detail_rec.attribute29 := '';
4114       ELSE
4115          fnd_flex_descval.set_column_value ('ATTRIBUTE29'
4116                                            ,p_material_detail_rec.attribute29);
4117          l_material_detail_rec.attribute29 := p_material_detail_rec.attribute29;
4118       END IF;
4119 
4120       IF p_material_detail_rec.attribute30 IS NULL THEN
4121          fnd_flex_descval.set_column_value
4122                                      ('ATTRIBUTE30'
4123                                      ,NVL (l_material_detail_rec.attribute30
4124                                           ,'') );
4125       ELSIF p_material_detail_rec.attribute30 = fnd_api.g_miss_char THEN
4126          fnd_flex_descval.set_column_value ('ATTRIBUTE30', '');
4127          l_material_detail_rec.attribute30 := '';
4128       ELSE
4129          fnd_flex_descval.set_column_value ('ATTRIBUTE30'
4130                                            ,p_material_detail_rec.attribute30);
4131          l_material_detail_rec.attribute30 := p_material_detail_rec.attribute30;
4132       END IF;
4133 
4134       /* if gme_common_pvt.g_flex_validate_prof is 0 then no validation required so
4135          copy values back */
4136       IF gme_common_pvt.g_flex_validate_prof = 0 THEN
4137          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
4138             gme_debug.put_line
4139                      ('GME Flexfield is not enabled, No validation required.');
4140          END IF;
4141 
4142          /* only flex field values will be copied back */
4143          x_material_detail_rec.attribute_category :=
4144                                       l_material_detail_rec.attribute_category;
4145          x_material_detail_rec.attribute1 := l_material_detail_rec.attribute1;
4146          x_material_detail_rec.attribute2 := l_material_detail_rec.attribute2;
4147          x_material_detail_rec.attribute3 := l_material_detail_rec.attribute3;
4148          x_material_detail_rec.attribute4 := l_material_detail_rec.attribute4;
4149          x_material_detail_rec.attribute5 := l_material_detail_rec.attribute5;
4150          x_material_detail_rec.attribute6 := l_material_detail_rec.attribute6;
4151          x_material_detail_rec.attribute7 := l_material_detail_rec.attribute7;
4152          x_material_detail_rec.attribute8 := l_material_detail_rec.attribute8;
4153          x_material_detail_rec.attribute9 := l_material_detail_rec.attribute9;
4154          x_material_detail_rec.attribute10 := l_material_detail_rec.attribute10;
4155          x_material_detail_rec.attribute11 := l_material_detail_rec.attribute11;
4156          x_material_detail_rec.attribute12 := l_material_detail_rec.attribute12;
4157          x_material_detail_rec.attribute13 := l_material_detail_rec.attribute13;
4158          x_material_detail_rec.attribute14 := l_material_detail_rec.attribute14;
4159          x_material_detail_rec.attribute15 := l_material_detail_rec.attribute15;
4160          x_material_detail_rec.attribute16 := l_material_detail_rec.attribute16;
4161          x_material_detail_rec.attribute17 := l_material_detail_rec.attribute17;
4162          x_material_detail_rec.attribute18 := l_material_detail_rec.attribute18;
4163          x_material_detail_rec.attribute19 := l_material_detail_rec.attribute19;
4164          x_material_detail_rec.attribute20 := l_material_detail_rec.attribute20;
4165          x_material_detail_rec.attribute21 := l_material_detail_rec.attribute21;
4166          x_material_detail_rec.attribute22 := l_material_detail_rec.attribute22;
4167          x_material_detail_rec.attribute23 := l_material_detail_rec.attribute23;
4168          x_material_detail_rec.attribute24 := l_material_detail_rec.attribute24;
4169          x_material_detail_rec.attribute25 := l_material_detail_rec.attribute25;
4170          x_material_detail_rec.attribute26 := l_material_detail_rec.attribute26;
4171          x_material_detail_rec.attribute27 := l_material_detail_rec.attribute27;
4172          x_material_detail_rec.attribute28 := l_material_detail_rec.attribute28;
4173          x_material_detail_rec.attribute29 := l_material_detail_rec.attribute29;
4174          x_material_detail_rec.attribute30 := l_material_detail_rec.attribute30;
4175          RETURN;
4176       END IF;
4177 
4178       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
4179          gme_debug.put_line ('Calling FND_FLEX_DESCVAL.validate_desccols ');
4180       END IF;
4181 
4182       IF fnd_flex_descval.validate_desccols
4183                                           (appl_short_name      => appl_short_name
4184                                           ,desc_flex_name       => desc_flex_name
4185                                           ,values_or_ids        => values_or_ids
4186                                           ,validation_date      => validation_date) THEN
4187          --SUCCESS
4188          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
4189             gme_debug.put_line ('Validation Success ');
4190          END IF;
4191 
4192          x_return_status := fnd_api.g_ret_sts_success;
4193          n := fnd_flex_descval.segment_count;
4194 
4195          /*Now let us copy back the storage value  */
4196          FOR i IN 1 .. n LOOP
4197             IF fnd_flex_descval.segment_column_name (i) =
4198                                                          'ATTRIBUTE_CATEGORY' THEN
4199                x_material_detail_rec.attribute_category :=
4200                                               fnd_flex_descval.segment_id (i);
4201             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE1' THEN
4202                x_material_detail_rec.attribute1 :=
4203                                               fnd_flex_descval.segment_id (i);
4204             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE2' THEN
4205                x_material_detail_rec.attribute2 :=
4206                                               fnd_flex_descval.segment_id (i);
4207             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE3' THEN
4208                x_material_detail_rec.attribute3 :=
4209                                               fnd_flex_descval.segment_id (i);
4210             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE4' THEN
4211                x_material_detail_rec.attribute4 :=
4212                                               fnd_flex_descval.segment_id (i);
4213             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE5' THEN
4214                x_material_detail_rec.attribute5 :=
4215                                               fnd_flex_descval.segment_id (i);
4216             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE6' THEN
4217                x_material_detail_rec.attribute6 :=
4218                                               fnd_flex_descval.segment_id (i);
4219             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE7' THEN
4220                x_material_detail_rec.attribute7 :=
4221                                               fnd_flex_descval.segment_id (i);
4222             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE8' THEN
4223                x_material_detail_rec.attribute8 :=
4224                                               fnd_flex_descval.segment_id (i);
4225             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE9' THEN
4226                x_material_detail_rec.attribute9 :=
4227                                               fnd_flex_descval.segment_id (i);
4228             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE10' THEN
4229                x_material_detail_rec.attribute10 :=
4230                                               fnd_flex_descval.segment_id (i);
4231             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE11' THEN
4232                x_material_detail_rec.attribute11 :=
4233                                               fnd_flex_descval.segment_id (i);
4234             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE12' THEN
4235                x_material_detail_rec.attribute12 :=
4236                                               fnd_flex_descval.segment_id (i);
4237             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE13' THEN
4238                x_material_detail_rec.attribute13 :=
4239                                               fnd_flex_descval.segment_id (i);
4240             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE14' THEN
4241                x_material_detail_rec.attribute14 :=
4242                                               fnd_flex_descval.segment_id (i);
4243             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE15' THEN
4244                x_material_detail_rec.attribute15 :=
4245                                               fnd_flex_descval.segment_id (i);
4246             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE16' THEN
4247                x_material_detail_rec.attribute16 :=
4248                                               fnd_flex_descval.segment_id (i);
4249             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE17' THEN
4250                x_material_detail_rec.attribute17 :=
4251                                               fnd_flex_descval.segment_id (i);
4252             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE18' THEN
4253                x_material_detail_rec.attribute18 :=
4254                                               fnd_flex_descval.segment_id (i);
4255             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE19' THEN
4256                x_material_detail_rec.attribute19 :=
4257                                               fnd_flex_descval.segment_id (i);
4258             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE20' THEN
4259                x_material_detail_rec.attribute20 :=
4260                                               fnd_flex_descval.segment_id (i);
4261             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE21' THEN
4262                x_material_detail_rec.attribute21 :=
4263                                               fnd_flex_descval.segment_id (i);
4264             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE22' THEN
4265                x_material_detail_rec.attribute22 :=
4266                                               fnd_flex_descval.segment_id (i);
4267             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE23' THEN
4268                x_material_detail_rec.attribute23 :=
4269                                               fnd_flex_descval.segment_id (i);
4270             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE24' THEN
4271                x_material_detail_rec.attribute24 :=
4272                                               fnd_flex_descval.segment_id (i);
4273             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE25' THEN
4274                x_material_detail_rec.attribute25 :=
4275                                               fnd_flex_descval.segment_id (i);
4276             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE26' THEN
4277                x_material_detail_rec.attribute26 :=
4278                                               fnd_flex_descval.segment_id (i);
4279             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE27' THEN
4280                x_material_detail_rec.attribute27 :=
4281                                               fnd_flex_descval.segment_id (i);
4282             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE28' THEN
4283                x_material_detail_rec.attribute28 :=
4284                                               fnd_flex_descval.segment_id (i);
4285             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE29' THEN
4286                x_material_detail_rec.attribute29 :=
4287                                               fnd_flex_descval.segment_id (i);
4288             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE30' THEN
4289                x_material_detail_rec.attribute30 :=
4290                                               fnd_flex_descval.segment_id (i);
4291             END IF;
4292          END LOOP;
4293       ELSE
4294          error_msg := fnd_flex_descval.error_message;
4295 
4296          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
4297             gme_debug.put_line ('Validation Ends With Error(s) :');
4298             gme_debug.put_line ('Error :' || error_msg);
4299          END IF;
4300 
4301          gme_common_pvt.log_message ('FLEX-USER DEFINED ERROR'
4302                                     ,'MSG'
4303                                     ,error_msg);
4304          RAISE validation_error;
4305       END IF;
4306 
4307        IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
4308          gme_debug.put_line (   'Validation completed for the Flex field : '
4309                              || desc_flex_name);
4310       END IF;
4311    EXCEPTION
4312       WHEN validation_error THEN
4313          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
4314             gme_debug.put_line
4315                  (   'Validation completed with errors for the Flex field : '
4316                   || desc_flex_name);
4317          END IF;
4318 
4319          x_return_status := fnd_api.g_ret_sts_error;
4320       WHEN material_fetch_err THEN
4321          x_return_status := fnd_api.g_ret_sts_error;
4322       WHEN OTHERS THEN
4323          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
4324             gme_debug.put_line (   g_pkg_name
4325                                 || '.'
4326                                 || desc_flex_name
4327                                 || ': '
4328                                 || 'in unexpected error');
4329          END IF;
4330 
4331          x_return_status := fnd_api.g_ret_sts_unexp_error;
4332          fnd_msg_pub.add_exc_msg (g_pkg_name, desc_flex_name);
4333    END validate_flex_material_details;
4334 
4335     /*======================================================================
4336    -- NAME
4337    -- validate_flex_process_param
4338    --
4339    -- DESCRIPTION
4340    --    This procedure will validate the GME_BATCH_PROC_PARAM_FLEX, descriptive flex field
4341    --    for process parameter, using serverside flex field validation package FND_FLEX_DESCVAL.
4342    --
4343    -- SYNOPSIS:
4344 
4345         validate_flex_process_param(p_process_param_rec => a_process_param_rec,
4346                                    x_process_param_rec => b_process_param_rec,
4347                                    x_return_status =>l_return_status);
4348    -- HISTORY
4349    -- A.Sriram    23-FEB-2004     Created --BUG#3406639
4350 
4351    -- G. Muratore 05-MAY-2004     Bug 3575735
4352    --  New profile added to control whether or not this procedure should be
4353    --  executed. A problem occurs when there is a flexfield of value set type,
4354    --  that has a where clause using a block field on the form.
4355    --
4356    -- G. Muratore 25-MAY-2004     Bug 3649415
4357    --  This is a follow up fix to bug 3575735.
4358    --  The flex field data entered by the user on the form is still saved even
4359    --  if the profile says not to validate it on the server side.
4360    --  Additional fix 3556979. The code will no longer fail during insert.
4361    --
4362    -- G. Muratore 11-JUN-2004     Bug 3681718
4363    --  This is a follow up fix to bug 3649415.
4364    --  Only flex field data will be overwritten in x_material_detail parameter.
4365    ======================================================================= */
4366    PROCEDURE validate_flex_process_param (
4367       p_process_param_rec     IN              gme_process_parameters%ROWTYPE
4368      ,p_validate_flexfields   IN              VARCHAR2
4369      ,x_process_param_rec     IN OUT NOCOPY   gme_process_parameters%ROWTYPE
4370      ,x_return_status         OUT NOCOPY      VARCHAR2)
4371    IS
4372       l_attribute_category        VARCHAR2 (240);
4373       appl_short_name             VARCHAR2 (30)                    := 'GME';
4374       desc_flex_name              VARCHAR2 (30)
4375                                                := 'GME_BATCH_PROC_PARAM_FLEX';
4376       values_or_ids               VARCHAR2 (10)                    := 'I';
4377       validation_date             DATE                             := SYSDATE;
4378       error_msg                   VARCHAR2 (5000);
4379       validation_error            EXCEPTION;
4380       process_param_fetch_error   EXCEPTION;
4381       l_field_value               VARCHAR2 (240);
4382       l_field_name                VARCHAR2 (100);
4383       n                           NUMBER                           := 0;
4384       l_process_param_rec         gme_process_parameters%ROWTYPE;
4385       l_exists                    NUMBER;
4386       l_dummy                     BOOLEAN;
4387 
4388       CURSOR cur_record_exists (v_rec_id NUMBER)
4389       IS
4390          SELECT 1
4391            FROM gme_process_parameters
4392           WHERE process_param_id = v_rec_id;
4393    BEGIN
4394       /* Set return status to success initially */
4395       x_return_status := fnd_api.g_ret_sts_success;
4396 
4397       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
4398          gme_debug.put_line (   'Check if flexfield is enabled : '
4399                              || desc_flex_name);
4400       END IF;
4401 
4402       OPEN cur_get_appl_id;
4403 
4404       FETCH cur_get_appl_id
4405        INTO pkg_application_id;
4406 
4407       CLOSE cur_get_appl_id;
4408 
4409       IF NOT fnd_flex_apis.is_descr_setup (pkg_application_id, desc_flex_name) THEN
4410          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
4411             gme_debug.put_line
4412                          ('Flexfield is not enabled, No validation required.');
4413          END IF;
4414 
4415          RETURN;
4416       END IF;
4417 
4418       -- 3556979 Check if record being worked on already exists
4419       OPEN cur_record_exists (p_process_param_rec.process_param_id);
4420 
4421       FETCH cur_record_exists
4422        INTO l_exists;
4423 
4424       IF cur_record_exists%NOTFOUND THEN
4425          l_process_param_rec := p_process_param_rec;
4426       ELSE
4427          l_dummy :=
4428             gme_process_parameters_dbl.fetch_row (p_process_param_rec
4429                                                  ,l_process_param_rec);
4430       END IF;
4431 
4432       CLOSE cur_record_exists;
4433 
4434       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
4435          gme_debug.put_line (   'Validation of the Flex field : '
4436                              || desc_flex_name);
4437          gme_debug.put_line
4438             ('Assignment of the attribute Category And Attribute Values to Local Variables');
4439       END IF;
4440 
4441       /* Bug 3649415 - Retain all current flexfield values in l_process_param_rec.  */
4442       /* This will allow us to pass back the correct row with all the proper values */
4443       /* in the event the flex field validation on the server side is off.          */
4444       /* All the following if statements will now retain that data.                 */
4445       IF p_process_param_rec.attribute_category IS NULL THEN
4446          l_attribute_category :=
4447                              NVL (l_process_param_rec.attribute_category, '');
4448       ELSIF p_process_param_rec.attribute_category = fnd_api.g_miss_char THEN
4449          l_attribute_category := '';
4450       ELSE
4451          l_attribute_category := p_process_param_rec.attribute_category;
4452       END IF;
4453 
4454       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
4455          gme_debug.put_line
4456             ('setting set column values for the context value,for Global Data Elements and for context code.');
4457       END IF;
4458 
4459       fnd_flex_descval.set_context_value (l_attribute_category);
4460       l_process_param_rec.attribute_category := l_attribute_category;
4461 
4462       IF p_process_param_rec.attribute1 IS NULL THEN
4463          fnd_flex_descval.set_column_value
4464                                        ('ATTRIBUTE1'
4465                                        ,NVL (l_process_param_rec.attribute1
4466                                             ,'') );
4467       ELSIF p_process_param_rec.attribute1 = fnd_api.g_miss_char THEN
4468          fnd_flex_descval.set_column_value ('ATTRIBUTE1', '');
4469          l_process_param_rec.attribute1 := '';
4470       ELSE
4471          fnd_flex_descval.set_column_value ('ATTRIBUTE1'
4472                                            ,p_process_param_rec.attribute1);
4473          l_process_param_rec.attribute1 := p_process_param_rec.attribute1;
4474       END IF;
4475 
4476       IF p_process_param_rec.attribute2 IS NULL THEN
4477          fnd_flex_descval.set_column_value
4478                                        ('ATTRIBUTE2'
4479                                        ,NVL (l_process_param_rec.attribute2
4480                                             ,'') );
4481       ELSIF p_process_param_rec.attribute2 = fnd_api.g_miss_char THEN
4482          fnd_flex_descval.set_column_value ('ATTRIBUTE2', '');
4483          l_process_param_rec.attribute2 := '';
4484       ELSE
4485          fnd_flex_descval.set_column_value ('ATTRIBUTE2'
4486                                            ,p_process_param_rec.attribute2);
4487          l_process_param_rec.attribute2 := p_process_param_rec.attribute2;
4488       END IF;
4489 
4490       IF p_process_param_rec.attribute3 IS NULL THEN
4491          fnd_flex_descval.set_column_value
4492                                        ('ATTRIBUTE3'
4493                                        ,NVL (l_process_param_rec.attribute3
4494                                             ,'') );
4495       ELSIF p_process_param_rec.attribute3 = fnd_api.g_miss_char THEN
4496          fnd_flex_descval.set_column_value ('ATTRIBUTE3', '');
4497          l_process_param_rec.attribute3 := '';
4498       ELSE
4499          fnd_flex_descval.set_column_value ('ATTRIBUTE3'
4500                                            ,p_process_param_rec.attribute3);
4501          l_process_param_rec.attribute3 := p_process_param_rec.attribute3;
4502       END IF;
4503 
4504       IF p_process_param_rec.attribute4 IS NULL THEN
4505          fnd_flex_descval.set_column_value
4506                                        ('ATTRIBUTE4'
4507                                        ,NVL (l_process_param_rec.attribute4
4508                                             ,'') );
4509       ELSIF p_process_param_rec.attribute4 = fnd_api.g_miss_char THEN
4510          fnd_flex_descval.set_column_value ('ATTRIBUTE4', '');
4511          l_process_param_rec.attribute4 := '';
4512       ELSE
4513          fnd_flex_descval.set_column_value ('ATTRIBUTE4'
4514                                            ,p_process_param_rec.attribute4);
4515          l_process_param_rec.attribute4 := p_process_param_rec.attribute4;
4516       END IF;
4517 
4518       IF p_process_param_rec.attribute5 IS NULL THEN
4519          fnd_flex_descval.set_column_value
4520                                        ('ATTRIBUTE5'
4521                                        ,NVL (l_process_param_rec.attribute5
4522                                             ,'') );
4523       ELSIF p_process_param_rec.attribute5 = fnd_api.g_miss_char THEN
4524          fnd_flex_descval.set_column_value ('ATTRIBUTE5', '');
4525          l_process_param_rec.attribute5 := '';
4526       ELSE
4527          fnd_flex_descval.set_column_value ('ATTRIBUTE5'
4528                                            ,p_process_param_rec.attribute5);
4529          l_process_param_rec.attribute5 := p_process_param_rec.attribute5;
4530       END IF;
4531 
4532       IF p_process_param_rec.attribute6 IS NULL THEN
4533          fnd_flex_descval.set_column_value
4534                                        ('ATTRIBUTE6'
4535                                        ,NVL (l_process_param_rec.attribute6
4536                                             ,'') );
4537       ELSIF p_process_param_rec.attribute6 = fnd_api.g_miss_char THEN
4538          fnd_flex_descval.set_column_value ('ATTRIBUTE6', '');
4539          l_process_param_rec.attribute6 := '';
4540       ELSE
4541          fnd_flex_descval.set_column_value ('ATTRIBUTE6'
4542                                            ,p_process_param_rec.attribute6);
4543          l_process_param_rec.attribute6 := p_process_param_rec.attribute6;
4544       END IF;
4545 
4546       IF p_process_param_rec.attribute7 IS NULL THEN
4547          fnd_flex_descval.set_column_value
4548                                        ('ATTRIBUTE7'
4549                                        ,NVL (l_process_param_rec.attribute7
4550                                             ,'') );
4551       ELSIF p_process_param_rec.attribute7 = fnd_api.g_miss_char THEN
4552          fnd_flex_descval.set_column_value ('ATTRIBUTE7', '');
4553          l_process_param_rec.attribute7 := '';
4554       ELSE
4555          fnd_flex_descval.set_column_value ('ATTRIBUTE7'
4556                                            ,p_process_param_rec.attribute7);
4557          l_process_param_rec.attribute7 := p_process_param_rec.attribute7;
4558       END IF;
4559 
4560       IF p_process_param_rec.attribute8 IS NULL THEN
4561          fnd_flex_descval.set_column_value
4562                                        ('ATTRIBUTE8'
4563                                        ,NVL (l_process_param_rec.attribute8
4564                                             ,'') );
4565       ELSIF p_process_param_rec.attribute8 = fnd_api.g_miss_char THEN
4566          fnd_flex_descval.set_column_value ('ATTRIBUTE8', '');
4567          l_process_param_rec.attribute8 := '';
4568       ELSE
4569          fnd_flex_descval.set_column_value ('ATTRIBUTE8'
4570                                            ,p_process_param_rec.attribute8);
4571          l_process_param_rec.attribute8 := p_process_param_rec.attribute8;
4572       END IF;
4573 
4574       IF p_process_param_rec.attribute9 IS NULL THEN
4575          fnd_flex_descval.set_column_value
4576                                        ('ATTRIBUTE9'
4577                                        ,NVL (l_process_param_rec.attribute9
4578                                             ,'') );
4579       ELSIF p_process_param_rec.attribute9 = fnd_api.g_miss_char THEN
4580          fnd_flex_descval.set_column_value ('ATTRIBUTE9', '');
4581          l_process_param_rec.attribute9 := '';
4582       ELSE
4583          fnd_flex_descval.set_column_value ('ATTRIBUTE9'
4584                                            ,p_process_param_rec.attribute9);
4585          l_process_param_rec.attribute9 := p_process_param_rec.attribute9;
4586       END IF;
4587 
4588       IF p_process_param_rec.attribute10 IS NULL THEN
4589          fnd_flex_descval.set_column_value
4590                                       ('ATTRIBUTE10'
4591                                       ,NVL (l_process_param_rec.attribute10
4592                                            ,'') );
4593       ELSIF p_process_param_rec.attribute10 = fnd_api.g_miss_char THEN
4594          fnd_flex_descval.set_column_value ('ATTRIBUTE10', '');
4595          l_process_param_rec.attribute10 := '';
4596       ELSE
4597          fnd_flex_descval.set_column_value ('ATTRIBUTE10'
4598                                            ,p_process_param_rec.attribute10);
4599          l_process_param_rec.attribute10 := p_process_param_rec.attribute10;
4600       END IF;
4601 
4602       IF p_process_param_rec.attribute11 IS NULL THEN
4603          fnd_flex_descval.set_column_value
4604                                       ('ATTRIBUTE11'
4605                                       ,NVL (l_process_param_rec.attribute11
4606                                            ,'') );
4607       ELSIF p_process_param_rec.attribute11 = fnd_api.g_miss_char THEN
4608          fnd_flex_descval.set_column_value ('ATTRIBUTE11', '');
4609          l_process_param_rec.attribute11 := '';
4610       ELSE
4611          fnd_flex_descval.set_column_value ('ATTRIBUTE11'
4612                                            ,p_process_param_rec.attribute11);
4613          l_process_param_rec.attribute11 := p_process_param_rec.attribute11;
4614       END IF;
4615 
4616       IF p_process_param_rec.attribute12 IS NULL THEN
4617          fnd_flex_descval.set_column_value
4618                                       ('ATTRIBUTE12'
4619                                       ,NVL (l_process_param_rec.attribute12
4620                                            ,'') );
4621       ELSIF p_process_param_rec.attribute12 = fnd_api.g_miss_char THEN
4622          fnd_flex_descval.set_column_value ('ATTRIBUTE12', '');
4623          l_process_param_rec.attribute12 := '';
4624       ELSE
4625          fnd_flex_descval.set_column_value ('ATTRIBUTE12'
4626                                            ,p_process_param_rec.attribute12);
4627          l_process_param_rec.attribute12 := p_process_param_rec.attribute12;
4628       END IF;
4629 
4630       IF p_process_param_rec.attribute13 IS NULL THEN
4631          fnd_flex_descval.set_column_value
4632                                       ('ATTRIBUTE13'
4633                                       ,NVL (l_process_param_rec.attribute13
4634                                            ,'') );
4635       ELSIF p_process_param_rec.attribute13 = fnd_api.g_miss_char THEN
4636          fnd_flex_descval.set_column_value ('ATTRIBUTE13', '');
4637          l_process_param_rec.attribute13 := '';
4638       ELSE
4639          fnd_flex_descval.set_column_value ('ATTRIBUTE13'
4640                                            ,p_process_param_rec.attribute13);
4641          l_process_param_rec.attribute13 := p_process_param_rec.attribute13;
4642       END IF;
4643 
4644       IF p_process_param_rec.attribute14 IS NULL THEN
4645          fnd_flex_descval.set_column_value
4646                                       ('ATTRIBUTE14'
4647                                       ,NVL (l_process_param_rec.attribute14
4648                                            ,'') );
4649       ELSIF p_process_param_rec.attribute14 = fnd_api.g_miss_char THEN
4650          fnd_flex_descval.set_column_value ('ATTRIBUTE14', '');
4651          l_process_param_rec.attribute14 := '';
4652       ELSE
4653          fnd_flex_descval.set_column_value ('ATTRIBUTE14'
4654                                            ,p_process_param_rec.attribute14);
4655          l_process_param_rec.attribute14 := p_process_param_rec.attribute14;
4656       END IF;
4657 
4658       IF p_process_param_rec.attribute15 IS NULL THEN
4659          fnd_flex_descval.set_column_value
4660                                       ('ATTRIBUTE15'
4661                                       ,NVL (l_process_param_rec.attribute15
4662                                            ,'') );
4663       ELSIF p_process_param_rec.attribute15 = fnd_api.g_miss_char THEN
4664          fnd_flex_descval.set_column_value ('ATTRIBUTE15', '');
4665          l_process_param_rec.attribute15 := '';
4666       ELSE
4667          fnd_flex_descval.set_column_value ('ATTRIBUTE15'
4668                                            ,p_process_param_rec.attribute15);
4669          l_process_param_rec.attribute15 := p_process_param_rec.attribute15;
4670       END IF;
4671 
4672       IF p_process_param_rec.attribute16 IS NULL THEN
4673          fnd_flex_descval.set_column_value
4674                                       ('ATTRIBUTE16'
4675                                       ,NVL (l_process_param_rec.attribute16
4676                                            ,'') );
4677       ELSIF p_process_param_rec.attribute16 = fnd_api.g_miss_char THEN
4678          fnd_flex_descval.set_column_value ('ATTRIBUTE16', '');
4679          l_process_param_rec.attribute16 := '';
4680       ELSE
4681          fnd_flex_descval.set_column_value ('ATTRIBUTE16'
4682                                            ,p_process_param_rec.attribute16);
4683          l_process_param_rec.attribute16 := p_process_param_rec.attribute16;
4684       END IF;
4685 
4686       IF p_process_param_rec.attribute17 IS NULL THEN
4687          fnd_flex_descval.set_column_value
4688                                       ('ATTRIBUTE17'
4689                                       ,NVL (l_process_param_rec.attribute17
4690                                            ,'') );
4691       ELSIF p_process_param_rec.attribute17 = fnd_api.g_miss_char THEN
4692          fnd_flex_descval.set_column_value ('ATTRIBUTE17', '');
4693          l_process_param_rec.attribute17 := '';
4694       ELSE
4695          fnd_flex_descval.set_column_value ('ATTRIBUTE17'
4696                                            ,p_process_param_rec.attribute17);
4697          l_process_param_rec.attribute17 := p_process_param_rec.attribute17;
4698       END IF;
4699 
4700       IF p_process_param_rec.attribute18 IS NULL THEN
4701          fnd_flex_descval.set_column_value
4702                                       ('ATTRIBUTE18'
4703                                       ,NVL (l_process_param_rec.attribute18
4704                                            ,'') );
4705       ELSIF p_process_param_rec.attribute18 = fnd_api.g_miss_char THEN
4706          fnd_flex_descval.set_column_value ('ATTRIBUTE18', '');
4707          l_process_param_rec.attribute18 := '';
4708       ELSE
4709          fnd_flex_descval.set_column_value ('ATTRIBUTE18'
4710                                            ,p_process_param_rec.attribute18);
4711          l_process_param_rec.attribute18 := p_process_param_rec.attribute18;
4712       END IF;
4713 
4714       IF p_process_param_rec.attribute19 IS NULL THEN
4715          fnd_flex_descval.set_column_value
4716                                       ('ATTRIBUTE19'
4717                                       ,NVL (l_process_param_rec.attribute19
4718                                            ,'') );
4719       ELSIF p_process_param_rec.attribute19 = fnd_api.g_miss_char THEN
4720          fnd_flex_descval.set_column_value ('ATTRIBUTE19', '');
4721          l_process_param_rec.attribute19 := '';
4722       ELSE
4723          fnd_flex_descval.set_column_value ('ATTRIBUTE19'
4724                                            ,p_process_param_rec.attribute19);
4725          l_process_param_rec.attribute19 := p_process_param_rec.attribute19;
4726       END IF;
4727 
4728       IF p_process_param_rec.attribute20 IS NULL THEN
4729          fnd_flex_descval.set_column_value
4730                                       ('ATTRIBUTE20'
4731                                       ,NVL (l_process_param_rec.attribute20
4732                                            ,'') );
4733       ELSIF p_process_param_rec.attribute20 = fnd_api.g_miss_char THEN
4734          fnd_flex_descval.set_column_value ('ATTRIBUTE20', '');
4735          l_process_param_rec.attribute20 := '';
4736       ELSE
4737          fnd_flex_descval.set_column_value ('ATTRIBUTE20'
4738                                            ,p_process_param_rec.attribute20);
4739          l_process_param_rec.attribute20 := p_process_param_rec.attribute20;
4740       END IF;
4741 
4742       IF p_process_param_rec.attribute21 IS NULL THEN
4743          fnd_flex_descval.set_column_value
4744                                       ('ATTRIBUTE21'
4745                                       ,NVL (l_process_param_rec.attribute21
4746                                            ,'') );
4747       ELSIF p_process_param_rec.attribute21 = fnd_api.g_miss_char THEN
4748          fnd_flex_descval.set_column_value ('ATTRIBUTE21', '');
4749          l_process_param_rec.attribute21 := '';
4750       ELSE
4751          fnd_flex_descval.set_column_value ('ATTRIBUTE21'
4752                                            ,p_process_param_rec.attribute21);
4753          l_process_param_rec.attribute21 := p_process_param_rec.attribute21;
4754       END IF;
4755 
4756       IF p_process_param_rec.attribute22 IS NULL THEN
4757          fnd_flex_descval.set_column_value
4758                                       ('ATTRIBUTE22'
4759                                       ,NVL (l_process_param_rec.attribute22
4760                                            ,'') );
4761       ELSIF p_process_param_rec.attribute22 = fnd_api.g_miss_char THEN
4762          fnd_flex_descval.set_column_value ('ATTRIBUTE22', '');
4763          l_process_param_rec.attribute22 := '';
4764       ELSE
4765          fnd_flex_descval.set_column_value ('ATTRIBUTE22'
4766                                            ,p_process_param_rec.attribute22);
4767          l_process_param_rec.attribute22 := p_process_param_rec.attribute22;
4768       END IF;
4769 
4770       IF p_process_param_rec.attribute23 IS NULL THEN
4771          fnd_flex_descval.set_column_value
4772                                       ('ATTRIBUTE23'
4773                                       ,NVL (l_process_param_rec.attribute23
4774                                            ,'') );
4775       ELSIF p_process_param_rec.attribute23 = fnd_api.g_miss_char THEN
4776          fnd_flex_descval.set_column_value ('ATTRIBUTE23', '');
4777          l_process_param_rec.attribute23 := '';
4778       ELSE
4779          fnd_flex_descval.set_column_value ('ATTRIBUTE23'
4780                                            ,p_process_param_rec.attribute23);
4781          l_process_param_rec.attribute23 := p_process_param_rec.attribute23;
4782       END IF;
4783 
4784       IF p_process_param_rec.attribute24 IS NULL THEN
4785          fnd_flex_descval.set_column_value
4786                                       ('ATTRIBUTE24'
4787                                       ,NVL (l_process_param_rec.attribute24
4788                                            ,'') );
4789       ELSIF p_process_param_rec.attribute24 = fnd_api.g_miss_char THEN
4790          fnd_flex_descval.set_column_value ('ATTRIBUTE24', '');
4791          l_process_param_rec.attribute24 := '';
4792       ELSE
4793          fnd_flex_descval.set_column_value ('ATTRIBUTE24'
4794                                            ,p_process_param_rec.attribute24);
4795          l_process_param_rec.attribute24 := p_process_param_rec.attribute24;
4796       END IF;
4797 
4798       IF p_process_param_rec.attribute25 IS NULL THEN
4799          fnd_flex_descval.set_column_value
4800                                       ('ATTRIBUTE25'
4801                                       ,NVL (l_process_param_rec.attribute25
4802                                            ,'') );
4803       ELSIF p_process_param_rec.attribute25 = fnd_api.g_miss_char THEN
4804          fnd_flex_descval.set_column_value ('ATTRIBUTE25', '');
4805          l_process_param_rec.attribute25 := '';
4806       ELSE
4807          fnd_flex_descval.set_column_value ('ATTRIBUTE25'
4808                                            ,p_process_param_rec.attribute25);
4809          l_process_param_rec.attribute25 := p_process_param_rec.attribute25;
4810       END IF;
4811 
4812       IF p_process_param_rec.attribute26 IS NULL THEN
4813          fnd_flex_descval.set_column_value
4814                                       ('ATTRIBUTE26'
4815                                       ,NVL (l_process_param_rec.attribute26
4816                                            ,'') );
4817       ELSIF p_process_param_rec.attribute26 = fnd_api.g_miss_char THEN
4818          fnd_flex_descval.set_column_value ('ATTRIBUTE26', '');
4819          l_process_param_rec.attribute26 := '';
4820       ELSE
4821          fnd_flex_descval.set_column_value ('ATTRIBUTE26'
4822                                            ,p_process_param_rec.attribute26);
4823          l_process_param_rec.attribute26 := p_process_param_rec.attribute26;
4824       END IF;
4825 
4826       IF p_process_param_rec.attribute27 IS NULL THEN
4827          fnd_flex_descval.set_column_value
4828                                       ('ATTRIBUTE27'
4829                                       ,NVL (l_process_param_rec.attribute27
4830                                            ,'') );
4831       ELSIF p_process_param_rec.attribute27 = fnd_api.g_miss_char THEN
4832          fnd_flex_descval.set_column_value ('ATTRIBUTE27', '');
4833          l_process_param_rec.attribute27 := '';
4834       ELSE
4835          fnd_flex_descval.set_column_value ('ATTRIBUTE27'
4836                                            ,p_process_param_rec.attribute27);
4837          l_process_param_rec.attribute27 := p_process_param_rec.attribute27;
4838       END IF;
4839 
4840       IF p_process_param_rec.attribute28 IS NULL THEN
4841          fnd_flex_descval.set_column_value
4842                                       ('ATTRIBUTE28'
4843                                       ,NVL (l_process_param_rec.attribute28
4844                                            ,'') );
4845       ELSIF p_process_param_rec.attribute28 = fnd_api.g_miss_char THEN
4846          fnd_flex_descval.set_column_value ('ATTRIBUTE28', '');
4847          l_process_param_rec.attribute28 := '';
4848       ELSE
4849          fnd_flex_descval.set_column_value ('ATTRIBUTE28'
4850                                            ,p_process_param_rec.attribute28);
4851          l_process_param_rec.attribute28 := p_process_param_rec.attribute28;
4852       END IF;
4853 
4854       IF p_process_param_rec.attribute29 IS NULL THEN
4855          fnd_flex_descval.set_column_value
4856                                       ('ATTRIBUTE29'
4857                                       ,NVL (l_process_param_rec.attribute29
4858                                            ,'') );
4859       ELSIF p_process_param_rec.attribute29 = fnd_api.g_miss_char THEN
4860          fnd_flex_descval.set_column_value ('ATTRIBUTE29', '');
4861          l_process_param_rec.attribute29 := '';
4862       ELSE
4863          fnd_flex_descval.set_column_value ('ATTRIBUTE29'
4864                                            ,p_process_param_rec.attribute29);
4865          l_process_param_rec.attribute29 := p_process_param_rec.attribute29;
4866       END IF;
4867 
4868       IF p_process_param_rec.attribute30 IS NULL THEN
4869          fnd_flex_descval.set_column_value
4870                                       ('ATTRIBUTE30'
4871                                       ,NVL (l_process_param_rec.attribute30
4872                                            ,'') );
4873       ELSIF p_process_param_rec.attribute30 = fnd_api.g_miss_char THEN
4874          fnd_flex_descval.set_column_value ('ATTRIBUTE30', '');
4875          l_process_param_rec.attribute30 := '';
4876       ELSE
4877          fnd_flex_descval.set_column_value ('ATTRIBUTE30'
4878                                            ,p_process_param_rec.attribute30);
4879          l_process_param_rec.attribute30 := p_process_param_rec.attribute30;
4880       END IF;
4881 
4882       /* Do not run this validation if it is set to N. */
4883       /* It should only be set to N if it is a value set flexfield   */
4884       /* with a where clause using block fields from the form.       */
4885       /* Pass back all flexfield values w/ no validation.            */
4886 
4887       /* Nsinha changed the condition IF g_flex_validate_prof = 0 THEN as part of GME_Process_Parameter_APIs_TD */
4888       IF p_validate_flexfields = fnd_api.g_false THEN
4889          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
4890             gme_debug.put_line
4891                      ('GME Flexfield is not enabled, No validation required.');
4892          END IF;
4893 
4894          /* Only update flex field columns in x_out parameter. */
4895          x_process_param_rec.attribute_category :=
4896                                         l_process_param_rec.attribute_category;
4897          x_process_param_rec.attribute1 := l_process_param_rec.attribute1;
4898          x_process_param_rec.attribute2 := l_process_param_rec.attribute2;
4899          x_process_param_rec.attribute3 := l_process_param_rec.attribute3;
4900          x_process_param_rec.attribute4 := l_process_param_rec.attribute4;
4901          x_process_param_rec.attribute5 := l_process_param_rec.attribute5;
4902          x_process_param_rec.attribute6 := l_process_param_rec.attribute6;
4903          x_process_param_rec.attribute7 := l_process_param_rec.attribute7;
4904          x_process_param_rec.attribute8 := l_process_param_rec.attribute8;
4905          x_process_param_rec.attribute9 := l_process_param_rec.attribute9;
4906          x_process_param_rec.attribute10 := l_process_param_rec.attribute10;
4907          x_process_param_rec.attribute11 := l_process_param_rec.attribute11;
4908          x_process_param_rec.attribute12 := l_process_param_rec.attribute12;
4909          x_process_param_rec.attribute13 := l_process_param_rec.attribute13;
4910          x_process_param_rec.attribute14 := l_process_param_rec.attribute14;
4911          x_process_param_rec.attribute15 := l_process_param_rec.attribute15;
4912          x_process_param_rec.attribute16 := l_process_param_rec.attribute16;
4913          x_process_param_rec.attribute17 := l_process_param_rec.attribute17;
4914          x_process_param_rec.attribute18 := l_process_param_rec.attribute18;
4915          x_process_param_rec.attribute19 := l_process_param_rec.attribute19;
4916          x_process_param_rec.attribute20 := l_process_param_rec.attribute20;
4917          x_process_param_rec.attribute21 := l_process_param_rec.attribute21;
4918          x_process_param_rec.attribute22 := l_process_param_rec.attribute22;
4919          x_process_param_rec.attribute23 := l_process_param_rec.attribute23;
4920          x_process_param_rec.attribute24 := l_process_param_rec.attribute24;
4921          x_process_param_rec.attribute25 := l_process_param_rec.attribute25;
4922          x_process_param_rec.attribute26 := l_process_param_rec.attribute26;
4923          x_process_param_rec.attribute27 := l_process_param_rec.attribute27;
4924          x_process_param_rec.attribute28 := l_process_param_rec.attribute28;
4925          x_process_param_rec.attribute29 := l_process_param_rec.attribute29;
4926          x_process_param_rec.attribute30 := l_process_param_rec.attribute30;
4927          RETURN;
4928       END IF;
4929 
4930       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
4931          gme_debug.put_line ('Calling FND_FLEX_DESCVAL.validate_desccols ');
4932       END IF;
4933 
4934       IF fnd_flex_descval.validate_desccols
4935                                           (appl_short_name      => appl_short_name
4936                                           ,desc_flex_name       => desc_flex_name
4937                                           ,values_or_ids        => values_or_ids
4938                                           ,validation_date      => validation_date) THEN
4939          --SUCCESS
4940          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
4941             gme_debug.put_line ('Validation Success ');
4942          END IF;
4943 
4944          x_return_status := fnd_api.g_ret_sts_success;
4945          n := fnd_flex_descval.segment_count;
4946 
4947          /*Now let us copy back the storage value  */
4948          FOR i IN 1 .. n LOOP
4949             IF fnd_flex_descval.segment_column_name (i) =
4950                                                          'ATTRIBUTE_CATEGORY' THEN
4951                x_process_param_rec.attribute_category :=
4952                                               fnd_flex_descval.segment_id (i);
4953             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE1' THEN
4954                x_process_param_rec.attribute1 :=
4955                                               fnd_flex_descval.segment_id (i);
4956             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE2' THEN
4957                x_process_param_rec.attribute2 :=
4958                                               fnd_flex_descval.segment_id (i);
4959             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE3' THEN
4960                x_process_param_rec.attribute3 :=
4961                                               fnd_flex_descval.segment_id (i);
4962             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE4' THEN
4963                x_process_param_rec.attribute4 :=
4964                                               fnd_flex_descval.segment_id (i);
4965             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE5' THEN
4966                x_process_param_rec.attribute5 :=
4967                                               fnd_flex_descval.segment_id (i);
4968             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE6' THEN
4969                x_process_param_rec.attribute6 :=
4970                                               fnd_flex_descval.segment_id (i);
4971             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE7' THEN
4972                x_process_param_rec.attribute7 :=
4973                                               fnd_flex_descval.segment_id (i);
4974             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE8' THEN
4975                x_process_param_rec.attribute8 :=
4976                                               fnd_flex_descval.segment_id (i);
4977             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE9' THEN
4978                x_process_param_rec.attribute9 :=
4979                                               fnd_flex_descval.segment_id (i);
4980             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE10' THEN
4981                x_process_param_rec.attribute10 :=
4982                                               fnd_flex_descval.segment_id (i);
4983             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE11' THEN
4984                x_process_param_rec.attribute11 :=
4985                                               fnd_flex_descval.segment_id (i);
4986             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE12' THEN
4987                x_process_param_rec.attribute12 :=
4988                                               fnd_flex_descval.segment_id (i);
4989             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE13' THEN
4990                x_process_param_rec.attribute13 :=
4991                                               fnd_flex_descval.segment_id (i);
4992             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE14' THEN
4993                x_process_param_rec.attribute14 :=
4994                                               fnd_flex_descval.segment_id (i);
4995             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE15' THEN
4996                x_process_param_rec.attribute15 :=
4997                                               fnd_flex_descval.segment_id (i);
4998             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE16' THEN
4999                x_process_param_rec.attribute16 :=
5000                                               fnd_flex_descval.segment_id (i);
5001             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE17' THEN
5002                x_process_param_rec.attribute17 :=
5003                                               fnd_flex_descval.segment_id (i);
5004             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE18' THEN
5005                x_process_param_rec.attribute18 :=
5006                                               fnd_flex_descval.segment_id (i);
5007             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE19' THEN
5008                x_process_param_rec.attribute19 :=
5009                                               fnd_flex_descval.segment_id (i);
5010             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE20' THEN
5011                x_process_param_rec.attribute20 :=
5012                                               fnd_flex_descval.segment_id (i);
5013             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE21' THEN
5014                x_process_param_rec.attribute21 :=
5015                                               fnd_flex_descval.segment_id (i);
5016             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE22' THEN
5017                x_process_param_rec.attribute22 :=
5018                                               fnd_flex_descval.segment_id (i);
5019             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE23' THEN
5020                x_process_param_rec.attribute23 :=
5021                                               fnd_flex_descval.segment_id (i);
5022             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE24' THEN
5023                x_process_param_rec.attribute24 :=
5024                                               fnd_flex_descval.segment_id (i);
5025             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE25' THEN
5026                x_process_param_rec.attribute25 :=
5027                                               fnd_flex_descval.segment_id (i);
5028             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE26' THEN
5029                x_process_param_rec.attribute26 :=
5030                                               fnd_flex_descval.segment_id (i);
5031             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE27' THEN
5032                x_process_param_rec.attribute27 :=
5033                                               fnd_flex_descval.segment_id (i);
5034             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE28' THEN
5035                x_process_param_rec.attribute28 :=
5036                                               fnd_flex_descval.segment_id (i);
5037             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE29' THEN
5038                x_process_param_rec.attribute29 :=
5039                                               fnd_flex_descval.segment_id (i);
5040             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE30' THEN
5041                x_process_param_rec.attribute30 :=
5042                                               fnd_flex_descval.segment_id (i);
5043             END IF;
5044          END LOOP;
5045       ELSE
5046          error_msg := fnd_flex_descval.error_message;
5047 
5048          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
5049             gme_debug.put_line ('Validation Ends With Error(s) :');
5050             gme_debug.put_line ('Error :' || error_msg);
5051          END IF;
5052 
5053          gme_common_pvt.log_message ('FLEX-USER DEFINED ERROR'
5054                                     ,'MSG'
5055                                     ,error_msg);
5056          RAISE validation_error;
5057       END IF;
5058 
5059       IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
5060          gme_debug.put_line (   'Validation completed for the Flex field : '
5061                              || desc_flex_name);
5062       END IF;
5063    EXCEPTION
5064       WHEN validation_error THEN
5065          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
5066             gme_debug.put_line
5067                  (   'Validation completed with errors for the Flex field : '
5068                   || desc_flex_name);
5069          END IF;
5070 
5071          x_return_status := fnd_api.g_ret_sts_error;
5072       WHEN process_param_fetch_error THEN
5073          x_return_status := fnd_api.g_ret_sts_error;
5074       WHEN OTHERS THEN
5075          IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
5076             gme_debug.put_line (   g_pkg_name
5077                                 || '.'
5078                                 || desc_flex_name
5079                                 || ': '
5080                                 || 'in unexpected error');
5081          END IF;
5082 
5083          x_return_status := fnd_api.g_ret_sts_unexp_error;
5084          fnd_msg_pub.add_exc_msg (g_pkg_name, desc_flex_name);
5085    END validate_flex_process_param;
5086 
5087    -- FPBug#4395561 Start
5088    /*======================================================================
5089     -- NAME
5090     -- create_flex_batch_header
5091     --
5092     -- DESCRIPTION
5093     --    This procedure will assign the default values of the segments into the columns.
5094     --
5095     -- SYNOPSIS:
5096 
5097        create_flex_batch_header (
5098                   p_batch_header    IN              gme_batch_header%ROWTYPE,
5099                   x_batch_header    IN OUT NOCOPY   gme_batch_header%ROWTYPE
5100                   x_return_status   OUT NOCOPY      VARCHAR2);
5101     -- HISTORY
5102     -- K.Swapna    07-MAR-2005     Created --BUG#4050727
5103     --25-MAY-2005 Swapna K Bug#4257930
5104       Changed the whole logic by adding the function call,
5105       fnd_flex_descval.validate_desccols with the parameter,values_or_ids as 'D'
5106       and erroring out from the procedure based on global validate flag
5107   ======================================================================= */
5108     PROCEDURE create_flex_batch_header (
5109       p_batch_header    IN              gme_batch_header%ROWTYPE,
5110       x_batch_header    IN OUT NOCOPY   gme_batch_header%ROWTYPE,
5111       x_return_status   OUT NOCOPY      VARCHAR2
5112     ) IS
5113       appl_short_name        VARCHAR2 (30)              := 'GME';
5114       desc_flex_name         VARCHAR2 (30)              := 'BATCH_FLEX';
5115       values_or_ids          VARCHAR2 (10)              := 'D';
5116       validation_date        DATE                       := SYSDATE;
5117       error_msg              VARCHAR2 (5000);
5118       n NUMBER := 0;
5119       l_attribute_category   VARCHAR2 (240);
5120       defaulting_error       EXCEPTION;
5121 
5122     BEGIN
5123       /* Set return status to success initially */
5124       x_return_status := FND_API.G_RET_STS_SUCCESS;
5125       x_batch_header := p_batch_header;
5126 
5127       IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5128          gme_debug.put_line (
5129             'Entered into the procedure create_flex_batch_header');
5130       END IF;
5131        IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5132          gme_debug.put_line ('Check if flexfield is enabled : ' ||desc_flex_name);
5133       END IF;
5134 
5135       OPEN cur_get_appl_id;
5136       FETCH cur_get_appl_id INTO pkg_application_id;
5137       CLOSE cur_get_appl_id;
5138 
5139       IF NOT fnd_flex_apis.is_descr_setup (pkg_application_id, desc_flex_name) THEN
5140          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5141             gme_debug.put_line ('Flexfield is not enabled, No validation required.');
5142          END IF;
5143          RETURN;
5144       END IF;
5145       l_attribute_category := NVL(x_batch_header.attribute_category, '');
5146       fnd_flex_descval.set_context_value (l_attribute_category);
5147          fnd_flex_descval.set_column_value (
5148             'ATTRIBUTE1',
5149             NVL (x_batch_header.attribute1, ''));
5150          fnd_flex_descval.set_column_value (
5151             'ATTRIBUTE2',
5152             NVL (x_batch_header.attribute2, ''));
5153          fnd_flex_descval.set_column_value (
5154             'ATTRIBUTE3',
5155             NVL (x_batch_header.attribute3, ''));
5156          fnd_flex_descval.set_column_value (
5157             'ATTRIBUTE4',
5158             NVL (x_batch_header.attribute4, ''));
5159          fnd_flex_descval.set_column_value (
5160             'ATTRIBUTE5',
5161             NVL (x_batch_header.attribute5, ''));
5162          fnd_flex_descval.set_column_value (
5163             'ATTRIBUTE6',
5164             NVL (x_batch_header.attribute6, ''));
5165          fnd_flex_descval.set_column_value (
5166             'ATTRIBUTE7',
5167             NVL (x_batch_header.attribute7, ''));
5168          fnd_flex_descval.set_column_value (
5169             'ATTRIBUTE8',
5170             NVL (x_batch_header.attribute8, ''));
5171          fnd_flex_descval.set_column_value (
5172             'ATTRIBUTE9',
5173             NVL (x_batch_header.attribute9, ''));
5174          fnd_flex_descval.set_column_value (
5175             'ATTRIBUTE10',
5176             NVL (x_batch_header.attribute10, ''));
5177          fnd_flex_descval.set_column_value (
5178             'ATTRIBUTE11',
5179             NVL (x_batch_header.attribute11, ''));
5180          fnd_flex_descval.set_column_value (
5181             'ATTRIBUTE12',
5182             NVL (x_batch_header.attribute12, ''));
5183          fnd_flex_descval.set_column_value (
5184             'ATTRIBUTE13',
5185             NVL (x_batch_header.attribute13, ''));
5186          fnd_flex_descval.set_column_value (
5187             'ATTRIBUTE14',
5188             NVL (x_batch_header.attribute14, ''));
5189          fnd_flex_descval.set_column_value (
5190             'ATTRIBUTE15',
5191             NVL (x_batch_header.attribute15, ''));
5192          fnd_flex_descval.set_column_value (
5193             'ATTRIBUTE16',
5194             NVL (x_batch_header.attribute16, ''));
5195          fnd_flex_descval.set_column_value (
5196             'ATTRIBUTE17',
5197             NVL (x_batch_header.attribute17, ''));
5198          fnd_flex_descval.set_column_value (
5199             'ATTRIBUTE18',
5200             NVL (x_batch_header.attribute18, ''));
5201          fnd_flex_descval.set_column_value (
5202             'ATTRIBUTE19',
5203             NVL (x_batch_header.attribute19, ''));
5204          fnd_flex_descval.set_column_value (
5205             'ATTRIBUTE20',
5206             NVL (x_batch_header.attribute20, ''));
5207          fnd_flex_descval.set_column_value (
5208             'ATTRIBUTE21',
5209             NVL (x_batch_header.attribute21, ''));
5210          fnd_flex_descval.set_column_value (
5211             'ATTRIBUTE22',
5212             NVL (x_batch_header.attribute22, ''));
5213          fnd_flex_descval.set_column_value (
5214             'ATTRIBUTE23',
5215             NVL (x_batch_header.attribute23, ''));
5216          fnd_flex_descval.set_column_value (
5217             'ATTRIBUTE24',
5218             NVL (x_batch_header.attribute24, ''));
5219          fnd_flex_descval.set_column_value (
5220             'ATTRIBUTE25',
5221             NVL (x_batch_header.attribute25, ''));
5222          fnd_flex_descval.set_column_value (
5223             'ATTRIBUTE26',
5224             NVL (x_batch_header.attribute26, ''));
5225          fnd_flex_descval.set_column_value (
5226             'ATTRIBUTE27',
5227             NVL (x_batch_header.attribute27, ''));
5228          fnd_flex_descval.set_column_value (
5229             'ATTRIBUTE28',
5230             NVL (x_batch_header.attribute28, ''));
5231          fnd_flex_descval.set_column_value (
5232             'ATTRIBUTE29',
5233             NVL (x_batch_header.attribute29, ''));
5234          fnd_flex_descval.set_column_value (
5235             'ATTRIBUTE30',
5236             NVL (x_batch_header.attribute30, ''));
5237          fnd_flex_descval.set_column_value (
5238             'ATTRIBUTE31',
5239             NVL (x_batch_header.attribute31, ''));
5240          fnd_flex_descval.set_column_value (
5241             'ATTRIBUTE32',
5242             NVL (x_batch_header.attribute32, ''));
5243          fnd_flex_descval.set_column_value (
5244             'ATTRIBUTE33',
5245             NVL (x_batch_header.attribute33, ''));
5246          fnd_flex_descval.set_column_value (
5247             'ATTRIBUTE34',
5248             NVL (x_batch_header.attribute34, ''));
5249          fnd_flex_descval.set_column_value (
5250             'ATTRIBUTE35',
5251             NVL (x_batch_header.attribute35, ''));
5252          fnd_flex_descval.set_column_value (
5253             'ATTRIBUTE36',
5254             NVL (x_batch_header.attribute36, ''));
5255          fnd_flex_descval.set_column_value (
5256             'ATTRIBUTE37',
5257             NVL (x_batch_header.attribute37, ''));
5258          fnd_flex_descval.set_column_value (
5259             'ATTRIBUTE38',
5260             NVL (x_batch_header.attribute38, ''));
5261          fnd_flex_descval.set_column_value (
5262             'ATTRIBUTE39',
5263             NVL (x_batch_header.attribute39, ''));
5264          fnd_flex_descval.set_column_value (
5265             'ATTRIBUTE40',
5266             NVL (x_batch_header.attribute40, ''));
5267 
5268 
5269       IF fnd_flex_descval.validate_desccols (
5270             appl_short_name     => appl_short_name,
5271             desc_flex_name      => desc_flex_name,
5272             values_or_ids       => values_or_ids,
5273             validation_date     => validation_date
5274          ) THEN
5275          --SUCCESS
5276          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5277             gme_debug.put_line ('Defaulting Success. ');
5278          END IF;
5279          x_return_status := FND_API.G_RET_STS_SUCCESS;
5280          n := fnd_flex_descval.segment_count;
5281          /*Now let us copy back the default values returned from the above call */
5282          FOR i IN 1 .. n
5283          LOOP
5284             IF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE_CATEGORY' THEN
5285                x_batch_header.attribute_category := fnd_flex_descval.segment_id(i);
5286             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE1' THEN
5287                x_batch_header.attribute1 := fnd_flex_descval.segment_id (i);
5288             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE2' THEN
5289                x_batch_header.attribute2 := fnd_flex_descval.segment_id (i);
5290             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE3' THEN
5291                x_batch_header.attribute3 := fnd_flex_descval.segment_id (i);
5292             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE4' THEN
5293                x_batch_header.attribute4 := fnd_flex_descval.segment_id (i);
5294             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE5' THEN
5295                x_batch_header.attribute5 := fnd_flex_descval.segment_id (i);
5296             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE6' THEN
5297                x_batch_header.attribute6 := fnd_flex_descval.segment_id (i);
5298             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE7' THEN
5299                x_batch_header.attribute7 := fnd_flex_descval.segment_id (i);
5300             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE8' THEN
5301                x_batch_header.attribute8 := fnd_flex_descval.segment_id (i);
5302             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE9' THEN
5303                x_batch_header.attribute9 := fnd_flex_descval.segment_id (i);
5304             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE10' THEN
5305                x_batch_header.attribute10 := fnd_flex_descval.segment_id (i);
5306             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE11' THEN
5307                x_batch_header.attribute11 := fnd_flex_descval.segment_id (i);
5308             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE12' THEN
5309                x_batch_header.attribute12 := fnd_flex_descval.segment_id (i);
5310             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE13' THEN
5311                x_batch_header.attribute13 := fnd_flex_descval.segment_id (i);
5312             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE14' THEN
5313                x_batch_header.attribute14 := fnd_flex_descval.segment_id (i);
5314             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE15' THEN
5315                x_batch_header.attribute15 := fnd_flex_descval.segment_id (i);
5316             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE16' THEN
5317                x_batch_header.attribute16 := fnd_flex_descval.segment_id (i);
5318             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE17' THEN
5319                x_batch_header.attribute17 := fnd_flex_descval.segment_id (i);
5320             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE18' THEN
5321                x_batch_header.attribute18 := fnd_flex_descval.segment_id (i);
5322             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE19' THEN
5323                x_batch_header.attribute19 := fnd_flex_descval.segment_id (i);
5324             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE20' THEN
5325                x_batch_header.attribute20 := fnd_flex_descval.segment_id (i);
5326             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE21' THEN
5327                x_batch_header.attribute21 := fnd_flex_descval.segment_id (i);
5328             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE22' THEN
5329                x_batch_header.attribute22 := fnd_flex_descval.segment_id (i);
5330             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE23' THEN
5331                x_batch_header.attribute23 := fnd_flex_descval.segment_id (i);
5332             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE24' THEN
5333                x_batch_header.attribute24 := fnd_flex_descval.segment_id (i);
5334             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE25' THEN
5335                x_batch_header.attribute25 := fnd_flex_descval.segment_id (i);
5336             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE26' THEN
5337                x_batch_header.attribute26 := fnd_flex_descval.segment_id (i);
5338             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE27' THEN
5339                x_batch_header.attribute27 := fnd_flex_descval.segment_id (i);
5340             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE28' THEN
5341                x_batch_header.attribute28 := fnd_flex_descval.segment_id (i);
5342             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE29' THEN
5343                x_batch_header.attribute29 := fnd_flex_descval.segment_id (i);
5344             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE30' THEN
5345                x_batch_header.attribute30 := fnd_flex_descval.segment_id (i);
5346             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE31' THEN
5347                x_batch_header.attribute31 := fnd_flex_descval.segment_id (i);
5348             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE32' THEN
5349                x_batch_header.attribute32 := fnd_flex_descval.segment_id (i);
5350             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE33' THEN
5351                x_batch_header.attribute33 := fnd_flex_descval.segment_id (i);
5352             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE34' THEN
5353                x_batch_header.attribute34 := fnd_flex_descval.segment_id (i);
5354             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE35' THEN
5355                x_batch_header.attribute35 := fnd_flex_descval.segment_id (i);
5356             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE36' THEN
5357                x_batch_header.attribute36 := fnd_flex_descval.segment_id (i);
5358             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE37' THEN
5359                x_batch_header.attribute37 := fnd_flex_descval.segment_id (i);
5360             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE38' THEN
5361                x_batch_header.attribute38 := fnd_flex_descval.segment_id (i);
5362             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE39' THEN
5363                x_batch_header.attribute39 := fnd_flex_descval.segment_id (i);
5364             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE40' THEN
5365                x_batch_header.attribute40 := fnd_flex_descval.segment_id (i);
5366             END IF;
5367          END LOOP;
5368       ELSE
5369          error_msg := fnd_flex_descval.error_message;
5370          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5371             gme_debug.put_line ('Defaulting Ends With Error(s) :');
5372             gme_debug.put_line ('Error :' || error_msg);
5373          END IF;
5374 
5375          gme_common_pvt.log_message ('FLEX-USER DEFINED ERROR', 'MSG', error_msg);
5376         /* error out based on global validate flag */
5377         IF gme_common_pvt.g_flex_validate_prof = 1 THEN
5378           IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5379              gme_debug.put_line ('GME Flexfield is enabled, Give the Error.');
5380           END IF;
5381           RAISE defaulting_error;
5382         END IF;
5383       END IF;
5384 
5385       IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5386          gme_debug.put_line (
5387             'Defaulting completed for the Flex field : ' || desc_flex_name);
5388       END IF;
5389    EXCEPTION
5390       WHEN defaulting_error THEN
5391          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5392             gme_debug.put_line (
5393                'Defaulting completed with errors for the Flex field : ' ||desc_flex_name);
5394          END IF;
5395          x_return_status := FND_API.G_RET_STS_ERROR;
5396       WHEN OTHERS THEN
5397         IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
5398           gme_debug.put_line (g_pkg_name||'.'||desc_flex_name||': '||'in unexpected error');
5399         END IF;
5400         x_return_status := FND_API.g_ret_sts_unexp_error;
5401         fnd_msg_pub.add_exc_msg (g_pkg_name, desc_flex_name);
5402    END create_flex_batch_header;
5403 
5404    /*======================================================================
5405      -- NAME
5406      -- create_flex_batch_step
5407      --
5408      -- DESCRIPTION
5409      --    This procedure will assign the default values of the segments into the columns.
5410      -- SYNOPSIS:
5411 
5412       create_flex_batch_step (
5413                   p_batch_step      IN              gme_batch_steps%ROWTYPE,
5414                   x_batch_step      IN OUT NOCOPY   gme_batch_steps%ROWTYPE,
5415                   x_return_status   OUT NOCOPY      VARCHAR2);
5416      -- HISTORY
5417      -- K.Swapna    07-MAR-2005     Created --BUG#4050727
5418      --K Swapna Bug#4257930   25-MAY-2005
5419        Changed the whole logic by adding the function call,
5420        fnd_flex_descval.validate_desccols with the parameter,values_or_ids as 'D'
5421        and erroring out from the procedure based on global validate flag
5422   ======================================================================= */
5423      PROCEDURE create_flex_batch_step (
5424       p_batch_step      IN              gme_batch_steps%ROWTYPE,
5425       x_batch_step      IN OUT NOCOPY   gme_batch_steps%ROWTYPE,
5426       x_return_status   OUT NOCOPY      VARCHAR2
5427      ) IS
5428       appl_short_name        VARCHAR2 (30)              := 'GME';
5429       desc_flex_name         VARCHAR2 (30)              := 'BATCH_STEPS_DTL_FLEX';
5430       values_or_ids          VARCHAR2 (10)              := 'D';
5431       validation_date        DATE                       := SYSDATE;
5432       error_msg              VARCHAR2 (5000);
5433       n                      NUMBER := 0;
5434       l_attribute_category   VARCHAR2 (240);
5435       defaulting_error       EXCEPTION;
5436    BEGIN
5437       /* Set return status to success initially */
5438       x_return_status := FND_API.G_RET_STS_SUCCESS;
5439       x_batch_step := p_batch_step;
5440 
5441       IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5442          gme_debug.put_line (
5443             'Entered into the procedure create_flex_batch_step');
5444       END IF;
5445 
5446       IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5447          gme_debug.put_line ('Check if flexfield is enabled : ' ||desc_flex_name);
5448       END IF;
5449 
5450       OPEN cur_get_appl_id;
5451       FETCH cur_get_appl_id INTO pkg_application_id;
5452       CLOSE cur_get_appl_id;
5453 
5454       IF NOT fnd_flex_apis.is_descr_setup (pkg_application_id, desc_flex_name) THEN
5455          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5456             gme_debug.put_line ('Flexfield is not enabled, No validation required.');
5457          END IF;
5458          RETURN;
5459       END IF;
5460 
5461       l_attribute_category := NVL (x_batch_step.attribute_category, '');
5462       fnd_flex_descval.set_context_value (l_attribute_category);
5463          fnd_flex_descval.set_column_value (
5464             'ATTRIBUTE1',
5465             NVL (x_batch_step.attribute1, ''));
5466          fnd_flex_descval.set_column_value (
5467             'ATTRIBUTE2',
5468             NVL (x_batch_step.attribute2, ''));
5469          fnd_flex_descval.set_column_value (
5470             'ATTRIBUTE3',
5471             NVL (x_batch_step.attribute3, ''));
5472          fnd_flex_descval.set_column_value (
5473             'ATTRIBUTE4',
5474             NVL (x_batch_step.attribute4, ''));
5475          fnd_flex_descval.set_column_value (
5476             'ATTRIBUTE5',
5477             NVL (x_batch_step.attribute5, ''));
5478          fnd_flex_descval.set_column_value (
5479             'ATTRIBUTE6',
5480             NVL (x_batch_step.attribute6, ''));
5481          fnd_flex_descval.set_column_value (
5482             'ATTRIBUTE7',
5483             NVL (x_batch_step.attribute7, ''));
5484          fnd_flex_descval.set_column_value (
5485             'ATTRIBUTE8',
5486             NVL (x_batch_step.attribute8, ''));
5487          fnd_flex_descval.set_column_value (
5488             'ATTRIBUTE9',
5489             NVL (x_batch_step.attribute9, ''));
5490          fnd_flex_descval.set_column_value (
5491             'ATTRIBUTE10',
5492             NVL (x_batch_step.attribute10, ''));
5493          fnd_flex_descval.set_column_value (
5494             'ATTRIBUTE11',
5495             NVL (x_batch_step.attribute11, ''));
5496          fnd_flex_descval.set_column_value (
5497             'ATTRIBUTE12',
5498             NVL (x_batch_step.attribute12, ''));
5499          fnd_flex_descval.set_column_value (
5500             'ATTRIBUTE13',
5501             NVL (x_batch_step.attribute13, ''));
5502          fnd_flex_descval.set_column_value (
5503             'ATTRIBUTE14',
5504             NVL (x_batch_step.attribute14, ''));
5505          fnd_flex_descval.set_column_value (
5506             'ATTRIBUTE15',
5507             NVL (x_batch_step.attribute15, ''));
5508          fnd_flex_descval.set_column_value (
5509             'ATTRIBUTE16',
5510             NVL (x_batch_step.attribute16, ''));
5511          fnd_flex_descval.set_column_value (
5512             'ATTRIBUTE17',
5513             NVL (x_batch_step.attribute17, ''));
5514          fnd_flex_descval.set_column_value (
5515             'ATTRIBUTE18',
5516             NVL (x_batch_step.attribute18, ''));
5517          fnd_flex_descval.set_column_value (
5518             'ATTRIBUTE19',
5519             NVL (x_batch_step.attribute19, ''));
5520          fnd_flex_descval.set_column_value (
5521             'ATTRIBUTE20',
5522             NVL (x_batch_step.attribute20, ''));
5523          fnd_flex_descval.set_column_value (
5524             'ATTRIBUTE21',
5525             NVL (x_batch_step.attribute21, ''));
5526          fnd_flex_descval.set_column_value (
5527             'ATTRIBUTE22',
5528             NVL (x_batch_step.attribute22, ''));
5529          fnd_flex_descval.set_column_value (
5530             'ATTRIBUTE23',
5531             NVL (x_batch_step.attribute23, ''));
5532          fnd_flex_descval.set_column_value (
5533             'ATTRIBUTE24',
5534             NVL (x_batch_step.attribute24, ''));
5535          fnd_flex_descval.set_column_value (
5536             'ATTRIBUTE25',
5537             NVL (x_batch_step.attribute25, ''));
5538          fnd_flex_descval.set_column_value (
5539             'ATTRIBUTE26',
5540             NVL (x_batch_step.attribute26, ''));
5541          fnd_flex_descval.set_column_value (
5542             'ATTRIBUTE27',
5543             NVL (x_batch_step.attribute27, ''));
5544          fnd_flex_descval.set_column_value (
5545             'ATTRIBUTE28',
5546             NVL (x_batch_step.attribute28, ''));
5547          fnd_flex_descval.set_column_value (
5548             'ATTRIBUTE29',
5549             NVL (x_batch_step.attribute29, ''));
5550          fnd_flex_descval.set_column_value (
5551             'ATTRIBUTE30',
5552             NVL (x_batch_step.attribute30, ''));
5553       IF fnd_flex_descval.validate_desccols (
5554             appl_short_name     => appl_short_name,
5555             desc_flex_name      => desc_flex_name,
5556             values_or_ids       => values_or_ids,
5557             validation_date     => validation_date
5558          ) THEN
5559          --SUCCESS
5560          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5561             gme_debug.put_line ('Defaulting Success. ');
5562          END IF;
5563 
5564          x_return_status := FND_API.G_RET_STS_SUCCESS;
5565          n := fnd_flex_descval.segment_count;
5566          /*Now let us copy back the default values returned from the above call */
5567          FOR i IN 1 .. n
5568          LOOP
5569             IF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE_CATEGORY' THEN
5570                x_batch_step.attribute_category := fnd_flex_descval.segment_id(i);
5571             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE1' THEN
5572                x_batch_step.attribute1 := fnd_flex_descval.segment_id (i);
5573             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE2' THEN
5574                x_batch_step.attribute2 := fnd_flex_descval.segment_id (i);
5575             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE3' THEN
5576                x_batch_step.attribute3 := fnd_flex_descval.segment_id (i);
5577             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE4' THEN
5578                x_batch_step.attribute4 := fnd_flex_descval.segment_id (i);
5579             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE5' THEN
5580                x_batch_step.attribute5 := fnd_flex_descval.segment_id (i);
5581             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE6' THEN
5582                x_batch_step.attribute6 := fnd_flex_descval.segment_id (i);
5583             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE7' THEN
5584                x_batch_step.attribute7 := fnd_flex_descval.segment_id (i);
5585             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE8' THEN
5586                x_batch_step.attribute8 := fnd_flex_descval.segment_id (i);
5587             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE9' THEN
5588                x_batch_step.attribute9 := fnd_flex_descval.segment_id (i);
5589             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE10' THEN
5590                x_batch_step.attribute10 := fnd_flex_descval.segment_id (i);
5591             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE11' THEN
5592                x_batch_step.attribute11 := fnd_flex_descval.segment_id (i);
5593             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE12' THEN
5594                x_batch_step.attribute12 := fnd_flex_descval.segment_id (i);
5595             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE13' THEN
5596                x_batch_step.attribute13 := fnd_flex_descval.segment_id (i);
5597             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE14' THEN
5598                x_batch_step.attribute14 := fnd_flex_descval.segment_id (i);
5599             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE15' THEN
5600                x_batch_step.attribute15 := fnd_flex_descval.segment_id (i);
5601             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE16' THEN
5602                x_batch_step.attribute16 := fnd_flex_descval.segment_id (i);
5603             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE17' THEN
5604                x_batch_step.attribute17 := fnd_flex_descval.segment_id (i);
5605             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE18' THEN
5606                x_batch_step.attribute18 := fnd_flex_descval.segment_id (i);
5607             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE19' THEN
5608                x_batch_step.attribute19 := fnd_flex_descval.segment_id (i);
5609             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE20' THEN
5610                x_batch_step.attribute20 := fnd_flex_descval.segment_id (i);
5611             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE21' THEN
5612                x_batch_step.attribute21 := fnd_flex_descval.segment_id (i);
5613             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE22' THEN
5614                x_batch_step.attribute22 := fnd_flex_descval.segment_id (i);
5615             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE23' THEN
5616                x_batch_step.attribute23 := fnd_flex_descval.segment_id (i);
5617             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE24' THEN
5618                x_batch_step.attribute24 := fnd_flex_descval.segment_id (i);
5619             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE25' THEN
5620                x_batch_step.attribute25 := fnd_flex_descval.segment_id (i);
5621             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE26' THEN
5622                x_batch_step.attribute26 := fnd_flex_descval.segment_id (i);
5623             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE27' THEN
5624                x_batch_step.attribute27 := fnd_flex_descval.segment_id (i);
5625             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE28' THEN
5626                x_batch_step.attribute28 := fnd_flex_descval.segment_id (i);
5627             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE29' THEN
5628                x_batch_step.attribute29 := fnd_flex_descval.segment_id (i);
5629             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE30' THEN
5630                x_batch_step.attribute30 := fnd_flex_descval.segment_id (i);
5631             END IF;
5632          END LOOP;
5633       ELSE
5634          error_msg := fnd_flex_descval.error_message;
5635          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5636             gme_debug.put_line ('Defaulting Ends With Error(s) :');
5637             gme_debug.put_line ('Error :' || error_msg);
5638          END IF;
5639          gme_common_pvt.log_message ('FLEX-USER DEFINED ERROR', 'MSG', error_msg);
5640          /* error out based on value global validate flag */
5641         IF gme_common_pvt.g_flex_validate_prof = 1 THEN
5642           IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5643              gme_debug.put_line ('GME Flexfield is enabled, Give the Error.');
5644           END IF;
5645           RAISE defaulting_error;
5646         END IF;
5647       END IF;
5648       IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5649          gme_debug.put_line (
5650             'Defaulting completed for the Flex field : ' || desc_flex_name);
5651       END IF;
5652 
5653    EXCEPTION
5654       WHEN defaulting_error THEN
5655          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5656             gme_debug.put_line (
5657                'Defaulting completed with errors for the Flex field : ' ||desc_flex_name);
5658          END IF;
5659          x_return_status := FND_API.G_RET_STS_ERROR;
5660       WHEN OTHERS THEN
5661         IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
5662           gme_debug.put_line (g_pkg_name||'.'||desc_flex_name||': '||'in unexpected error');
5663         END IF;
5664         x_return_status := FND_API.g_ret_sts_unexp_error;
5665         fnd_msg_pub.add_exc_msg (g_pkg_name, desc_flex_name);
5666    END create_flex_batch_step;
5667    /*======================================================================
5668    -- NAME
5669    -- create_flex_step_activities
5670    --
5671    -- DESCRIPTION
5672    --    This procedure will assign the default values of the segments into the columns.
5673    -- SYNOPSIS:
5674 
5675      create_flex_step_activities (
5676                  p_step_activities   IN              gme_batch_step_activities%ROWTYPE,
5677                  x_step_activities   IN OUT NOCOPY   gme_batch_step_activities%ROWTYPE,
5678                  x_return_status   OUT NOCOPY      VARCHAR2
5679    -- HISTORY
5680    -- K.Swapna    07-MAR-2005     Created --BUG#4050727
5681    --K Swapna Bug#4257930   25-MAY-2005
5682      Changed the whole logic by adding the function call,
5683      fnd_flex_descval.validate_desccols with the parameter,values_or_ids as 'D'
5684      and erroring out from the procedure based on global validate flag
5685    ======================================================================= */
5686      PROCEDURE create_flex_step_activities (
5687       p_step_activities   IN              gme_batch_step_activities%ROWTYPE,
5688       x_step_activities   IN OUT NOCOPY   gme_batch_step_activities%ROWTYPE,
5689       x_return_status   OUT NOCOPY      VARCHAR2
5690      ) IS
5691       appl_short_name        VARCHAR2 (30)              := 'GME';
5692       desc_flex_name         VARCHAR2 (30)              := 'GME_BATCH_STEP_ACTIVITIES_FLEX';
5693       values_or_ids          VARCHAR2 (10)              := 'D';
5694       validation_date        DATE                       := SYSDATE;
5695       error_msg              VARCHAR2 (5000);
5696       n                      NUMBER := 0;
5697       l_attribute_category   VARCHAR2 (240);
5698       defaulting_error       EXCEPTION;
5699    BEGIN
5700       /* Set return status to success initially */
5701       x_return_status := FND_API.G_RET_STS_SUCCESS;
5702       x_step_activities :=  p_step_activities;
5703 
5704       IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5705          gme_debug.put_line (
5706             'Entered into the procedure create_flex_step_activities');
5707       END IF;
5708 
5709       IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5710          gme_debug.put_line ('Check if flexfield is enabled : ' ||desc_flex_name);
5711       END IF;
5712 
5713       OPEN cur_get_appl_id;
5714       FETCH cur_get_appl_id INTO pkg_application_id;
5715       CLOSE cur_get_appl_id;
5716 
5717       IF NOT fnd_flex_apis.is_descr_setup (pkg_application_id, desc_flex_name) THEN
5718          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5719             gme_debug.put_line ('Flexfield is not enabled, No validation required.');
5720          END IF;
5721          RETURN;
5722       END IF;
5723       l_attribute_category := NVL (x_step_activities.attribute_category, '');
5724       fnd_flex_descval.set_context_value (l_attribute_category);
5725          fnd_flex_descval.set_column_value (
5726             'ATTRIBUTE1',
5727             NVL (x_step_activities.attribute1, ''));
5728          fnd_flex_descval.set_column_value (
5729             'ATTRIBUTE2',
5730             NVL (x_step_activities.attribute2, ''));
5731          fnd_flex_descval.set_column_value (
5732             'ATTRIBUTE3',
5733             NVL (x_step_activities.attribute3, ''));
5734          fnd_flex_descval.set_column_value (
5735             'ATTRIBUTE4',
5736             NVL (x_step_activities.attribute4, ''));
5737          fnd_flex_descval.set_column_value (
5738             'ATTRIBUTE5',
5739             NVL (x_step_activities.attribute5, ''));
5740          fnd_flex_descval.set_column_value (
5741             'ATTRIBUTE6',
5742             NVL (x_step_activities.attribute6, ''));
5743          fnd_flex_descval.set_column_value (
5744             'ATTRIBUTE7',
5745             NVL (x_step_activities.attribute7, ''));
5746          fnd_flex_descval.set_column_value (
5747             'ATTRIBUTE8',
5748             NVL (x_step_activities.attribute8, ''));
5749          fnd_flex_descval.set_column_value (
5750             'ATTRIBUTE9',
5751             NVL (x_step_activities.attribute9, ''));
5752          fnd_flex_descval.set_column_value (
5753             'ATTRIBUTE10',
5754             NVL (x_step_activities.attribute10, ''));
5755          fnd_flex_descval.set_column_value (
5756             'ATTRIBUTE11',
5757             NVL (x_step_activities.attribute11, ''));
5758          fnd_flex_descval.set_column_value (
5759             'ATTRIBUTE12',
5760             NVL (x_step_activities.attribute12, ''));
5761          fnd_flex_descval.set_column_value (
5762             'ATTRIBUTE13',
5763             NVL (x_step_activities.attribute13, ''));
5764          fnd_flex_descval.set_column_value (
5765             'ATTRIBUTE14',
5766             NVL (x_step_activities.attribute14, ''));
5767          fnd_flex_descval.set_column_value (
5768             'ATTRIBUTE15',
5769             NVL (x_step_activities.attribute15, ''));
5770          fnd_flex_descval.set_column_value (
5771             'ATTRIBUTE16',
5772             NVL (x_step_activities.attribute16, ''));
5773          fnd_flex_descval.set_column_value (
5774             'ATTRIBUTE17',
5775             NVL (x_step_activities.attribute17, ''));
5776          fnd_flex_descval.set_column_value (
5777             'ATTRIBUTE18',
5778             NVL (x_step_activities.attribute18, ''));
5779          fnd_flex_descval.set_column_value (
5780             'ATTRIBUTE19',
5781             NVL (x_step_activities.attribute19, ''));
5782          fnd_flex_descval.set_column_value (
5783             'ATTRIBUTE20',
5784             NVL (x_step_activities.attribute20, ''));
5785          fnd_flex_descval.set_column_value (
5786             'ATTRIBUTE21',
5787             NVL (x_step_activities.attribute21, ''));
5788          fnd_flex_descval.set_column_value (
5789             'ATTRIBUTE22',
5790             NVL (x_step_activities.attribute22, ''));
5791          fnd_flex_descval.set_column_value (
5792             'ATTRIBUTE23',
5793             NVL (x_step_activities.attribute23, ''));
5794          fnd_flex_descval.set_column_value (
5795             'ATTRIBUTE24',
5796             NVL (x_step_activities.attribute24, ''));
5797          fnd_flex_descval.set_column_value (
5798             'ATTRIBUTE25',
5799             NVL (x_step_activities.attribute25, ''));
5800          fnd_flex_descval.set_column_value (
5801             'ATTRIBUTE26',
5802             NVL (x_step_activities.attribute26, ''));
5803          fnd_flex_descval.set_column_value (
5804             'ATTRIBUTE27',
5805             NVL (x_step_activities.attribute27, ''));
5806          fnd_flex_descval.set_column_value (
5807             'ATTRIBUTE28',
5808             NVL (x_step_activities.attribute28, ''));
5809          fnd_flex_descval.set_column_value (
5810             'ATTRIBUTE29',
5811             NVL (x_step_activities.attribute29, ''));
5812          fnd_flex_descval.set_column_value (
5813             'ATTRIBUTE30',
5814             NVL (x_step_activities.attribute30, ''));
5815       IF fnd_flex_descval.validate_desccols (
5816             appl_short_name     => appl_short_name,
5817             desc_flex_name      => desc_flex_name,
5818             values_or_ids       => values_or_ids,
5819             validation_date     => validation_date
5820          ) THEN
5821          --SUCCESS
5822          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5823             gme_debug.put_line ('Defaulting Success. ');
5824          END IF;
5825 
5826          x_return_status := FND_API.G_RET_STS_SUCCESS;
5827          n := fnd_flex_descval.segment_count;
5828          /*Now let us copy back the default values returned from the above call */
5829          FOR i IN 1 .. n
5830          LOOP
5831             IF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE_CATEGORY' THEN
5832                x_step_activities.attribute_category :=fnd_flex_descval.segment_id (i);
5833             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE1' THEN
5834                x_step_activities.attribute1 := fnd_flex_descval.segment_id (i);
5835             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE2' THEN
5836                x_step_activities.attribute2 := fnd_flex_descval.segment_id (i);
5837             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE3' THEN
5838                x_step_activities.attribute3 := fnd_flex_descval.segment_id (i);
5839             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE4' THEN
5840                x_step_activities.attribute4 := fnd_flex_descval.segment_id (i);
5841             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE5' THEN
5842                x_step_activities.attribute5 := fnd_flex_descval.segment_id (i);
5843             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE6' THEN
5844                x_step_activities.attribute6 := fnd_flex_descval.segment_id (i);
5845             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE7' THEN
5846                x_step_activities.attribute7 := fnd_flex_descval.segment_id (i);
5847             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE8' THEN
5848                x_step_activities.attribute8 := fnd_flex_descval.segment_id (i);
5849             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE9' THEN
5850                x_step_activities.attribute9 := fnd_flex_descval.segment_id (i);
5851             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE10' THEN
5852                x_step_activities.attribute10 := fnd_flex_descval.segment_id (i);
5853             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE11' THEN
5854                x_step_activities.attribute11 := fnd_flex_descval.segment_id (i);
5855             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE12' THEN
5856                x_step_activities.attribute12 := fnd_flex_descval.segment_id (i);
5857             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE13' THEN
5858                x_step_activities.attribute13 := fnd_flex_descval.segment_id (i);
5859             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE14' THEN
5860                x_step_activities.attribute14 := fnd_flex_descval.segment_id (i);
5861             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE15' THEN
5862                x_step_activities.attribute15 := fnd_flex_descval.segment_id (i);
5863             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE16' THEN
5864                x_step_activities.attribute16 := fnd_flex_descval.segment_id (i);
5865             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE17' THEN
5866                x_step_activities.attribute17 := fnd_flex_descval.segment_id (i);
5867             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE18' THEN
5868                x_step_activities.attribute18 := fnd_flex_descval.segment_id (i);
5869             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE19' THEN
5870                x_step_activities.attribute19 := fnd_flex_descval.segment_id (i);
5871             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE20' THEN
5872                x_step_activities.attribute20 := fnd_flex_descval.segment_id (i);
5873             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE21' THEN
5874                x_step_activities.attribute21 := fnd_flex_descval.segment_id (i);
5875             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE22' THEN
5876                x_step_activities.attribute22 := fnd_flex_descval.segment_id (i);
5877             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE23' THEN
5878                x_step_activities.attribute23 := fnd_flex_descval.segment_id (i);
5879             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE24' THEN
5880                x_step_activities.attribute24 := fnd_flex_descval.segment_id (i);
5881             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE25' THEN
5882                x_step_activities.attribute25 := fnd_flex_descval.segment_id (i);
5883             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE26' THEN
5884                x_step_activities.attribute26 := fnd_flex_descval.segment_id (i);
5885             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE27' THEN
5886                x_step_activities.attribute27 := fnd_flex_descval.segment_id (i);
5887             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE28' THEN
5888                x_step_activities.attribute28 := fnd_flex_descval.segment_id (i);
5889             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE29' THEN
5890                x_step_activities.attribute29 := fnd_flex_descval.segment_id (i);
5891             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE30' THEN
5892                x_step_activities.attribute30 := fnd_flex_descval.segment_id (i);
5893             END IF;
5894          END LOOP;
5895       ELSE
5896          error_msg := fnd_flex_descval.error_message;
5897          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5898             gme_debug.put_line ('Defaulting Ends With Error(s) :');
5899             gme_debug.put_line ('Error :' || error_msg);
5900          END IF;
5901          gme_common_pvt.log_message ('FLEX-USER DEFINED ERROR', 'MSG', error_msg);
5902         /* error out based on global validate flag*/
5903         IF gme_common_pvt.g_flex_validate_prof = 1 THEN
5904           IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5905              gme_debug.put_line ('GME Flexfield is enabled, Give the Error.');
5906           END IF;
5907           RAISE defaulting_error;
5908         END IF;
5909       END IF;
5910 
5911       IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5912          gme_debug.put_line (
5913             'Defaulting completed for the Flex field : ' || desc_flex_name);
5914       END IF;
5915    EXCEPTION
5916       WHEN defaulting_error THEN
5917          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5918             gme_debug.put_line (
5919                'Defaulting completed with errors for the Flex field : ' ||desc_flex_name);
5920          END IF;
5921          x_return_status := FND_API.G_RET_STS_ERROR;
5922       WHEN OTHERS THEN
5923         IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
5924           gme_debug.put_line (g_pkg_name||'.'||desc_flex_name||': '||'in unexpected error');
5925         END IF;
5926         x_return_status := FND_API.g_ret_sts_unexp_error;
5927         fnd_msg_pub.add_exc_msg (g_pkg_name, desc_flex_name);
5928    END create_flex_step_activities;
5929 
5930    /*======================================================================
5931   -- NAME
5932   -- create_flex_step_resources
5933   --
5934   -- DESCRIPTION
5935   --    This procedure will assign the default values of the segments into the columns.
5936   -- SYNOPSIS:
5937 
5938       create_flex_step_resources (
5939                 p_step_resources   IN              gme_batch_step_resources%ROWTYPE,
5940                 x_step_resources   IN OUT NOCOPY   gme_batch_step_resources%ROWTYPE,
5941                 x_return_status   OUT NOCOPY      VARCHAR2);
5942   -- HISTORY
5943   -- K.Swapna    07-MAR-2005     Created --BUG#4050727
5944   --K Swapna Bug#4257930   25-MAY-2005
5945     Changed the whole logic by adding the function call,
5946      fnd_flex_descval.validate_desccols with the parameter,values_or_ids as 'D'
5947      and erroring out from the procedure based on global validate flag
5948   ======================================================================= */
5949      PROCEDURE create_flex_step_resources (
5950       p_step_resources   IN              gme_batch_step_resources%ROWTYPE,
5951       x_step_resources   IN OUT NOCOPY   gme_batch_step_resources%ROWTYPE,
5952       x_return_status   OUT NOCOPY      VARCHAR2
5953      ) IS
5954       appl_short_name        VARCHAR2 (30)              := 'GME';
5955       desc_flex_name         VARCHAR2 (30)              := 'GME_BATCH_STEP_RESOURCES_FLEX';
5956       values_or_ids          VARCHAR2 (10)              := 'D';
5957       validation_date        DATE                       := SYSDATE;
5958       error_msg              VARCHAR2 (5000);
5959       n                      NUMBER := 0;
5960       l_attribute_category   VARCHAR2 (240);
5961       defaulting_error       EXCEPTION;
5962    BEGIN
5963       /* Set return status to success initially */
5964       x_return_status := FND_API.G_RET_STS_SUCCESS;
5965       x_step_resources :=  p_step_resources;
5966 
5967       IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5968          gme_debug.put_line (
5969             'Entered into the procedure create_flex_step_resources');
5970       END IF;
5971 
5972       IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5973          gme_debug.put_line ('Check if flexfield is enabled : ' ||desc_flex_name);
5974       END IF;
5975 
5976       OPEN cur_get_appl_id;
5977       FETCH cur_get_appl_id INTO pkg_application_id;
5978       CLOSE cur_get_appl_id;
5979 
5980       IF NOT fnd_flex_apis.is_descr_setup (pkg_application_id, desc_flex_name) THEN
5981          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
5982             gme_debug.put_line ('Flexfield is not enabled, No validation required.');
5983          END IF;
5984          RETURN;
5985       END IF;
5986       l_attribute_category := NVL (x_step_resources.attribute_category, '');
5987       fnd_flex_descval.set_context_value (l_attribute_category);
5988          fnd_flex_descval.set_column_value (
5989             'ATTRIBUTE1',
5990             NVL (x_step_resources.attribute1, ''));
5991          fnd_flex_descval.set_column_value (
5992             'ATTRIBUTE2',
5993             NVL (x_step_resources.attribute2, ''));
5994 
5995          fnd_flex_descval.set_column_value (
5996             'ATTRIBUTE3',
5997             NVL (x_step_resources.attribute3, ''));
5998 
5999          fnd_flex_descval.set_column_value (
6000             'ATTRIBUTE4',
6001             NVL (x_step_resources.attribute4, ''));
6002          fnd_flex_descval.set_column_value (
6003             'ATTRIBUTE5',
6004             NVL (x_step_resources.attribute5, ''));
6005          fnd_flex_descval.set_column_value (
6006             'ATTRIBUTE6',
6007             NVL (x_step_resources.attribute6, ''));
6008          fnd_flex_descval.set_column_value (
6009             'ATTRIBUTE7',
6010             NVL (x_step_resources.attribute7, ''));
6011          fnd_flex_descval.set_column_value (
6012             'ATTRIBUTE8',
6013             NVL (x_step_resources.attribute8, ''));
6014          fnd_flex_descval.set_column_value (
6015             'ATTRIBUTE9',
6016             NVL (x_step_resources.attribute9, ''));
6017          fnd_flex_descval.set_column_value (
6018             'ATTRIBUTE10',
6019             NVL (x_step_resources.attribute10, ''));
6020          fnd_flex_descval.set_column_value (
6021             'ATTRIBUTE11',
6022             NVL (x_step_resources.attribute11, ''));
6023          fnd_flex_descval.set_column_value (
6024             'ATTRIBUTE12',
6025             NVL (x_step_resources.attribute12, ''));
6026          fnd_flex_descval.set_column_value (
6027             'ATTRIBUTE13',
6028             NVL (x_step_resources.attribute13, ''));
6029          fnd_flex_descval.set_column_value (
6030             'ATTRIBUTE14',
6031             NVL (x_step_resources.attribute14, ''));
6032          fnd_flex_descval.set_column_value (
6033             'ATTRIBUTE15',
6034             NVL (x_step_resources.attribute15, ''));
6035          fnd_flex_descval.set_column_value (
6036             'ATTRIBUTE16',
6037             NVL (x_step_resources.attribute16, ''));
6038          fnd_flex_descval.set_column_value (
6039             'ATTRIBUTE17',
6040             NVL (x_step_resources.attribute17, ''));
6041          fnd_flex_descval.set_column_value (
6042             'ATTRIBUTE18',
6043             NVL (x_step_resources.attribute18, ''));
6044          fnd_flex_descval.set_column_value (
6045             'ATTRIBUTE19',
6046             NVL (x_step_resources.attribute19, ''));
6047          fnd_flex_descval.set_column_value (
6048             'ATTRIBUTE20',
6049             NVL (x_step_resources.attribute20, ''));
6050          fnd_flex_descval.set_column_value (
6051             'ATTRIBUTE21',
6052             NVL (x_step_resources.attribute21, ''));
6053          fnd_flex_descval.set_column_value (
6054             'ATTRIBUTE22',
6055             NVL (x_step_resources.attribute22, ''));
6056          fnd_flex_descval.set_column_value (
6057             'ATTRIBUTE23',
6058             NVL (x_step_resources.attribute23, ''));
6059          fnd_flex_descval.set_column_value (
6060             'ATTRIBUTE24',
6061             NVL (x_step_resources.attribute24, ''));
6062          fnd_flex_descval.set_column_value (
6063             'ATTRIBUTE25',
6064             NVL (x_step_resources.attribute25, ''));
6065          fnd_flex_descval.set_column_value (
6066             'ATTRIBUTE26',
6067             NVL (x_step_resources.attribute26, ''));
6068          fnd_flex_descval.set_column_value (
6069             'ATTRIBUTE27',
6070             NVL (x_step_resources.attribute27, ''));
6071          fnd_flex_descval.set_column_value (
6072             'ATTRIBUTE28',
6073             NVL (x_step_resources.attribute28, ''));
6074          fnd_flex_descval.set_column_value (
6075             'ATTRIBUTE29',
6076             NVL (x_step_resources.attribute29, ''));
6077          fnd_flex_descval.set_column_value (
6078             'ATTRIBUTE30',
6079             NVL (x_step_resources.attribute30, ''));
6080       IF fnd_flex_descval.validate_desccols (
6081             appl_short_name     => appl_short_name,
6082             desc_flex_name      => desc_flex_name,
6083             values_or_ids       => values_or_ids,
6084             validation_date     => validation_date
6085          ) THEN
6086          --SUCCESS
6087          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6088             gme_debug.put_line ('Defaulting Success. ');
6089          END IF;
6090 
6091          x_return_status := FND_API.G_RET_STS_SUCCESS;
6092          n := fnd_flex_descval.segment_count;
6093          /*Now let us copy back the default values returned from the above call */
6094          FOR i IN 1 .. n
6095          LOOP
6096             IF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE_CATEGORY' THEN
6097                x_step_resources.attribute_category := fnd_flex_descval.segment_id (i);
6098             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE1' THEN
6099                x_step_resources.attribute1 := fnd_flex_descval.segment_id (i);
6100             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE2' THEN
6101                x_step_resources.attribute2 := fnd_flex_descval.segment_id (i);
6102             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE3' THEN
6103                x_step_resources.attribute3 := fnd_flex_descval.segment_id (i);
6104             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE4' THEN
6105                x_step_resources.attribute4 := fnd_flex_descval.segment_id (i);
6106             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE5' THEN
6107                x_step_resources.attribute5 := fnd_flex_descval.segment_id (i);
6108             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE6' THEN
6109                x_step_resources.attribute6 := fnd_flex_descval.segment_id (i);
6110             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE7' THEN
6111                x_step_resources.attribute7 := fnd_flex_descval.segment_id (i);
6112             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE8' THEN
6113                x_step_resources.attribute8 := fnd_flex_descval.segment_id (i);
6114             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE9' THEN
6115                x_step_resources.attribute9 := fnd_flex_descval.segment_id (i);
6116             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE10' THEN
6117                x_step_resources.attribute10 := fnd_flex_descval.segment_id (i);
6118             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE11' THEN
6119                x_step_resources.attribute11 := fnd_flex_descval.segment_id (i);
6120             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE12' THEN
6121                x_step_resources.attribute12 := fnd_flex_descval.segment_id (i);
6122             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE13' THEN
6123                x_step_resources.attribute13 := fnd_flex_descval.segment_id (i);
6124             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE14' THEN
6125                x_step_resources.attribute14 := fnd_flex_descval.segment_id (i);
6126             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE15' THEN
6127                x_step_resources.attribute15 := fnd_flex_descval.segment_id (i);
6128             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE16' THEN
6129                x_step_resources.attribute16 := fnd_flex_descval.segment_id (i);
6130             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE17' THEN
6131                x_step_resources.attribute17 := fnd_flex_descval.segment_id (i);
6132             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE18' THEN
6133                x_step_resources.attribute18 := fnd_flex_descval.segment_id (i);
6134             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE19' THEN
6135                x_step_resources.attribute19 := fnd_flex_descval.segment_id (i);
6136             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE20' THEN
6137                x_step_resources.attribute20 := fnd_flex_descval.segment_id (i);
6138             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE21' THEN
6139                x_step_resources.attribute21 := fnd_flex_descval.segment_id (i);
6140             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE22' THEN
6141                x_step_resources.attribute22 := fnd_flex_descval.segment_id (i);
6142             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE23' THEN
6143                x_step_resources.attribute23 := fnd_flex_descval.segment_id (i);
6144             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE24' THEN
6145                x_step_resources.attribute24 := fnd_flex_descval.segment_id (i);
6146             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE25' THEN
6147                x_step_resources.attribute25 := fnd_flex_descval.segment_id (i);
6148             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE26' THEN
6149                x_step_resources.attribute26 := fnd_flex_descval.segment_id (i);
6150             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE27' THEN
6151                x_step_resources.attribute27 := fnd_flex_descval.segment_id (i);
6152             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE28' THEN
6153                x_step_resources.attribute28 := fnd_flex_descval.segment_id (i);
6154             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE29' THEN
6155                x_step_resources.attribute29 := fnd_flex_descval.segment_id (i);
6156             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE30' THEN
6157                x_step_resources.attribute30 := fnd_flex_descval.segment_id (i);
6158             END IF;
6159          END LOOP;
6160       ELSE
6161          error_msg := fnd_flex_descval.error_message;
6162          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6163             gme_debug.put_line ('Defaulting Ends With Error(s) :');
6164             gme_debug.put_line ('Error :' || error_msg);
6165          END IF;
6166          gme_common_pvt.log_message ('FLEX-USER DEFINED ERROR', 'MSG', error_msg);
6167          /* error out based on global validate flag */
6168         IF gme_common_pvt.g_flex_validate_prof = 1 THEN
6169           IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6170              gme_debug.put_line ('GME Flexfield is enabled, Give the Error.');
6171           END IF;
6172           RAISE defaulting_error;
6173         END IF;
6174       END IF;
6175 
6176       IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6177          gme_debug.put_line (
6178             'Defaulting completed for the Flex field : ' || desc_flex_name);
6179       END IF;
6180    EXCEPTION
6181       WHEN defaulting_error THEN
6182          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6183             gme_debug.put_line (
6184                'Defaulting completed with errors for the Flex field : ' ||desc_flex_name);
6185          END IF;
6186          x_return_status := FND_API.G_RET_STS_ERROR;
6187       WHEN OTHERS THEN
6188         IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
6189           gme_debug.put_line (g_pkg_name||'.'||desc_flex_name||': '||'in unexpected error');
6190         END IF;
6191         x_return_status := FND_API.g_ret_sts_unexp_error;
6192         fnd_msg_pub.add_exc_msg (g_pkg_name, desc_flex_name);
6193    END create_flex_step_resources;
6194 
6195    /*======================================================================
6196     -- NAME
6197     -- create_flex_process_param
6198     --
6199     -- DESCRIPTION
6200     --    This procedure will assign the default values of the segments into the columns.
6201     -- SYNOPSIS:
6202        create_flex_process_param (
6203                 p_process_param_rec   IN              gme_process_parameters%ROWTYPE,
6204                 x_process_param_rec   IN OUT NOCOPY   gme_process_parameters%ROWTYPE,
6205                 x_return_status   OUT NOCOPY      VARCHAR2
6206     -- HISTORY
6207     -- K.Swapna    07-MAR-2005     Created --BUG#4050727
6208     -- K Swapna Bug#4257930   25-MAY-2005
6209        Changed the whole logic by adding the function call,
6210        fnd_flex_descval.validate_desccols with the parameter,values_or_ids as 'D'
6211        and erroring out from the procedure based on profile, GME:Validate Flex on sertver.
6212   ======================================================================= */
6213   PROCEDURE create_flex_process_param (
6214       p_process_param_rec   IN              gme_process_parameters%ROWTYPE,
6215       x_process_param_rec   IN OUT NOCOPY   gme_process_parameters%ROWTYPE,
6216       x_return_status   OUT NOCOPY      VARCHAR2
6217    ) IS
6218       appl_short_name        VARCHAR2 (30)              := 'GME';
6219       desc_flex_name         VARCHAR2 (30)              := 'GME_BATCH_PROC_PARAM_FLEX';
6220       values_or_ids          VARCHAR2 (10)              := 'D';
6221       validation_date        DATE                       := SYSDATE;
6222       error_msg              VARCHAR2 (5000);
6223       n                      NUMBER := 0;
6224       l_attribute_category   VARCHAR2 (240);
6225       defaulting_error       EXCEPTION;
6226    BEGIN
6227       /* Set return status to success initially */
6228       x_return_status := FND_API.G_RET_STS_SUCCESS;
6229       x_process_param_rec :=  p_process_param_rec;
6230 
6231       IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6232          gme_debug.put_line (
6233             'Entered into the procedure create_flex_process_param');
6234       END IF;
6235 
6236       IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6237          gme_debug.put_line ('Check if flexfield is enabled : ' ||desc_flex_name);
6238       END IF;
6239 
6240       OPEN cur_get_appl_id;
6241       FETCH cur_get_appl_id INTO pkg_application_id;
6242       CLOSE cur_get_appl_id;
6243 
6244       IF NOT fnd_flex_apis.is_descr_setup (pkg_application_id, desc_flex_name) THEN
6245          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6246             gme_debug.put_line ('Flexfield is not enabled, No validation required.');
6247          END IF;
6248          RETURN;
6249       END IF;
6250       l_attribute_category := NVL (x_process_param_rec.attribute_category, '');
6251       fnd_flex_descval.set_context_value (l_attribute_category);
6252          fnd_flex_descval.set_column_value (
6253             'ATTRIBUTE1',
6254             NVL (x_process_param_rec.attribute1, ''));
6255          fnd_flex_descval.set_column_value (
6256             'ATTRIBUTE2',
6257             NVL (x_process_param_rec.attribute2, ''));
6258 
6259          fnd_flex_descval.set_column_value (
6260             'ATTRIBUTE3',
6261             NVL (x_process_param_rec.attribute3, ''));
6262 
6263          fnd_flex_descval.set_column_value (
6264             'ATTRIBUTE4',
6265             NVL (x_process_param_rec.attribute4, ''));
6266          fnd_flex_descval.set_column_value (
6267             'ATTRIBUTE5',
6268             NVL (x_process_param_rec.attribute5, ''));
6269          fnd_flex_descval.set_column_value (
6270             'ATTRIBUTE6',
6271             NVL (x_process_param_rec.attribute6, ''));
6272          fnd_flex_descval.set_column_value (
6273             'ATTRIBUTE7',
6274             NVL (x_process_param_rec.attribute7, ''));
6275          fnd_flex_descval.set_column_value (
6276             'ATTRIBUTE8',
6277             NVL (x_process_param_rec.attribute8, ''));
6278          fnd_flex_descval.set_column_value (
6279             'ATTRIBUTE9',
6280             NVL (x_process_param_rec.attribute9, ''));
6281          fnd_flex_descval.set_column_value (
6282             'ATTRIBUTE10',
6283             NVL (x_process_param_rec.attribute10, ''));
6284          fnd_flex_descval.set_column_value (
6285             'ATTRIBUTE11',
6286             NVL (x_process_param_rec.attribute11, ''));
6287          fnd_flex_descval.set_column_value (
6288             'ATTRIBUTE12',
6289             NVL (x_process_param_rec.attribute12, ''));
6290          fnd_flex_descval.set_column_value (
6291             'ATTRIBUTE13',
6292             NVL (x_process_param_rec.attribute13, ''));
6293          fnd_flex_descval.set_column_value (
6294             'ATTRIBUTE14',
6295             NVL (x_process_param_rec.attribute14, ''));
6296          fnd_flex_descval.set_column_value (
6297             'ATTRIBUTE15',
6298             NVL (x_process_param_rec.attribute15, ''));
6299          fnd_flex_descval.set_column_value (
6300             'ATTRIBUTE16',
6301             NVL (x_process_param_rec.attribute16, ''));
6302          fnd_flex_descval.set_column_value (
6303             'ATTRIBUTE17',
6304             NVL (x_process_param_rec.attribute17, ''));
6305          fnd_flex_descval.set_column_value (
6306             'ATTRIBUTE18',
6307             NVL (x_process_param_rec.attribute18, ''));
6308          fnd_flex_descval.set_column_value (
6309             'ATTRIBUTE19',
6310             NVL (x_process_param_rec.attribute19, ''));
6311          fnd_flex_descval.set_column_value (
6312             'ATTRIBUTE20',
6313             NVL (x_process_param_rec.attribute20, ''));
6314          fnd_flex_descval.set_column_value (
6315             'ATTRIBUTE21',
6316             NVL (x_process_param_rec.attribute21, ''));
6317          fnd_flex_descval.set_column_value (
6318             'ATTRIBUTE22',
6319             NVL (x_process_param_rec.attribute22, ''));
6320          fnd_flex_descval.set_column_value (
6321             'ATTRIBUTE23',
6322             NVL (x_process_param_rec.attribute23, ''));
6323          fnd_flex_descval.set_column_value (
6324             'ATTRIBUTE24',
6325             NVL (x_process_param_rec.attribute24, ''));
6326          fnd_flex_descval.set_column_value (
6327             'ATTRIBUTE25',
6328             NVL (x_process_param_rec.attribute25, ''));
6329          fnd_flex_descval.set_column_value (
6330             'ATTRIBUTE26',
6331             NVL (x_process_param_rec.attribute26, ''));
6332          fnd_flex_descval.set_column_value (
6333             'ATTRIBUTE27',
6334             NVL (x_process_param_rec.attribute27, ''));
6335          fnd_flex_descval.set_column_value (
6336             'ATTRIBUTE28',
6337             NVL (x_process_param_rec.attribute28, ''));
6338          fnd_flex_descval.set_column_value (
6339             'ATTRIBUTE29',
6340             NVL (x_process_param_rec.attribute29, ''));
6341          fnd_flex_descval.set_column_value (
6342             'ATTRIBUTE30',
6343             NVL (x_process_param_rec.attribute30, ''));
6344       IF fnd_flex_descval.validate_desccols (
6345             appl_short_name     => appl_short_name,
6346             desc_flex_name      => desc_flex_name,
6347             values_or_ids       => values_or_ids,
6348             validation_date     => validation_date
6349          ) THEN
6350          --SUCCESS
6351          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6352             gme_debug.put_line ('Defaulting Success. ');
6353          END IF;
6354 
6355          x_return_status := FND_API.G_RET_STS_SUCCESS;
6356          n := fnd_flex_descval.segment_count;
6357          /*Now let us copy back the default values returned from the above call */
6358          FOR i IN 1 .. n
6359          LOOP
6360             IF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE_CATEGORY' THEN
6361                x_process_param_rec.attribute_category := fnd_flex_descval.segment_id(i);
6362             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE1' THEN
6363                x_process_param_rec.attribute1 := fnd_flex_descval.segment_id(i);
6364             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE2' THEN
6365                x_process_param_rec.attribute2 := fnd_flex_descval.segment_id(i);
6366             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE3' THEN
6367                x_process_param_rec.attribute3 := fnd_flex_descval.segment_id(i);
6368             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE4' THEN
6369                x_process_param_rec.attribute4 := fnd_flex_descval.segment_id(i);
6370             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE5' THEN
6371                x_process_param_rec.attribute5 := fnd_flex_descval.segment_id(i);
6372             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE6' THEN
6373                x_process_param_rec.attribute6 := fnd_flex_descval.segment_id(i);
6374             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE7' THEN
6375                x_process_param_rec.attribute7 := fnd_flex_descval.segment_id(i);
6376             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE8' THEN
6377                x_process_param_rec.attribute8 := fnd_flex_descval.segment_id(i);
6378             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE9' THEN
6379                x_process_param_rec.attribute9 := fnd_flex_descval.segment_id(i);
6380             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE10' THEN
6381                x_process_param_rec.attribute10 := fnd_flex_descval.segment_id(i);
6382             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE11' THEN
6383                x_process_param_rec.attribute11 := fnd_flex_descval.segment_id(i);
6384             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE12' THEN
6385                x_process_param_rec.attribute12 := fnd_flex_descval.segment_id(i);
6386             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE13' THEN
6387                x_process_param_rec.attribute13 := fnd_flex_descval.segment_id(i);
6388             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE14' THEN
6389                x_process_param_rec.attribute14 := fnd_flex_descval.segment_id(i);
6390             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE15' THEN
6391                x_process_param_rec.attribute15 := fnd_flex_descval.segment_id(i);
6392             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE16' THEN
6393                x_process_param_rec.attribute16 := fnd_flex_descval.segment_id(i);
6394             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE17' THEN
6395                x_process_param_rec.attribute17 := fnd_flex_descval.segment_id(i);
6396             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE18' THEN
6397                x_process_param_rec.attribute18 := fnd_flex_descval.segment_id(i);
6398             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE19' THEN
6399                x_process_param_rec.attribute19 := fnd_flex_descval.segment_id(i);
6400             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE20' THEN
6401                x_process_param_rec.attribute20 := fnd_flex_descval.segment_id(i);
6402             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE21' THEN
6403                x_process_param_rec.attribute21 := fnd_flex_descval.segment_id(i);
6404             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE22' THEN
6405                x_process_param_rec.attribute22 := fnd_flex_descval.segment_id(i);
6406             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE23' THEN
6407                x_process_param_rec.attribute23 := fnd_flex_descval.segment_id(i);
6408             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE24' THEN
6409                x_process_param_rec.attribute24 := fnd_flex_descval.segment_id(i);
6410             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE25' THEN
6411                x_process_param_rec.attribute25 := fnd_flex_descval.segment_id(i);
6412             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE26' THEN
6413                x_process_param_rec.attribute26 := fnd_flex_descval.segment_id(i);
6414             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE27' THEN
6415                x_process_param_rec.attribute27 := fnd_flex_descval.segment_id(i);
6416             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE28' THEN
6417                x_process_param_rec.attribute28 := fnd_flex_descval.segment_id(i);
6418             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE29' THEN
6419                x_process_param_rec.attribute29 := fnd_flex_descval.segment_id(i);
6420             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE30' THEN
6421                x_process_param_rec.attribute30 := fnd_flex_descval.segment_id(i);
6422             END IF;
6423          END LOOP;
6424       ELSE
6425          error_msg := fnd_flex_descval.error_message;
6426          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6427             gme_debug.put_line ('Defaulting Ends With Error(s) :');
6428             gme_debug.put_line ('Error :' || error_msg);
6429          END IF;
6430         gme_common_pvt.log_message ('FLEX-USER DEFINED ERROR', 'MSG', error_msg);
6431         /* error out based on global validate flag */
6432         IF gme_common_pvt.g_flex_validate_prof = 1 THEN
6433           IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6434              gme_debug.put_line ('GME Flexfield is enabled, Give the Error.');
6435           END IF;
6436           RAISE defaulting_error;
6437         END IF;
6438       END IF;
6439       IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6440          gme_debug.put_line (
6441             'Defaulting completed for the Flex field : ' || desc_flex_name);
6442       END IF;
6443    EXCEPTION
6444       WHEN defaulting_error THEN
6445          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6446             gme_debug.put_line (
6447                'Defaulting completed with errors for the Flex field : ' ||desc_flex_name);
6448          END IF;
6449          x_return_status := FND_API.G_RET_STS_ERROR;
6450       WHEN OTHERS THEN
6451         IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
6452           gme_debug.put_line (g_pkg_name||'.'||desc_flex_name||': '||'in unexpected error');
6453         END IF;
6454         x_return_status := FND_API.g_ret_sts_unexp_error;
6455         fnd_msg_pub.add_exc_msg (g_pkg_name, desc_flex_name);
6456    END create_flex_process_param;
6457    /*======================================================================
6458     *   NAME
6459     *   create_flex_material_details
6460     *
6461     *  DESCRIPTION
6462     *  This procedure will assign the default values of the segments
6463     *   into the columns.
6464     *  SYNOPSIS:
6465     *  create_flex_material_details (
6466     *                p_process_param_rec   IN
6467     *                gme_process_parameters%ROWTYPE,
6468     *                x_process_param_rec   IN OUT NOCOPY gme_process_parameters%ROWTYPE,
6469     *                x_return_status OUT NOCOPY VARCHAR2);
6470     *  HISTORY
6471     *  K.Swapna 07-MAR-2005 Created --BUG#4050727
6472     *  K Swapna 25-MAY-2005 Bug#4257930
6473     *    Changed the whole logic by adding the function call,
6474     *    fnd_flex_descval.validate_desccols with the parameter,values_or_ids as 'D'
6475     *    and erroring out from the procedure based on global validate flag
6476     * ======================================================================= */
6477 
6478      PROCEDURE create_flex_material_details (
6479       p_material_detail   IN              gme_material_details%ROWTYPE,
6480       x_material_detail   IN OUT NOCOPY   gme_material_details%ROWTYPE,
6481       x_return_status   OUT NOCOPY      VARCHAR2
6482      ) IS
6483       appl_short_name        VARCHAR2 (30)              := 'GME';
6484       desc_flex_name         VARCHAR2 (30)              := 'BATCH_DTL_FLEX';
6485       values_or_ids          VARCHAR2 (10)              := 'D';
6486       validation_date        DATE                       := SYSDATE;
6487       error_msg              VARCHAR2 (5000);
6488       n                      NUMBER := 0;
6489       l_attribute_category   VARCHAR2 (240);
6490       defaulting_error       EXCEPTION;
6491 
6492    BEGIN
6493       /* Set return status to success initially */
6494       x_return_status := FND_API.G_RET_STS_SUCCESS;
6495       x_material_detail :=  p_material_detail;
6496 
6497       IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6498          gme_debug.put_line (
6499             'Entered into the procedure create_flex_material_details');
6500       END IF;
6501 
6502       IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6503          gme_debug.put_line ('Check if flexfield is enabled : ' ||desc_flex_name);
6504       END IF;
6505 
6506       OPEN cur_get_appl_id;
6507       FETCH cur_get_appl_id INTO pkg_application_id;
6508       CLOSE cur_get_appl_id;
6509 
6510       IF NOT fnd_flex_apis.is_descr_setup (pkg_application_id, desc_flex_name) THEN
6511          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6512             gme_debug.put_line ('Flexfield is not enabled, No validation required.');
6513          END IF;
6514          RETURN;
6515       END IF;
6516       l_attribute_category := NVL (x_material_detail.attribute_category, '');
6517       fnd_flex_descval.set_context_value (l_attribute_category);
6518          fnd_flex_descval.set_column_value (
6519             'ATTRIBUTE1',
6520             NVL (x_material_detail.attribute1, ''));
6521          fnd_flex_descval.set_column_value (
6522             'ATTRIBUTE2',
6523             NVL (x_material_detail.attribute2, ''));
6524          fnd_flex_descval.set_column_value (
6525             'ATTRIBUTE3',
6526             NVL (x_material_detail.attribute3, ''));
6527          fnd_flex_descval.set_column_value (
6528             'ATTRIBUTE4',
6529             NVL (x_material_detail.attribute4, ''));
6530          fnd_flex_descval.set_column_value (
6531             'ATTRIBUTE5',
6532             NVL (x_material_detail.attribute5, ''));
6533          fnd_flex_descval.set_column_value (
6534             'ATTRIBUTE6',
6535             NVL (x_material_detail.attribute6, ''));
6536          fnd_flex_descval.set_column_value (
6537             'ATTRIBUTE7',
6538             NVL (x_material_detail.attribute7, ''));
6539          fnd_flex_descval.set_column_value (
6540             'ATTRIBUTE8',
6541             NVL (x_material_detail.attribute8, ''));
6542          fnd_flex_descval.set_column_value (
6543             'ATTRIBUTE9',
6544             NVL (x_material_detail.attribute9, ''));
6545          fnd_flex_descval.set_column_value (
6546             'ATTRIBUTE10',
6547             NVL (x_material_detail.attribute10, ''));
6548          fnd_flex_descval.set_column_value (
6549             'ATTRIBUTE11',
6550             NVL (x_material_detail.attribute11, ''));
6551          fnd_flex_descval.set_column_value (
6552             'ATTRIBUTE12',
6553             NVL (x_material_detail.attribute12, ''));
6554          fnd_flex_descval.set_column_value (
6555             'ATTRIBUTE13',
6556             NVL (x_material_detail.attribute13, ''));
6557          fnd_flex_descval.set_column_value (
6558             'ATTRIBUTE14',
6559             NVL (x_material_detail.attribute14, ''));
6560          fnd_flex_descval.set_column_value (
6561             'ATTRIBUTE15',
6562             NVL (x_material_detail.attribute15, ''));
6563          fnd_flex_descval.set_column_value (
6564             'ATTRIBUTE16',
6565             NVL (x_material_detail.attribute16, ''));
6566          fnd_flex_descval.set_column_value (
6567             'ATTRIBUTE17',
6568             NVL (x_material_detail.attribute17, ''));
6569          fnd_flex_descval.set_column_value (
6570             'ATTRIBUTE18',
6571             NVL (x_material_detail.attribute18, ''));
6572          fnd_flex_descval.set_column_value (
6573             'ATTRIBUTE19',
6574             NVL (x_material_detail.attribute19, ''));
6575          fnd_flex_descval.set_column_value (
6576             'ATTRIBUTE20',
6577             NVL (x_material_detail.attribute20, ''));
6578          fnd_flex_descval.set_column_value (
6579             'ATTRIBUTE21',
6580             NVL (x_material_detail.attribute21, ''));
6581          fnd_flex_descval.set_column_value (
6582             'ATTRIBUTE22',
6583             NVL (x_material_detail.attribute22, ''));
6584          fnd_flex_descval.set_column_value (
6585             'ATTRIBUTE23',
6586             NVL (x_material_detail.attribute23, ''));
6587          fnd_flex_descval.set_column_value (
6588             'ATTRIBUTE24',
6589             NVL (x_material_detail.attribute24, ''));
6590          fnd_flex_descval.set_column_value (
6591             'ATTRIBUTE25',
6592             NVL (x_material_detail.attribute25, ''));
6593          fnd_flex_descval.set_column_value (
6594             'ATTRIBUTE26',
6595             NVL (x_material_detail.attribute26, ''));
6596          fnd_flex_descval.set_column_value (
6597             'ATTRIBUTE27',
6598             NVL (x_material_detail.attribute27, ''));
6599          fnd_flex_descval.set_column_value (
6600             'ATTRIBUTE28',
6601             NVL (x_material_detail.attribute28, ''));
6602          fnd_flex_descval.set_column_value (
6603             'ATTRIBUTE29',
6604             NVL (x_material_detail.attribute29, ''));
6605          fnd_flex_descval.set_column_value (
6606             'ATTRIBUTE30',
6607             NVL (x_material_detail.attribute30, ''));
6608       IF fnd_flex_descval.validate_desccols (
6609             appl_short_name     => appl_short_name,
6610             desc_flex_name      => desc_flex_name,
6611             values_or_ids       => values_or_ids,
6612             validation_date     => validation_date
6613          ) THEN
6614          --SUCCESS
6615          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6616             gme_debug.put_line ('Defaulting Success. ');
6617          END IF;
6618 
6619          x_return_status := FND_API.G_RET_STS_SUCCESS;
6620          n := fnd_flex_descval.segment_count;
6621          /*Now let us copy back the default values returned from the above call */
6622          FOR i IN 1 .. n
6623          LOOP
6624             IF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE_CATEGORY' THEN
6625                x_material_detail.attribute_category := fnd_flex_descval.segment_id (i);
6626             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE1' THEN
6627                x_material_detail.attribute1 := fnd_flex_descval.segment_id (i);
6628             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE2' THEN
6629                x_material_detail.attribute2 := fnd_flex_descval.segment_id (i);
6630             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE3' THEN
6631                x_material_detail.attribute3 := fnd_flex_descval.segment_id (i);
6632             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE4' THEN
6633                x_material_detail.attribute4 := fnd_flex_descval.segment_id (i);
6634             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE5' THEN
6635                x_material_detail.attribute5 := fnd_flex_descval.segment_id (i);
6636             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE6' THEN
6637                x_material_detail.attribute6 := fnd_flex_descval.segment_id (i);
6638             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE7' THEN
6639                x_material_detail.attribute7 := fnd_flex_descval.segment_id (i);
6640             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE8' THEN
6641                x_material_detail.attribute8 := fnd_flex_descval.segment_id (i);
6642             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE9' THEN
6643                x_material_detail.attribute9 := fnd_flex_descval.segment_id (i);
6644             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE10' THEN
6645                x_material_detail.attribute10 := fnd_flex_descval.segment_id (i);
6646             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE11' THEN
6647                x_material_detail.attribute11 := fnd_flex_descval.segment_id (i);
6648             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE12' THEN
6649                x_material_detail.attribute12 := fnd_flex_descval.segment_id (i);
6650             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE13' THEN
6651                x_material_detail.attribute13 := fnd_flex_descval.segment_id (i);
6652             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE14' THEN
6653                x_material_detail.attribute14 := fnd_flex_descval.segment_id (i);
6654             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE15' THEN
6655                x_material_detail.attribute15 := fnd_flex_descval.segment_id (i);
6656             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE16' THEN
6657                x_material_detail.attribute16 := fnd_flex_descval.segment_id (i);
6658             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE17' THEN
6659                x_material_detail.attribute17 := fnd_flex_descval.segment_id (i);
6660             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE18' THEN
6661                x_material_detail.attribute18 := fnd_flex_descval.segment_id (i);
6662             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE19' THEN
6663                x_material_detail.attribute19 := fnd_flex_descval.segment_id (i);
6664             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE20' THEN
6665                x_material_detail.attribute20 := fnd_flex_descval.segment_id (i);
6666             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE21' THEN
6667                x_material_detail.attribute21 := fnd_flex_descval.segment_id (i);
6668             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE22' THEN
6669                x_material_detail.attribute22 := fnd_flex_descval.segment_id (i);
6670             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE23' THEN
6671                x_material_detail.attribute23 := fnd_flex_descval.segment_id (i);
6672             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE24' THEN
6673                x_material_detail.attribute24 := fnd_flex_descval.segment_id (i);
6674             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE25' THEN
6675                x_material_detail.attribute25 := fnd_flex_descval.segment_id (i);
6676             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE26' THEN
6677                x_material_detail.attribute26 := fnd_flex_descval.segment_id (i);
6678             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE27' THEN
6679                x_material_detail.attribute27 := fnd_flex_descval.segment_id (i);
6680             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE28' THEN
6681                x_material_detail.attribute28 := fnd_flex_descval.segment_id (i);
6682             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE29' THEN
6683                x_material_detail.attribute29 := fnd_flex_descval.segment_id (i);
6684             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE30' THEN
6685                x_material_detail.attribute30 := fnd_flex_descval.segment_id (i);
6686             END IF;
6687          END LOOP;
6688       ELSE
6689          error_msg := fnd_flex_descval.error_message;
6690          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6691             gme_debug.put_line ('Defaulting Ends With Error(s) :');
6692             gme_debug.put_line ('Error :' || error_msg);
6693          END IF;
6694          gme_common_pvt.log_message ('FLEX-USER DEFINED ERROR', 'MSG', error_msg);
6695          /* error out based on global validate flag */
6696         IF gme_common_pvt.g_flex_validate_prof = 1 THEN
6697           IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6698              gme_debug.put_line ('GME Flexfield is enabled, Give the Error.');
6699           END IF;
6700           RAISE defaulting_error;
6701         END IF;
6702       END IF;
6703       IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6704          gme_debug.put_line (
6705             'Defaulting completed for the Flex field : ' || desc_flex_name);
6706       END IF;
6707    EXCEPTION
6708       WHEN defaulting_error THEN
6709          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6710             gme_debug.put_line (
6711                'Defaulting completed with errors for the Flex field : ' ||desc_flex_name);
6712          END IF;
6713          x_return_status := FND_API.G_RET_STS_ERROR;
6714       WHEN OTHERS THEN
6715         IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
6716           gme_debug.put_line (g_pkg_name||'.'||desc_flex_name||': '||'in unexpected error');
6717         END IF;
6718         x_return_status := FND_API.g_ret_sts_unexp_error;
6719         fnd_msg_pub.add_exc_msg (g_pkg_name, desc_flex_name);
6720    END create_flex_material_details;
6721 
6722    /*======================================================================
6723     -- NAME
6724     -- create_flex_resource_txns
6725     --
6726     -- DESCRIPTION
6727     --    This procedure will assign the default values of the segments into the columns.
6728     --
6729     -- SYNOPSIS:
6730        create_flex_resource_txns (
6731                                   p_resource_txns   IN              gme_resource_txns%ROWTYPE,
6732                                   x_resource_txns   IN OUT NOCOPY   gme_resource_txns%ROWTYPE,
6733                                   x_return_status   OUT NOCOPY      VARCHAR2
6734                                 );
6735     -- HISTORY
6736     -- Sivakumar.G    03-NOV-2005   Created --BUG#4395561
6737   ======================================================================= */
6738    PROCEDURE create_flex_resource_txns (
6739       p_resource_txns   IN              gme_resource_txns%ROWTYPE,
6740       x_resource_txns   IN OUT NOCOPY   gme_resource_txns%ROWTYPE,
6741       x_return_status   OUT NOCOPY      VARCHAR2
6742    ) IS
6743       appl_short_name        VARCHAR2 (30)              := 'GME';
6744       desc_flex_name         VARCHAR2 (30)              := 'GME_RSRC_TXN_FLEX';
6745       values_or_ids          VARCHAR2 (10)              := 'D';
6746       validation_date        DATE                       := SYSDATE;
6747       error_msg              VARCHAR2 (5000);
6748       n                      NUMBER := 0;
6749       l_attribute_category   VARCHAR2 (240);
6750       defaulting_error       EXCEPTION;
6751    BEGIN
6752       /* Set return status to success initially */
6753       x_return_status := FND_API.G_RET_STS_SUCCESS;
6754       x_resource_txns :=  p_resource_txns;
6755 
6756       IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6757          gme_debug.put_line (
6758             'Entered into the procedure create_flex_material_details');
6759       END IF;
6760 
6761       IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6762          gme_debug.put_line ('Check if flexfield is enabled : ' ||desc_flex_name);
6763       END IF;
6764 
6765       OPEN cur_get_appl_id;
6766       FETCH cur_get_appl_id INTO pkg_application_id;
6767       CLOSE cur_get_appl_id;
6768 
6769       IF NOT fnd_flex_apis.is_descr_setup (pkg_application_id, desc_flex_name) THEN
6770          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6771             gme_debug.put_line ('Flexfield is not enabled, No validation required.');
6772          END IF;
6773          RETURN;
6774       END IF;
6775       l_attribute_category := NVL (x_resource_txns.attribute_category, '');
6776       fnd_flex_descval.set_context_value (l_attribute_category);
6777          fnd_flex_descval.set_column_value (
6778             'ATTRIBUTE1',
6779             NVL (x_resource_txns.attribute1, ''));
6780          fnd_flex_descval.set_column_value (
6781             'ATTRIBUTE2',
6782             NVL (x_resource_txns.attribute2, ''));
6783          fnd_flex_descval.set_column_value (
6784             'ATTRIBUTE3',
6785             NVL (x_resource_txns.attribute3, ''));
6786          fnd_flex_descval.set_column_value (
6787             'ATTRIBUTE4',
6788             NVL (x_resource_txns.attribute4, ''));
6789          fnd_flex_descval.set_column_value (
6790             'ATTRIBUTE5',
6791             NVL (x_resource_txns.attribute5, ''));
6792          fnd_flex_descval.set_column_value (
6793             'ATTRIBUTE6',
6794             NVL (x_resource_txns.attribute6, ''));
6795          fnd_flex_descval.set_column_value (
6796             'ATTRIBUTE7',
6797             NVL (x_resource_txns.attribute7, ''));
6798          fnd_flex_descval.set_column_value (
6799             'ATTRIBUTE8',
6800             NVL (x_resource_txns.attribute8, ''));
6801          fnd_flex_descval.set_column_value (
6802             'ATTRIBUTE9',
6803             NVL (x_resource_txns.attribute9, ''));
6804          fnd_flex_descval.set_column_value (
6805             'ATTRIBUTE10',
6806             NVL (x_resource_txns.attribute10, ''));
6807          fnd_flex_descval.set_column_value (
6808             'ATTRIBUTE11',
6809             NVL (x_resource_txns.attribute11, ''));
6810          fnd_flex_descval.set_column_value (
6811             'ATTRIBUTE12',
6812             NVL (x_resource_txns.attribute12, ''));
6813          fnd_flex_descval.set_column_value (
6814             'ATTRIBUTE13',
6815             NVL (x_resource_txns.attribute13, ''));
6816          fnd_flex_descval.set_column_value (
6817             'ATTRIBUTE14',
6818             NVL (x_resource_txns.attribute14, ''));
6819          fnd_flex_descval.set_column_value (
6820             'ATTRIBUTE15',
6821             NVL (x_resource_txns.attribute15, ''));
6822          fnd_flex_descval.set_column_value (
6823             'ATTRIBUTE16',
6824             NVL (x_resource_txns.attribute16, ''));
6825          fnd_flex_descval.set_column_value (
6826             'ATTRIBUTE17',
6827             NVL (x_resource_txns.attribute17, ''));
6828          fnd_flex_descval.set_column_value (
6829             'ATTRIBUTE18',
6830             NVL (x_resource_txns.attribute18, ''));
6831          fnd_flex_descval.set_column_value (
6832             'ATTRIBUTE19',
6833             NVL (x_resource_txns.attribute19, ''));
6834          fnd_flex_descval.set_column_value (
6835             'ATTRIBUTE20',
6836             NVL (x_resource_txns.attribute20, ''));
6837          fnd_flex_descval.set_column_value (
6838             'ATTRIBUTE21',
6839             NVL (x_resource_txns.attribute21, ''));
6840          fnd_flex_descval.set_column_value (
6841             'ATTRIBUTE22',
6842             NVL (x_resource_txns.attribute22, ''));
6843          fnd_flex_descval.set_column_value (
6844             'ATTRIBUTE23',
6845             NVL (x_resource_txns.attribute23, ''));
6846          fnd_flex_descval.set_column_value (
6847             'ATTRIBUTE24',
6848             NVL (x_resource_txns.attribute24, ''));
6849          fnd_flex_descval.set_column_value (
6850             'ATTRIBUTE25',
6851             NVL (x_resource_txns.attribute25, ''));
6852          fnd_flex_descval.set_column_value (
6853             'ATTRIBUTE26',
6854             NVL (x_resource_txns.attribute26, ''));
6855          fnd_flex_descval.set_column_value (
6856             'ATTRIBUTE27',
6857             NVL (x_resource_txns.attribute27, ''));
6858          fnd_flex_descval.set_column_value (
6859             'ATTRIBUTE28',
6860             NVL (x_resource_txns.attribute28, ''));
6861          fnd_flex_descval.set_column_value (
6862             'ATTRIBUTE29',
6863             NVL (x_resource_txns.attribute29, ''));
6864          fnd_flex_descval.set_column_value (
6865             'ATTRIBUTE30',
6866             NVL (x_resource_txns.attribute30, ''));
6867 
6868 		IF fnd_flex_descval.validate_desccols (
6869             appl_short_name     => appl_short_name,
6870             desc_flex_name      => desc_flex_name,
6871             values_or_ids       => values_or_ids,
6872             validation_date     => validation_date
6873          ) THEN
6874          --SUCCESS
6875          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6876             gme_debug.put_line ('Defaulting Success. ');
6877          END IF;
6878 
6879          x_return_status := FND_API.G_RET_STS_SUCCESS;
6880          n := fnd_flex_descval.segment_count;
6881          /*Now let us copy back the default values returned from the above call */
6882          FOR i IN 1 .. n
6883          LOOP
6884             IF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE_CATEGORY' THEN
6885                x_resource_txns.attribute_category := fnd_flex_descval.segment_id (i);
6886             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE1' THEN
6887                x_resource_txns.attribute1 := fnd_flex_descval.segment_id (i);
6888             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE2' THEN
6889                x_resource_txns.attribute2 := fnd_flex_descval.segment_id (i);
6890             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE3' THEN
6891                x_resource_txns.attribute3 := fnd_flex_descval.segment_id (i);
6892             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE4' THEN
6893                x_resource_txns.attribute4 := fnd_flex_descval.segment_id (i);
6894             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE5' THEN
6895                x_resource_txns.attribute5 := fnd_flex_descval.segment_id (i);
6896             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE6' THEN
6897                x_resource_txns.attribute6 := fnd_flex_descval.segment_id (i);
6898             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE7' THEN
6899                x_resource_txns.attribute7 := fnd_flex_descval.segment_id (i);
6900             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE8' THEN
6901                x_resource_txns.attribute8 := fnd_flex_descval.segment_id (i);
6902             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE9' THEN
6903                x_resource_txns.attribute9 := fnd_flex_descval.segment_id (i);
6904             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE10' THEN
6905                x_resource_txns.attribute10 := fnd_flex_descval.segment_id (i);
6906             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE11' THEN
6907                x_resource_txns.attribute11 := fnd_flex_descval.segment_id (i);
6908             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE12' THEN
6909                x_resource_txns.attribute12 := fnd_flex_descval.segment_id (i);
6910             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE13' THEN
6911                x_resource_txns.attribute13 := fnd_flex_descval.segment_id (i);
6912             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE14' THEN
6913                x_resource_txns.attribute14 := fnd_flex_descval.segment_id (i);
6914             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE15' THEN
6915                x_resource_txns.attribute15 := fnd_flex_descval.segment_id (i);
6916             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE16' THEN
6917                x_resource_txns.attribute16 := fnd_flex_descval.segment_id (i);
6918             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE17' THEN
6919                x_resource_txns.attribute17 := fnd_flex_descval.segment_id (i);
6920             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE18' THEN
6921                x_resource_txns.attribute18 := fnd_flex_descval.segment_id (i);
6922             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE19' THEN
6923                x_resource_txns.attribute19 := fnd_flex_descval.segment_id (i);
6924             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE20' THEN
6925                x_resource_txns.attribute20 := fnd_flex_descval.segment_id (i);
6926             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE21' THEN
6927                x_resource_txns.attribute21 := fnd_flex_descval.segment_id (i);
6928             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE22' THEN
6929                x_resource_txns.attribute22 := fnd_flex_descval.segment_id (i);
6930             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE23' THEN
6931                x_resource_txns.attribute23 := fnd_flex_descval.segment_id (i);
6932             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE24' THEN
6933                x_resource_txns.attribute24 := fnd_flex_descval.segment_id (i);
6934             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE25' THEN
6935                x_resource_txns.attribute25 := fnd_flex_descval.segment_id (i);
6936             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE26' THEN
6937                x_resource_txns.attribute26 := fnd_flex_descval.segment_id (i);
6938             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE27' THEN
6939                x_resource_txns.attribute27 := fnd_flex_descval.segment_id (i);
6940             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE28' THEN
6941                x_resource_txns.attribute28 := fnd_flex_descval.segment_id (i);
6942             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE29' THEN
6943                x_resource_txns.attribute29 := fnd_flex_descval.segment_id (i);
6944             ELSIF fnd_flex_descval.segment_column_name (i) = 'ATTRIBUTE30' THEN
6945                x_resource_txns.attribute30 := fnd_flex_descval.segment_id (i);
6946             END IF;
6947          END LOOP;
6948       ELSE
6949          error_msg := fnd_flex_descval.error_message;
6950          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6951             gme_debug.put_line ('Defaulting Ends With Error(s) :');
6952             gme_debug.put_line ('Error :' || error_msg);
6953          END IF;
6954          gme_common_pvt.log_message ('FLEX-USER DEFINED ERROR', 'MSG', error_msg);
6955          /* error out based on global validate flag */
6956         IF gme_common_pvt.g_flex_validate_prof = 1 THEN
6957           IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6958              gme_debug.put_line ('GME Flexfield is enabled, Give the Error.');
6959           END IF;
6960           RAISE defaulting_error;
6961         END IF;
6962       END IF;
6963       IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6964          gme_debug.put_line (
6965             'Defaulting completed for the Flex field : ' || desc_flex_name);
6966       END IF;
6967    EXCEPTION
6968       WHEN defaulting_error THEN
6969          IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
6970             gme_debug.put_line (
6971                'Defaulting completed with errors for the Flex field : ' ||desc_flex_name);
6972          END IF;
6973          x_return_status := FND_API.G_RET_STS_ERROR;
6974       WHEN OTHERS THEN
6975         IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
6976           gme_debug.put_line (g_pkg_name||'.'||desc_flex_name||': '||'in unexpected error');
6977         END IF;
6978         x_return_status := FND_API.g_ret_sts_unexp_error;
6979         fnd_msg_pub.add_exc_msg (g_pkg_name, desc_flex_name);
6980    END create_flex_resource_txns;
6981 
6982    --FPBug#4395561 End
6983 END gme_validate_flex_fld_pvt;