cancel
Showing results for 
Search instead for 
Did you mean: 

Help required: ALV settings

Former Member
0 Kudos

Hi everybody,

I am facing a problem in restoring the standard ALV layout. After hiding all the columns through the 'settings' property, I applied it. But since then whenever the application is re-executed, the alv is displayed with all columns as hidden without displaying any rows, even though there are records in the table.

Can somone please suggest, what the problem could be and how to rectify it.

Regards,

Mainak

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

With the settings you can hide the columns for that session only.

To hide the column throuhout do something like this in DOINIT method

if you want to hide a column named OBJID and OBJTYP then implement following coding

DATA:

lr_comp_alv TYPE REF TO if_wd_component_usage,

lr_comp_if_alv TYPE REF TO iwci_salv_wd_table,

lr_config TYPE REF TO cl_salv_wd_config_table,

lr_column TYPE REF TO cl_salv_wd_column,

ls_column TYPE salv_wd_s_column_ref,

lt_columns TYPE salv_wd_t_column_ref.

data: lr_column_settings TYPE REF TO if_salv_wd_column_settings.

*... ALV Component Usage

lr_comp_alv = wd_this->wd_cpuse_alv( ).

IF lr_comp_alv->has_active_component( ) IS INITIAL.

lr_comp_alv->create_component( ).

ENDIF.

lr_comp_if_alv = wd_this->wd_cpifc_alv( ).

*... Configure ALV

lr_config = lr_comp_if_alv->get_model( ).

lr_config->if_salv_wd_table_settings~set_read_only( abap_false ).

lr_config->if_salv_wd_std_functions~set_edit_insert_row_allowed( ).

lr_config->if_salv_wd_std_functions~set_view_list_allowed( abap_false ).

lr_config->if_salv_wd_std_functions~set_export_allowed( abap_true ).

lt_columns = lr_config->if_salv_wd_column_settings~get_columns( ).

lr_column = lr_config->if_salv_wd_column_settings~get_column('OBJID' ).

*To hide particular coulmn

LOOP AT lt_columns INTO ls_column.

CASE ls_column-id.

when 'OBJID'.

ls_column-r_column->set_visible( value = '99' ).

when 'OBJTP'.

ls_column-r_column->set_visible( value = '99' ).

ENDCASE.

ENDLOOP.

Best regards,

Rohit

Former Member
0 Kudos

Hi Mainak,

Even if you hide the columns using Settings property on the ALV, it will be displayed again once you refresh the screen.

I think you can view them again.

Regards,

Shashikanth. D