Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

selecting a value from table

hi experts,

i am usng a table in my wd-abap compent. the table has to 2 columns. one of them is a text view and other is a link to action. the table can contain multiple values which are fetched from some database table. now i want that when i click on any one of the link to action, a pop up window is opened which contains data that is fetched from some data base table according to the perticular link clicked.

eg : say my link in the first row of the table is "link1"

and link in the second row of the table is "link2".

so when i click on link1, a pop up window containing some data gets opened and when i click link2 another pop up window is opened containing different data. How can i do it.....

According to the requirement i have to set the "selection mode " property of the table as 'none'.

Plz help.

regards

arjun

replied

Hi Arjun,

You can proceed as explained in here. In the onAction event of the LinkToAction place the following coding:

method ONACTIONONLINKCLICK .
  data: lr_element type ref to if_wd_context_element,
          lv_index type i.

  lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT'  ).
  lv_index = lr_element->get_index( ).

Now lv_index will contain the table row number in which the LinkToAction was clicked upon. I guess that you would know as to how to proceed from here. Use this index number to read the internal table which you are using to bind to the table ui element.

ex:

read table lt_sflight into wa_sflight index lv_index.

Thought to try edit my previous post again... Once you obtain the reference of type if_wd_context_element you can directly read the value of the attribute in the first column. You dont have to read the internal table using a READ or anything as how I had said earlier... Directly code like as shown below:

CALL METHOD lr_element->get_attribute
    EXPORTING
      name   = 'MATNR'   " Give the name of your first column in here
    IMPORTING
      value  = lv_matnr.   " Your first columns value would get saved into this variable

I had declared lv_matnr as a local variable of type mara-matnr & I could get the value of the MATNR which is present in the 1st column of the same row.

Regards,

Uday

Edited by: Uday Gubbala on Oct 10, 2008 4:32 PM

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question