Ansicht
Dokumentation

ABENLOGEXP_RULES_OPERANDS_INCOMPA - LOGEXP RULES OPERANDS INCOMPA

ABENLOGEXP_RULES_OPERANDS_INCOMPA - LOGEXP RULES OPERANDS INCOMPA

General Material Data   PERFORM Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

log_exp - Comparing Incompatible Elementary Operands

If operand1 and operand2 have elementary data types and are not compatible, their contents are converted according to the following rules and then compared:

Operands of the Same Type but with a Different Length

  • For operands of data type p of a different length or with a different number of decimal places, the system compares the numeric values. If the number of decimal places is different, the operand with fewer decimal places is converted into an internal field with 31 decimal places and the same number of decimal places as the other operand. If the whole number places and required decimal places add up to more than 31, this causes an overflow and triggers a corresponding runtime error.
  • For operands of data type c, the system adjusts the shorter field to the length of the longer field by filling the shorter field with spaces on the right. Then the comparison is started.
  • Operands with a different length of data type string are always unequal. If the contents of the operands match for the length of the shorter operand, the shorter operand is smaller than the longer one. In all other cases, the excess positions of the longer field are truncated on the right before the system compares the size on a character-by-character basis from left to right.
  • For operands of data type n, the shorter field is filled with zeros on the left to achieve the length of the longer field.
  • For operands of data type x, the shorter field is filled with hexadecimal zeros on the right to achieve the length of the longer field.
  • Operands with a different length of data type xstring are always unequal. If the contents of the operands match for the length of the shorter operand, the shorter operand is smaller than the longer one. In all other cases, the excess positions of the longer field are truncated on the right before the system compares the size on a byte-by-byte basis from left to right.

Operands of Different Elementary Types

If the operands have different data types, they are converted according to the conversion tables based on the following hierarchy, where the priority gets lower, from top to bottom:

  1. If one of the operands has the numeric data type decfloat34, then the other operand is also converted to decfloat34.

  2. If one of the operands has the numeric data type decfloat16, then both operands are converted to decfloat34.

  3. If one of the operands has one of the numeric data types i (b, s), f, or p, then the other operand is converted to the data type with the largest value range, with the value range of f being greater than that of p and the value range of p being greater than that of i (the value range of data type i is greater than that of s and the value range of s is greater than that of b).

  4. If one of the operands has the data type d or t and the other operand a numeric data type (i, f, p), the content of the date or time field is converted to the numeric data type.

  5. If one of the operands has the data type d or t and the other operand a character-type data type except d or t (c, n, string), the content of the date or time field is also handled as if it was character-type. If one of the operands has the data type d and the other the data type t, an exception occurs which cannot be handled.

  6. If one of the operands has the data type n and the other one the data type c, string, x, or xstring, the contents of both operands are converted to data type p.

  7. If one of the operands has a data type of fixed length c or x and the other operand a data type of variable length string or xstring, the fixed length operand is converted to the associated variable length data type (c to string, x to xstring).

  8. If one of the operands has a byte-type type (x, xstring) and the other operand a character-type type (c, string), the content of the operand with the byte-type type is converted to the corresponding character-type data type (x to c, xstring to string).

Notes

If a decimal floating point number is involved in a comparison, the comparison is always made with the type decfloat34.

  • If an exception occurs during conversion between different data types, this cannot ever be caught in comparisons and instead always leads to a runtime error.





BAL_S_LOG - Application Log: Log header data   PERFORM Short Reference  
This documentation is copyright by SAP AG.

Length: 5523 Date: 20240328 Time: 225853     sap01-206 ( 116 ms )