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

Problem in using ON CHANGE OF

Former Member
0 Likes
912

Hi,

I am using ON CHANGE OF statement in a program.

When I execute program from SE38, the ON CHNAGE OF command is getting executed correctly.

When I execute the same program again in the same session (without opening it using /nse38), the ON CHANGE OF command is not working correctly. The program control is not going inside ON CHANGE OF.

I think the contents of internal table field during ON CHANGE OF go into some session buffer, which is not getting refreshed when I execute the same program again in same session. But I am not sure is this the problem.

Please help me how I can solve this problem. I want that ON CHANGE OF executes correctly even if I execute same program multiple times without refreshing session.

Regards,

Vijay

Hi,

I am using ON CHANGE OF statement in a program.

When I execute program from SE38, the ON CHNAGE OF command is getting executed correctly.

When I execute the same program again in the same session (without opening it using /nse38), the ON CHANGE OF command is not working correctly. The program control is not going inside ON CHANGE OF.

I think the contents of internal table field during ON CHANGE OF go into some session buffer, which is not getting refreshed when I execute the same program again in same session. But I am not sure is this the problem.

Please help me how I can solve this problem. I want that ON CHANGE OF executes correctly even if I execute same program multiple times without refreshing session.

Regards,

Vijay

5 REPLIES 5
Read only

JozsefSzikszai
Active Contributor
0 Likes
827

hi Vijay,

surprisingly enough, but you have to debug your program... Looks like a variable is not CLEARed.

ec

Read only

Former Member
0 Likes
827

Hi,

Read this.

ON CHANGE OF is unsuitable for recognizing control levels in loops of this type because it always creates a global auxiliary field which is used to check for changes. This global auxiliary field is only changed in the relevant ON CHANGE OF statement. It is not reset when the processing enters loops or subroutines, so unwanted effects can occur if the loop or subroutine is executed again. Also, since it is set to its initial value when created (like any other field), any ON CHANGE OF processing will be executed after the first test, unless the contents of the field concerned happen to be identical to the initial value.

Regards,

Pankaj

Read only

0 Likes
827

Hi Pankaj,

You are right.

But is there some way to refresh global auxiliary field.

Thanks,

Vijay

Read only

0 Likes
827

Hi Vijay,

I am not aware on how to refreshing global auxiliary field.

But if there is a way, still it can cause some problem because multiple instances of same program would be using this field and if you refresh that in one instance it would affect all.

Instead of using ON CHANGE OF f; You can try with statement AT NEW f.

Regards,

Pankaj

Read only

Former Member
0 Likes
827

Hi,

try using statements like the following before start-of-selection.

refresh itab[].

or

clear itab[].

Regards,

Renjith Michael.