SAP LOGEXP RULES EXPR CHAR



Get Example source ABAP code based on a different SAP table
  



ABAP_RELEXP - Comparison Type of String Expressions
String expressions can be used as operands of comparison expressions with the following:
Comparison operators for all data types
Comparison operators for character-like data types
It is possible to compare a string expression with a single operand of any elementary data type or with another string expression. With regard to the conversion of the elementary expression by string, two cases can be distinguished:
If a string expression is compared with an individual operand in a generic logical expression, the comparison type is string. The individual operand is implicitly regarded as an embedded expression of a string template and formatted as a text string before the comparison in accordance with the associated predefined format.
If a string expression on the right side of a WHERE condition is used in a processing statement for internal tables, the comparison type results from the combination of string with the type on the left side. Both sides are converted to the comparison type as required.



Latest notes:

A string expression cannot be specified as the operand of a predicate expression.
The result of the formatting of an individual operand differs from the result of a simple conversion for some data types. An example is the type decfloat34.
The results of general logical expressions and logical expressions in WHERE conditions for internal tables may differ for comparisons with string expressions, since both the formatting and the comparison type play a role.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
This example demonstrates the effect of different comparison types. The first comparison is true, since the character-like operand is converted to the type of the numeric operand in accordance with the rule for comparing character-like data types and the numeric value is compared. However, the second comparison is also true, since the numeric operand is formatted as a text string and the internal representation of the code page used is compared.
ABEXA 01108
ABAP_EXAMPLE_END

ABAP_EXAMPLE_VX5
This example demonstrates the effect of different formatting and different rules. All comparisons are true. An elementary operand of type decfloat34 is compared with a text string and a string expression. For the comparison with the text string, the left side is also converted to the type string and the values of both sides are the same. For the comparison with the chain, the left-hand side is formatted differently and the values of both sides are different. The third comparison shows explicitly how the elementary operand is handled during the comparison with the chain. In contrast, the WHERE conditions LOOP statements convert both sides to the numeric comparison type decfloat34 . The output shows the difference between simple conversion and formatting as an embedded expression.
ABEXA 01109
ABAP_EXAMPLE_END