AlexanderK
AlexanderK

Reputation: 365

Pass internal table into REUSE_ALV_FIELDCATALOG_MERGE

I've got lt_result table as result of function module, just a usual internal table with 50+ columns.

So, I have to send that to ALV display, how to properly use that table as a source for REUSE_ALV_FIELDCATALOG_MERGE?

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
 EXPORTING
   I_PROGRAM_NAME               = sy-repid
   I_INTERNAL_TABNAME           = 'LT_RESULT'

This way it compiles, but won't get any fieldnames from that table. The same, when I try to use structure.

How do i get field names from given table to lt_fieldcat[] with shortest way possible?

Upvotes: 0

Views: 8317

Answers (2)

Suncatcher
Suncatcher

Reputation: 10621

The shortest way possible is using SALV classes:

data: gr_table  type ref to cl_salv_table.

call method cl_salv_table=>factory
  IMPORTING
    R_SALV_TABLE = gr_table
  CHANGING
    t_table      = lt_result.

gr_table->display( ).

This way you don't need fieldcatalog at all.

Upvotes: 2

devman
devman

Reputation: 11

    call function 'REUSE_ALV_FIELDCATALOG_MERGE'
   exporting
     i_program_name                    = sy-repid
     i_internal_tabname                = 'LT_RESULT'
     i_inclname                        = sy-repid "< if you use top-include  
    changing
     ct_fieldcat                       = lt_fldcat[]

When declaring lt_result using TYPE and not using LIKE

Upvotes: 1

Related Questions