DBA Data[Home] [Help]

PACKAGE BODY: APPS.AR_GDF_VALIDATION

Source


1 PACKAGE BODY AR_GDF_VALIDATION AS
2 /* $Header: ARXGDVHB.pls 120.6.12010000.2 2008/11/20 07:21:04 npanchak ship $ */
3 
4 /*-------------------------------------------------------------------------+
5  | PUBLIC FUNCTION                                                         |
6  |    is_gdf_valid                                                         |
7  |                                                                         |
8  | PUBLIC VARIABLES                                                        |
9  |                                                                         |
10  | DESCRIPTION                                                             |
11  |    This is a stub module for global descriptive flex field validation   |
12  |    during autoinvoice run.                                              |
13  |                                                                         |
14  |    The global descriptive flex field validation package                 |
15  |    JG_ZZ_AUTO_INVOICE is installed only when JG is installed.           |
16  |                                                                         |
17  | ARGUMENTS                                                               |
18  |    request_id        request_id of the autoinvoice run                  |
19  |                                                                         |
20  | RETURNS                                                                 |
21  |    1      If validation is successful                                   |
22  |    0      If error occured during validation                            |
23  |                                                                         |
24  | NOTES                                                                   |
25  |                                                                         |
26  | EXAMPLE                                                                 |
27  |    ar_gdf_validation.is_gdf_valid(99999)                                |
28  |                                                                         |
29  | MODIFICATION HISTORY                                                    |
30  |    28-Aug-97  Srinivasan Jandyala   Created.                            |
31  |    08-JAN-03  Bhushan Dhotkar     Bug 2446618 : Replaced the sys_context|
32  |                                   ('JG','JGZZ_PRODUCT_CODE') with       |
33  |                                   variable g_jgzz_product_code to avoid |
34  |                                    multiple execution                   |
35  +-------------------------------------------------------------------------*/
36 
37 g_jgzz_product_code VARCHAR2(100);
38 l_org_id NUMBER := arp_global.sysparam.org_id;
39 
40 PG_DEBUG varchar2(1) := NVL(FND_PROFILE.value('AFLOG_ENABLED'), 'N');
41 
42 FUNCTION is_gdf_valid(request_id IN NUMBER)
43 
44 	RETURN NUMBER IS
45 
46  /*-------------------------------+
47   |  Global variable declarations |
48   +-------------------------------*/
49 
50    TRUE  CONSTANT NUMBER  := 1;
51    FALSE CONSTANT NUMBER  := 0;
52    cr    CONSTANT char(1) := '
53 ';
54 
55    return_value NUMBER := 0;
56    is_there NUMBER := 0;
57    lcursor  NUMBER;
58    lignore  NUMBER;
59    sqlstmt  VARCHAR2(254);
60 
61 BEGIN
62 
63    arp_standard.enable_debug;
64 
65    IF PG_DEBUG in ('Y', 'C') THEN
66       arp_standard.debug('is_gdf_valid: ' || cr || 'Global Descr Flex Field Validation begin: ' ||
67                     to_char(sysdate, 'DD-MON-YY HH:MI:SS'));
68    END IF;
69 
70    /* Check if JG_ZZ_AUTO_INVOICE package is installed */
71    /* If JG_ZZ_AUTO_INVOICE is not installed, always return 1 */
72 
73 /* ---------------------------------------------------------------------------
74 -- The following SQL will always return 1 because all the Globalization
75 -- packages are now installed even if any Globalizations are not active
76 -- We now use Application Context to verify if any Gloablizations are active
77 --
78 --   SELECT  distinct 1
79 --   INTO    is_there
80 --   FROM    all_source
81 --   WHERE   name = 'JL_ZZ_AUTO_INVOICE'
82 --   AND     type = 'PACKAGE BODY';
83 ----------------------------------------------------------------------------*/
84 --  Bug 2446618
85 
86    IF g_jgzz_product_code IS NOT NULL THEN
87 
88       IF PG_DEBUG in ('Y', 'C') THEN
89          arp_standard.debug('is_gdf_valid: ' || cr || 'Package: JG_ZZ_AUTO_INVOICE is installed.');
90       END IF;
91 
92       /* JG_ZZ_AUTO_INVOICE package is installed, so OK to call it */
93 
94       BEGIN
95 
96           lcursor := dbms_sql.open_cursor;
97           sqlstmt :=
98 'BEGIN :return_value:=JG_ZZ_AUTO_INVOICE.validate_gdff(:request_id);
99 END;';
100 
101           dbms_sql.parse(lcursor, sqlstmt, dbms_sql.native);
102           dbms_sql.bind_variable(lcursor, ':request_id', request_id);
103           dbms_sql.bind_variable(lcursor, ':return_value', return_value);
104 
105           IF PG_DEBUG in ('Y', 'C') THEN
106              arp_standard.debug('is_gdf_valid: ' || cr||'Executing Statement:'||cr||cr||sqlstmt);
107           END IF;
108 
109           lignore := dbms_sql.execute(lcursor);
110           dbms_sql.variable_value (lcursor, ':return_value', return_value);
111           IF PG_DEBUG in ('Y', 'C') THEN
112              arp_standard.debug('is_gdf_valid: ' || 'Return value from JG_ZZ_AUTO_INVOICE.validate_gdff(): ' || return_value);
113           END IF;
114           dbms_sql.close_cursor(lcursor);
115 
116       EXCEPTION
117 	  WHEN OTHERS THEN
118 	  IF PG_DEBUG in ('Y', 'C') THEN
119 	     arp_standard.debug('is_gdf_valid: ' || cr|| 'Exception calling JG_ZZ_AUTO_INVOICE.validate_gdff()');
120 	     arp_standard.debug('is_gdf_valid: ' || SQLERRM);
121 	  END IF;
122 
123           IF dbms_sql.is_open(lcursor)
124           THEN
125                dbms_sql.close_cursor(lcursor);
126           END IF;
127 
128           IF PG_DEBUG in ('Y', 'C') THEN
129              arp_standard.debug('is_gdf_valid: ' || cr || 'Global Descr Flex Field Validation end: ' || to_char(sysdate, 'DD-MON-YY HH:MI:SS'));
130           END IF;
131 
132 	  return(FALSE);
133       END;
134 
135    ELSE
136 
137    -- Always return 1 if JG is not installed
138 
139       return_value := 1 ;
140 
141    END IF ;
142 
143 
144    IF PG_DEBUG in ('Y', 'C') THEN
145       arp_standard.debug('is_gdf_valid: ' || cr || 'Global Descr Flex Field Validation end: ' ||
146                     to_char(sysdate, 'DD-MON-YY HH:MI:SS'));
147    END IF;
148 
149    /* Always return TRUE if JG is not installed */
150 
151    return(return_value);
152 
153 EXCEPTION
154 
155     WHEN OTHERS THEN
156          IF PG_DEBUG in ('Y', 'C') THEN
157             arp_standard.debug(cr|| 'Exception in AR_GDF_VALIDATION.is_gdf_valid()');
158             arp_standard.debug('is_gdf_valid: ' || SQLERRM);
159             arp_standard.debug('is_gdf_valid: ' || cr || 'Global Descr Flex Field Validation end: ' || to_char(sysdate, 'DD-MON-YY HH:MI:SS'));
160          END IF;
161          return(FALSE);
162 
163 END is_gdf_valid;
164 
165 /*-------------------------------------------------------------------------+
166  | PUBLIC FUNCTION                                                         |
167  |    is_gdf_postbatch_valid                                               |
168  |                                                                         |
169  | PUBLIC VARIABLES                                                        |
170  |                                                                         |
171  | DESCRIPTION                                                             |
172  |    This is a stub module for global descriptive flex field validation   |
173  |    during postbatch run.                                                |
174  |                                                                         |
175  |    The global descriptive flex field validation package                 |
176  |    JL_ZZ_POSTBATCH is installed only when JL is installed.              |
177  |                                                                         |
178  | ARGUMENTS                                                               |
179  |    batch_id   IN NUMBER                                                 |
180  |    cash_receipt_id IN NUMBER                                            |
181  |                                                                         |
182  | RETURNS                                                                 |
183  |    1      If validation is successful                                   |
184  |    0      If error occured during validation                            |
185  |                                                                         |
186  | NOTES                                                                   |
187  |                                                                         |
188  | EXAMPLE                                                                 |
189  |    ar_gdf_validation.is_gdf_postbatch_valid(99999,99999)                |
190  |                                                                         |
191  | MODIFICATION HISTORY                                                    |
192  |    31-Aug-98  Nilesh Acharya             Created.                       |
193  |    12-Aug-02  Ramakant Alat              Calling JL code based on       |
194  |                                          context setting                |
195  +-------------------------------------------------------------------------*/
196 
197 FUNCTION is_gdf_postbatch_valid(batch_id IN NUMBER,
198                                 cash_receipt_id IN NUMBER)
199 
200 RETURN NUMBER IS
201 
202  /*-------------------------------+
203   |  Global variable declarations |
204   +-------------------------------*/
205 
206    TRUE  CONSTANT NUMBER  := 1;
207    FALSE CONSTANT NUMBER  := 0;
208    cr    CONSTANT char(1) := '
209 ';
210 
211    is_there NUMBER := 0;
212    lcursor  NUMBER;
213    lignore  NUMBER;
214    sqlstmt  VARCHAR2(254);
215 
216 
217 BEGIN
218 
219    --arp_standard.enable_debug;
220 
221    IF PG_DEBUG in ('Y', 'C') THEN
222       arp_standard.debug('is_gdf_postbatch_valid: ' || cr || 'Global Descr Flex Field Validation begin: ' ||
223                             to_char(sysdate, 'DD-MON-YY HH:MI:SS'));
224       arp_standard.debug('is_gdf_postbatch_valid: ' || cr || 'batch_id= ' || batch_id ||
225                             'cash_receipt_id= ' || cash_receipt_id);
226    END IF;
227 
228    /* Check if JL_ZZ_POSTBATCH package is installed */
229    /* If JL_ZZ_POSTBATCH is not installed, handle it in the exception */
230    /***
231    SELECT  distinct 1
232    INTO    is_there
233    FROM    all_source
234    WHERE   name = 'JL_ZZ_POSTBATCH'
235    AND     type = 'PACKAGE BODY';
236 
237    IF PG_DEBUG in ('Y', 'C') THEN
238       arp_standard.debug('is_gdf_postbatch_valid: ' || cr || 'Package: JL_ZZ_POSTBATCH is installed.');
239    END IF;
240    ***/
241 
242    /* JL_ZZ_POSTBATCH package is installed, so OK to call it */
243 
244    IF g_jgzz_product_code = 'JL' THEN
245 
246       BEGIN
247 	     JL_ZZ_POSTBATCH.populate_gdfs(p_cash_receipt_id=>cash_receipt_id,
248 		                               p_batch_id=>batch_id);
249 
250       EXCEPTION
251           when OTHERS then
252            IF PG_DEBUG in ('Y', 'C') THEN
253               arp_standard.debug('is_gdf_postbatch_valid: ' || cr|| 'Exception calling JL_ZZ_POSTBATCH.populate_gdfs()');
254               arp_standard.debug('is_gdf_postbatch_valid: ' || SQLERRM(SQLCODE));
255               arp_standard.debug('is_gdf_postbatch_valid: ' || cr || 'Global Descr Flex Field Validation end: '
256                                   || to_char(sysdate, 'DD-MON-YY HH:MI:SS'));
257            END IF;
258 
259            return(FALSE);
260       END;
261     END IF;
262 
263 
264     IF PG_DEBUG in ('Y', 'C') THEN
265        arp_standard.debug('is_gdf_postbatch_valid: ' || cr || 'Global Descr Flex Field Validation end: ' ||
266                     to_char(sysdate, 'DD-MON-YY HH:MI:SS'));
267     END IF;
268 
269 
270     return(TRUE);
271 
272    EXCEPTION
273 
274         WHEN NO_DATA_FOUND THEN
275             /* Always return TRUE if JL is not installed */
276             IF PG_DEBUG in ('Y', 'C') THEN
277                arp_standard.debug('is_gdf_postbatch_valid: ' || 'Not running Global Validation, JL_ZZ_POSTBATCH NOT installed.');
278                arp_standard.debug('is_gdf_postbatch_valid: ' || cr || 'Global Descr Flex Field Validation end: '
279                                   || to_char(sysdate, 'DD-MON-YY HH:MI:SS'));
280             END IF;
281             return(TRUE);
282 
283         WHEN OTHERS THEN
284             IF PG_DEBUG in ('Y', 'C') THEN
285                arp_standard.debug(cr|| 'Exception in AR_GDF_VALIDATION.is_gdf_postbatch_valid()');
286                arp_standard.debug('is_gdf_postbatch_valid: ' || SQLERRM);
287                arp_standard.debug('is_gdf_postbatch_valid: ' || cr || 'Global Descr Flex Field Validation end: '
288                                   || to_char(sysdate, 'DD-MON-YY HH:MI:SS'));
289             END IF;
290             return(FALSE);
291 
292 END is_gdf_postbatch_valid;
293 
294 
295 /*-------------------------------------------------------------------------+
296  | PUBLIC FUNCTION                                                         |
297  |    is_gdf_taxid_valid                                                   |
298  |                                                                         |
299  | DESCRIPTION                                                             |
300  |    This is a stub module for taxid and global flexfields validation     |
301  |    for Globalizations.                                                  |
302  |                                                                         |
303  |    This package may exist as a stub, however for future implementation  |
304  |    this has been integrated as a hook.                                  |
305  |                                                                         |
306  | ARGUMENTS                                                               |
307  |   request_id        IN NUMBER                                           |
308  |   org_id            IN NUMBER                                           |
309  |   sob               IN NUMBER                                           |
310  |   user_id           IN NUMBER                                           |
311  |   application_id    IN NUMBER                                           |
312  |   language_id       IN NUMBER                                           |
313  |   program_id        IN NUMBER                                           |
314  |   prog_appl_id      IN NUMBER                                           |
315  |   last_update_login IN NUMBER                                           |
316  |                                                                         |
317  | RETURNS                                                                 |
318  |    1      If validation is successful                                   |
319  |    0      If error occured during validation                            |
320  |                                                                         |
321  | NOTES                                                                   |
322  |                                                                         |
323  | EXAMPLE                                                                 |
324  |                                                                         |
325  | MODIFICATION HISTORY                                                    |
326  |    09-Sep-98  Vikram Ahluwalia           Created.                       |
327  |    14-Dec-98  Josie Gazmen-Dabir         Bug 776476:  replaced reference|
328  |                                          to package JG_TAXID_VAL_PKG    |
329  |                                          to use JG_GLOBE_FLEX_VAL for   |
330  |					    customer interface.            |
331  |                                                                         |
332  +-------------------------------------------------------------------------*/
333 
334 FUNCTION is_gdf_taxid_valid(request_id        IN NUMBER,
335                             org_id            IN NUMBER,
339                             language_id       IN NUMBER,
336                             sob               IN NUMBER,
337                             user_id           IN NUMBER,
338                             application_id    IN NUMBER,
340                             program_id        IN NUMBER,
341                             prog_appl_id      IN NUMBER,
342                             last_update_login IN NUMBER )
343 RETURN NUMBER IS
344 
345  /*-------------------------------+
346   |  Global variable declarations |
347   +-------------------------------*/
348 
349    TRUE  CONSTANT NUMBER  := 1;
350    FALSE CONSTANT NUMBER  := 0;
351    cr    CONSTANT char(1) := '
352 ';
353 
354    is_there NUMBER := 0;
355    lcursor  NUMBER;
356    lignore  NUMBER;
357    sqlstmt  VARCHAR2(254);
358 
359    /*Bug 3544086*/
360    l_user_schema	VARCHAR2(30) := USER;
361 
362 BEGIN
363 
364    --arp_standard.enable_debug;
365 
366    IF PG_DEBUG in ('Y', 'C') THEN
367       arp_standard.debug('is_gdf_taxid_valid: ' || cr || 'Global Descr Flex Field Validation begin: ' ||
368                             to_char(sysdate, 'DD-MON-YY HH:MI:SS'));
369    END IF;
370 
371    /* Check if JG_GLOBE_FLEX_VAL package is installed */
372    /* If JG_GLOBE_FLEX_VAL is not installed, handle it in the exception */
373 
374    SELECT  distinct 1
375    INTO    is_there
376    FROM    all_source
377    WHERE   name = 'JG_GLOBE_FLEX_VAL'
378    AND     type = 'PACKAGE BODY'
379    AND     owner = l_user_schema;   /*Bug 3544086*/
380 
381    IF PG_DEBUG in ('Y', 'C') THEN
382       arp_standard.debug('is_gdf_taxid_valid: ' || cr || 'Package: JG_GLOBE_FLEX_VAL is installed.');
383    END IF;
384 
385    /* JG_GLOBE_FLEX_VAL package is installed, so OK to call it */
386 
387    BEGIN
388 
389        lcursor := dbms_sql.open_cursor;
390        sqlstmt :=
391 'BEGIN JG_GLOBE_FLEX_VAL.ar_cust_interface('|| request_id         || ','
392                                            || org_id             || ','
393                                            || sob                || ','
394                                            || user_id            || ','
395                                            || application_id     || ','
396                                            || language_id        || ','
397                                            || program_id         || ','
398                                            || prog_appl_id       || ','
399                                            || last_update_login  || '); END;';
400 
401        dbms_sql.parse(lcursor, sqlstmt, dbms_sql.native);
402 
403        IF PG_DEBUG in ('Y', 'C') THEN
404           arp_standard.debug('is_gdf_taxid_valid: ' || cr||'Executing Statement:'||cr||cr||sqlstmt);
405        END IF;
406 
407        lignore := dbms_sql.execute(lcursor);
408 
409        dbms_sql.close_cursor(lcursor);
410 
411        EXCEPTION
412            when OTHERS then
413            IF PG_DEBUG in ('Y', 'C') THEN
414               arp_standard.debug('is_gdf_taxid_valid: ' || cr|| 'Exception calling JG_GLOBE_FLEX_VAL.ar_cust_interface()');
415               arp_standard.debug('is_gdf_taxid_valid: ' || SQLERRM);
416            END IF;
417 
418            IF dbms_sql.is_open(lcursor)
419            THEN
420                 dbms_sql.close_cursor(lcursor);
421            END IF;
422             IF PG_DEBUG in ('Y', 'C') THEN
423                arp_standard.debug('is_gdf_taxid_valid: ' || cr || 'Global Descr Flex Field Validation end: '
424                                   || to_char(sysdate, 'DD-MON-YY HH:MI:SS'));
425             END IF;
426 
427            return(FALSE);
428    END;
429 
430 
431    IF PG_DEBUG in ('Y', 'C') THEN
432       arp_standard.debug('is_gdf_taxid_valid: ' || cr || 'Global Descr Flex Field Validation end: ' ||
433                     to_char(sysdate, 'DD-MON-YY HH:MI:SS'));
434    END IF;
435 
436    return(TRUE);
437 
438    EXCEPTION
439 
440         WHEN NO_DATA_FOUND THEN
441             /* Always return TRUE if JG is not installed */
442             IF PG_DEBUG in ('Y', 'C') THEN
443                arp_standard.debug('is_gdf_taxid_valid: ' || 'Not running Global Validation, JG_GLOBE_FLEX_VAL NOT installed.');
444                arp_standard.debug('is_gdf_taxid_valid: ' || cr || 'Global Descr Flex Field Validation end: '
445                                   || to_char(sysdate, 'DD-MON-YY HH:MI:SS'));
446             END IF;
447             return(TRUE);
448 
449         WHEN OTHERS THEN
450             IF PG_DEBUG in ('Y', 'C') THEN
451                arp_standard.debug(cr|| 'Exception in AR_GDF_VALIDATION.is_gdf_taxid_valid()');
452                arp_standard.debug('is_gdf_taxid_valid: ' || SQLERRM);
453                arp_standard.debug('is_gdf_taxid_valid: ' || cr || 'Global Descr Flex Field Validation end: '
454                                   || to_char(sysdate, 'DD-MON-YY HH:MI:SS'));
455             END IF;
456             return(FALSE);
457 
458 END is_gdf_taxid_valid;
459 
460 
461 /*-------------------------------------------------------------------------+
462  | PUBLIC FUNCTION                                                         |
463  |    is_cust_imp_valid                                                    |
464  |                                                                         |
468  |                                                                         |
465  | DESCRIPTION                                                             |
466  |    This is a stub module for taxid and global flexfields validation     |
467  |    for Globalizations.                                                  |
469  | ARGUMENTS                                                               |
470  |   request_id        IN NUMBER                                           |
471  |   org_id            IN NUMBER                                           |
472  |   sob               IN NUMBER                                           |
473  |   user_id           IN NUMBER                                           |
474  |   application_id    IN NUMBER                                           |
475  |   language_id       IN NUMBER                                           |
476  |   program_id        IN NUMBER                                           |
477  |   prog_appl_id      IN NUMBER                                           |
478  |   last_update_login IN NUMBER                                           |
479  |   int_table_name    IN VARCHAR2                                                                       |
480  | RETURNS                                                                 |
481  |    1      If validation is successful                                   |
482  |    0      If error occured during validation                            |
483  |                                                                         |
484  | NOTES                                                                   |
485  |                                                                         |
486  | EXAMPLE                                                                 |
487  |                                                                         |
488  | MODIFICATION HISTORY                                                    |
489  |    10-MAR-00  Chirag Mehta               Created.                       |
490  |                                                                         |
491  +-------------------------------------------------------------------------*/
492 
493 FUNCTION is_cust_imp_valid(request_id        IN NUMBER,
494                             org_id            IN NUMBER,
495                             sob               IN NUMBER,
496                             user_id           IN NUMBER,
497                             application_id    IN NUMBER,
498                             language_id       IN NUMBER,
499                             program_id        IN NUMBER,
500                             prog_appl_id      IN NUMBER,
501                             last_update_login IN NUMBER,
502                             int_table_name    IN VARCHAR2)
503 RETURN NUMBER IS
504 
505  /*-------------------------------+
506   |  Global variable declarations |
507   +-------------------------------*/
508 
509    TRUE  CONSTANT NUMBER  := 1;
510    FALSE CONSTANT NUMBER  := 0;
511    cr    CONSTANT char(1) := '
512 ';
513 
514    is_there NUMBER := 0;
515    lcursor  NUMBER;
516    lignore  NUMBER;
517    sqlstmt  VARCHAR2(254);
518 
519    /*Bug 3544086*/
520    l_user_schema	VARCHAR2(30) := USER;
521 
522 BEGIN
523 
524    --arp_standard.enable_debug;
525 
526    IF PG_DEBUG in ('Y', 'C') THEN
527       arp_standard.debug('is_cust_imp_valid: ' || cr || 'Global Descr Flex Field Validation begin: ' ||
528                             to_char(sysdate, 'DD-MON-YY HH:MI:SS'));
529    END IF;
530 
531    /* Check if JG_GLOBE_FLEX_VAL package is installed */
532    /* If JG_GLOBE_FLEX_VAL is not installed, handle it in the exception */
533 
534    SELECT  distinct 1
535    INTO    is_there
536    FROM    all_source
537    WHERE   name = 'JG_GLOBE_FLEX_VAL'
538    AND     type = 'PACKAGE BODY'
539    AND     owner = l_user_schema;
540 
541    IF PG_DEBUG in ('Y', 'C') THEN
542       arp_standard.debug('is_cust_imp_valid: ' || cr || 'Package: JG_GLOBE_FLEX_VAL is installed.');
543    END IF;
544 
545    /* JG_GLOBE_FLEX_VAL package is installed, so OK to call it */
546 
547    BEGIN
548 
549        lcursor := dbms_sql.open_cursor;
550 
551 if org_id is null then
552 
553 if(int_table_name='CUSTOMER') then
554 
555        sqlstmt :=
556 'BEGIN JG_GLOBE_FLEX_VAL.ar_cust_interface('|| request_id         || ','
557                                            || 'NULL'              || ','
558                                            || sob                || ','
559                                            || user_id            || ','
560                                            || application_id     || ','
561                                            || language_id        || ','
562                                            || program_id         || ','
563                                            || prog_appl_id       || ','
564                                            || last_update_login  || ','
565                                            ||'''CUSTOMER'''||'); END;';
566 
567 elsif(int_table_name='PROFILE') then
568 
569        sqlstmt :=
570 'BEGIN JG_GLOBE_FLEX_VAL.ar_cust_interface('|| request_id         || ','
571                                            || 'NULL'              || ','
572                                            || sob                || ','
573                                            || user_id            || ','
577                                            || prog_appl_id       || ','
574                                            || application_id     || ','
575                                            || language_id        || ','
576                                            || program_id         || ','
578                                            || last_update_login  || ','
579                                            ||'''PROFILE'''||'); END;';
580 
581 end if;
582 else
583 
584 if(int_table_name='CUSTOMER') then
585 
586        sqlstmt :=
587 'BEGIN JG_GLOBE_FLEX_VAL.ar_cust_interface('|| request_id         || ','
588                                            || org_id             || ','
589                                            || sob                || ','
590                                            || user_id            || ','
591                                            || application_id     || ','
592                                            || language_id        || ','
593                                            || program_id         || ','
594                                            || prog_appl_id       || ','
595                                            || last_update_login  || ','
596                                            ||'''CUSTOMER'''||'); END;';
597 
598 elsif(int_table_name='PROFILE') then
599 
600        sqlstmt :=
601 'BEGIN JG_GLOBE_FLEX_VAL.ar_cust_interface('|| request_id         || ','
602                                            || org_id             || ','
603                                            || sob                || ','
604                                            || user_id            || ','
605                                            || application_id     || ','
606                                            || language_id        || ','
607                                            || program_id         || ','
608                                            || prog_appl_id       || ','
609                                            || last_update_login  || ','
610                                            ||'''PROFILE'''||'); END;';
611 
612 end if;
613 end if;
614        dbms_sql.parse(lcursor, sqlstmt, dbms_sql.native);
615 
616        IF PG_DEBUG in ('Y', 'C') THEN
617           arp_standard.debug('is_cust_imp_valid: ' || cr||'Executing Statement:'||cr||cr||sqlstmt);
618        END IF;
619 
620        lignore := dbms_sql.execute(lcursor);
621 
622        dbms_sql.close_cursor(lcursor);
623 
624        EXCEPTION
625            when OTHERS then
626            IF PG_DEBUG in ('Y', 'C') THEN
627               arp_standard.debug('is_cust_imp_valid: ' || cr|| 'Exception calling JG_GLOBE_FLEX_VAL.ar_cust_interface()');
628               arp_standard.debug('is_cust_imp_valid: ' || SQLERRM);
629            END IF;
630 
631            IF dbms_sql.is_open(lcursor)
632            THEN
633                 dbms_sql.close_cursor(lcursor);
634            END IF;
635             IF PG_DEBUG in ('Y', 'C') THEN
636                arp_standard.debug('is_cust_imp_valid: ' || cr || 'Global Descr Flex Field Validation end: '
637                                   || to_char(sysdate, 'DD-MON-YY HH:MI:SS'));
638             END IF;
639 
640            return(FALSE);
641    END;
642 
643 
644    IF PG_DEBUG in ('Y', 'C') THEN
645       arp_standard.debug('is_cust_imp_valid: ' || cr || 'Global Descr Flex Field Validation end: ' ||
646                     to_char(sysdate, 'DD-MON-YY HH:MI:SS'));
647    END IF;
648 
649    return(TRUE);
650 
651    EXCEPTION
652 
653         WHEN NO_DATA_FOUND THEN
654             /* Always return TRUE if JG is not installed */
655             IF PG_DEBUG in ('Y', 'C') THEN
656                arp_standard.debug('is_cust_imp_valid: ' || 'Not running Global Validation, JG_GLOBE_FLEX_VAL NOT installed.');
657                arp_standard.debug('is_cust_imp_valid: ' || cr || 'Global Descr Flex Field Validation end: '
658                                   || to_char(sysdate, 'DD-MON-YY HH:MI:SS'));
659             END IF;
660             return(TRUE);
661 
662         WHEN OTHERS THEN
663             IF PG_DEBUG in ('Y', 'C') THEN
664                arp_standard.debug(cr|| 'Exception in AR_GDF_VALIDATION.is_cust_imp_valid()');
665                arp_standard.debug('is_cust_imp_valid: ' || SQLERRM);
666                arp_standard.debug('is_cust_imp_valid: ' || cr || 'Global Descr Flex Field Validation end: '
667                                   || to_char(sysdate, 'DD-MON-YY HH:MI:SS'));
668             END IF;
669             return(FALSE);
670 
671 END is_cust_imp_valid;
672 
673 /*-------------------------------------------------------------------------+
674  | PUBLIC PROCEDURE                                                        |
675  |    copy_gdf_attributes                                                  |
676  |                                                                         |
677  | PUBLIC VARIABLES                                                        |
678  |                                                                         |
679  | DESCRIPTION                                                             |
680  |    This is a stub module for copying global descriptive flex fields to  |
681  |    to JG Tables from Autoinvoice and Copy Transactions.                 |
682  |                                                                         |
683  |    The global descriptive flex field copy package                       |
684  |    JL_BR_SPED_PKG is installed only when JG is installed.               |
685  |                                                                         |
686  | ARGUMENTS                                                               |
687  |    p_request_id        Request Id of Autoinvoice/Copy Transactions.     |
688  |    p_called_from       Module Name of Autoinvoice/Copy Transactions.    |
689  |                                                                         |
690  | RETURNS                                                                 |
691  |    None                                                                 |
692  |                                                                         |
693  | NOTES                                                                   |
694  |                                                                         |
695  | EXAMPLE                                                                 |
696  |    ar_gdf_validation.copy_gdf_attributes(99999,'RAXTRX')                |
697  |                                                                         |
698  | MODIFICATION HISTORY                                                    |
699  |    26-Aug-08  Vijay Pusuluri   Created.                                 |
700  +-------------------------------------------------------------------------*/
701 
702 PROCEDURE copy_gdf_attributes(p_request_id IN NUMBER,
703 	p_called_from IN VARCHAR2) IS
704 
705  /*-------------------------------+
706   |  Global variable declarations |
707   +-------------------------------*/
708    lcursor  NUMBER;
709    lignore  NUMBER;
710    sqlstmt  VARCHAR2(254);
711    l_error  VARCHAR2(1000);
712    l_return_value NUMBER;
713 BEGIN
714 
715    IF PG_DEBUG in ('Y', 'C') THEN
716       arp_standard.debug('ar_gdf_validation.copy_gdf_attributes()+');
717    END IF;
718 
719    /* Check if JL_BR_SPED_PKG package is installed. */
720 
721   /* IF is_jg_installed IS NOT NULL THEN*/
722     g_jgzz_product_code := FND_PROFILE.value('JGZZ_PRODUCT_CODE');
723    IF g_jgzz_product_code IS NOT NULL THEN
724 
725       IF PG_DEBUG in ('Y', 'C') THEN
726          arp_standard.debug('copy_gdf_attributes: Package: JL_BR_SPED_PKG is installed.');
727       END IF;
728 
729       /* JL_BR_SPED_PKG package is installed, so OK to call the package. */
730 
731       BEGIN
732 
733           lcursor := dbms_sql.open_cursor;
734           sqlstmt :=
735 		'BEGIN :l_return_value := JL_BR_SPED_PKG.copy_gdf_attributes(:p_request_id, :p_called_from);
736 		 END;';
737 
738           dbms_sql.parse(lcursor, sqlstmt, dbms_sql.native);
739 	  dbms_sql.bind_variable(lcursor, ':p_request_id', p_request_id);
740           dbms_sql.bind_variable(lcursor, ':p_called_from', p_called_from);
741 	  dbms_sql.bind_variable(lcursor, ':l_return_value', l_return_value);
742 
743           IF PG_DEBUG in ('Y', 'C') THEN
744              arp_standard.debug('copy_gdf_attributes: Executing Statement: '||sqlstmt);
745           END IF;
746 
747           lignore := dbms_sql.execute(lcursor);
748           dbms_sql.close_cursor(lcursor);
749 
750       EXCEPTION
751 	  WHEN OTHERS THEN
752 	  IF PG_DEBUG in ('Y', 'C') THEN
753 	     arp_standard.debug('copy_gdf_attributes: Exception calling BEGIN JL_BR_SPED_PKG.copy_gdf_attributes.');
754 	     arp_standard.debug('copy_gdf_attributes: ' || SQLERRM);
755 	     l_error := SQLERRM;
756 	     arp_standard.debug('ar_gdf_validation.copy_gdf_attributes()-');
757 	  END IF;
758           IF dbms_sql.is_open(lcursor)
759           THEN
760                dbms_sql.close_cursor(lcursor);
761           END IF;
762       END;
763 
764    END IF ;
765 
766    IF PG_DEBUG in ('Y', 'C') THEN
767 	arp_standard.debug('ar_gdf_validation.copy_gdf_attributes()-');
768    END IF;
769 
770 EXCEPTION
771     WHEN OTHERS THEN
772          IF PG_DEBUG in ('Y', 'C') THEN
773 	     arp_standard.debug('copy_gdf_attributes: Exception calling BEGIN JL_BR_SPED_PKG.copy_gdf_attributes.');
774 	     arp_standard.debug('copy_gdf_attributes: ' || SQLERRM);
775 	     arp_standard.debug('ar_gdf_validation.copy_gdf_attributes()-');
776          END IF;
777 END copy_gdf_attributes;
778 
779 
780 /*-------------------------------------------------------------------------+
781  | PUBLIC PROCEDURE                                                        |
782  |  insert_global_table                                                    |
783  |                                                                         |
784  | DESCRIPTION                                                             |
785  |    This is module for insertion of address related 			   |
786  |    records in globalization tables   				   |
787  |    for Globalizations.                                                  |
788  |									   |
789  | ARGUMENTS                                                               |
790  |   p_address_id      IN NUMBER                                           |
791  |   p_contributor_class_code IN VARCHAR2                                  |
792  |                                                                         |
793  | NOTES                                                                   |
794  |                                                                         |
795  | EXAMPLE                                                                 |
796  |                                                                         |
797  | MODIFICATION HISTORY                                                    |
798  |    11-JUNE-00  Chirag Mehta               Created.                      |
799  |                                                                         |
800  +-------------------------------------------------------------------------*/
801 
802 
803 
804 PROCEDURE insert_global_table(p_address_id             IN NUMBER,
805                               p_contributor_class_code IN VARCHAR2) IS
806 BEGIN
807 
808 /* Call Globalization's procedue */
809 
810 JL_ZZ_AR_TX_LIB_PKG.populate_cus_cls_details(p_address_id,p_contributor_class_code);
811 
812 END insert_global_table;
813 
814 FUNCTION is_jg_installed RETURN VARCHAR2 IS
815  BEGIN
816          return FND_PROFILE.value('JGZZ_PRODUCT_CODE');
817  END is_jg_installed;
818 
819 BEGIN
820 
821  /* g_jgzz_product_code:= sys_context('JG','JGZZ_PRODUCT_CODE'); */
822 
823      g_jgzz_product_code := JG_ZZ_SHARED_PKG.GET_PRODUCT(l_org_id);
824 
825 
826 END AR_GDF_VALIDATION;