Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problem with DropDown

Hi,

i m having two dropdwn and one table.

when i select a prod_num in first dropdwn i should get corresponding part_num's in second drpdwn. after selecting a perticular part_num from second drpdwn table should fill.

i have completed above.

in do_init i filled first dropdwn.

in if condition i filled second drop dwn, after selecting a values from second drop dwn i can able to fill table,.

but what my issue is, after selecting second dropdwn value, table is filling, but dropdwn box is getting empty. values are gone. no values displaying in second drop down. again i need to select fisr drop den to fill second dropdwn values.

please where should i chane.

this is my code, please have a look below.

method DO_INIT .

*CALL METHOD SUPER->DO_INIT

  • .

myview = create_view( view_name = 'Main_View.htm' ).

mymodel ?= create_model( model_id = 'm' class_name = 'ZAMR_DDW_MODEL' ).

myview->set_attribute( name = 'obj' value = mymodel ).

mymodel->FILL_PROD_DDW( ).

call_view( myview ).

endmethod.

method DO_REQUEST .

*CALL METHOD SUPER->DO_REQUEST

  • .

dispatch_input( ).

endmethod.

method DO_HANDLE_EVENT .

DATA: event1 TYPE REF TO CL_HTMLB_EVENT,

tv type ref to CL_HTMLB_TABLEVIEW,

table_event type ref to CL_HTMLB_EVENT_TABLEVIEW.

myview = create_view( view_name = 'Main_View.htm' ).

mymodel ?= create_model( model_id = 'm' class_name = 'ZAMR_DDW_MODEL' ).

myview->set_attribute( name = 'obj' value = mymodel ).

mymodel->FILL_PROD_DDW( ).

event1 = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).

event2 = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).

IF event1->name = 'dropdownListBox' AND event1->event_type ='select'.

DATA : dd_listbox_event TYPE REF TO CL_HTMLB_EVENT_SELECTION.

if event1->id = 'id1'.

dd_listbox_event ?= event1.

mymodel->SEL_PRD_TYPE = dd_listbox_event->selection.

mymodel->FILL_PRT_DDW( ).

endif.

if event2->id = 'id2'.

dd_listbox_event ?= event2.

mymodel->FILL_PRT_DDW( ).

mymodel->SEL_PRT_TYPE = dd_listbox_event->selection.

mymodel->fill_table( ).

endif.

endif.

call_view( myview ).

endmethod.

method DO_HANDLE_EVENT .

DATA: event1 TYPE REF TO CL_HTMLB_EVENT,

tv type ref to CL_HTMLB_TABLEVIEW,

table_event type ref to CL_HTMLB_EVENT_TABLEVIEW.

myview = create_view( view_name = 'Main_View.htm' ).

mymodel ?= create_model( model_id = 'm' class_name = 'ZAMR_DDW_MODEL' ).

myview->set_attribute( name = 'obj' value = mymodel ).

mymodel->FILL_PROD_DDW( ).

event1 = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).

event2 = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).

IF event1->name = 'dropdownListBox' AND event1->event_type ='select'.

DATA : dd_listbox_event TYPE REF TO CL_HTMLB_EVENT_SELECTION.

if event1->id = 'id1'.

dd_listbox_event ?= event1.

mymodel->SEL_PRD_TYPE = dd_listbox_event->selection.

mymodel->FILL_PRT_DDW( ).

endif.

if event2->id = 'id2'.

dd_listbox_event ?= event2.

mymodel->FILL_PRT_DDW( ).

mymodel->SEL_PRT_TYPE = dd_listbox_event->selection.

mymodel->fill_table( ).

endif.

  • endif.

endif.

call_view( myview ).

endmethod.

Please let me know wer do i need to change my code.

Thanks in advance,

Venkat

Former Member
replied

Look at the below blog: It will solve your problem.

<a href="/people/durairaj.athavanraja/blog/2004/12/20/bsphow-to-chained-dropdownlistbox dropdownListBox</a>

<i>*Reward each useful answer</i>

Raja T

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question