Hi all,
I cannot figure out on how to set the value back for dropdown using key value; I supposed it'll select the text description but it turned out showing the key value instead. Those attributes of context have the same data type.
Let's see the picture below for a quick understand.
Here is the coded for loading value to dropdown
===================
method WDDOINIT .
DATA : ls_V_BIND TYPE ihttpnvp,
lt_V_BIND TYPE tihttpnvp.
DATA lo_nd TYPE REF TO IF_WD_CONTEXT_NODE_INFO.
LO_ND = WD_CONTEXT->GET_NODE_INFO( ).
ls_v_bind-name = 5.
ls_v_bind-value = 'Five'.
APPEND ls_v_bind TO lt_v_bind.
ls_v_bind-name = 10.
ls_v_bind-value = 'Ten'.
APPEND ls_v_bind TO lt_v_bind.
ls_v_bind-name = 20.
ls_v_bind-value = 'Twenty'.
APPEND ls_v_bind TO lt_v_bind.
lo_nd = wd_context->get_node_info( ).
LO_ND = LO_ND->GET_CHILD_NODE( NAME = WD_THIS->wdctx_year ).
LO_ND->SET_ATTRIBUTE_VALUE_SET(
exporting
NAME = 'ZZYEAR'
VALUE_SET = lt_v_bind
).
endmethod.
======================
Here is the code for button action
========================
method ONACTIONSET .
DATA : LO_ND TYPE REF TO IF_WD_CONTEXT_NODE,
LO_EL TYPE REF TO IF_WD_CONTEXT_ELEMENT,
LS_INPUT TYPE wd_this->element_input.
DATA LS_YEAR TYPE wd_this->element_year.
LO_ND = WD_CONTEXT->GET_CHILD_NODE( name = WD_THIS->wdctx_input ).
lo_nd->get_static_attributes(
IMPORTING
static_attributes = ls_input
).
LS_YEAR-zzyear = ls_input-zzyear_start.
LO_ND = WD_CONTEXT->GET_CHILD_NODE( WD_THIS->wdctx_year ).
lo_nd->set_static_attributes( static_attributes = ls_year ).
endmethod.