Tuesday, November 16, 2010

Excluding a column from ALV Display using CL_SALV_TABLE Class.

It is assumed that the reader of the article has knowledge in ALV Grid Programming.

Please use the SET_VISIBLE method of the class CL_SALV_COLUMN_TABLE.

REPORT ztest.

DATA: ispfli TYPE TABLE OF spfli.
DATA: gr_table TYPE REF TO cl_salv_table.
data: gr_funct type ref to cl_salv_functions.
data: gr_columns type ref to cl_salv_columns_table.
data: gr_column type ref to CL_SALV_COLUMN_table.

START-OF-SELECTION.

SELECT * INTO TABLE ispfli FROM spfli.

TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = gr_table
CHANGING
t_table = ispfli.
CATCH cx_salv_msg .
ENDTRY.

gr_funct = gr_table->get_functions( ).
gr_funct->set_all( Abap_True ).

gr_columns = gr_table->get_columns( ).
gr_column ?= gr_columns->Get_Column( 'DISTANCE' ).
gr_column->SET_VISIBLE( abap_false ).

gr_table->display( ).

No comments:

Tutorials on SAP-ABAP

Adobe Interactive Forms Tutorials

Business Server Pages (BSP)

Userexits/BADIs

Web Dynpro for ABAP (Step by step procedure for web dynpro,Tutorials on Web Dynpro,)

ALV Tutorials

Blog Archive

goodsites