cancel
Showing results for 
Search instead for 
Did you mean: 

How to take value from html Dropdown menu?

Former Member
0 Kudos

Hi to all,

I have a HTML based dropdown menu, it takes the values from R/3 and show the values in the list. But I cannot use this choosen value in my program.

<b>code of layout</b>

<%@page language="ABAP"%>

<%

data: med type table of T502T.

field-symbols: <med> like line of med.

select * from T502T into table med where SPRSL = 'T'.

%>

<b><select size="1" style="font-family: Verdana; font-size: 8pt; name="famst" >

<%

loop at med assigning <med>.

%>

<option value="<%=<med>-FAMST%>"

<%if FAMST = <med>-FAMST.%> selected<%endif.%> >

<%= <med>-ftext%>

</option>

<%

endloop.

%>

</select></b>

<b>In the event_handler part</b>

I try to assign the choosen value

wa1-famst = FAMST.

There is no problem with text-input fields.

Any idea?

regards,

Hasan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

if your requirement is to use dropdown then why dont you use htmlb tag <htmlb:dropdownlistbox> it has an attribute "selected" which contains the selected value of the dropdown.

This way you can get the selected value in an abap variable at event handling.

e.g. bsp application has been allready told to you. check that out.

problem with your case:

In order to assing a value to you abap variable you require a server round trip. since the abap code is executed at server end(its server side programming).

however if you still want to move wiht your design only you can do it.

define an hidden input field on your page layout.

use a javascript to assin the selected value from dropdown to it.

now at server side event handling just get the value from this hidden inputfield.

regards,

Former Member
0 Kudos

hi Hemendra,

I'm new in bsp programming, I check the f4 search help examples and they are complex for me. so I built html based dropdown menus for taking input values.

<htmlb:dropdownlistbox> does not support dynamic values.

defining hidden input field can be solution for me.

Is it possible to build input helps without using any RFC or class programming?

regards,

Former Member
0 Kudos

You cen develop input help without rfc in case your table lies on same server where the bsp is, else you have to go for rfc call to other server where table(help values) lies.

i dont think its possible to develop help without class programming.

but if your help values are static then you can develop help using javascript.

regards,

Do reward points if answers are helpfull.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>><htmlb:dropdownlistbox> does not support dynamic values.

I'm not sure what you mean by this. You can of course populate any values you want into the dropdownlistbox. If you use data binding with MVC you don't even have to write any code to populate the allowed values if they are defined via relationship in the data dictionary.

Answers (1)

Answers (1)

Former Member
0 Kudos

hi,

I think for getting the values of the dropdownfield you can check BSP application.

SBSPEXT_htmlb/drowndownListbox.bsp

Regards

Aashish