on 01-13-2015 7:13 AM
I am using knb1 table - ktzlf field( DropDownByKey ). My requirement is to get the fixed values, but am getting short description. How to resolve it???
Eg:
fixed values short description
A partially delivered
B delivered
C not delivered
SPACE processing
Thanks in Advance.
Hi,
You can use the following code.
DATA lo_nd_<node> TYPE REF TO if_wd_context_node.
DATA lo_nd_<node>_info TYPE REF TO if_wd_context_node_info.
DATA lt_values TYPE wdr_context_attr_value_list.
DATA lw_values TYPE wdr_context_attr_value.
lw_values-text = 'A'.
lw_values-value = 'A'.
APPEND lw_values TO lt_values.
CLEAR lw_values.
lw_values-text = 'B'.
lw_values-value = 'B'.
APPEND lw_values TO lt_values.
CLEAR lw_values.
lw_values-text = 'C'.
lw_values-value = 'C'.
APPEND lw_values TO lt_values.
CLEAR lw_values.
APPEND INTIAL LINE TO LT_VALUES . " For Blank = Processing
SORT lt_values AS TEXT.
lo_nd_<node>_info->set_attribute_value_set(
EXPORTING
name = " Web Dynpro: Name of Context Element
value_set = lt_values " All Fixed Values of an Attribute with Texts
).
Hope it will be useful to you.Else pls revert.
Thanks
KH
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In init,
DATA lo_nd_NODE TYPE REF TO if_wd_context_node.
DATA lo_nd_NODE_info TYPE REF TO if_wd_context_node_info.
DATA lt_values TYPE wdr_context_attr_value_list.
DATA lw_values TYPE wdr_context_attr_value.
Hi,
What is your node name and attribute name?.
One statement is missing in your above code.
After lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ) , write below code
lo_nd_node_info = lo_nd_node->get_node_info( ).
If still the probelm persists, share snapshot of your node and attributes of your wdp component .
Thanks
KH
Alternate solution:
1. Use DropdownbyIndex
2. create Node DDKEY with 1:n cardinality, add attribute 'DDFLD' to it.
3. Bind the DDI to this attribute
4. in INIT method, write following code:
DATA lo_nd_ddkey TYPE REF TO if_wd_context_node. " Node Reference to Dropdown
DATA lt_keys TYPE wd_this->elements_ddkey. " Drodopwn Context Table
DATA ls_keys TYPE wd_this->element_ddKEY. " Dorpdown Context Workarea
*&- Navigate from <CONTEXT> to <DDKEY> via Lead Selection
lo_nd_ddkey = wd_context->path_get_node( path = `DDKEY` ).
*&- Store Entries
ls_keys-ddfld = 'A'.
APPEND ls_keys TO lt_keys.
ls_keys-ddfld = 'B'.
APPEND ls_keys TO lt_keys.
*&- Check If Table is Initial and Append Initial Line
IF lt_keys IS INITIAL.
APPEND INITIAL LINE TO lt_keys.
ENDIF.
*&- Bind Values to Context
lo_nd_reports->bind_table( new_items = lt_keys set_initial_elements = abap_false ).
Use code generator as much as you can expeciall for context node references. Once generated, remove unwanted code elements and add whatever custom code you may want to add. You can also dynamically read domain values using FM 'DD_DOMA_GET'
and set the dropdown internal table values.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
there is no KTZLF field in KNB1 table in my system. When you use dropdownbykey and you bind only the value of your context, this is the standard behavior.
Try DropdownbyIndex (or code your own if_wd_context_node_info=>set_attribute_values_list( ) and you still can use dropdownbykey. Please, search for those terms and you will find lots of articles.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
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.