cancel
Showing results for 
Search instead for 
Did you mean: 

DropDown by Index. Problem creating.

Former Member
0 Kudos

Hi,

I've created a DropDown by index in my Webdynpro, but I don't know how can I populate it. Can your help me?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Moreno,

Consider a simple scenario where you want to display yes and no in your drop down.

Bind the 'TEXTS' property of your drop down with a node attribute.You can give the cardinality of the node as 0..n and selection as 0..1.For this example consider the node name is 'dropdown'.

DATA lo_nd_dropdown TYPE REF TO if_wd_context_node.

data: Stru_dropdown type If_Main=>Elements_dispose,

wa_stru_dropdown TYPE wd_this->element_dispose.

  • navigate from <CONTEXT> to <DISPOSE> via lead selection

lo_nd_dropdown = wd_context->get_child_node( name = wd_this->wdctx_dropdown ).

wa_stru_dropdown-DEACTIVATE_VAL = 'Yes'.

INSERT wa_stru_dropdown INTO TABLE Stru_dropdown.

wa_stru_dropdown-DEACTIVATE_VAL = 'No'.

INSERT wa_stru_dropdown INTO TABLE Stru_dropdown.

lo_nd_dropdown->bind_elements( Stru_dropdown ).

this should fill up your pop up by values 'yes' and 'no'.

Basically you are just binding a table containing the desired values with the node.

Hope this solves your problem.

Former Member
0 Kudos

Hi,

The line

data: Stru_dropdown type If_Main=>Elements_dispose

it's error line.

Former Member
0 Kudos

Hi.

The example code is just an EXAMPLE create with the wizard.

You have to build your own node in your context for the drop down elements.

What is the structure of the node you want to use to display the elements?

Cheers,

Sascha

Former Member
0 Kudos

Hi,

For example, I want that my dropdown show the data in the field sflight-CARRID.

Thanks.

Former Member
0 Kudos

Ok.

Lets take SCARR and display all available carriers.

Create a node carriers and assign structure SCARR with all fields to the node.

Set cardinality 0..n and init lead selection.

then enter supply_carriers as supply method at the bottom. double click the method name and use the following code in the method:


  data:
          lt_carriers     type table of scarr.

  select * from scarr 
    into corresponding fields of table lt_carriers.

  node->bind_table( lt_carriers ).

node is the reference of the context node you want to supply and is transfered by the system.

The go to your drop down and bind the textx attribute to the carrname field of the context node carriers.

Thats it.

Cheers,

Sascha

Former Member
0 Kudos

hi ,

data: Stru_dropdown type If_Main=>Elements_dispose

was an example to show u how it can be created...if you have created a node with name "DROPDOWN" and your view name is "MAIN" then substitute If_Main=>Elements_dispose with "If_Main=>Elements_dropdown"...hope this will solve your problem

Former Member
0 Kudos

Hi,

I've solved the problem.

Thanks.

Former Member
0 Kudos

Thanks.

Answers (2)

Answers (2)

Former Member
0 Kudos

Check the webdynpro component WDR_TEST_EVENTS, which is an example to use various UI elements. There is a view for drop down by index also, that will be of help to you.

Regards,

Nithya

Former Member
0 Kudos

Hi,

I've seen WDR_TEST_EVENTS but that webdynpro (DropDown) it's very complicated.

Former Member
0 Kudos

Hi.

create a context node of some structure which contains the elements for the dropdown. One attribute of this structure shoul contain the text you want to display in the drop down. Then bind the texts property of the dropdown to this attribute.

for example:

node (cardinality 0..n or 1..n)

--- attribute customer name

--- attribute customer number

bind attribute customer name to the texts attribute of dropdown by index and all names will be displayed. Fill this node in supply method for example.

Afterwards you can get the selected element via the lead selection.

If you set initialize lead selection the first element of the node will be preselected in the drop down.

Voila.

Cheers,

Sascha

Message was edited by:

Sascha Dingeldey

Former Member
0 Kudos

Hi,

I've done that but it doesn't run.