Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BSP range

Former Member
0 Likes
620

Hello folks,

I need an example on how to do a BSP application using ranges. Let's say: I want to have a from -


to selection.

Any ideas?

Thanks in advance.

Ol Pom.

4 REPLIES 4
Read only

Former Member
Read only

Former Member
0 Likes
554

Hi Ol,

I think you msu t use two different input fields which act as the low and high values of a select-option.

There is no direct way of exactly replicating all the features of a select-options.

YOu can as well have a table view with four fields that a select-option usually has.

But the user will be all the more confused.

Regards,

Ravi

Read only

Former Member
0 Likes
554

hi,

it's very simple,place 2 input fields on the layout screen and write a select stmt using between clause.

follow the below complete BSP App procedure:

create <b>page1</b>: select the option page with flow logic.

in the <b>layout</b> screen paste the below code,

<%@page language="abap"%>

<%@extension name="htmlb" prefix="htmlb"%>

<htmlb:content design="design2003">

<htmlb:page title = "1st page ">

<htmlb:form>

<br><br><br><br>

<center>

<htmlb:textView design = "emphasized"

text = "Enter Material Numbers"

textColor = "red">

</htmlb:textView>

<htmlb:inputField id = "matnr1"

value = "12"/>

<br>

<htmlb:inputField id = "matnr2"

value = "20"/>

<br><br>

<htmlb:button id = "but1"

text = "Display"

onClick = "Click"/>

</center>

</htmlb:form>

</htmlb:page>

</htmlb:content>

In the event handler paste the below code in <b>OnInputProcessing</b> bolck

class cl_htmlb_manager definition load.

data: event type ref to cl_htmlb_event.

event ?= cl_htmlb_manager=>get_event( runtime->server->request ).

if event->id = 'but1' and event->event_type = 'click'.

data: data1 type ref to cl_htmlb_inputfield,

data2 type ref to cl_htmlb_inputfield.

data1 ?= cl_htmlb_manager=>get_data( request = runtime->server->request

name = 'inputField'

id = 'matnr1'

).

data2 ?= cl_htmlb_manager=>get_data( request = runtime->server->request

name = 'inputField'

id = 'matnr2'

).

if data1 is not initial.

v_matnr1 = data1->value.

else.

v_matnr1 = ''.

endif.

if data2 is not initial.

v_matnr2 = data2->value.

else.

v_matnr2 = ''.

endif.

if v_matnr1 <> '' and v_matnr2 <> ''.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = v_matnr1

importing

output = v_matnr1.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = v_matnr2

importing

output = v_matnr2.

select single matnr from mara

into v_matnr1

where matnr between v_matnr1 and v_matnr2.

if sy-subrc = 0.

v_flag = ' '.

else.

v_flag = 'X'.

endif.

if v_flag = ' '.

navigation->set_parameter( name = 'v_matnr1' value = v_matnr1 ).

navigation->set_parameter( name = 'v_matnr2' value = v_matnr2 ).

endif.

navigation->goto_page( 'page2.htm' ).

endif.

endif.

in <b>page attributes</b> tab,declare the below variables

v_flag type char1

v_matnr1 type mara-matnr

v_matnr2 type mara-matnr

create <b>page2</b> with page with flow logic option again

in the <b>layout</b> tab give

<%@page language="abap"%>

<%@extension name="htmlb" prefix="htmlb"%>

<htmlb:content design="design2003">

<htmlb:page title = "2nd page ">

<htmlb:form>

<br><br><br>

<htmlb:tableView id="tab1" table="<%=it_mara%>">

</htmlb:tableView>

</htmlb:form>

</htmlb:page>

</htmlb:content>

in the event handler tab,<b>OnInitialization</b>

select * from mara

into table it_mara

where matnr <b>between v_matnr1 and v_matnr2.</b>

in <b>page attributes</b> tab,declare the below variables

v_matnr1 type mara-matnr

v_matnr2 type mara-matnr

it_mara type t_mara

check the checkbox <b>Auto</b> next to v_matnr1 and v_matnr2 variables.

if you check this, values passed from page1will be available in page2 also.

in <b>type definitions</b> tab,

types:t_mara type table of mara.

And double click on object name, in the <b>navigation</b> tab,give

(start) nav. req. (target)

page1.htm req page2.htm

activate and run it you will get all the records given in range, aim passing default values at staring,you can even overwrite them.

*Do award points if it helps you.

regards

Read only

athavanraja
Active Contributor
0 Likes
554

check this weblog for complete code sample.

/people/sap.user72/blog/2006/12/20/bsp-value-help-input-field-and-select-options-ranges

Regards

Raja