Introduction
Use
Explanation
At its interface, the control wrapper class provides methods for operating on the control. However, calling a method does not imply that the method is automatically executed at runtime. Initially, the system buffers methods in a queue, referred to as the Automation Queue, when they are called in the ABAP program. The execution sequence of the methods therefore remains unchanged. However, the methods are only executed if they are transferred to the frontend via Remote Function Call (RFC) using method FLUSH. This means that the Automation Queue is used to reduce the number of RFC calls required.
Due to the buffering of control methods in the Automation Queue, the method calls and the remaining ABAP code are executed at different times. Method FLUSH thus determines a synchronization point.
Type of Parameter Passing
Robust control programming depends on the Automation Queue concept. If a method is added to the queue, there are two ways how the Control Framework can save the method parameters:
-
The values of the actual parameters are added to the queue (call by value).
-
The references to the actual parameters are added to the queue (call by reference).
Call by Reference
The Framework stores the reference to an actual parameter in the queue if the variable was imported during the method call, that is, returned to the program. If more methods with the same parameter are added to the queue, they are also stored by reference.
The Framework recognizes identical references in the queue and links them by a Parameter Reference:
This means: Values of variables imported in the program during a method call can be exported within the queue during subsequent method calls. It is not necessary to return control to the backend. Due to this mechanism, the number of RFC calls can be reduced, improving performance.
Call by Value
In all other cases, the Control Framework stores the values of the actual parameters in the Automation Queue. The value that is passed is determined before the flush call.
Conclusion
An RFC call represents a bottleneck in the connection to the frontend. Consequently, you should keep the number of flush calls in your programs to a minimum.
Since the method calls and the remaining chunks of source code are executed at different times, wrong synchronization might have the following consequences:
-
The values of imported variables are not current (which affects conditional queries) or are modified prematurely (so that any changes are overwritten). This is the case if the Automation Queue is processed too late by a flush call.
-
A change made to a variable becomes ineffective between two method calls if the first method imports and the second method exports the change. The reason is that the variable is passed within the Automation Queue.
-
Actual parameters passed by reference are no longer valid. This is the case if the method was called in a subroutine and the FLUSHmethod was only called after the end of the subroutine.
The exercises in this lesson serve as a basis for discussing the flush issue.