cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic dropdown(supply function)

Former Member
0 Kudos

Hi,

I have a requirement where I have to populate dropdown_by_key2 values on selecion of value of dropdown_by_key1.

Hence in componentcontroller context i created a node as subnode of another node. Now i am trying to use supply function in my child node to populate dropdown_by_key_2.

Could I have the code for supply function? I am not able to populate this.

Also is my design if parent child node relation correct? and should the code be written in supply function of child?

Regards,

Vishal Bhatia

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

First, you have to use DropDownByIndex for this scenario.

You can implement the supply function like


Context:
+ ItemsOfFirstList (node, card=0:n, selection=0:1)
   + text (string)
   + ItemsOfSecondList (node, card=0:n, selection=0:1, supplyFunction=supplyItemsOfSecondList, singleton=true)
      + text (string)

void supplyItemsOfSecondList(IItemsOfFirstListElement parentElement, IItemsOfSecondListNode node)
{
  if (parentElement.getText().equals("some_value"))
  {
    /* add elements to node depending on some_value */
  }
  else ...
}

Bind the "texts" properties of each drop-down list to the "text" attribute of the corresponding context node.

Additionally, assign an action to the "onSelect" event of the first drop-down list such that a server roundtrip occurs when a value is selected. This server roundtrip will trigger a call to the supply function of the second list because the lead-selection of the first context node was changed by selecting an entry in the first drop-down list.

Former Member
0 Kudos

I am looking for Webdynpro ABAP solution not java.

However thanks, I succeded with drop down by index, however i need to understand what u mentioned,

Additionally, assign an action to the "onSelect" event of the first drop-down list such that a server roundtrip occurs when a value is selected. This server roundtrip will trigger a call to the supply function of the second list because the lead-selection of the first context node was changed by selecting an entry in the first drop-down list.

How do i do this server round trip mentioned? What is the action i should assign and what is the code i need to write in that action, keep in mind i need webdynpro for abap solution?

Edited by: Vishal Bhatia on Apr 29, 2011 6:41 PM

Former Member
0 Kudos

If you don't assign an action to the "onSelect" event of the first drop-down list, no server-roundtrip occurs and the supply function for the second drop-down is not executed immediately (only after the next roundtrip). You can create an empty action and assign it.

Former Member
0 Kudos

Hi Segmantation Fault,

I cant understand it to the much extent can you please elaborate it a little more so that i can work on it properly. Even i had the same doubt.

Thanks

Former Member
0 Kudos

Hi,

As I solved it, I used both the drop downs as Drop Down by index with cardinality 1:N. You can code directly inside the on submit event method, without writing code in supply method.

I used web dynpro by ABAP to solve it. It does work for me now.

See the link below.

Regards,

Vishal