cancel
Showing results for 
Search instead for 
Did you mean: 

Append initial line to Drop down values coming from value range of domain

preethi_santhanam
Participant
0 Kudos

Hi All,

I have a DropDownbyKey UI element which fetches values from the value range in domain. So, the dropdown is populated with values automatically. I would like to append an initial line to the dropdown list.

Could you please suggest the best way to achieve this.

Thanks a lot in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Just add value range and dont provide the description for that fixed values

if you are using the standard domain just make a zcopy of it .

pls look at this pic i have tried .

[http://i31.tinypic.com/14b3hw5.jpg|http://i31.tinypic.com/14b3hw5.jpg]

Regards

Chinnaiya P

preethi_santhanam
Participant
0 Kudos

Hi Chinnaiya,

Thanks for your quick reply. Is there any way without altering the value range in domain? As in programatically?

Former Member
0 Kudos

HI Preeti ,

in Dropdown by key that is notpossible .hence the value will be populated from the domain ,

But if you us drop bown by value we can control it via program by writting supply function .

For eg :

* data declaration
  DATA lt_ddk TYPE wd_this->Elements_ddk.
  DATA ls_ddk LIKE LINE OF lt_ddk.

  ls_ddk-key   = 1.
  ls_ddk-value = 'one'.
  APPEND ls_ddk to lt_ddk.

  ls_ddk-key   = 2.
  ls_ddk-value = 'two'.
  APPEND ls_ddk to lt_ddk.

  ls_ddk-key   = 3.
  ls_ddk-value = 'three'.
  APPEND ls_ddk to lt_ddk.

  ls_ddk-key   = 4.
  ls_ddk-value = ' ''.      "  appending initial line 
  APPEND ls_ddk to lt_ddk.

  node->bind_table(
    new_items            =  lt_ddk
    set_initial_elements = abap_true ).

Regards

Chinnaiya P

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>in Dropdown by key that is notpossible .hence the value will be populated from the domain

That's not actually true. You can override the Value Set of a DropDownByKey by using the IF_WD_CONTEXT_NODE_INFO=>SET_ATTRIBUTE_VALUE_SET API.

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/bb/69b441b0133531e10000000a155106/frameset.htm

Answers (1)

Answers (1)

preethi_santhanam
Participant
0 Kudos

Thanks a lot for your help.