on 03-13-2013 12:52 PM
Hi Friends,
I am working on the webdynpro Abap and my requirement is to highlight a particular value in the drop down list along with the drop down. that mean i should get the drop down list and in that list when i write the select query depending on where condition i should high light that value in the drop down in webdynpro abap.
how can i do it? please provide an solution for this.
Hi,
FOR GETTING DROP DOWN GENERALLY WE DO THE FOLLOWING.
1) CHOOSE THE FIELD IN ALV WHERE WE HAVE TO GIVE THE DROP DOWN....
2)TO POPULATE VALUE IN THE DROP DOWN WE MAKE AN ATTRIBUTE value set OF TYPE WDR_CONTEXT_ATTR_VALUE_LIST
Remember here that this node is simply used because we have to populate value in the drop down it will not be used for binding it with any other attribute.
You can check the following code:
data: lr_col type ref to CL_SALV_WD_COLUMN,
lr_dropdown type ref to cl_salv_wd_uie_dropdown_by_key.
lo_value = lo_interfacecontroller->get_model( ).
lo_value->if_salv_wd_table_settings~set_read_only( abap_false ).
lr_column = lo_value->if_salv_wd_column_settings~get_column( id = 'Name of the alv column' ).
create object lr_dropdown exporting selected_key_fieldname = 'Name of the alv column' ..
lr_column->set_cell_editor( lr_dropdown ).
data: lt_valueset type table of wdr_context_attr_value,
ls_valueset type wdr_context_attr_value,
lr_node type ref to if_wd_context_node,
lr_nodeinfo type ref to if_wd_context_node_info.
lr_node = wd_context->get_child_node( 'CTX_VN_ALV_TABLE' ).
lr_nodeinfo = lr_node->get_node_info( ).
* navigate from <CONTEXT> to <CTX_VN_ALV_TABLE> via lead selection
LO_ND_CTX_VN_ALV_TABLE = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_CTX_VN_ALV_TABLE ).
* get element via lead selection
LO_EL_CTX_VN_ALV_TABLE = LO_ND_CTX_VN_ALV_TABLE->GET_ELEMENT( ).
* @TODO handle not set lead selection
IF LO_EL_CTX_VN_ALV_TABLE IS INITIAL.
ENDIF.
CALL METHOD LO_ND_CTX_VN_ALV_TABLE->GET_STATIC_ATTRIBUTES_TABLE
IMPORTING
TABLE = LT_ALV.
*append ls_valueset to lt_valueset.
ls_valueset-value = 'First value'.
ls_valueset-text = 'First value'.
append ls_valueset to lt_valueset.
ls_valueset-value = 'Second value'.
ls_valueset-text = 'Second value'.
append ls_valueset to lt_valueset.
lr_nodeinfo->set_attribute_value_set(
exporting
name = 'TYPES'
value_set = lt_valueset
).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Vyshnavi, I hope this feature is not yet included.. only thing is after selecting we can do the operation, when we click on dropdown, there is no option / event to trigger..
And just have a look on Suggest Values property of InputField, if suits, you can..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Refer to the below code this will highlight the value 2. I am not using the value set property of the context attribute. I have followed the example in my previous reply.
data lo_nd_drop type ref to if_wd_context_node.
data lt_drop type wd_this->elements_drop.
data ls_drop type wd_this->element_drop.
lo_nd_drop = wd_context->get_child_node( name = wd_this->wdctx_drop ).
ls_drop-index = 'Value 1'.
append ls_drop to lt_drop.
clear ls_drop.
ls_drop-index = 'Value 2'.
append ls_drop to lt_drop.
clear ls_drop.
ls_drop-index = 'Value 3'.
append ls_drop to lt_drop.
clear ls_drop.
lo_nd_drop->bind_table( new_items = lt_drop set_initial_elements = abap_true ).
* Setting the second value as default.
call method lo_nd_drop->set_lead_selection_index
exporting
index = 2
.
Best regards,
Arun Krishnamoorthy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is possible via lead selection..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
lead selection of the dropdown list node wont work?
Regards
Srinivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI friends thanks for the replies.
for example if i have an drop down contains the values regarding the plant.
drop down : 1000
2000
3000 etc.
drop down contains those values.
now i will right the select query.
select * from likp into lt_likp where vbeln = ls_likp-vbeln.
now for that particular number i should get the plant in the drop down box along with the drop down list.
suppose for that delivery number if 3000 is the plant i should get the 3000 highlighted and in the down all the remaining values how can i do it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Step 1: Populate all the values in the 2nd dropdown as required. When you are creating a node for this dropdown, check box 'Set Lead selection' must be iniital ' '. (say : plant )
Step2 : Create an action on the first dropdown.
On action, read the value from Drop1 and get the corresponding plant.
Step3 : Get the plant dropdown table, read the value from step2 to get the index.
Now set the lead selection index .
** reading the plant table.
context_node->get_static_attributes_table(
IMPORTING
table = lt_plant ).
** read the table with the plant above to get the index.
** Set the lead selection index.
context_node->set_lead_selection_index( lf_index ).
Hi,
Refer the following link for drop down by index.
http://webdynproabap.wordpress.com/2012/07/08/drop-down-by-index/
And to highlight the value try using method set_selection_index method of the interface if_wd_context_node.
Best regards,
Arun Krishnamoorthy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Refer this link. It will help you: -
http://webdynproabap.wordpress.com/2012/07/08/drop-down-by-key/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.