cancel
Showing results for 
Search instead for 
Did you mean: 

Getting the WDA Element in the onAction event

Former Member
0 Kudos

Hi All,

We are working on the Netweaver 2004S release and in the process of writing an interactive Web Dynpro (ABAP) application. A Table (UI element) is defined in the main view with data binding to a context node (Cardinality 0:n, NO LEAD SELECTION, NO SINGLETON). This table has three columns and the first column is defined as a "LinkToAction" element. The values are displayed in the table correctly and the first column with document numbers is displayed properly as a link. I defined the "onAction" event of the link, and would like to get access to the selected document number. How to do this? I only get "WDEVENT" parameter in the onAction event handler. Is there any way to get access to the "LinkToAction" UI object itself in the event?

I was trying to draw a parallel with BSP's and was hoping to get access to the UI event object itself, just like what we get in the "DO_HANDLE_EVENT" of the controller. When the user clicks on the link of TABLE, I want to read the text attribute of "LinkToAction" element and then use the document number to display details. I tried using the IF_WD_CONTEXT_NODE interface etc but could not get to the "Text" attribute.

Again, this is for Web Dynpro ABAP and we don't want to use a singleton.

Thanks much for you time and your response will be appreciated

Points will be awarded

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thank you Srini,

I implemented your suggestions and it looks like I'm getting a reference to "LinkToAction" element. Very helpful answer. But again I cannot get to the "Text" property of this element. The ID parameter only contains the generic value TAB_DOCNO_EDITOR and does not have the table index. I tried using the GET_TEXT of the "LinkToAction" element but got a short dump. Any ideas, how I can get the actual cell value or the Text property of "Link". The table is bound to the context node.

srinivasa_raghavachar
Participant
0 Kudos

Hi Sanjay,

Thats easy!

Add the following code.

DATA: THE_TABLE_CELL_EDITOR type ref to CL_WD_LINK_TO_ACTION,

link_value type string.

THE_TABLE_CELL_EDITOR ?= wd_table_column->GET_TABLE_CELL_EDITOR( ).

link_value = THE_TABLE_CELL_EDITOR->GET_TEXT( ).

You will get text in link_value.

Regards,

Srini.

Answers (4)

Answers (4)

Former Member
0 Kudos

Thank you,

It works fine. Much appreciated. I awarded points.

srinivasa_raghavachar
Participant
0 Kudos

Hi Sanjay,

If you want to get access to UI LinkToAction itself, try using the following code:

data wd_table_cell_editor type ref to cl_Wd_view_element.

data wd_table_column type ref to cl_wd_table_column.

  • This gets access to LinkToACtion

wd_table_cell_editor ?= wd_this->m_view->get_element( ID ).

  • THis gets access to table column itself

wd_table_column ?= wd_table_cell_editor->get__parent( ).

Before using this code:

1) declare ID TYPE STRING as parameter in the eventhandler method(You can add parameters) and declare M_VIEW REF TO IF_WD_VIEW as an attribute in the view.

2) Write the following code in method WDDOMODIFYVIEW:

if first_time = abap_true.

wd_this->m_view = view.

endif.

Regards,

Srini

srinivasa_raghavachar
Participant
0 Kudos

Hi Sanjay,

If you want to get access to UI LinkToAction itself, try using the following code:

data wd_table_cell_editor type ref to cl_Wd_view_element.

data wd_table_column type ref to cl_wd_table_column.

  • This gets access to LinkToACtion

wd_table_cell_editor ?= wd_this->m_view->get_element( ID ).

  • THis gets access to table column itself

wd_table_column ?= wd_table_cell_editor->get__parent( ).

Before using this code:

1) declare ID TYPE STRING as parameter in the eventhandler method(You can add parameters) and declare M_VIEW REF TO IF_WD_VIEW as an attribute in the view.

2) Write the following code in method WDDOMODIFYVIEW:

if first_time = abap_true.

wd_this->m_view = view.

endif.

Former Member
0 Kudos

Hello Sanjay,

From WebDynpro for Java perspective, it is possible to do it through <a href="http://help.sap.com/saphelp_nw04/helpdata/en/60/1f1f056f057d4d962375efd3c92ed0/content.htm">Event Parameter and Parameter Mapping</a>. So, I think you should be able to draw similar lines for WD ABAP as well using this link : <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/33/b11042705a5533e10000000a155106/content.htm">Parameter Mapping</a>

Good Luck.

Bala