cancel
Showing results for 
Search instead for 
Did you mean: 

ALV component

Former Member
0 Kudos

Hello,

I am using the ALV component. For one of my columns I need an anchor tag. Each cell of this column got its own link. E.g. cell in column 2 row 3 links to www.sap.com, cell in column 2 row 4 links to www.microsoft.com.

With help of the demo WD4A components SALV_WD_DEMO I managed to link all cells of a column to the same site. This I achieved by using the methods of the interface IF_SALV_COLUMN_SETTINGS (method SET_CELL_EDITOR). But I need an individual link for each cell of the column.

Anybody got an idea what and where to look for?

Maybe it is even possible to set the content of cell to SAP and prevent SAP to escape the HTML tags?

It is also very important that the link won’t open a new window.

Regards

René

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Rene.

I guess you use LinkToUrl for your Links. Then the URL which will be navigated to is bound to the attribute 'reference' of the UI ELement (Cell Editor).

So you must bind this attribute to the attribute of your context node which contains the URL. In each element of the node you can set different URLs.

Fill the attribute target with the name of the window which should contain the new

content. If no new window should poip up use the name of the current window, I guess this should work.

Cheers,

Sascha

Former Member
0 Kudos

Unfortunately, the target attribute does not allow something like self and providing the window name doesnt help either. Actually I found out that LinkToUrl Element prepends "X" in front of target attribute, so the new window is called "X_self".

One funny thing is, if I name the browser window which displays the ALV "X_self" and set target to "_self", the navigation wont open a new window as intended. Alas I cant name the browser window in productive enviromnent.

In the meantime I am experimenting with action buttons corrsponding to a suspend outbound plug.

Anyone can think of any better solution?

Thanks

René

PS: With your answers I managed at least to provide the different URLs for each row

Message was edited by:

Rene Guenther

Answers (1)

Answers (1)

Former Member
0 Kudos

In your context node that you bind to the ALV table, declare one more attribute 'URL' of type string. This will be holding the value of the URL for each row in the table. In the class CL_SALV_WD_UIE_LINK_TO_URL, that you have used to set the cell editor, there is a method set_reference_fieldname. You need to use the method and set the reference field as 'URL'. The code would be as below if the cell editor reference is lr_link_to_url.

lr_link_to_url->set_reference_fieldname( 'URL' ).

This is similar to the static binding that we do for other UI elements like table, input field etc. Now you have done a binding of the reference property to the URL attribute.

When you populate data in your internal table, fill the URL field with different URLs for each row. This field would have www.sap.com for 1 row, www.microsoft.com for one row and so on. Now on doing a bind_table, the link would automatically point to the corresponding URLs.

If you want the text displayed in the link as the url itself, then on your link to url reference, then use the method set_text_fieldname( 'URL' ) to set the text same as the URL. In case you want the text to be different, say only SAP but url as www.sap.com, then introduce another field URLTEXT in your context and do the same process.

Hope this solves your problem. Revert for any clarifications.

Regards

Nithya