Skip to Content
avatar image
Former Member

ALV OO Column Header With Dynamic Internal Table

Hi abapers,

I have an issue of displaying column header for dynamic internal table. I am using ALV OO. The methods SET_*****_TEXT do not work with variables and I dont know the columns name until runtime and I am using fieldcatalog for getting names of columns.

Any help Would be appreciated.

My code for naming columns is as follows:

LOOP AT t_fldcat INTO wa_it_fldcat.
lr_columns = r_salv_table->get_columns( ).
* lr_columns->set_optimize( 'X' ).
TRANSLATE wa_it_fldcat-fieldname to UPPER CASE.
lr_column ?= lr_columns->get_column( wa_it_fldcat-fieldname ).
ltext = WA_IT_FLDCAT-SELTEXT(40).
lr_column->set_long_text( ltext ).
mtext = WA_IT_FLDCAT-SELTEXT(20).
lr_column->set_medium_text( mtext ).
stext = WA_IT_FLDCAT-SELTEXT(10).
lr_column->set_short_text( stext ).
lr_column->set_output_length( 25 ).

ENDLOOP.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Dec 17, 2016 at 06:31 PM

    You should call the method r_salv_table->display( ) after you have changed anything (once, just before the display)

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 19, 2016 at 07:03 AM

    Thanks Sandra..... I have put a couple of method calls after this loop... Now I removed them and my problem is solved....

    Add comment
    10|10000 characters needed characters exceeded