Skip to Content
author's profile photo Former Member
Former Member

get_columns() method of the table

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Jan 06, 2012 at 04:13 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 25, 2012 at 04:15 PM

    Rohini,

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

    Thanks,

    Kenneth

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 25, 2012 at 05:52 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 26, 2012 at 05:25 AM

    Rohini,

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

    Regarsd

    srinivas

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.