Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Calling and leaving program units →  Calling Processing Blocks →  Calling procedures →  External Procedure Call →  Program Attributes for External Procedure Call 

Fixed point arithmetic during external procedure call

A procedure that is called externally is executed according to the attribute Fixed point arithmetic in your framework program. When doing this, each actual parameterthat is linked to a formal parameter in the procedure is handled independently of the corresponding attribute of the calling program and independent of the parameter type and transfer type also according to the attribute of the program called.

Other versions: 7.31 | 7.40 | 7.54


Example

Let us take a global class:

CLASS cl_test DEFINITION PUBLIC.
  PUBLIC SECTION.
    CLASS-METHODS meth RETURNING value(p) TYPE string.
ENDCLASS.

CLASS cl_test IMPLEMENTATION.
  METHOD meth.
    p = '1000'.
  ENDMETHOD.
ENDCLASS.

A calling program section could look as follows:

DATA pack TYPE p DECIMALS 2.

pack = cl_test=>meth( ).

Depending on the attributes, the result then looks as follows, whereby the attributes of the calling program are listed in the top row and the attributes of the called program are listed in the left-hand column:

Fixed point arithmetic on off
on 1000.00 1000.00
off 10.00 10.00

Only when the fixed point arithmetic is switched on in the called procedure does the system assign the formal parameter to the linked actual parameter, including the associated conversion and taking into account its decimal separator. if the fixed point arithmetic is switched off in the called procedure, the system does not take into account the decimal separator of the actual parameter.

However, if the call looks as follows:

DATA pack TYPE p DECIMALS 2.

pack = + cl_test=>meth( ).

The result looks like this:

Fixed point arithmetic on off
on 1000.00 10.00
off 1000.00 10.00

In this case, the call takes place in an arithmetic expression. The return value of the call is direct assigned to an interim result of the same type as the formal parameter and this is then converted in the calling program to the calculation type of the arithmetic expression. Therefore, in this case, the attribute of the calling program determines whether or not the decimal separator is taken into account or not.

The behavior in the second case generally corresponds to the expectations of a calling program. Of course, we can also acheive this by introducing an auxiliary variable of the same type as the formal parameter that we use in the calling program first as an actual parameter and then assign to the target field.


Note

The justification for the behavior shown here is that the passing of parameters is to be independent of pass by reference and pass by value. To bypass the associated problems, we strongly recommend not switching off the fixed point arithmetic in any program. In this context, this applies particularly to class pools and function groups.