Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get field catalog of ALV in a program?

Former Member
0 Kudos

Hi, experts.


I need to get field catalog information in a specific program from other program.


I found some FM like "LT_DBDATA_READ_FROM_LTDX" but it can not brings field catalog information from all of program. Because some program dosen`t exist in a table LTDX.


Any idea to get field catalog list?

Specifically, I need column text of it.


Please help.

3 REPLIES 3

Former Member
0 Kudos

if it is ooalv please use this method....

 

          CALL METHOD g_grid_solopos->get_frontend_fieldcatalog
            IMPORTING
              et_fieldcatalog = lt_fcat[].

gouravkumar64
Active Contributor
0 Kudos

Hi,

Generally fieldcatalog can be made by 2 way.

1)

     i_fcat TYPE slis_t_fieldcat_alv,

       wa_fcat TYPE slis_fieldcat_alv,

wa_fcat-col_pos = 30.

   wa_fcat-fieldname = 'WITHT'.

   wa_fcat-seltext_l = 'WHT Type'.

   wa_fcat-outputlen   = '10'.

   APPEND wa_fcat TO i_fcat.

   CLEAR wa_fcat.

then

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

   EXPORTING

      i_callback_program                = sy-repid

      it_fieldcat                       = i_fcat

2)Otherwise using reuse_alv_fieldcatalog_merge.

Take a look at that one.

Regards

Gourav.


0 Kudos

This one is a basic question

These are the

helpful comments:

For Clasical ALV:

data : er_layout   type slis_layout_alv,

        gt_fieldcat type slis_t_fieldcat_alv,

        er_sp_group type slis_t_sp_group_alv,

        e_save(1)   type c,

        e_variant   like disvariant,

        er_events   type slis_t_event,

        gv_repid like sy-repid.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

     EXPORTING

       I_PROGRAM_NAME         = GV_REPID

       I_INTERNAL_TABNAME     = 'internal table name'

       I_INCLNAME             = GV_REPID

     CHANGING

       CT_FIELDCAT            = GT_FIELDCAT

     EXCEPTIONS

       INCONSISTENT_INTERFACE = 1

       PROGRAM_ERROR          = 2.

FOR Object oriented ALV:

CLASS-DATA: GT_FIELDCAT TYPE LVC_T_FCAT.

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

       EXPORTING

         I_STRUCTURE_NAME       = 'ZFI001N_ERRORS'

       CHANGING

         CT_FIELDCAT            = GT_FIELDCAT

       EXCEPTIONS

         INCONSISTENT_INTERFACE = 1

         PROGRAM_ERROR          = 2

         OTHERS                 = 3.

Notice the diffrence fieldcatalog is a diffrent type between classic and object oriented alv

There is another useful one which was mentioned

    DATA: GO_GRID  TYPE REF TO CL_GUI_ALV_GRID.

         CALL METHOD go_grid->get_frontend_fieldcatalog
            IMPORTING
              et_fieldcatalog = gt_fcat[].