Application Development 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: 

Remove particular field in alv with Specific Condition

0 Kudos

Hello Guru's,

How can we hide particular column according to a particular condition in ALV.

1 ACCEPTED SOLUTION

thkolz
Contributor

This is for the usage of CL_SALV_TABLE:

  TRY.
cl_salv_table=>factory(
EXPORTING
r_container = i_container
IMPORTING
r_salv_table = DATA(r_salv_table)
CHANGING
t_table = gt_output
).
CATCH cx_salv_msg.
ENDTRY. IF p_showde NE abap_true.
* Deleted documents should not be shown => hide column with deletion flag
r_salv_table->get_columns( )->get_column( 'LOEKZ' )->set_technical( ).
ENDIF.

If the column should be still available in the cataglog, but not visible:

r_salv_table->get_columns( )->get_column( 'LOEKZ' )->set_visible( abap_false ).
3 REPLIES 3

thkolz
Contributor

This is for the usage of CL_SALV_TABLE:

  TRY.
cl_salv_table=>factory(
EXPORTING
r_container = i_container
IMPORTING
r_salv_table = DATA(r_salv_table)
CHANGING
t_table = gt_output
).
CATCH cx_salv_msg.
ENDTRY. IF p_showde NE abap_true.
* Deleted documents should not be shown => hide column with deletion flag
r_salv_table->get_columns( )->get_column( 'LOEKZ' )->set_technical( ).
ENDIF.

If the column should be still available in the cataglog, but not visible:

r_salv_table->get_columns( )->get_column( 'LOEKZ' )->set_visible( abap_false ).

Sandra_Rossi
Active Contributor
0 Kudos

The answer will depend on the ALV technology that you are using... What is it?

Sandra_Rossi
Active Contributor
0 Kudos

Thorsten answer is about technology CL_SALV_TABLE.