cancel
Showing results for 
Search instead for 
Did you mean: 

Problems showing Values in a DROPDOWNBYINDEX

Former Member
0 Kudos

Hello together,

I've got a problem of showing values in a Drop Down Box.

I've got 1 Dropdown box, 1 button and a text field. In the text field i'm wirting a carrid for example AC.

If i press the button in the Drop down box should show the name to the corresponding carrid for example Air Canada.

this is my code till yet. But i don't see what's missing.

Maybe anybody can help?

  Data: context_node type ref to if_wd_context_node.

  Data: it_carriers TYPE STANDARD TABLE OF scarr,
        wa_carriers LIKE LINE OF it_carriers,
        wa_carrid(3) TYPE c.

  context_node = wd_context->get_child_node( 'DROPDOWN_CARRIERS' ).
  context_node->get_attribute( exporting Name = 'CARRID' importing value = wa_carrid ).

  select * from scarr
    INTO wa_carriers
    WHERE carrid = wa_carrid.
    APPEND wa_carriers TO it_carriers.
  ENDSELECT.

  context_node = wd_context->get_child_node( name = 'CARRID').
  context_node->BIND_TABLE( new_items = it_carriers ).

Accepted Solutions (1)

Accepted Solutions (1)

ChrisPaine
Active Contributor
0 Kudos

Hi...

I'm guessing that this code is in the method handling the event of the button?

You have bound your dropdown by index texts property to the node 'CARRID' and the text field within it?

Unless you set the lead selection of the table that you have just inserted the dropdown by index doesn't know what is selected...

in the set up of your context check that the node is set to initialise lead selection.

good luck,

Chris

Former Member
0 Kudos

Hi,

Yes to your first question.

Yes i bound the dropdown by index text properties to the Node 'CARRID' but the TF is bound with the DROPDOWN_CARRIERS -> CARRID.

Former Member
0 Kudos

Get the selected row by using code wizard and use the values of the structure whereever you want. Refer to the below code:

Suppose I have a Node NODE_OUTPUT and binded with my table UI element. We need to get the selected row (ls_node_output) in my Button UI event handler method as below:

DATA lo_nd_node_output TYPE REF TO if_wd_context_node.

DATA lo_el_node_output TYPE REF TO if_wd_context_element.

DATA ls_node_output TYPE wd_this->element_node_output.

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

lo_nd_node_output = wd_context->get_child_node( name = wd_this->wdctx_node_output ).

  • get element via lead selection

lo_el_node_output = lo_nd_node_output->get_element( ).

  • get all declared attributes

lo_el_node_output->get_static_attributes(

IMPORTING

static_attributes = ls_node_output ).

ChrisPaine
Active Contributor
0 Kudos

Hi,

just bind your text field to the same node as the dropdown by index - any selection of the dropdown by index will update the lead selection of that context node - and thus the value displayed in the text field. No need for two nodes.

Sorry, having re-read you post after a weekend's gap it seems much simpler!

Chris

Former Member
0 Kudos

Yes I did it.

Now I have the Problem the TF is not blank when i start the problem and the DropDown Box is showing me all the results of the select statement.

Is there maybe a Method how to set the TF blank?

Former Member
0 Kudos

Just pass a Blank entry at the top of the table (Means on Index 1); which is binded with Dropdown by Index.

ChrisPaine
Active Contributor
0 Kudos

Hi,

whichever node you want to restrict your list of possible airlines to - bind this to both the dropdown and the text field.

There is no need for any onSelect type event or two nodes.

if you wish to populate this node using the select statement (for example during applicaition initalisaition) do so.

If at the start of the application you don't want anything selected then ensure that the node is not set to initalise lead selection.

If you want the user to be able to deselect once they have made a selection - then you will need to add a blank value to the list of possible selections.

Hope this helps....

Chris

Former Member
0 Kudos

THX ALOT FOR HELP. NOW IT WORKS.

Answers (1)

Answers (1)

Former Member
0 Kudos

Ensure that you didn't set any supply function on the context node which is binded with the Dropdown. And set your dropdown node binding code in the Modify view by checking that the screen is not initially installed. Use the First_time parameter of the modify view to do this.

Former Member
0 Kudos

I'm new in Web Dynpro. I don't understand everything you told me.

I don't have any supply functions set.

How can i Check that the screen is not initially installed?

Former Member
0 Kudos

I'm new in Web Dynpro. I don't understand everything you told me.

I don't have any supply functions set.

How can i Check that the screen is not initially installed?

Former Member
0 Kudos

Sorry I,ve got connection problems

Edited by: ChristianA. on May 7, 2010 9:38 AM