cancel
Showing results for 
Search instead for 
Did you mean: 

Calculated Fields

Former Member
0 Kudos

(New to dynpro)

How should I make a calculated field?

What I have currently is:

Opening Balance ________

Received ________

Paid ________

Closing Balance ________

All four fields are input fields, Closing Balance is marked read-only.

Currently, to calculate the closing balance I have implemented event onEnter in the first 3 input fields so now if the user hits <Enter> after putting in opening balance/received/payed the closing balance is calculated.

What I want of course is something more 'automatic' - no need to hit the enter key - any time a change is detected - for example during navigation between the fields w/ a <TAB>. How can I do this?

Thanks,

Michal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Michal!

You need at least some sort of event to check out if new values have been entered.

Also, in case of an input field, the context is updated only when you press enter.

You can try having a button say CALCULATE on your screen. In the event handler of this button, you can calculate the closing balance.

Hope this helps.

Regards,

Neha

Former Member
0 Kudos

So it's impossible to do what I want to do? Is there no event equivalent to change-of-values? I thought finally we are using web-technology so it would be possible...

Thanks,

Michal

Former Member
0 Kudos

Hi Michal.

Yes ... you are right.

OnFocus and things like that are missing which is also very painfull for me.

Cheers,

Sascha

Message was edited by:

Sascha Dingeldey

former_member215843
Active Participant
0 Kudos

Hi,

This behaviour has it's reasons: Imagine there is a user entering data very fast. If the data are sent to the server and the changes are sent back, and the server is not very fast, the user may be frustrated that he/she has always to wait for the response.

Ciao, Regina

Answers (2)

Answers (2)

Former Member
0 Kudos

You can use the ENABLE_CONTEXT_CHANGE_LOG method to enable the recording of the context changes to which your inputfields are bound. This method is in interface IF_WD_CONTEXT.

data ref_context type ref to IF_WD_CONTEXT

ref_context = wd_Context->get_context( ).

The GET_CONTEXT_CHANGE_LOG method of the same interface then gives the NODE , Old Val and New Val of the changed attributes in the context

Thanks

Anand

Former Member
0 Kudos

Hi Michal,

In WEBDYNPRO, to perform an action you must have to trigger an event or perform an Action.

Now to solve your problem you have to trigger an event or you have to perform an action to check is there any change of value?

As you working in Input field, it’s not possible to trigger an event when you are entering any value in the input box, until you are pressing ENTER. Other-wise you have to go for an action Button and on perform of that action you can do your job.

I think it will help you for better understanding.

Regards

Satrajit

Former Member
0 Kudos

... which was already explained perfectly by Nehal ....