09-13-2010 1:41 PM
Hi,
In my Report according to Radio button selection, I need to hide few columns.
I tried it with Method - IS_HEADER_VISIBLE.
But it's giving syntax error - " You can only omit the parameter name if the method only has a non-optional parameter or an optional IMPORTING parameter that is identified by "PREFERRED PARAMETER".
I am unable to work on this.
DATA: lr_columns TYPE REF TO cl_salv_columns_table.
TRY.
CALL METHOD lr_table->get_columns
RECEIVING
value = lr_columns.
CATCH cx_salv_not_found .
ENDTRY.
lr_columns->set_optimize('X' ).
lr_columns->is_headers_visible( 'X' ).
09-13-2010 3:17 PM
HI
you may have columns in the table that do not need to be included in the display, in order to
make them 'invisible' you must use this code for each of them
OR just remove them from the data table
l_columns = l_table->get_columns( ). "sets the handle for all of the columns
l_column ?= l_columns->get_column( 'FIELDNAME' ).
l_column->set_technical( if_salv_c_bool_sap=>true ).
Regards
09-13-2010 3:17 PM
HI
you may have columns in the table that do not need to be included in the display, in order to
make them 'invisible' you must use this code for each of them
OR just remove them from the data table
l_columns = l_table->get_columns( ). "sets the handle for all of the columns
l_column ?= l_columns->get_column( 'FIELDNAME' ).
l_column->set_technical( if_salv_c_bool_sap=>true ).
Regards
09-13-2010 3:17 PM
Hi Priya,
You can hide columns in SALV using the following statements
In the example below column 'MANDT' is hidden on the output and in the edit layout options of the ALV toolbar.
data: lr_column type ref to cl_salv_column.
try.
lr_column = ir_columns->get_column( 'MANDT' ). " you can replace your column name(that needs to be hidden) here
lr_column->set_technical( if_salv_c_bool_sap=>true ).
catch cx_salv_not_found.
endtry.
For more inofrmation please check and run SAP example program SALV_TEST_TABLE_COLUMNS on your system.
Please close the thread if the above solution helps you.
Thanks
SHRaj
09-13-2010 3:26 PM
You can do it like this
IF p_simu = abap_true AND p_mess = abap_false.
lf_column = lf_cols->get_column( 'ICON'(016) ). "Hides column ICON
lf_column->set_technical( if_salv_c_bool_sap=>true ).
lf_column = lf_cols->get_column( 'MESSAGE'(017) ). "Hides column MESSAGE
lf_column->set_technical( if_salv_c_bool_sap=>true ).
ENDIF.
09-14-2010 7:38 PM
Priya,
In the fieldcat for the fields you want to hide, populate "NO_OUT" with "X".
Bruce