Application Development and Automation 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: 
Read only

ALV report without using field catalogue manually

Former Member
0 Likes
7,446

I am looking for alv report in which I will not create fieldcatalogue manually but pass the structure as it is and display the alv. Please provide me sample code.

Moderator message: Please do not use all upper case in the future.

Edited by: Thomas Zloch on Apr 1, 2010 12:31 PM - converted to lower case

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,336

Donot post in ALL CAPS. Please read the forum rules before posting

I am looking for alv report in which I will not create fieldcatalogue manually but pass the structure as it is and display the alv. Please provide me sample code.

Moderator message: Please do not use all upper case in the future.

Edited by: Thomas Zloch on Apr 1, 2010 12:31 PM - converted to lower case

7 REPLIES 7
Read only

Former Member
0 Likes
3,337

Donot post in ALL CAPS. Please read the forum rules before posting

Read only

Former Member
0 Likes
3,336

Use the function module "REUSE_ALV_FIELDCATALOG_MERGE" to create the field catalog of all the fields in a structure

eg :

data : xfieldcat type slis_t_fieldcat_alv.

call function 'REUSE_ALV_FIELDCATALOG_MERGE'

exporting

i_program_name = sy-repid

i_internal_tabname = <internal table structure>

i_bypassing_buffer = 'X'

i_buffer_active = ' '

changing

ct_fieldcat = xfieldcat

exceptions

inconsistent_interface = 1

program_error = 2

others = 3.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = sy-repid

i_callback_user_command = 'USER_COMMAND'

it_fieldcat = xfieldcat[]

tables

t_outtab = <internal table>.

Regards

Vinod

Edited by: Vinod Kumar on Apr 1, 2010 3:45 PM

Read only

Former Member
0 Likes
3,336

have a look at program

SALV_DEMO_TABLE_COLUMNS

Read only

Former Member
0 Likes
3,336

Hi


  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
            i_program_name     = 'progname
            i_internal_tabname = 'REPORT_TAB'
       CHANGING
            ct_fieldcat        = bo_fieldcat.

 CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
             it_fieldcat              = bo_fieldcat.
       TABLES
            t_outtab          = alvgrid_tab.

best regard

Marco

Read only

0 Likes
3,336

come on guys we have 2010 by now, would you guys please try to evolve to modern techniques and make use of either:

CL_GUI_ALV_GRID or CL_SALV_TABLE?

I dont mind how you code your programs, that is YOUR point, but when people asking for advice since they are new to the subject, we shouldnt teach them old fashioned stuff.

Edited by: Florian Kemmer on Apr 1, 2010 12:28 PM

Read only

Rocky1
Product and Topic Expert
Product and Topic Expert
0 Likes
3,336

Hi,

Use the following function mudule

g_repid = sy-repid.
  g_tabname_header = 'ZLS_PROD_ERR_LOG'.

    REFRESH i_fieldcat.

    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
      EXPORTING
        i_program_name         = g_repid
        i_structure_name       = g_tabname_header
      CHANGING
        ct_fieldcat            = i_fieldcat
      EXCEPTIONS
        inconsistent_interface = 1
        program_error          = 2
        OTHERS                 = 3.

Now you can pass this i_fieldcat to FM 'REUSE_ALV_GRID_DISPLAY'.

Thanks & Regards

Rocky Agarwal

Read only

ThomasZloch
Active Contributor
0 Likes
3,336

In addition to the all caps thing, please search for existing solutions first, there are many available. Use the classes as suggested by Florian rather than the function modules.

Thread locked

Thomas