cancel
Showing results for 
Search instead for 
Did you mean: 

Get multiple selection data of Table into an internal table

Former Member
0 Kudos

Hi Guys,

I have a Table in my view layout and selected 'SelectionMode' as 'Multi' in the table properties.How to get the selected data into an internal table when rows selected on the table output.For example,I have a 10 rows in the table and selected only 5 rows,need to get these 5 rows into an internal table?

Regards

Nandana

Accepted Solutions (1)

Accepted Solutions (1)

Madhu2004
Active Contributor
0 Kudos

Use get_selected_elements methods.

If you also want to include the lead slected element pass use_lead_selection = abap_true.

The above methjod returns the ist of elements and after that with the elements you can use the get_static_attribytes method to get the attributes

Former Member
0 Kudos

Hi Madhu,

Here is the piece of code which i have written.But the get_static_attributes method throwing an error.

Is there any other way to get the attributes of seleched row.

method ONACTIONON_SELECT_LINE .

data selected_elements type wdr_context_element_set.

data elements type wdr_context_element_set.

data element type ref to if_wd_context_element.

data w_select_row type wd_this->element_lm_data.

data t_select_rows TYPE zirr_tt_org_unit.

elements = wd_context->get_elements( ).

selected_elements = wd_context->get_selected_elements( ).

loop at elements into element.

read table selected_elements transporting no fields

with key table_line = element.

if sy-subrc = 0.

element->get_static_attributes(

importing

static_attributes = w_select_row ).

endif.

APPEND w_select_row to t_select_rows.

ENDLOOP.

Former Member
0 Kudos

Hi,

Can you just post what error you are getting?

Regards,

Aditya.

former_member1151507
Participant
0 Kudos

Hi,

Here is some sample code. Please try this and let me know if you are still getting any errors.

DATA lo_nd_table_node TYPE REF TO if_wd_context_node.

DATA lo_el_table_node TYPE REF TO if_wd_context_element.

DATA ls_table_node TYPE wd_this->element_table_node.

DATA lt_table_node TYPE wd_this->elements_table_node.

DATA lt_table TYPE wdr_context_element_set.

lo_nd_table_node = wd_context->get_child_node( name = wd_this->wdctx_table_node ).

lt_table = lo_nd_table_node->get_selected_elements( including_lead_selection = abap_true ).

LOOP AT lt_table INTO lo_el_table_node.

lo_el_table_node->get_static_attributes(

IMPORTING

static_attributes = ls_table_node ).

APPEND ls_table_node TO lt_table_node.

CLEAR ls_table_node.

ENDLOOP.

    • lt_table_node contains the selected rows.

Former Member
0 Kudos

Hi,

Here is the error msg.

Note

The following error text was processed in the system F67 : Invalid operand type for the MOVE-CORRESPONDING statement.

The error occurred on the application server dbcif67_F67_82 and in the work process 0 .

The termination type was: RABAX_STATE

The ABAP call stack was:

Method: IF_WD_CONTEXT_ELEMENT~GET_STATIC_ATTRIBUTES of program CL_WDR_CONTEXT_ELEMENT========CP

Method: ONACTIONON_SELECT_LINE of program /1BCWDY/J2SLFL7YLDZ11VI2WXJF==CP

Method: IF_WDR_VIEW_DELEGATE~WD_INVOKE_EVENT_HANDLER of program /1BCWDY/J2SLFL7YLDZ11VI2WXJF==CP

Method: INVOKE_EVENTHANDLER of program CL_WDR_DELEGATING_VIEW========CP

Method: IF_WDR_ACTION~FIRE of program CL_WDR_ACTION=================CP

Method: DO_HANDLE_ACTION_EVENT of program CL_WDR_WINDOW_PHASE_MODEL=====CP

Method: PROCESS_REQUEST of program CL_WDR_WINDOW_PHASE_MODEL=====CP

Method: PROCESS_REQUEST of program CL_WDR_WINDOW=================CP

Method: EXECUTE of program CL_WDR_MAIN_TASK==============CP

Method: IF_WDR_RUNTIME~EXECUTE of program CL_WDR_MAIN_TASK==============CP

Regards

Nandana

Madhu2004
Active Contributor
0 Kudos

hi ,

code is:

CALL METHOD node->get_selected_elements
  EXPORTING
    including_lead_selection = ABAP_true
  receiving
    set                      = element_set
    .

loop at element_set into element.
CALL METHOD element->get_static_attributes
  IMPORTING
    static_attributes = attributes
endloop.

Former Member
0 Kudos

Problem solved.

Thanx

Vasumathi

Former Member
0 Kudos

Hi Manogna,

U solved my problem.

Thanx

Vasumathi

Answers (1)

Answers (1)

former_member1151507
Participant
0 Kudos

Hi Nandana,

You need to use GET_SELECTED_ELEMENTS( ) method of IF_WD_CONTEXT_NODE. This method returns the selected elements of the table node.

Regards,

Manogna