44: l_module_name VARCHAR2(100);
45: ---------------------
46: -- Flexfield API type
47: ---------------------
48: lseg_gl_segs fnd_flex_key_api.segment_type; -- Segment Type
49: lseg_glat_segs fnd_flex_key_api.segment_type; -- Segment Type
50: lseg_new_seg fnd_flex_key_api.segment_type;
51: lseg_att_new_seg fnd_flex_key_api.segment_type;
52: --
45: ---------------------
46: -- Flexfield API type
47: ---------------------
48: lseg_gl_segs fnd_flex_key_api.segment_type; -- Segment Type
49: lseg_glat_segs fnd_flex_key_api.segment_type; -- Segment Type
50: lseg_new_seg fnd_flex_key_api.segment_type;
51: lseg_att_new_seg fnd_flex_key_api.segment_type;
52: --
53: lstr_gl_struc fnd_flex_key_api.structure_type; -- Structure Type
46: -- Flexfield API type
47: ---------------------
48: lseg_gl_segs fnd_flex_key_api.segment_type; -- Segment Type
49: lseg_glat_segs fnd_flex_key_api.segment_type; -- Segment Type
50: lseg_new_seg fnd_flex_key_api.segment_type;
51: lseg_att_new_seg fnd_flex_key_api.segment_type;
52: --
53: lstr_gl_struc fnd_flex_key_api.structure_type; -- Structure Type
54: lstr_new_struc fnd_flex_key_api.structure_type;
47: ---------------------
48: lseg_gl_segs fnd_flex_key_api.segment_type; -- Segment Type
49: lseg_glat_segs fnd_flex_key_api.segment_type; -- Segment Type
50: lseg_new_seg fnd_flex_key_api.segment_type;
51: lseg_att_new_seg fnd_flex_key_api.segment_type;
52: --
53: lstr_gl_struc fnd_flex_key_api.structure_type; -- Structure Type
54: lstr_new_struc fnd_flex_key_api.structure_type;
55: lstr_glat_struc fnd_flex_key_api.structure_type;
49: lseg_glat_segs fnd_flex_key_api.segment_type; -- Segment Type
50: lseg_new_seg fnd_flex_key_api.segment_type;
51: lseg_att_new_seg fnd_flex_key_api.segment_type;
52: --
53: lstr_gl_struc fnd_flex_key_api.structure_type; -- Structure Type
54: lstr_new_struc fnd_flex_key_api.structure_type;
55: lstr_glat_struc fnd_flex_key_api.structure_type;
56: --
57: lflx_gl_flex fnd_flex_key_api.flexfield_type; -- Flexfield Type
50: lseg_new_seg fnd_flex_key_api.segment_type;
51: lseg_att_new_seg fnd_flex_key_api.segment_type;
52: --
53: lstr_gl_struc fnd_flex_key_api.structure_type; -- Structure Type
54: lstr_new_struc fnd_flex_key_api.structure_type;
55: lstr_glat_struc fnd_flex_key_api.structure_type;
56: --
57: lflx_gl_flex fnd_flex_key_api.flexfield_type; -- Flexfield Type
58: lflx_new_flex fnd_flex_key_api.flexfield_type;
51: lseg_att_new_seg fnd_flex_key_api.segment_type;
52: --
53: lstr_gl_struc fnd_flex_key_api.structure_type; -- Structure Type
54: lstr_new_struc fnd_flex_key_api.structure_type;
55: lstr_glat_struc fnd_flex_key_api.structure_type;
56: --
57: lflx_gl_flex fnd_flex_key_api.flexfield_type; -- Flexfield Type
58: lflx_new_flex fnd_flex_key_api.flexfield_type;
59: lflx_glat_flex fnd_flex_key_api.flexfield_type;
53: lstr_gl_struc fnd_flex_key_api.structure_type; -- Structure Type
54: lstr_new_struc fnd_flex_key_api.structure_type;
55: lstr_glat_struc fnd_flex_key_api.structure_type;
56: --
57: lflx_gl_flex fnd_flex_key_api.flexfield_type; -- Flexfield Type
58: lflx_new_flex fnd_flex_key_api.flexfield_type;
59: lflx_glat_flex fnd_flex_key_api.flexfield_type;
60: --
61: llst_gl_seg_list fnd_flex_key_api.segment_list; -- Segment List
54: lstr_new_struc fnd_flex_key_api.structure_type;
55: lstr_glat_struc fnd_flex_key_api.structure_type;
56: --
57: lflx_gl_flex fnd_flex_key_api.flexfield_type; -- Flexfield Type
58: lflx_new_flex fnd_flex_key_api.flexfield_type;
59: lflx_glat_flex fnd_flex_key_api.flexfield_type;
60: --
61: llst_gl_seg_list fnd_flex_key_api.segment_list; -- Segment List
62: llst_glat_seg_list fnd_flex_key_api.segment_list;
55: lstr_glat_struc fnd_flex_key_api.structure_type;
56: --
57: lflx_gl_flex fnd_flex_key_api.flexfield_type; -- Flexfield Type
58: lflx_new_flex fnd_flex_key_api.flexfield_type;
59: lflx_glat_flex fnd_flex_key_api.flexfield_type;
60: --
61: llst_gl_seg_list fnd_flex_key_api.segment_list; -- Segment List
62: llst_glat_seg_list fnd_flex_key_api.segment_list;
63: ---------------------
57: lflx_gl_flex fnd_flex_key_api.flexfield_type; -- Flexfield Type
58: lflx_new_flex fnd_flex_key_api.flexfield_type;
59: lflx_glat_flex fnd_flex_key_api.flexfield_type;
60: --
61: llst_gl_seg_list fnd_flex_key_api.segment_list; -- Segment List
62: llst_glat_seg_list fnd_flex_key_api.segment_list;
63: ---------------------
64: -- Value set API
65: ---------------------
58: lflx_new_flex fnd_flex_key_api.flexfield_type;
59: lflx_glat_flex fnd_flex_key_api.flexfield_type;
60: --
61: llst_gl_seg_list fnd_flex_key_api.segment_list; -- Segment List
62: llst_glat_seg_list fnd_flex_key_api.segment_list;
63: ---------------------
64: -- Value set API
65: ---------------------
66: lval_valueset fnd_vset.valueset_r;
267: --Find the Structure and Segments for the entered
268: --chart of accounts ID
269: --------------------------------------------------
270: BEGIN
271: fnd_flex_key_api.set_session_mode('seed_data');
272: --
273: debug (l_module_name, 'Calling fnd_flex_key_api.find_flexfield GLLE');
274: lflx_gl_flex := fnd_flex_key_api.find_flexfield('SQLGL','GLLE');
275:
269: --------------------------------------------------
270: BEGIN
271: fnd_flex_key_api.set_session_mode('seed_data');
272: --
273: debug (l_module_name, 'Calling fnd_flex_key_api.find_flexfield GLLE');
274: lflx_gl_flex := fnd_flex_key_api.find_flexfield('SQLGL','GLLE');
275:
276: debug (l_module_name, '=============================');
277: debug (l_module_name, 'DUMP OF flex field SQLGL GLLE');
270: BEGIN
271: fnd_flex_key_api.set_session_mode('seed_data');
272: --
273: debug (l_module_name, 'Calling fnd_flex_key_api.find_flexfield GLLE');
274: lflx_gl_flex := fnd_flex_key_api.find_flexfield('SQLGL','GLLE');
275:
276: debug (l_module_name, '=============================');
277: debug (l_module_name, 'DUMP OF flex field SQLGL GLLE');
278: debug (l_module_name, '=============================');
295: debug (l_module_name, 'table_application_id='||lflx_gl_flex.table_application_id);
296: debug (l_module_name, 'table_id='||lflx_gl_flex.table_id);
297: debug (l_module_name, '=============================');
298:
299: debug (l_module_name, 'fnd_flex_key_api.find_structure');
300: lstr_gl_struc := fnd_flex_key_api.find_structure(lflx_gl_flex,p_coa_id);
301: debug (l_module_name, '======================================');
302: debug (l_module_name, 'DUMP OF flex field structure SQLGL GLLE');
303: debug (l_module_name, '======================================');
296: debug (l_module_name, 'table_id='||lflx_gl_flex.table_id);
297: debug (l_module_name, '=============================');
298:
299: debug (l_module_name, 'fnd_flex_key_api.find_structure');
300: lstr_gl_struc := fnd_flex_key_api.find_structure(lflx_gl_flex,p_coa_id);
301: debug (l_module_name, '======================================');
302: debug (l_module_name, 'DUMP OF flex field structure SQLGL GLLE');
303: debug (l_module_name, '======================================');
304: debug (l_module_name, 'instantiated='||lstr_gl_struc.instantiated);
316: debug (l_module_name, 'shorthand_enabled_flag='||lstr_gl_struc.shorthand_enabled_flag);
317: debug (l_module_name, 'shorthand_prompt='||lstr_gl_struc.shorthand_prompt);
318: debug (l_module_name, 'shorthand_length='||lstr_gl_struc.shorthand_length);
319: debug (l_module_name, '======================================');
320: debug (l_module_name, 'fnd_flex_key_api.get_segments');
321: fnd_flex_key_api.get_segments
322: (
323: flexfield => lflx_gl_flex,
324: structure => lstr_gl_struc,
317: debug (l_module_name, 'shorthand_prompt='||lstr_gl_struc.shorthand_prompt);
318: debug (l_module_name, 'shorthand_length='||lstr_gl_struc.shorthand_length);
319: debug (l_module_name, '======================================');
320: debug (l_module_name, 'fnd_flex_key_api.get_segments');
321: fnd_flex_key_api.get_segments
322: (
323: flexfield => lflx_gl_flex,
324: structure => lstr_gl_struc,
325: nsegments => ln_gl_nsegs, --nseg stores the number of segments
345: --delete records for GLAT Flexfield
346: --Also set the flag for new GLAT flexfield
347: ---------------------------------------------
348: BEGIN
349: debug (l_module_name, 'fnd_flex_key_api.find_flexfield GLAT');
350: lflx_glat_flex :=fnd_flex_key_api.find_flexfield('SQLGL', 'GLAT');
351: debug (l_module_name, '=============================');
352: debug (l_module_name, 'DUMP OF flex field SQLGL GLAT');
353: debug (l_module_name, '=============================');
346: --Also set the flag for new GLAT flexfield
347: ---------------------------------------------
348: BEGIN
349: debug (l_module_name, 'fnd_flex_key_api.find_flexfield GLAT');
350: lflx_glat_flex :=fnd_flex_key_api.find_flexfield('SQLGL', 'GLAT');
351: debug (l_module_name, '=============================');
352: debug (l_module_name, 'DUMP OF flex field SQLGL GLAT');
353: debug (l_module_name, '=============================');
354: debug (l_module_name, 'instantiated='||lflx_glat_flex.instantiated);
372: debug (l_module_name, '=============================');
373: EXCEPTION
374: WHEN no_data_found THEN
375: debug (l_module_name, 'No GLAT Defined. Creating GLAT');
376: debug (l_module_name, 'Calling fnd_flex_key_api.new_flexfield');
377: debug (l_module_name, '==============================');
378: debug (l_module_name, 'CREATING flex field SQLGL GLAT');
379: debug (l_module_name, '==============================');
380: debug (l_module_name, 'appl_short_name='||lflx_gl_flex.appl_short_name);
391: debug (l_module_name, 'concat_seg_len_max='||lflx_gl_flex.concat_seg_len_max);
392: debug (l_module_name, 'concat_seg_len_max='||lflx_gl_flex.concat_seg_len_max);
393: debug (l_module_name, 'concat_len_warning='||lflx_gl_flex.concat_len_warning);
394: debug (l_module_name, '==============================');
395: lflx_new_flex := fnd_flex_key_api.new_flexfield
396: (
397: appl_short_name =>lflx_gl_flex.appl_short_name,
398: flex_code =>'GLAT',
399: flex_title =>substr('Reporting Attributes:'||lflx_gl_flex.flex_title,1,30),
430: debug (l_module_name, 'table_application_id='||lflx_new_flex.table_application_id);
431: debug (l_module_name, 'table_id='||lflx_new_flex.table_id);
432: debug (l_module_name, '=============================');
433: --
434: debug (l_module_name, 'Calling fnd_flex_key_api.register');
435: fnd_flex_key_api.register
436: (
437: flexfield =>lflx_new_flex,
438: enable_columns => 'Y'
431: debug (l_module_name, 'table_id='||lflx_new_flex.table_id);
432: debug (l_module_name, '=============================');
433: --
434: debug (l_module_name, 'Calling fnd_flex_key_api.register');
435: fnd_flex_key_api.register
436: (
437: flexfield =>lflx_new_flex,
438: enable_columns => 'Y'
439: );
437: flexfield =>lflx_new_flex,
438: enable_columns => 'Y'
439: );
440: --
441: debug (l_module_name, 'Calling fnd_flex_key_api.find_flexfield after creation of GLAT');
442: lflx_glat_flex :=fnd_flex_key_api.find_flexfield('SQLGL', 'GLAT');
443: debug (l_module_name, '=============================');
444: debug (l_module_name, 'DUMP OF flex field SQLGL GLAT');
445: debug (l_module_name, '=============================');
438: enable_columns => 'Y'
439: );
440: --
441: debug (l_module_name, 'Calling fnd_flex_key_api.find_flexfield after creation of GLAT');
442: lflx_glat_flex :=fnd_flex_key_api.find_flexfield('SQLGL', 'GLAT');
443: debug (l_module_name, '=============================');
444: debug (l_module_name, 'DUMP OF flex field SQLGL GLAT');
445: debug (l_module_name, '=============================');
446: debug (l_module_name, 'instantiated='||lflx_glat_flex.instantiated);
481: ln_segs_ctr := 1;
482: ln_seg_num := 1;
483: debug (l_module_name, 'ln_gl_nsegs='||ln_gl_nsegs);
484: WHILE (ln_segs_ctr<=ln_gl_nsegs) LOOP
485: debug (l_module_name, 'Calling fnd_flex_key_api.find_segment');
486: debug (l_module_name, 'llst_gl_seg_list('||ln_segs_ctr||')='||llst_gl_seg_list(ln_segs_ctr));
487: lseg_gl_segs:=fnd_flex_key_api.find_segment
488: (
489: lflx_gl_flex,
483: debug (l_module_name, 'ln_gl_nsegs='||ln_gl_nsegs);
484: WHILE (ln_segs_ctr<=ln_gl_nsegs) LOOP
485: debug (l_module_name, 'Calling fnd_flex_key_api.find_segment');
486: debug (l_module_name, 'llst_gl_seg_list('||ln_segs_ctr||')='||llst_gl_seg_list(ln_segs_ctr));
487: lseg_gl_segs:=fnd_flex_key_api.find_segment
488: (
489: lflx_gl_flex,
490: lstr_gl_struc,
491: llst_gl_seg_list(ln_segs_ctr)
516: debug (l_module_name, 'lov_prompt='||lseg_gl_segs.lov_prompt);
517: debug (l_module_name, 'window_prompt='||lseg_gl_segs.window_prompt);
518: debug (l_module_name, '=============================');
519: BEGIN
520: debug (l_module_name, 'Calling fnd_flex_key_api.find_structure');
521: lstr_glat_struc:=fnd_flex_key_api.find_structure
522: (
523: flexfield => lflx_glat_flex,
524: structure_number => p_coa_id
517: debug (l_module_name, 'window_prompt='||lseg_gl_segs.window_prompt);
518: debug (l_module_name, '=============================');
519: BEGIN
520: debug (l_module_name, 'Calling fnd_flex_key_api.find_structure');
521: lstr_glat_struc:=fnd_flex_key_api.find_structure
522: (
523: flexfield => lflx_glat_flex,
524: structure_number => p_coa_id
525: );
576: debug (l_module_name, 'shorthand_enabled_flag='||lstr_new_struc.shorthand_enabled_flag);
577: debug (l_module_name, 'shorthand_prompt='||lstr_new_struc.shorthand_prompt);
578: debug (l_module_name, 'shorthand_length='||lstr_new_struc.shorthand_length);
579: debug (l_module_name, '======================================');
580: debug (l_module_name, 'Calling fnd_flex_key_api.add_structure');
581: fnd_flex_key_api.add_structure
582: (
583: flexfield=>lflx_glat_flex,
584: structure=>lstr_new_struc
577: debug (l_module_name, 'shorthand_prompt='||lstr_new_struc.shorthand_prompt);
578: debug (l_module_name, 'shorthand_length='||lstr_new_struc.shorthand_length);
579: debug (l_module_name, '======================================');
580: debug (l_module_name, 'Calling fnd_flex_key_api.add_structure');
581: fnd_flex_key_api.add_structure
582: (
583: flexfield=>lflx_glat_flex,
584: structure=>lstr_new_struc
585: );
583: flexfield=>lflx_glat_flex,
584: structure=>lstr_new_struc
585: );
586: --
587: debug (l_module_name, 'Calling fnd_flex_key_api.find_structure');
588: lstr_glat_struc :=fnd_flex_key_api.find_structure
589: (
590: flexfield=>lflx_glat_flex,
591: structure_number=>p_coa_id
584: structure=>lstr_new_struc
585: );
586: --
587: debug (l_module_name, 'Calling fnd_flex_key_api.find_structure');
588: lstr_glat_struc :=fnd_flex_key_api.find_structure
589: (
590: flexfield=>lflx_glat_flex,
591: structure_number=>p_coa_id
592: );
631: AND sav.segment_attribute_type = cv_del_seg_attr_cur.segment_attribute_type;
632: debug (l_module_name, 'Updated '||SQL%ROWCOUNT||' rows.');
633:
634: debug (l_module_name, 'Deleting flex field qualifier '||cv_del_seg_attr_cur.segment_attribute_type);
635: debug (l_module_name, 'Calling fnd_flex_key_api.delete_flex_qualifier');
636: ln_func:=fnd_flex_key_api.delete_flex_qualifier
637: (
638: flexfield=>lflx_glat_flex,
639: qualifier_name=>cv_del_seg_attr_cur.segment_attribute_type
632: debug (l_module_name, 'Updated '||SQL%ROWCOUNT||' rows.');
633:
634: debug (l_module_name, 'Deleting flex field qualifier '||cv_del_seg_attr_cur.segment_attribute_type);
635: debug (l_module_name, 'Calling fnd_flex_key_api.delete_flex_qualifier');
636: ln_func:=fnd_flex_key_api.delete_flex_qualifier
637: (
638: flexfield=>lflx_glat_flex,
639: qualifier_name=>cv_del_seg_attr_cur.segment_attribute_type
640: );
639: qualifier_name=>cv_del_seg_attr_cur.segment_attribute_type
640: );
641: debug (l_module_name, 'ln_func='||ln_func);
642: IF (ln_func < 0) THEN
643: lc_api_message:=fnd_flex_key_api.message;
644: error (l_module_name, lc_api_message);
645: RAISE lexp_error;
646: END IF;
647: END LOOP;
645: RAISE lexp_error;
646: END IF;
647: END LOOP;
648: --
649: debug (l_module_name, 'Calling fnd_flex_key_api.delete_structure');
650: fnd_flex_key_api.delete_structure
651: (
652: lflx_glat_flex,
653: lstr_glat_struc
646: END IF;
647: END LOOP;
648: --
649: debug (l_module_name, 'Calling fnd_flex_key_api.delete_structure');
650: fnd_flex_key_api.delete_structure
651: (
652: lflx_glat_flex,
653: lstr_glat_struc
654: );
654: );
655: ---------------------------------------
656: -- Create New structure for GLAT Flexfield
657: ----------------------------------------
658: debug (l_module_name, 'Calling fnd_flex_key_api.find_flexfield');
659: lflx_glat_flex :=fnd_flex_key_api.find_flexfield('SQLGL', 'GLAT');
660: --
661: lstr_new_struc.structure_number :=p_coa_id;
662: lstr_new_struc.structure_code :=lstr_gl_struc.structure_code;
655: ---------------------------------------
656: -- Create New structure for GLAT Flexfield
657: ----------------------------------------
658: debug (l_module_name, 'Calling fnd_flex_key_api.find_flexfield');
659: lflx_glat_flex :=fnd_flex_key_api.find_flexfield('SQLGL', 'GLAT');
660: --
661: lstr_new_struc.structure_number :=p_coa_id;
662: lstr_new_struc.structure_code :=lstr_gl_struc.structure_code;
663: lstr_new_struc.structure_name :=lstr_gl_struc.structure_name;
674: lstr_new_struc.shorthand_length :=lstr_gl_struc.shorthand_length;
675: -------------------
676: --Add new structure
677: -------------------
678: debug (l_module_name, 'Calling fnd_flex_key_api.add_structure');
679: fnd_flex_key_api.add_structure
680: (
681: flexfield=>lflx_glat_flex,
682: structure=>lstr_new_struc
675: -------------------
676: --Add new structure
677: -------------------
678: debug (l_module_name, 'Calling fnd_flex_key_api.add_structure');
679: fnd_flex_key_api.add_structure
680: (
681: flexfield=>lflx_glat_flex,
682: structure=>lstr_new_struc
683: );
680: (
681: flexfield=>lflx_glat_flex,
682: structure=>lstr_new_struc
683: );
684: debug (l_module_name, 'Calling fnd_flex_key_api.find_structure');
685: lstr_glat_struc:=fnd_flex_key_api.find_structure
686: (
687: flexfield=>lflx_glat_flex,
688: structure_number=>p_coa_id
681: flexfield=>lflx_glat_flex,
682: structure=>lstr_new_struc
683: );
684: debug (l_module_name, 'Calling fnd_flex_key_api.find_structure');
685: lstr_glat_struc:=fnd_flex_key_api.find_structure
686: (
687: flexfield=>lflx_glat_flex,
688: structure_number=>p_coa_id
689: );
715:
716: --
717:
718:
719: debug (l_module_name, 'Calling fnd_flex_key_api.new_segment');
720: lseg_new_seg:= fnd_flex_key_api.new_segment
721: (
722: flexfield =>lflx_glat_flex,
723: structure =>lstr_glat_struc,
716: --
717:
718:
719: debug (l_module_name, 'Calling fnd_flex_key_api.new_segment');
720: lseg_new_seg:= fnd_flex_key_api.new_segment
721: (
722: flexfield =>lflx_glat_flex,
723: structure =>lstr_glat_struc,
724: segment_name =>lseg_gl_segs.segment_name,
742: );
743: --------------------------------------
744: --Add a new segment for GLAT Flexfield
745: --------------------------------------
746: debug (l_module_name, 'Calling fnd_flex_key_api.add_segment');
747: fnd_flex_key_api.add_segment
748: (
749: flexfield =>lflx_glat_flex,
750: structure =>lstr_glat_struc,
743: --------------------------------------
744: --Add a new segment for GLAT Flexfield
745: --------------------------------------
746: debug (l_module_name, 'Calling fnd_flex_key_api.add_segment');
747: fnd_flex_key_api.add_segment
748: (
749: flexfield =>lflx_glat_flex,
750: structure =>lstr_glat_struc,
751: segment =>lseg_new_seg
764: FOR c_rep_attr_cur IN rep_attr_cur(lseg_gl_segs.column_name,lc_flex_val_set_name,0) LOOP
765: -------------------------------
766: --Create corresponding segments
767: -------------------------------
768: debug (l_module_name, 'Calling fnd_flex_key_api.new_segment');
769: lseg_att_new_seg:= fnd_flex_key_api.new_segment
770: (
771: flexfield =>lflx_glat_flex,
772: structure =>lstr_glat_struc,
765: -------------------------------
766: --Create corresponding segments
767: -------------------------------
768: debug (l_module_name, 'Calling fnd_flex_key_api.new_segment');
769: lseg_att_new_seg:= fnd_flex_key_api.new_segment
770: (
771: flexfield =>lflx_glat_flex,
772: structure =>lstr_glat_struc,
773: segment_name =>c_rep_attr_cur.application_column_name,
790: window_prompt => c_rep_attr_cur.form_left_prompt
791: );
792: --Enable SEGMENT_ATTRIBUTE columns
793: BEGIN
794: debug (l_module_name, 'Calling fnd_flex_key_api.enable_column');
795: fnd_flex_key_api.enable_column
796: (
797: lflx_glat_flex,
798: lseg_att_new_seg.column_name
791: );
792: --Enable SEGMENT_ATTRIBUTE columns
793: BEGIN
794: debug (l_module_name, 'Calling fnd_flex_key_api.enable_column');
795: fnd_flex_key_api.enable_column
796: (
797: lflx_glat_flex,
798: lseg_att_new_seg.column_name
799: );
802: debug (l_module_name, 'Exception Null');
803: null;
804: END;
805: --Add the Segments
806: debug (l_module_name, 'Calling fnd_flex_key_api.add_segment');
807: fnd_flex_key_api.add_segment
808: (
809: flexfield =>lflx_glat_flex,
810: structure =>lstr_glat_struc,
803: null;
804: END;
805: --Add the Segments
806: debug (l_module_name, 'Calling fnd_flex_key_api.add_segment');
807: fnd_flex_key_api.add_segment
808: (
809: flexfield =>lflx_glat_flex,
810: structure =>lstr_glat_struc,
811: segment =>lseg_att_new_seg
821: -----------------------------------------
822: -- Add the qualifiers for each segment
823: -----------------------------------------
824: BEGIN
825: debug (l_module_name, 'Calling fnd_flex_key_api.get_segments');
826: fnd_flex_key_api.get_segments
827: (
828: flexfield=>lflx_glat_flex,
829: structure=>lstr_glat_struc,
822: -- Add the qualifiers for each segment
823: -----------------------------------------
824: BEGIN
825: debug (l_module_name, 'Calling fnd_flex_key_api.get_segments');
826: fnd_flex_key_api.get_segments
827: (
828: flexfield=>lflx_glat_flex,
829: structure=>lstr_glat_struc,
830: nsegments=>ln_glat_nsegs,
832: );
833:
834: ln_glat_segs_ctr := 1;
835: WHILE ln_glat_segs_ctr<=ln_glat_nsegs LOOP
836: debug (l_module_name, 'Calling fnd_flex_key_api.find_segment');
837: lseg_glat_segs:=fnd_flex_key_api.find_segment
838: (
839: lflx_glat_flex,
840: lstr_glat_struc,
833:
834: ln_glat_segs_ctr := 1;
835: WHILE ln_glat_segs_ctr<=ln_glat_nsegs LOOP
836: debug (l_module_name, 'Calling fnd_flex_key_api.find_segment');
837: lseg_glat_segs:=fnd_flex_key_api.find_segment
838: (
839: lflx_glat_flex,
840: lstr_glat_struc,
841: llst_glat_seg_list(ln_glat_segs_ctr)
851: lseg_glat_segs.column_name
852: ) LOOP
853: debug (l_module_name, 'ln_flex_attr_flag='||ln_flex_attr_flag);
854: IF ln_flex_attr_flag=0 THEN
855: debug (l_module_name, 'Calling fnd_flex_key_api.add_flex_qualifier');
856: debug (l_module_name, 'segment_attribute_type='||cv_seg_attr_cur.segment_attribute_type);
857: debug (l_module_name, 'segment_prompt='||cv_seg_attr_cur.segment_prompt);
858: debug (l_module_name, 'description='||cv_seg_attr_cur.description);
859: debug (l_module_name, 'global_flag='||cv_seg_attr_cur.global_flag);
858: debug (l_module_name, 'description='||cv_seg_attr_cur.description);
859: debug (l_module_name, 'global_flag='||cv_seg_attr_cur.global_flag);
860: debug (l_module_name, 'required_flag='||cv_seg_attr_cur.required_flag);
861: debug (l_module_name, 'unique_flag='||cv_seg_attr_cur.unique_flag);
862: fnd_flex_key_api.add_flex_qualifier
863: (
864: flexfield =>lflx_glat_flex,
865: qualifier_name =>cv_seg_attr_cur.segment_attribute_type,
866: prompt =>cv_seg_attr_cur.segment_prompt,
869: required_flag =>cv_seg_attr_cur.required_flag,
870: unique_flag =>cv_seg_attr_cur.unique_flag
871: );
872: END IF;
873: debug (l_module_name, 'Calling fnd_flex_key_api.assign_qualifier');
874: fnd_flex_key_api.assign_qualifier
875: (
876: flexfield =>lflx_glat_flex,
877: structure=>lstr_glat_struc,
870: unique_flag =>cv_seg_attr_cur.unique_flag
871: );
872: END IF;
873: debug (l_module_name, 'Calling fnd_flex_key_api.assign_qualifier');
874: fnd_flex_key_api.assign_qualifier
875: (
876: flexfield =>lflx_glat_flex,
877: structure=>lstr_glat_struc,
878: segment=>lseg_glat_segs,
900: FOR coa_cntr IN c_other_coas
901: LOOP
902: fnd_file.put_line(fnd_file.log, 'Processing chart of account : '||coa_cntr.id_flex_num);
903: BEGIN
904: lstr_glat_struc:=fnd_flex_key_api.find_structure
905: (flexfield => lflx_glat_flex,
906: structure_number=> coa_cntr.id_flex_num);
907:
908: fnd_flex_key_api.get_segments(flexfield=>lflx_glat_flex,
904: lstr_glat_struc:=fnd_flex_key_api.find_structure
905: (flexfield => lflx_glat_flex,
906: structure_number=> coa_cntr.id_flex_num);
907:
908: fnd_flex_key_api.get_segments(flexfield=>lflx_glat_flex,
909: structure=>lstr_glat_struc,
910: nsegments=>ln_glat_nsegs,
911: segments=>llst_glat_seg_list);
912:
911: segments=>llst_glat_seg_list);
912:
913: ln_glat_segs_ctr := 1;
914: WHILE ln_glat_segs_ctr <= ln_glat_nsegs LOOP
915: lseg_glat_segs:=fnd_flex_key_api.find_segment(lflx_glat_flex,
916: lstr_glat_struc,
917: llst_glat_seg_list(ln_glat_segs_ctr));
918: FOR cv_seg_attr_cur in seg_attr_cur(coa_cntr.id_flex_num,
919: 'GLLE',
920: 101,
921: lseg_glat_segs.column_name)
922: LOOP
923:
924: fnd_flex_key_api.assign_qualifier
925: (flexfield =>lflx_glat_flex,
926: structure=>lstr_glat_struc,
927: segment=>lseg_glat_segs,
928: flexfield_qualifier=>cv_seg_attr_cur.segment_attribute_type,
957: fnd_file.put_line(FND_FILE.LOG,'ERROR :'||lc_err_message);
958: retcode := -1;
959: errbuf := null;
960: WHEN others THEN
961: lc_api_message:=fnd_flex_key_api.message;
962: fnd_file.put_line(FND_FILE.LOG,'Error:'||substr(lc_api_message,1,250));
963: retcode := -1;
964: errbuf := null;
965: END gl_preparation ;