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 OO Column Header With Dynamic Internal Table

fahd_hassan
Discoverer
0 Likes
1,330

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.

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
0 Likes
1,090

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

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.

2 REPLIES 2
Read only

Sandra_Rossi
Active Contributor
0 Likes
1,091

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

Read only

fahd_hassan
Discoverer
0 Likes
1,090

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