cancel
Showing results for 
Search instead for 
Did you mean: 

DropDownByKey

Former Member
0 Kudos

I have a DropDownByKey whose value is bound to a data element X.

The underlying Data Domain of X has a value range consisting of a single

value - 'Y'.

My client wants the DropDownByKey to accommodate one of two

values 'Y' or blank, either of which would be a valid entry.

How would I modify either the Domain Range Values or the DropDownByKey

to do this?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

Yes,u can modify the domain value range.It will reflect in ur drop down list.

Another way is that,ypu can hardcode the value set to be populated in the drop down as,

DATA lo_nd_nd_<nodename> TYPE REF TO if_wd_context_node.

DATA lo_nd_nd_info TYPE REF TO if_wd_context_node_info.

data : ls_valueset TYPE wdr_context_attr_value,

lt_valueset TYPE wdr_context_attr_value_list.

append initial line to lt_valueset.

ls_valueset-text = 'Y'

ls_valueset-value = 'Y'

APPEND ls_valueset TO lt_valueset.

CLEAR ls_valueset.

  • set all declared attributes

lo_nd_nd_info->set_attribute_value_set(

EXPORTING

name = 'STATUS' "attribute name

value_set = lt_valueset ).

Thanks,

Divya.S

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Instead you can create a custom data element say zelement using a custom domain whose data type is the same as the one intended there in the custom data domain you can give your intended values, it has worked for be before.

Regards,

Murthy.

uday_gubbala2
Active Contributor
0 Kudos

Hi Gregory,

Try go through the section "3.3.1 Using Dropdown Lists" of Ulli Hoffman's Web Dynpro For ABAP. There's a [sneak preview version|http://www.sap-press.de/download/dateien/1079/sappress_web_dynpro_for_abap.pdf] of the same available from SAP Press on the web & you can get to read over this particular section. The author explains clearly as to how you can work with both DropDownByIndex & DropDownByKey UI elements. While explaining the DropDownByKey UI element he explains as to how you can use a custom defined valueset & also as to how utilize the fixed values from the domain. The explanation should help resolve your problem.

Regards,

Uday

uday_gubbala2
Active Contributor
0 Kudos

Hi Gregory,

Instead of depending on the domain for the values you can explicitly bind an internal table with your desired valuset to the context attribute. This internal table (of type wdy_key_value_table) can be bound using the set_attribute_value_set method to the context attribute.

METHOD wddoinit.
DATA lr_node_info TYPE REF TO if_wd_context_node_info.
DATA ls_value TYPE wdy_key_value.
DATA lt_value_set TYPE wdy_key_value_table.
*----- Create value key list of different text designs
ls_value-key = if_wdl_standard=>textviewdesign_emphasized.
ls_value-value = 'emphasized'.
APPEND ls_value TO lt_value_set.
ls_value-key = if_wdl_standard=>textviewdesign_header1.

ls_value-value = 'header1'.
APPEND ls_value TO lt_value_set.
ls_value-key = if_wdl_standard=>textviewdesign_header2.
ls_value-value = 'header2'.
APPEND ls_value TO lt_value_set.
ls_value-key = if_wdl_standard=>textviewdesign_header3.
ls_value-value = 'header3'.
APPEND ls_value TO lt_value_set.
*----- Retrieve node
lr_node_info = wd_context->get_node_info( ).
lr_node_info = lr_node_info->get_child_node( 'TEXT_DESIGNS' ).
*----- Set attribute info
lr_node_info->set_attribute_value_set( name = 'KEY'
value_set = lt_value_set ).
ENDMETHOD.

For example in the above code snippet I am explicitly creating an internal table with the set of values I would like to appear in my DropDownByKey UI element. I have a context node TEXT_DESIGNS (cardinality: 1..1) & I have an attribute KEY under this node which am using to bind to the selectedKey property of the DropDownByKey element.

Regards,

Uday