Skip to Content

To Display fixed values instead of Short Description in ABAP Webdynpro

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Jan 13, 2015 at 07:50 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 13, 2015 at 07:25 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 13, 2015 at 04:24 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded