cancel
Showing results for 
Search instead for 
Did you mean: 

selecting a value from table

arjun_thakur
Active Contributor
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Arjun,

When you create a table in WD, you create a node first. Here in this case, you have created a node with two attributes in it.

Now when you created a table UI element, then you create binding to this node.

Once you create a binding with the attributes that many columns will be created for you.

In your case, one is textview column, and the other is the LinkToAction column. When you click on the LinkToAction in whatsoever may be the row, the event will be triggered.

The code you write in that method depends what pop up window needs to be called.

So, please check in the event handler for the LinkToAction, and what pop up window needs to be called.

Ideally, the sceanrio which you have posted does not encounter. What pop up needs to be called is unique to all the links in all the rows of the table.

Dynamically you need to change the Popup, and this will usually happen only on the basis of some criteria or some condition, or based on the value entered in the first column or so.

Thank you,

All the best!

arjun_thakur
Active Contributor
0 Kudos

hi Shashikanth,

I need to call the pop up window according to the value in the first column of that row (i.e text view). I need to know that when i click on a link to action of any row, how can i get the value the first column for that perticular row.

note i have set the selection mode property of table as none.

regards

arjun

uday_gubbala2
Active Contributor
0 Kudos

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

arjun_thakur
Active Contributor
0 Kudos

hi Uday,

I have tried the code which you have sent but it is giving me a run time error in the second line. error msg is 'Access via 'NULL' object reference not possible'.

plz help.

uday_gubbala2
Active Contributor
0 Kudos

Hi Arjun,

Mention the code line where you are getting the error message.

Uday

arjun_thakur
Active Contributor
0 Kudos

hi uday,

what should i pass as parameter in this line of code

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

Edited by: arjun on Oct 10, 2008 2:21 PM

uday_gubbala2
Active Contributor
0 Kudos

Hi Arjun,

Am not sure as to why its not working for you. Just check whether you are getting the object reference filled into lr_element when you use the get_context_element( ) method. WDEVENT would contain an object reference of type CL_WD_CUSTOM_EVENT. This would contain 2 parameters a hashed table called PARAMETERS & NAME which would contain the name of the action triggered by the user. CONTEXT_ELEMENT is one of the fields in the hashed table PARAMETERS which is filled by the system You don't have to even find out the index using the get_index( ) method as how I was suggesting earlier. You can directly try read the value of the attribute in the first column by passing the column name in get_attribute( ).

Regards,

Uday

DATA: lr_element TYPE REF TO if_wd_context_element,
            lv_matnr type mara-matnr.

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

  CALL METHOD lr_element->get_attribute
    EXPORTING
      name   = 'MATNR'
    IMPORTING
      value  = lv_matnr.

arjun_thakur
Active Contributor
0 Kudos

hi uday,

thanks a lot. problem solved

regards

arjun

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

When you click the link it should show a pop up with some details. use CL_WD_POPUP_FACTORY in your ONACTIONLINK event to display a pop up.