cancel
Showing results for 
Search instead for 
Did you mean: 

How to set reference property of LINK_TO_URL ?

Former Member
0 Kudos

Hi,

I have one table control which contains 5 columns.

(tripno, startdate, destination, reason, activities).

I am binding values from the internal table.

In 5th column(Activities), i need to display URL for each record.

So that i have used LINK_TO_URL as cell editor.

for ex:

<b><u>Activities</u></b>

<a href="http://www.abc.com/test?tripno=1">Edit</a>

<a href="http://www.abc.com/test?tripno=2">Edit</a>

<a href="http://www.abc.com/test?tripno=3">Edit</a>

<a href="http://www.abc.com/test?tripno=4">Edit</a>

<a href="http://www.abc.com/test?tripno=5">Edit</a>

....

Plz refer the reference link of each edit otpion.

When user clicks a particular hyperlink, it navigates to another page/component thru URL with one key field(tripno) to retrieve related records in next page.

<b>Problem is:</b>

i am getting like this:

<a href="http://www.abc.com/test?tripno=5">Edit</a>

<a href="http://www.abc.com/test?tripno=5">Edit</a>

<a href="http://www.abc.com/test?tripno=5">Edit</a>

<a href="http://www.abc.com/test?tripno=5">Edit</a>

<a href="http://www.abc.com/test?tripno=5">Edit</a>

i am not getting tripno of each record. Plz refer the reference link of each edit otpion. when i assign tripno, its taking the last value which i assigned. ie. tripno=5 only.

How to assign URL to Reference field of LINK_TO_URL element at run time?

OR

2) we can do like this.

Simply assign url to reach record without key field.

www.abc.com/test

www.abc.com/test

www.abc.com/test

.....

when user clicks a particular link, we can assign corresponding key field to the URL.

Where should i write this code? Bcoz, LINK_TO_URL doesnot have event.

how to do?

Accepted Solutions (1)

Accepted Solutions (1)

mohammed_anzys
Contributor
0 Kudos

Hi Mog,

One other solution is add one more entry in the internal table so that you could prepopulate the URL specific to each row in that attribute and bind it to the context node.

For Ex. In the table control i display

Flight Name RouteNo URLText

so the internal table is of the type

Flight

Name

RouteNo

URLText

Enhance the table by adding one more field

Flight

Name

RouteNo

URLText

acURL

Here the attribute acURL contains the URL specific to a row.So before binding it to the context node, please populate the field so that when you cllick on the URL you could navigate to the correct page.

Thanks

Anzy

mohammed_anzys
Contributor
0 Kudos

hey

here is the second work around , use link to action.And you get wdevent as a parameter. From the wdevent you will get the row where you clicked as the wdevent is of the type CL_WD_CUSTOM_EVENT and you could get the complete datils by invoking the method GET_CONTEXT_ELEMENT in the above class...so that you could frame the URL and then fire an exit to that URL.

Answers (2)

Answers (2)

Former Member
0 Kudos

The event handler method that you define for the OnAction of the Link to URL will have a parameter wdevent. Use the method wdevent->get_context_element( ) to get the exact element that you have clicked on. If you do a get_static_attributes on that element you will get the exact tripno you need to navigate. Hope this helps.

Former Member
0 Kudos

Mog,

Is the other page another WebDynpro View? You could use LinkToAction.

In the action handler method you could retrieve the element which contains the link via the wdevent parameter:


DATA: lr_element TYPE REF TO if_wd_context_element.
        .
  lr_element = wdevent->get_context_element( 'CONTEXT_ELEMENT' ).

Then just read the attribute TRIPNO from that element and feed the target component controller

with the necessary data and fire the outbound plug which navigates to the details view.

Hope this helps,

Sascha

PS: Please close the other thread regarding this topic.

Message was edited by:

Sascha Dingeldey