cancel
Showing results for 
Search instead for 
Did you mean: 

Need to Get selected row data of the table

Former Member
0 Kudos

Hi, all

I m new to web dynpro programming, im developing a page in which i want to get the data of the selected row. like for e.g

table has columns like

material code description

now i want to fetch only the material no. from the selected row and when i click it will show some data of that material no.

now the issue is i searched the forum and tried various but for each solution im getting stuck.

so can any one kindly help me out in the same.

details:

i have a function module attached to the context and in changing of that FM there is a table of which i want to select the row i.e. material no.

DATA : sel_rec  type WDR_CONTEXT_ELEMENT_SET.
DATA : wa_selrow like LINE OF lt_c_zmat.
CALL METHOD lo_zmat->GET_SELECTED_ELEMENTS
RECEIVING
SET = lt_elementset.

CALL METHOD sel_rec->get_static_attributes
        IMPORTING
          static_attributes = wa_selrow

i have tried 2-3 ways in which i was failed one of them is this.

thanks you.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You have not explained your problem completely so that we can help you.

Which UI element are you using ? I assume it is TABLE UI. If it is true then there is a event lead_selection. Use this event handler to get the selected element.

Use the code generator ctl+f7 to generate the code.

Select the context node,read attribute material number.

Former Member
0 Kudos

Thaks baskaran for your reply,

im using the normal table under ROOTUIELEMENTCONTAINER. the thing is now i have written the code in the method which gives me details of that material but its every time giving me the first record not the one im selected here is the code,

 DATA lo_nd_it_vttk TYPE REF TO if_wd_context_node.
  DATA lo_el_it_vttk TYPE REF TO if_wd_context_element.
  DATA ls_it_vttk    TYPE wd_this->Element_ZMAT.
  DATA lt_it_vttk    TYPE wd_this->Elements_ZMAT.
  DATA wa_vttk       like LINE OF lt_it_vttk."TYPE ZMAT.

  lo_nd_it_vttk = wd_context->path_get_node( path = `ZMTR_REPORT.CHANGING_1.ZMAT` ).

* get element via lead selection
  lo_el_it_vttk = lo_nd_it_vttk->get_element( ).

* get all declared attributes
  lo_el_it_vttk->get_static_attributes(
    IMPORTING
      static_attributes = ls_it_vttk ).

so kindly provide some help on the same can ask any doubt if you have to resolve my issue correctly

thanks a lot.

Former Member
0 Kudos

Hi,

Same question, cehck this..

Cheers,

Kris.

Former Member
0 Kudos

If this coding is providing always the first row then i suspect the way you select a line ?

Normally when you select a line, lead selection is set and get_element would return the selected element.

Former Member
0 Kudos

Thanks a lot kissnas. your suggestion is working and have resolved my issue

thanks a lot.

Answers (0)