cancel
Showing results for 
Search instead for 
Did you mean: 

UI ELEMENT : TABLE

Former Member
0 Kudos

I Have a UI ELMENT : TABLE . I changed 2 columns to type button, because the system have to do 2 separate processes. I want to catch the event that say which row was selected on every button.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can get the WDEVENT parameter where you will get the index value of row selected.

As you have got the buttons in the columns, on BUtton click you can get this parameter which aslo has the index.

Or If you have the lead selection set then you can implement the event OnLeadSelect event of the table to get the selection.

Or

I guess you have multiple row selection feature. For this, You can use the method GET_SELECTED_ELEMENTS of IF_WD_CONTEXT_NODE to which the table is bound.

Please refer to WDR_TEST_TABLE componenet for the SELECTION view which meets your requirement.

Regards,

Lekha.

Answers (2)

Answers (2)

Former Member
0 Kudos

I am looking through your samples, but still struggle : When I set my index to 4 it brings me back that index, but I tried to determine on which index was clicked.

DATA:

node_t_zhrsb_summary TYPE REF TO if_wd_context_node,

elem_t_zhrsb_summary TYPE REF TO

if_wd_context_element,

stru_t_zhrsb_summary TYPE

if_summary=>element_t_zhrsb_summary .

data id type string.

data wd_element type ref to cl_wd_view_element.

  • navigate from <CONTEXT> to <T_ZHRSB_SUMMARY> via lead selection

node_t_zhrsb_summary = wd_context->get_child_node( name =

if_summary=>wdctx_t_zhrsb_summary ).

  • @TODO handle not set lead selection

IF ( node_t_zhrsb_summary IS INITIAL ).

ENDIF.

  • get element via lead selection

elem_t_zhrsb_summary = node_t_zhrsb_summary->get_element( ).

  • @TODO handle not set lead selection

IF ( elem_t_zhrsb_summary IS INITIAL ).

ENDIF.

  • alternative access via index

Elem_T_Zhrsb_Summary = Node_T_Zhrsb_Summary->get_Element( Index = 4 ).

  • @TODO handle non existant child

if ( Elem_T_Zhrsb_Summary is initial ).

endif.

  • get all declared attributes

elem_t_zhrsb_summary->get_static_attributes(

IMPORTING

static_attributes = stru_t_zhrsb_summary ).

Former Member
0 Kudos

Hi,

Here are the simple steps to capture the INDEX of the clicked row in a table

1. Create an ONACTION event method for button in the table and write below code to get the clicked index

DATA lo_nd_X TYPE REF TO if_wd_context_node.
  DATA lo_el_X TYPE REF TO if_wd_context_element.
 
  DATA lv_index type i.

  "using the importing paramter WDEVENT, get the clicked index element
   lo_el_X = wdevent->get_context_element(
      name = 'CONTEXT_ELEMENT').

  " Here X is your context node name mapped to table

  "now using context_element u can get the index of selected row

   lv_index = lo_el_x->get_index( ).

Hope this helps.

Regards,

Manne.

Former Member
0 Kudos

I think I am almost there :

Just after executing line : "lv_index = lo_el_x->get_index( )."

I get the following dump :

The following error text was processed in the system ZAD : Access via 'NULL' object reference not possible.

The error occurred on the application server li09zada01_ZAD_00 and in the work process 1 .

The termination type was: RABAX_STATE

The ABAP call stack was:

Method: ONACTIONRESUBMIT of program /1BCWDY/JJI07CROBQPJ7YR1RIIE==CP

Method: IF_WDR_VIEW_DELEGATE~WD_INVOKE_EVENT_HANDLER of program /1BCWDY/JJI07CROBQPJ7YR1RIIE==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_HTTP_EXTENSION~HANDLE_REQUEST of program CL_WDR_MAIN_TASK==============CP

Method: EXECUTE_REQUEST_FROM_MEMORY of program CL_HTTP_SERVER================CP

Former Member
0 Kudos

Hi,

Error shows 'Null object reference'. Verify the syntax of the statement first, if the syntax is fine, put a break point and check whether any element reference is coming into variable lo_el_X after the below statement.

lo_el_X = wdevent->get_context_element(
      name = 'CONTEXT_ELEMENT').

Regards,

Manne.

Former Member
0 Kudos

Hi Kobu,

Have you done how raja shekar was explianed.If so you shouldn't have got error.You can also do in thisway..

Create one interface parameter CONTEXT_ELEMENT type ref to IF_WD_CONTEXT_ELEMENT in the method ONACTIONRESUBMIT.

Now using which you read the attributes of clicked row.

context_element->get_static_attributes

importing

static_attributes = ls_values.

Former Member
0 Kudos

Have you got examples for me? thanks

Former Member
0 Kudos

Hi,

In the button event, you can write the code by calling the methods I mentioned.

You can refer to the WDR_TEST_TABLE for coding.

Refer these threads for help -

Regards,

Lekha.