SAP CONV CONSTRUCTOR INFERENCE



Get Example source ABAP code based on a different SAP table
  



CONV, Type Inference for Actual Parameters
If a constructor expression
CONV #( $[ let_exp$] dobj )
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 argument dobj is known and matches the generic type of the formal parameter, no conversion is performed, and the type of the argument is used instead.
If the data type of the argument dobj is known and is elementary, types are derived from it as follows for formal parameter types with generic lengths as follows:
Generic type c
c with the length of the argument in arguments of the types n , d, and t; c of the predefined output length of the argument for all other argument types except strings; no type is derived for arguments of the types string and xtring
Generic type n
n with the length of the argument for arguments of the types n, d, and t and n with the length of a conversion of the argument to n for all other argument types except numeric types with decimal places and strings; no type is derived for arguments of the types decfloat16, decfloat34, f, and p with decimal places plus string and xtring
Generic type x
x with the rounded half length of the argument for arguments of the type c; x with the length 4 for all other argument types except strings; no type is derived for arguments of the types string and xtring
Generic type p
p without decimal places with the length 16 for arguments of the types decfloat16, decfloat34, f, string, or c and n with lengths greater than 15; p without decimal places with the length 8 for all other argument types
In other cases, the type is derived from the generic type of the formal parameter as follows:
csequence and clike produce string
xsequence produces xstring
numeric and decfloat produce decfloat34
p produces p with the length 8 and no decimal places
Standard table type with generic primary table key produces a standard table with a standard key
Other combinations of generic formal parameter types and arguments cannot be made more concrete in any meaningful way and produce a syntax error with the exception of table types that are explicitly generic with respect to their secondary table keys.
Syntax warnings that can be hidden using pragmas also indicate any redundant conversions resulting from the rules above.



Latest notes: