cancel
Showing results for 
Search instead for 
Did you mean: 

Hide some column of the node in ALV

mahesh_jagnani
Participant
0 Kudos

Hi experts,

I have one requirement in which the node contains 10 attribute,but i have to show only 5 attribute in ALV Table.

Can u plz tell me how i can do this.

Thanks

Mahesh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Try like this..

  • Declare ALV config table

data: ALV_CONFIG_TABLE type REF TO CL_SALV_WD_CONFIG_TABLE.

DATA: wd_table_usage TYPE REF TO if_wd_component_usage.

  • Create an instance of ALV component created ALV_COMP is usage name

wd_table_usage = wd_this->wd_cpuse_alv_comp( ).

IF wd_table_usage->has_active_component( ) IS INITIAL.

wd_table_usage->create_component( ).

ENDIF.

  • Get ALV component

DATA: wd_table TYPE REF TO iwci_salv_wd_table.

wd_table = wd_this->wd_cpifc_alv_comp( ).

alv_config_table = wd_table->get_model( ).

  • Declare variable to store column details

DATA: column_settings TYPE REF TO if_salv_wd_column_settings,

column TYPE REF TO cl_salv_wd_column.

column_settings ?= alv_config_table.

***************

*HIDE COLUMNS *

***************

column = column_settings->get_column( 'MANDT' ).

column->set_visible( if_wdl_core=>visibility_none ).

OR

If you want Delete Columns.

From the refernc eof CL_SALV_WD_CONFIG_TABLE you can access the method

CALL METHOD LR_FUNCTION_SETTINGS->IF_SALV_WD_COLUMN_SETTINGS~DELETE_COLUMN

EXPORTING

ID = ls_column-id.

Cheers,

Kris.

Answers (2)

Answers (2)

gill367
Active Contributor
0 Kudos

use the method delete column for the not required ones .

pass their id.

here is the sample code

data lo_cmp_usage type ref to if_wd_component_usage.

lo_cmp_usage =   wd_this->wd_cpuse_alv( ).
if lo_cmp_usage->has_active_component( ) is initial.
  lo_cmp_usage->create_component( ).
endif.

DATA lo_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
lo_INTERFACECONTROLLER =   wd_this->wd_cpifc_alv( ).

  DATA lo_value TYPE ref to cl_salv_wd_config_table.
  lo_value = lo_interfacecontroller->get_model(
  ).

lo_value->IF_SALV_WD_COLUMN_SETTINGS~DELETE_COLUMN( 'STATUS' ).     // deleting the col with id status

thanks

sarbjeet singh

Former Member
0 Kudos

Hi,

Using the reference cl_salv_wd_config_model, method GET_COLUMNS of IF_SALV_WD_COLUMN_SETTINGS.

Loop through the above columns and SET VISIBILITY method and pass the value NONE.

Regards,

Lekha.

Edited by: Lekha on May 10, 2011 2:12 PM