Sei sulla pagina 1di 4

1 BSP code to work with drop down list box

Layout code: <%@page language="abap" %> <%@extension name="htmlb" prefix="htmlb" %> <htmlb:content design="classic+design2002+design2003" > <htmlb:page title="BSP Extension: HTMLB / Element: checkboxGroup" > <htmlb:form> <htmlb:checkbox id = "chk"

tooltip = "Click the checkbox" text="<%=checked%>"(checked is a string type value) on Click </htmlb:form> </htmlb:page> </htmlb:content> OnInPutProcessing code: DATA: chkbox1 TYPE REF TO cl_htmlb_checkbox, chkbox1 ?= cl_htmlb_manager=>get_data( request = runtime->server->request name = 'checkbox' id = 'chk' ). DATA: event TYPE REF TO cl_htmlb_event. event = cl_htmlb_manager=>get_event( runtime->server->request ). IF event->name = 'checkbox' AND event->event_type = 'click'. CASE event->id. WHEN 'chk'. checked = chkbox1->checked. IF checked EQ 'X'. checked = ' Selected'.(Pass this "checked" value to layout) ELSE. checked = 'Not Selected'. ENDIF. endcase. endif. = "My CheckboxClick" />

Layout Code:<%@page language="abap"%> <%@extension name="htmlb" prefix="htmlb"%> <htmlb:content design="classic+design2002+design2003"> <htmlb:page title = "First Page "> <htmlb:form> <htmlb:dropdownListBox id = "myDropdownListDay" tooltip = "Quick info for myDropdownListBox"> <% LOOP AT t_mod INTO fs_mod. %> <htmlb:listBoxItem key = "<%=fs_mod%>" value = "<%=fs_mod%>"/> <% %> <%ENDLOOP.%> </htmlb:dropdownListBox> </htmlb:form> </htmlb:page> </htmlb:content> In Event-handler - on Initilalization. SELECT modul FROM zemployee INTO TABLE t_mod. sort t_mod. delete adjacent duplicates from t_mod comparing modul. In Page Attributes:Fs_mod type types_mod t_mod type fs_module. In Type Definition: TYPES: BEGIN OF types_mod, modul TYPE zemployee-modul, END OF types_mod, fs_module type standard table of TYPES_MOD.

------************
Layout -----The code below is pure HTML and not HTMLB so you will need to remove the htmlb code that SAP insert automatically. <htmlb:content design="design2003"> <htmlb:page title = " "> <htmlb:form> <html> <page> <FORM NAME="formlist"> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td align="RIGHT"> <INPUT TYPE="TEXT" NAME="keywords" size=60> <INPUT type="submit" name="OnInputProcessing(search)"> </td> <% data: it_ekko type standard table of ekko initial size 0, wa_ekko type ekko. select ebeln up to 10 rows

from ekko into table it_ekko. %> <td><SELECT NAME="typelist"> <% loop at it_ekko into wa_ekko. %> <OPTION VALUE="<%=sy-tabix%>"><%=wa_ekko-ebeln%> <% endloop. %> </SELECT> </td>

</tr></table> </FORM> </page> </html> OnInputProcessing ----------------case event_id. "declared in page attributes as type STRING when 'search'. * Sets value of parameter, i.e. gets value from screen navigation->set_parameter( name = 'keywords' ). * * Gets value of parameter, so can be moved into abap field Note: gd_keywords declared in page attributes as type string gd_keywords = navigation->get_parameter( name = 'keywords' ). set and get user option, gd_option(type string) will contain index of line selected navigation->set_parameter( name = 'typelist' ). gd_option = navigation->get_parameter( name = 'typelist' ).

* *

* * *

If you create page 'courses.htm' with a field called keywords within page attributes then the value entered in this page will be passed through. navigation->goto_page('courses.htm'). endcase.

ss

Potrebbero piacerti anche