cancel
Showing results for 
Search instead for 
Did you mean: 

working with drop down

Former Member
0 Kudos

hi,

i am working with dropdowns embbeded in a table.what i want to do is to display the data ,which is selected by user ( from this dropdown) into a text element. i have only one row of tabel and i have tried by reading the context and lead selection and setting the attribue of the that text element using value i got from attribute of my drop down but i am getting run time error and final objective is to save data selected by user into a database tabe, please guide me step by step in this regard.

thanks in advance.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

basically i am working with drop down by key and i want to show the value selected by user, using

another ui element( i.e text view) through action of a button, please tell me some sample code which is simple. i have values in drop don i just want to show the selected one.

thank you

Former Member
0 Kudos

Hiu2026

Here INDEX have the value what you have selected. You have to write this code at on action select event method of the dropdown.

DATA index TYPE string.

index = wdevent->get_string( 'INDEX' ).

Here index will contain the index which selected by user. Now find the value for the corresponding index. Now bind this value to the context of your textview. You ll automatically get it displayed to the textview.

Thanks

Satra

Former Member
0 Kudos

In the onaction method of the button do the following

1. Read the context attribute which you binded to the dropdown

2. Set the value which you read from the dropdown into the context attribute which you binded to the textview

Regards

Tamil

Former Member
0 Kudos

hi tamil,

i have done exactly what you has suggested but i am repeatedly getting runtime error

as "Access via 'NULL' object reference not possible" . so please help me out.

Former Member
0 Kudos

Goto ST22 and check where the dump occurs....If you can't fix paste the code here..

Regards

Tamil

TomVanDoo
Active Contributor
0 Kudos

"i have values in drop don i just want to show the selected one."

it depends on how you created the dropdown.

is it created with an internal table as value list, or with a childnode as value list.

internal table:

simply add a textView element and bind it to the same attribute as the dropdown.

it might be necessary to create an action on the select of the dropdown element to trigger the update (don't know by heart if it's required though, just test)

childnode as value list:

create an action on the select event of the dropdown element

in the handler, get_lead_selection of your child context node.

get the value of this selected element.

put it in the attribute of the parent element (your actual table node)

show that attribute somewhere with an extra ui element.

Former Member
0 Kudos

I think, you are already getting the dropdown, so the problem is in time of selection you get an runtime error. I am putting some pic of code to help you out. Just follow the code and try to implement in your component..

Please let me know if you need any help.

METHOD onactionfilter_vendor .

DATA index TYPE string.

DATA lo_nd_source_of_supply TYPE REF TO if_wd_context_node.

DATA lt_sos TYPE wd_this->elements_source_of_supply.

DATA ls_sos TYPE wd_this->element_source_of_supply.

DATA lv_all TYPE flag.

DATA lv_gesbu TYPE gesbu.

index = wdevent->get_string( 'INDEX' ).

MOVE index TO wd_comp_controller->my_filter_index.

CLEAR lv_all.

CASE index.

WHEN cl_mmpur_ui_cppr=>c_index_1.

lv_all = abap_true.

WHEN cl_mmpur_ui_cppr=>c_index_2.

lv_gesbu = cl_mmpur_ui_cppr=>c_eval_score_40.

WHEN cl_mmpur_ui_cppr=>c_index_3.

lv_gesbu = cl_mmpur_ui_cppr=>c_eval_score_50.

WHEN cl_mmpur_ui_cppr=>c_index_4.

lv_gesbu = cl_mmpur_ui_cppr=>c_eval_score_60.

WHEN cl_mmpur_ui_cppr=>c_index_5.

lv_gesbu = cl_mmpur_ui_cppr=>c_eval_score_70.

WHEN cl_mmpur_ui_cppr=>c_index_6.

lv_gesbu = cl_mmpur_ui_cppr=>c_eval_score_80.

WHEN cl_mmpur_ui_cppr=>c_index_7.

lv_gesbu = cl_mmpur_ui_cppr=>c_eval_score_90.

ENDCASE.

IF lv_all IS INITIAL.

LOOP AT wd_comp_controller->myt_sos INTO ls_sos WHERE gesbu > lv_gesbu.

APPEND ls_sos TO lt_sos.

ENDLOOP.

ELSE.

lt_sos = wd_comp_controller->myt_sos.

ENDIF.

lo_nd_source_of_supply = wd_context->get_child_node( name = wd_this->wdctx_source_of_supply ).

lo_nd_source_of_supply->bind_table( lt_sos ).

ENDMETHOD.

Reards

Satrajit.

abhimanyu_lagishetti7
Active Contributor
0 Kudos

go to ST22 and paste the runtime error also paste your code

Abhi