Creating the Value Set for a DropDownByKey Element
2017-12-01 16:08
387 查看
Overview
When using a DropDownByKey or DropDownByIndex element, the set of possible values is available automatically only for context attributes having a data type with fixed values defined in the underlying domain. Here we show how to manually create the set of possiblevalues when fixed values are not available in the data type’s domain.
Scenario
You want to create a DropDownByKey UI element for data element VSBED (Shipping Conditions) which has its possible values defined in check table TVSB.
Procedure
1.0 Create a Context Node
In the COMPONENTCONTROLLER, create a context node with cardinality 1..1 and selection 0..1. Then create the attribute VSBED, defined as follows.
2.0 Populate the Attribute Value Set
In method WDDOINIT of the COMPONENTCONTROLLER, enter the following code to define the set of possible values for context attribute VSBED.method WDDOINIT. DATA lo_nd_node TYPE REF TO if_wd_context_node. DATA lo_node_info TYPE REF TO if_wd_context_node_info. DATA lt_value_set TYPE wdr_context_attr_value_list. * -- Bind value set for the DropDownByKey element lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ). lo_node_info = lo_nd_node->get_node_info( ). SELECT tvsb~vsbed AS value tvsbt~vtext AS text FROM tvsb JOIN tvsbt ON tvsbt~vsbed = tvsb~vsbed INTO TABLE lt_value_set WHERE tvsbt~spras = sy-langu ORDER BY text. lo_node_info->set_attribute_value_set( EXPORTING name = 'VSBED' value_set = lt_value_set ). endmethod.
3.0 Create the DropDownByKey UI Element
Copy the context node from the COMPONENTCONTROLLER to the desired view. Now create a DropyDownByKey UI element and bind its selectedKey property to context attribute NODE.VSBED.
Result
The value set for context attribute VSBED is populated upon initialization of the COMPONENTCONTROLLER and is displayed in the view’s DropDownByKey UI element.相关文章推荐
- setNilValueForKey:could not set nil as the value for the key distance.解决方案
- iOS: setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key name.
- iOS- 报错(崩)[< > setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key
- ... setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key latitudeLabel.
- could not set nil as the value for the key verifyStatus
- ... setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key latitudeLab
- iOS: setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key name.
- setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key
- setValue:forUndefinedKey this class is not key value coding-compliant for the key
- setValue:forUndefinedKey this class is not key value coding-compliant for the key
- *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<WKWebViewConfiguration 0x1701bcd20> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the k
- iOS Xcode 6报错:setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key v
- question:setValue:forUndefinedKey: this class is not key value coding-compliant for the key
- setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key
- iOS could not set nil as the value for the key
- 服务器的日志一直报Packet for query is too large (7632997 > 4194304). You can change this value on the server by setting the max_allowed_packet' variable.的解决方法
- Packet for query is too large (1032 > 1024). You can change this value on the server by setting the
- Mapped Statements collection does not contain value for TaskMapper.selectByPrimaryKey
- 'date' is an invalid value for the SoapElementAttribute.DataType property. The property may only be specified for primitive types.
- his class is not key value coding-compliant for the key