Skip to Content
0

ALV OO Column Header With Dynamic Internal Table

Dec 17, 2016 at 05:44 AM

63

avatar image
Former Member

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Sandra Rossi Dec 17, 2016 at 06:31 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Dec 19, 2016 at 07:03 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded