SAP LOGEXP BYTE

Get Example source ABAP code based on a different SAP table
  


ARTICLE

rel_exp - Comparing Byte-Like Data Types
The following tables show the comparison types for comparisons between byte-like data types and other data types. If the type of an operand is not the same as the comparison type, it is converted to this type.
ITOC

Comparisons with Numeric Data Types - xstring, x
decfloat34decfloat34
decfloat16decfloat34
ff
pp
<(>int8<)>int8
i, s, bi
ABAP Code Snippet
Length Adjustments
The comparison type p has 31 decimal places and the number of places in the decimal portion in the operand of type p.
ABAP Code Snippet

Note
When converting byte-like data types to numeric types, note that all bytes are ignored except for the final four.

Comparisons with Character-Like Data Types - xstringx
stringstringstring
cstringc
npp
d,tii
ABAP Code Snippet
Length Adjustments
When data type c is compared with x or xstring, the shorter field is adjusted to the length of the longer field after conversions from x to c or xstring to string . Blanks are used as filler on the right.
Lengths are not adjusted for comparisons between the data type string and x or xstring.
ABAP Code Snippet

Comparisons with Byte-Like Data Types - xstringx
xstringxstringxstring
xxstringx
Length Adjustments
Operands of data type xstring with different lengths never match. If the contents of the operands match for the length of the shorter operand, the shorter operand is smaller than the longer one. Otherwise the surplus bytes in the longer field are truncated on the right, and then the content is compared.
For comparisons between two operands of data type c, the shorter field is converted to the longer field, with hexadecimal 0 used as filler on the right.

Example
The first comparison uses the appropriate conversion rules to convert the hexadecimal content 'FF00' of hex to the string 'FF00'; this string is then compared with 'FFxx'. Before the second comparison, the appropriate conversion rules are used to convert the content of text to the hexadecimal value 'FF00' in the helper variable hex_helper and this value is compared with the content of hex. DATA hex TYPE x LENGTH 2.
DATA text TYPE c LENGTH 4.
DATA hex_helper TYPE x LENGTH 2.

hex = 'FF00'.
text = 'FFxx'.

IF hex <(><<)>> text.
cl_demo_output=>write_text( |{ hex } <(><<)>> { text } | ).
ENDIF.

hex_helper = text.
IF hex = hex_helper.
cl_demo_output=>write_text( |{ hex } = { hex_helper } | ).
ENDIF.

cl_demo_output=>display( ).