cancel
Showing results for 
Search instead for 
Did you mean: 

Hiding a column when displaying an alv

adil_gndz
Explorer
0 Kudos

Hi Gurus,

Shortly I have these things :

1) A node with some attributes like customer_no, customer_name, status etc.

2) A view which contains an element(viewcontainerelement) and this displays the node.

This node is in CONTEXT of my view and in componentcontroller.

Now i want to hide some attributes(columns) when displaying this alv. Can anybody help me?

Thanks..

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Check the interface if_salv_wd_column_settings.

there is a method delete_column. you can always delete the columns which are not required.

Regards,

Kinshuk

Answers (3)

Answers (3)

Former Member
0 Kudos

This is a method that I wrote to not show a column.

Input parameter col_name is string containing column name in table.

method alv_col_set_invis .

data: l_ref_interfacecontroller type ref to iwci_salv_wd_table,

l_value type ref to cl_salv_wd_config_table,

lr_column type ref to cl_salv_wd_column.

  • Component name is 'ALV'

l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).

l_value = l_ref_interfacecontroller->get_model( ).

lr_column = l_value->if_salv_wd_column_settings~get_column( col_name ).

lr_column->set_visible( cl_wd_abstr_table_column=>e_visible-none ).

endmethod.

Former Member
0 Kudos

Hi,

Use this code to donot display the some of your attributes in ALV.

L_VALUE->IF_SALV_WD_COLUMN_SETTINGS~DELETE_COLUMN( ID = 'STATUS ).

where l_value is the table reference.

Thanks

Suman

Edited by: suman kumar chinnam on Sep 18, 2008 7:24 PM

baskaran00
Active Participant
0 Kudos

Hi Adil,

You can hide column using below code:

data: lr_salv_column type ref to cl_salv_wd_column,

lr_salv_table type ref to cl_salv_wd_config_table.

lr_salv_column = lr_salv_table-if_salv_wd_column_settings~get_column( 'column_ name' ).

lr_salv_column->set_visible( if_wdl_core=>visibility_blank ).

Thanks...

Edited by: Router on Sep 18, 2008 1:21 PM

adil_gndz
Explorer
0 Kudos

Hi,

When i write that code, it gives me an error message :

data: lr_salv_column type ref to cl_salv_wd_column,
lr_salv_table type ref to cl_salv_wd_config_table.

lr_salv_column = lr_salv_table-if_salv_wd_column_settings~get_column( 'm_no' ).
lr_salv_column->set_visible( if_wdl_core=>visibility_blank ).

Error message:

"Class "CL_MAINV_CTR" does not contain an interface

"LR_SALV_TABLE-IF_SALV_WD_COLUMN_SETTINGS". "

"Mainv" is the name of my view.

I am new at WDA, please give me detailed information.

Thanks

Edited by: Adil Gündüz on Sep 22, 2008 11:13 AM

Former Member
0 Kudos

Hi,

Nothing wrong in your code just give the column name caps.

lr_salv_column = lr_salv_table-if_salv_wd_column_settings~get_column( 'M_NO' ).

Thanks

Suman

adil_gndz
Explorer
0 Kudos

Hi,

I made that but not works. It still gives the same error. I think i must define a class or interface. Is it enough that only writing this code into the "wddoinit" methode ?

thanks for your help

Former Member
0 Kudos

Hi,

Yes i.e enough actually.even i also did in the same way.

or try to use delete_column method of cl_salv_wd_column.

still the problem persisting you post your complete code which you wrote in the WDDOINIT.

Thanks

Suman