cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove or hide the table column after binding it to the node.

Former Member
0 Kudos

Hi,

My requirement is based the field 'Service Group' which is like Nursing,HouseKeeping, i need to show the table columns.

in my first view i have 1 select-option for date and 1input field..

based on the date i am getting the records.till here it's working fine.i bind the table to the node.and it is showing the ALV table.

but for some service groups i need not show some table fields only.how to do this?yesterday one of the forum member has told me the procedure.but i did not get it.(that didnot work)giving NULL OBJECT reference.

please help to find out any way of doing this?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

hi,

can you plz tell me that are you using alv or you are using table controll.

regards,

ritwik.

Former Member
0 Kudos

Hi,

I am showing in ALV using standard component SALV_WD_TABLE.

Former Member
0 Kudos

Hi Lakshmi,

if you are using alv use the following code to disable your columns at runtime:

-


DATA : lr_alv_if TYPE REF TO iwci_salv_wd_table,

lr_alv_model TYPE REF TO cl_salv_wd_config_table,

lr_cmp_usage TYPE REF TO if_wd_component_usage.

lr_cmp_usage = wd_this->wd_cpuse_appr_alv( ).

IF lr_cmp_usage->has_active_component( ) IS INITIAL.

lr_cmp_usage->create_component( ).

ENDIF.

*... Invoke a Method of the ALV Interfacecontroller

lr_alv_if = wd_this->wd_cpifc_appr_alv( ).

*... Get Model

lr_alv_model = lr_alv_if->get_model( ).

  • get table of column settings - each line one column

lt_columns = mr_column_settings->get_columns( ).

  • loop over table - in each loop a column can be modified

LOOP AT lt_columns INTO ls_column .

CASE ls_column-id.

WHEN 'COLUMN NAME'.

ls_column-r_column->set_visible (abap_false).

............

hope this works.

Regards,

Ritwik.

Former Member
0 Kudos

if i use above mentioned code in the wddoinit method based on the column id,it hides the column.its ok good.but i want to hide the cloumns based on one column value.so i wrote the condition in the fill service method which fills the table with data.but it is not hiding the column.

IF lt_display IS NOT INITIAL.

LOOP AT lt_display INTO ls_display.

IF ls_display-service_grp = '00010'.

DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.

l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).

IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.

l_ref_cmp_usage->create_component( ).

DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .

l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).

DATA:

l_value TYPE REF TO cl_salv_wd_config_table.

l_value = l_ref_interfacecontroller->get_model(

).

lt_columns = lr_column_settings->get_columns( ).

LOOP AT lt_columns INTO ls_column.

IF ls_column-id = 'WARD_NO'.

ls_column-r_column->set_visible( lv_visible ).

ENDIF.

ENDLOOP.

ENDIF.

ENDIF.

endloop.

endif.

Former Member
0 Kudos

Hi Laksmi,

If you want to hide the colomn dynamically menas you should write the code in DOMODIFY view.

Then only your view will getting refreshed.

Thanks.

Former Member
0 Kudos

thanks all for replying me..

at last i got it.