04-04-2019 5:47 PM
hey,
I am using cl_salv_table to dispay report and I need to hide some of my column present in gt_table I did this using SET_VISIBLE method.
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = lt_table
CHANGING
t_table = gt_table
.
CATCH cx_salv_msg .
ENDTRY.
lt_function = lt_table->get_functions( ).
lt_function->set_all( abap_true ).
lr_columns = lt_table->get_columns( ).
" Hiding columns present in gt_table.
lr_column ?= lr_columns->get_column('PERIOD').
lr_column->set_visible( abap_false ).
lr_column ?= lr_columns->get_column('GJAHR').
lr_column->set_visible( abap_false ).
lr_column ?= lr_columns->get_column('ZTAG1').
lr_column->set_visible( abap_false ).
"Optimizing Column width
lr_columns->set_optimize('X').
lt_table->display( ).
this is ok it's hiding the column but when I use the function like sort in ascending order these hidden column is still present in that. how can I remove these entry also.
thanks in adv.
04-04-2019 6:12 PM
lr_column->set_technical should do this for you. This is from the class documentation as follows:
"By default, the user is provided with all columns as a column set. The user can decide for himself/herself, which of these columns from the column set he/she wants displayed or not.
You use the SET_TECHNICAL method to set whether the column is contained in the user's column set or not. The user never sees technical columns."
So your code would be:
lr_column->set_technical( abap_true ).
04-04-2019 6:12 PM
lr_column->set_technical should do this for you. This is from the class documentation as follows:
"By default, the user is provided with all columns as a column set. The user can decide for himself/herself, which of these columns from the column set he/she wants displayed or not.
You use the SET_TECHNICAL method to set whether the column is contained in the user's column set or not. The user never sees technical columns."
So your code would be:
lr_column->set_technical( abap_true ).
04-04-2019 7:24 PM