on 04-13-2011 7:52 PM
HI EXPERTS,
I HAVE A REQUIREMENT LIKE WHEN I SELECT A DATA FROM A DROP DOWN LIST IN A FIELD, THE CORRESPONDING VALUE SHOULD BE DISPLAYED IN THE NEXT FIELD IN A ALV TABLE. CAN ANY ONE GUIDE ME HOW TO DO THIS. OR SUPPORT ME WITH ANY ANY AVAILABLE SOLUTIONS. KINDLY HELP.
THANKS AND REGARDS,
VADIVU.
Hi vadiv,
Sorry for late reply.
You can go like this:---
1.Set drop down by key in the column which you want to display as drop down using
After instantiate ur alv component and using get model method,
lr_dropdown type ref to cl_salv_wd_uie_dropdown_by_key.
lv_value = lo_interfacecontroller->get_model( ).
lv_value->if_salv_wd_table_settings~set_read_only( abap_false ).
lr_column = lv_value->if_salv_wd_column_settings~get_column( id = 'Column_name' ).
create object lr_dropdown exporting selected_key_fieldname = 'Column_name'.
lr_column->set_cell_editor( lr_dropdown ).
call method lo_value->if_salv_wd_table_settings~set_cell_action_event_enabled
exporting
value = ABAP_TRUE .
2. Set values in the particular attribute by using SET_ATTRIBUTE_VALUE_SET.
DATA: LT_VALUESET TYPE STANDARD TABLE OF WDR_CONTEXT_ATTR_VALUE,
LS_VALUESET TYPE WDR_CONTEXT_ATTR_VALUE,
LR_NODE_INFO TYPE REF TO IF_WD_CONTEXT_NODE_INFO,
LR_NODE TYPE REF TO IF_WD_CONTEXT_NODE.
LR_NODE = WD_CONTEXT->GET_CHILD_NODE( 'node_name' ).
LR_NODE_INFO = LR_NODE->GET_NODE_INFO( ).
LT_VALUESET-VALUE = '0'.
LS_VALUESET-TEXT = '0'.
APPEND LS_EXTENSION TO LT_EXTENSION.
LS_VALUESET-VALUE = '1'.
LS_VALUESET-TEXT = '1'.
APPEND LS_VALUESET TO LT_VALUESET.
set values no of values for dropdown like this.
LR_NODE_INFO->SET_ATTRIBUTE_VALUE_SET(
EXPORTING
NAME = 'Column_name' "attribute name
VALUE_SET = LT_VALUESET ).
3.In methods create a event handler for ON_CELL_ACTION.
In that:-
DATA: INDEX_VALUE TYPE I.
INDEX_VALUE = R_PARAM->INDEX.
By using this index value you fetch the node by code wizard.
use like this:-
alternative access via index
lo_el_node_name = lo_nd_node_name->get_element( index = INDEX_VALUE ).
Fetch the particular value set in dropdown and the by using code wizard set it to the required field.
Your value will be displayed.
Hope this can resolve your issue.
Regards,
Monishankar C
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi vadiv,
Sorry for late reply. But good to see that you have solved the error. Enjoy Web dynpro.
All the best.
Regards,
Monishankar C
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi vadiv,
Go like this:-
1.Set drop down by key in the column which you want to display as drop down using CL_SALV_WD_UIE_DROPDOWN_BY_KEY.
2. Set values in the particular attribute by using SET_ATTRIBUTE_VALUE_SET.
3. There is a event handler like ' ON_CELL_ACTION' which will be triggered when you select particular value in drop down. GO to the event handler and get the value. Also get the index_value to identify the row.
In the event handler bind the value with the required attribute and then bind with context node.
Now whenever you set some value in drop down , it will be displayed in the required field in alv.
Reply if you need any coding reference.
Regards,
Monishankar C
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vadiv,
Try like this..
I think you are getting values into dropdown right..? hope upto its working. no on selection of this drop down, the selection value
should display in next column. right...
Dropdown contains ONSELECT event .. go to that event and write some code like this.. change code as for your requrement.
DATA lo_nd_segment1 TYPE REF TO if_wd_context_node.
DATA lo_el_segment1 TYPE REF TO if_wd_context_element.
DATA ls_segment1 TYPE wd_this->Element_segment1.
data lt_segment1 type wd_this->elements_segment1.
DATA lv_segment TYPE wd_this->Element_segment1-segment.
data lr_column type ref to cl_wd_table_column.
navigate from <CONTEXT> to <SEGMENT1> via lead selection
lo_nd_segment1 = wd_context->get_child_node( name = wd_this->wdctx_segment1 ).
get element via lead selection
lo_el_segment1 = lo_nd_segment1->get_element( ).
lo_el_segment1 = WDEVENT->GET_CONTEXT_ELEMENT( 'CONTEXT_ELEMENT' ).
get all declared attributes
lo_el_segment1->get_static_attributes(
IMPORTING
static_attributes = ls_segment1 ).
here ls_segment1 contains selected value in dropdown. now set attribute for next column.
lo_el_segment1->set_Attribute(
name = 'CELL_DESIGN'
VALUE = ls_segment1 ).
Cheers,
Kris.
hi,
please specifuy the requirement ...for now
i guess you can get that vaue when you read that node and den you can put the value in the wa and then append it to the table.....do the coding in modify view so that the thing gets refreshed everytime
regards,
sahai.s
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.