Skip to Content

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

Problem in transfring attributes.

Hi All,

I am practicing with a simple application where i have two inputfields and a submit button on a BSP page.

If i input a value in first inputfield then on pressing submit button some calculations are done and the result is shown in second inputfield same happens if i input a value in second inputfield.

<b>The code for layout is:</b>

<htmlb:content design="design2003" >

<htmlb:page title="First page" >

<htmlb:form id="form1" >

<htmlb:label for="field1" text="Enter % Disc." />

<htmlb:inputField id = "field1"

value = "<%= var2 %>"

type = "INTEGER"

alignment = "CENTER" />

<htmlb:label for="field2" text="Enter Disc. in Rs." />

<htmlb:inputField id = "field2"

value = "<%= var1 %>"

type = "INTEGER"

alignment = "CENTER" />

<htmlb:button id = "submit"

text = "Press Me"

onClientClick = "javascript:checkInput();" />




<b>Code of onInputProcessing is:</b>

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->name = 'button' and event->event_type = 'click'.

data: button_event type ref to cl_htmlb_event_button.

button_event ?= event.


case event->id .

when 'submit'.

data: input1 type ref to cl_htmlb_inputfield .

data: input2 type ref to cl_htmlb_inputfield .

input1 ?= cl_htmlb_manager=>get_data(

request = runtime->server->request

name = 'inputField'

id = 'field1' ).

input2 ?= cl_htmlb_manager=>get_data(

request = runtime->server->request

name = 'inputField'

id = 'field2' ).

if field1 is initial .

var1 = ( field2 * 100 ) / 5000 .


var2 = ( field1 * 5000 ) / 100 .


<b>And page attribtes are:</b>

field1 TYPE I (auto)

field2 TYPE I (auto)

var1 TYPE I (auto)

var2 TYPE I (auto)

Here when i debug i get proper values in field1 , field2 and var1 , var2 , But these values are not getting passed .ie. value is not displayed in browser when the page is reloaded.

Note that i m navigating to the same page only.

Thanks ,


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