cancel
Showing results for 
Search instead for 
Did you mean: 

dropdown box in webdynpro

Former Member
0 Kudos

My requirement is create the dropdown list and when i select the value from the list,have to display table values according to that selected value.

For this i have seen the demo example WDR_TEST_EVENTS provided by SAP.

I have created layout with one dropdownboxbyidx , one Table and

context with node dropdown1 and child node table1 with attributes and also with the corresponding supply functions.

when i test this application initially am getting the values when i select the another value in dropdown , it is not changing the values in the table and also it is giving error as' Access via null object reference not possible'

any one can help me to resolve this problem.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

For the changed values not coming in your table, have you done a bind_elements or bind_table in the on_select event handler? You need to bind every time.

Refer to this for dropdown by index. Can you post the dump here?

Regards,

Nithya

Answers (5)

Answers (5)

Former Member
0 Kudos

answered

Former Member
0 Kudos

Hi Neelima,

I would really suggest that you write appropriate code in OnSelect Method of DropDownBox instead of using a Supply function. Depending on the selected value, you can do a conditional select on the table to fill the corresponding values into the child node thru data binding.

Thanks & Regards,

Phani

Former Member
0 Kudos

write the code of supply function in the onselect and it should work fine...also don forget to bind the table

Former Member
0 Kudos

hi neelima,

instead of a supply function why dont you fill the value in ONSELECT method of the dropdown?

Former Member
0 Kudos

could you pls provide the code of you on_select action handler?

Cheers,

Sascha

Former Member
0 Kudos

i have written the following code in onselect

method ONACTIONONSELECT .

wd_this->all_in_one_util->on_element_event( wdevent ).

endmethod.

i declared attribute ALL_IN_ONE_UTIL with reference type CL_WDR_ALL_IN_ONE_UTIL.

Former Member
0 Kudos

Why do you use this class?

What do you want to do? User selects en entry and you update a table with elements regarding the selected value?

Then you have to get the selected element via the lead selection or by using the wdevent object passed to the action handler.

Then read the selected value from the element, perform a selection and add the result to the node of table that should display the result.

Cheers,

Sascha

Former Member
0 Kudos

I am getting the values in the listbox but when i select the perticular value in list, table is not changing as per selected value. that means Filltable1 supply function is not working.

code for the Filltable1 supply function:

data:

lt_attributes type standard table of if_mainview=>element_table1,

wa_attributes like line of lt_attributes,

carrid type s_carr_id,

lt_scarplan type cl_wd_flight_model=>tt_scarplan.

field-symbols:

<scarplan> like line of lt_scarplan.

parent_element->get_attribute( exporting name = 'CARRID' importing value = carrid ).

cl_wd_flight_model=>get_scarplan_by_carrid( exporting i_carrid = carrid importing et_scarplan = lt_scarplan ).

loop at lt_scarplan assigning <scarplan>.

move-corresponding <scarplan> to wa_attributes.

insert wa_attributes into table lt_attributes.

endloop.

node->bind_elements( lt_attributes ).

when i click anthor value in list , it's giving error as ' Access via null object reference is not possible'.

My concern is i want to display table data according to selected value.

Former Member
0 Kudos

The supply function will be called only when the table is filled for the first time. If you want it to be called every time when the drop down changes, do a node->invalidate( ) in the on_select event. Then it will be forced to be called again.

Check this , this is exactly the same problem that you are facing. Please award points for helpful answers.

Regards,

Nithya

Former Member
0 Kudos

Hi.

supply methods are normally only called once during initialization depending of

your context structure. So when you select another element the supply method will not be called again.

One exception: If you would declare the node, that contains the data for the table, as subnode of the node that contains the elements for the drop down and you declare this node as singleton the supply method is called each time you select an element of the parent node.

So you should use a method to fill it which you call in the action handler.

Cheers,

Sascha

Former Member
0 Kudos

HI Sascha,

what i should write in the method ONACTIONONSELECT instead of following code

wd_this->all_in_one_util->on_element_event( wdevent ).

Former Member
0 Kudos

Hi.

As suggested you can use the code of the supply method with the exception that you have to get the context which is bound to the table manually.

This can be done by using the wizard (Read Context).

Then you have the reference of the node.

Chjeers,

Sascha

Former Member
0 Kudos

Thanks for every body.

I resolved the problem

Former Member
0 Kudos

hi,

please award points and close the thread if your problem is solved