Ansicht
Dokumentation

ABENUNTYPED_NUMBER_LITERALS - UNTYPED NUMBER LITERALS

ABENUNTYPED_NUMBER_LITERALS - UNTYPED NUMBER LITERALS

Addresses (Business Address Services)   Vendor Master (General Section)  
This documentation is copyright by SAP AG.
SAP E-Book

Numeric Literals

... $[+$|-$]n$[n$[n$[...$]$]$] ...

Effect

A numeric literal consists of a continuous sequence of up to 31 digits n (0 to 9), which can be directly preceded by a plus (+) or minus (-) sign.

  • Numeric literals between -2147483648 and 2147483647 are integer literals and have the built-in ABAP type i.
  • Numeric literals outside of this interval are packed numeric literals and have the built-in ABAP type p, with a length of 8 bytes if they are not longer than 15 digits and with a length of 16 bytes if they have between 16 and 31 digits.

Notes

  • In numeric literals, no decimal separators or scientific notation with mantissa and exponent are possible.
  • Numbers that cannot be represented as numeric literals can only be specified in character literals. If they are used in operand positions in which a numeric value is expected, they are converted into these. The conversion operator CONV is recommended for targeted conversions.
  • Numeric literals that span multiple lines are not allowed. Furthermore, the literal operator & cannot be used to create a composite literal from multiple numeric literals.
  • A numeric literal +$|-literal directly prefixed with a plus or minus sign must not be confused with a simple arithmetic expression +$|- literal for which there is a space between the operator +$|- and an unsigned literal. Unlike the numeric literal, the expression is not evaluated until runtime. Therefore, in such cases, the numeric literal should always be used for performance reasons.

Example

The first literal is of the type i. The following literals are of the type p with lengths 8 and 16.

Targeted conversion of a character literal into type int8.

Example

The example shows that a casting of a packed numeric literal to the type int8 has a different result than when using a field of the type int8, due to the different internal representation. If the field symbol fs2> were typed with the time stamp type utclong, an exception would even be raised for the use in the embedded expression of the output.






ROGBILLS - Synchronize billing plans   ROGBILLS - Synchronize billing plans  
This documentation is copyright by SAP AG.

Length: 4554 Date: 20240424 Time: 013657     sap01-206 ( 82 ms )