cancel
Showing results for 
Search instead for 
Did you mean: 

get_columns() method of the table

Former Member
0 Kudos

Hello All,

I have a requirement to delete the selected columns.

I tried to get the columns of a table using get_columns() method.

But it is returning nothing.Even the no_of_columns() method is also returnin 0.

I have given my coding below.

Could anybody please tell me where am going wrong?

I have written in my delete action.

Data lr_table_column TYPE REF TO CL_WD_TABLE_COLUMN.

data lr_table type ref to cl_wd_table.

DATA VALUE TYPE WDUI_TABLE_COL_SEL_STATE.

view ?= wd_this->m_view.

lr_table ?= VIEW->GET_ELEMENT( 'TBL_PA002' ).

lt_columns = lr_table->get_columns( ).

data no type i.

no = lr_table->number_of_columns( ).

if lt_columns[] is not initial.

loop at lt_columns into lr_table_column.

CALL METHOD LR_TABLE_COLUMN->GET_COL_SELECTION_STATE

  • EXPORTING

  • CONTEXT_ELEMENT = lr_elem

  • CONTEXT_NODE_PATH_NAME =

RECEIVING

VALUE = VALUE

.

endloop.

endif.

Thanks and Regards,

Rohini Shankar

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member199125
Active Contributor
0 Kudos

Rohini,

You have to manipulate the table using cl_salv_wd_config_table. class object., if its alv table

Regarsd

srinivas

kmoore007
Active Contributor
0 Kudos

Rohini,

Here is what I had to do to get it to work below.  For some reason the attribute CH_COLUMNS was not populated for the wd_table.  But the CH_GROUPED_COLUMNS attribute was populated.  So I was able to use the grouped columns to get the columns.  Sounds weird, but seems to work.

  DATA wd_grp_cols TYPE cl_wd_abstr_table_column=>tt_abstr_table_column.
  DATA wd_grp_col TYPE REF TO cl_wd_abstr_table_column.

...

  wd_grp_cols = wd_table->get_grouped_columns( ).

  LOOP AT wd_grp_cols INTO wd_grp_col.
    wd_column ?= wd_grp_col.
    APPEND wd_column TO wd_columns.
    CLEAR wd_column.
  ENDLOOP.

kmoore007
Active Contributor
0 Kudos

Rohini,

I am having the same issue.  wd_table->get_columns( ) is not returning anything.  Did you find an answer to this?

Thanks,

Kenneth

rodrigo_paisante3
Active Contributor
0 Kudos

Hi Rohani ,

I looked to your problem but I did not have any solution. Maybe someone help you using these classes.

But what about use ALV component? Is it possible to you to change? The ALV component has the fieldcat button and user can setup visible fields.

Best regards.