on 02-23-2010 3:51 AM
Hi,
I have a scenario in which i need to create hyperlink on a column. However all rows in that column need not be hyperlink. Based on the data i need to create it as hyperlink.
eg: Column1 Column2
ABC 1234
DEF 5678
GHI 9123
DEF 5678
So in above case where data is DEF i keep it as hyperlink, other rows are not.
I am using ALV component to display data in a view container element.
Please help me with this.
Regards,
Saud
hi,
DATA: lr_column TYPE REF TO cl_salv_wd_column.
lr_column = l_value->if_salv_wd_column_settings~get_column( 'CONNID' ).
DATA: lr_link_to_action TYPE REF TO cl_salv_wd_uie_link_to_action.
CREATE OBJECT lr_link_to_action.
lr_link_to_action->set_text_fieldname( 'CONNID' ).
*lr_link_to_action->SET_ENABLED_FIELDNAME( 'BOOL' ).*
lr_column->set_cell_editor( lr_link_to_action ).
Here BOOL is my context attribute of type wdy_boolean inside the context node.
Now based on the value of BOOL , your link to action will vary.
DATA lo_nd_cn_flight TYPE REF TO if_wd_context_node.
DATA ls_cn_flight TYPE wd_this->element_cn_flight.
DATA lt_cn_flight TYPE wd_this->elements_cn_flight.
* navigate from <CONTEXT> to <CN_FLIGHT> via lead selection
lo_nd_cn_flight = wd_context->get_child_node( name = wd_this->wdctx_cn_flight ).
SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE lt_cn_flight.
*LOOP AT LT_CN_FLIGHT INTO LS_CN_FLIGHT WHERE CARRID = 'AA'.*
*LS_CN_FLIGHT-BOOL = ABAP_TRUE.*
*MODIFY LT_CN_FLIGHT FROM LS_CN_FLIGHT TRANSPORTING BOOL.*
*ENDLOOP.*
lo_nd_cn_flight->bind_table( lt_cn_flight ).
CN_FLIGHT is my context node binded to ALV. Now in above code you can set the value of BOOL attribute and link to Action will depend on this value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
For creating a hiperlink in ALV use the following code.
DATA: lr_column TYPE REF TO cl_salv_wd_column.
lr_column = l_value->if_salv_wd_column_settings~get_column( 'CONNID' ).
DATA: lr_link_to_action TYPE REF TO cl_salv_wd_uie_link_to_action.
CREATE OBJECT lr_link_to_action.
lr_link_to_action->set_text_fieldname( 'CONNID' ).
lr_column->set_cell_editor( lr_link_to_action ).
Now for enabling and disabling the Hiperlink have one more attribute in ur node, which contains all the data of the table, of type wdy_boolean.
Now bind this attribute with the enable property of the Hiperlink created above and also In ur coding part have tha data for this attribute before binding the internal table with the node, with values X or '' depending on the enable or disable.
It will solve ur problem. But because of this a new column will be visible in the output. To delete this use the below code.
l_value->if_salv_wd_column_settings~delete_column( id = 'COLOR' ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Following are the steps to get your requirement.
1. Create another column with the type boolean.
2. If the new column with 'X' or space as per ur condition for the hyperlink of the first column.
3 Use LINKTOURL UI Element for the first column
4. Bind the enabled property of LinktoURL UI element and bind to the new column.
5 Depending on the value of the column, the Hyperlink will be enabled.
Ranganathan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.