Ansicht
Dokumentation

ABENREDUCE_CONSTRUCTOR_INFERENCE - REDUCE CONSTRUCTOR INFERENCE

ABENREDUCE_CONSTRUCTOR_INFERENCE - REDUCE CONSTRUCTOR INFERENCE

BAL Application Log Documentation   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.
SAP E-Book

REDUCE, Type Inference for Actual Parameter

If a constructor expression

REDUCE #( ... INIT ... FOR ... )

is passed to generically typed formal parameters as an actual parameter using the character # as a symbol for the operand type, the following type inference is performed for the character #:

  • If the data type of the first declaration after INIT matches the generic type of the formal parameter, this data type is used.
  • If the data type of the first declaration after INIT does not match the generic type of the formal parameter, the type is derived from the generic type as follows: More specifically, this applies to the types c, n, and x with generic lengths.

Notes

  • The data type of the first declaration after INIT is always identified statically.


Example

The operator REDUCE generates a result of type string here. The generic parameter p has this type during the execution of the method, which is shown by the value "g" returned by DESCRIBE FIELD. The method call leads to a corresponding syntax warning that is suppressed by a pragma.

Reduce Operator, Type Inference






TXBHW - Original Tax Base Amount in Local Currency   PERFORM Short Reference  
This documentation is copyright by SAP AG.

Length: 1679 Date: 20240419 Time: 174958     sap01-206 ( 36 ms )