Application Development 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: 

on change of field value

Former Member
0 Kudos

Hi All!

As <b>on change of - endon</b> is obsolete in ABAP now.What shall be the alternative to achieve the above functionality.

My requirement is as follows :

I have a screen field and it has a check table(f4) attached to it.Before I save I would like to check if the field value has changed or not if it changes I want to process some code if not I want to come out.

Please advise

Regards

Praneeth

4 REPLIES 4

Former Member
0 Kudos

Hello,

For ur requirement u can't use the On cahnge of Syntax.

Instead u move the value of the field to any tempoary variable.

Before saving u check both the screen field value and temp varailble value is same.

If no u perform ur code.

Regards,

Vasanth

Former Member
0 Kudos

Use AT NEW ..........ENDAT. option.

0 Kudos

ON CHANGE OF is not supported in OO ABAP.

This is an excerpt from the Obsolete ABAP Language Constructs. YOu can define another field to track the changes and process accordingly.

ON CHANGE OF - ENDON not allowed

The pseudo control structure ON CHANGE OF - ENDON is not allowed in ABAP Objects.

Error message in ABAP Objects

if the following syntax is used: ON CHANGE OF f. ... ENDON.

Correct syntax:

DATA g LIKE f.

IF f <> g. ...

g = f.

ENDIF.

Reason:

A global invisible work field over which the program has no control is created internally.

A separate work field should be declared and processed using the IF control structure.

Also see https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/obsolete abap language constructs.pdf Page #19

Former Member
0 Kudos

Negi,

Can you just eleborate how to use this syntax.I mean the new syntax had to be put in between on change of and endon?

Regards

Praneeth