Ansicht
Dokumentation

ABENCONV_TYPE_INFERENCE_ABEXA - CONV TYPE INFERENCE ABEXA

ABENCONV_TYPE_INFERENCE_ABEXA - CONV TYPE INFERENCE ABEXA

PERFORM Short Reference   rdisp/max_wprun_time - Maximum work process run time  
This documentation is copyright by SAP AG.
SAP E-Book

Conversion Operator, Type Inference

This example demonstrates the type inference for the conversion operator CONV.

Source Code

Execute

Description

Constructor expressions with the conversion operator CONV are passed to differently typed formal parameters of methods. In the case of generic formal parameters, special rules apply when determining the operand type.

  • Completely typed formal parameter
When the method meth1 is called with a completely typed formal parameter, the operand type for # is determined using this parameter and in all three calls there is a conversion to c with length 10, whereby the first conversion is redundant here.
  • Formal parameter typed generically with c
The operand type for # is determined from the argument.
  • In the first call, the type c with length 20 of the argument matches the generic type and is used, which is why this conversion is redundant.

  • In the second call, the type i does not match the generic type and the type c with the predefined output length 11 of i is used.

  • Calls with the generically typed field symbol <fs> are not possible, since no type can be derived from the argument.

  • Formal parameter typed generically with csequence
  • In the first call, the type c with length 20 of the argument matches the generic type and is used, which is why this conversion is redundant.

  • In the second call, the type i does not match the generic type and the type string is used, which is indicated by a syntax check warning.

  • In the third call, no type can be determined from the generically typed field symbol <fs> and the type string is used, which is indicated by a syntax check warning.






TXBHW - Original Tax Base Amount in Local Currency   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.

Length: 2753 Date: 20240416 Time: 081839     sap01-206 ( 43 ms )