GET BIT bitpos OF byte_string INTO val.
This statement reads the bit at the bit position
bitpos of the data object
byte_string and assigns its value to the variable
The data object
byte_string must be byte-type.
bitpos is a
position of operand type
i. The value of
must be greater than 0, otherwise exceptions that cannot be handled will occur. The bit positions in
byte_string are counted from the beginning of the data object. If the value
bitpos is greater than the number of bits in
byte_string, no bit is read and
sy-subrc is set to 4.
|0||The value of the bit at position
|4||The value of
byte_stringis of the deep data type
xstring, one bit is read from the referenced byte string and not from the reference.
In non-Unicode programs, you can also use character-type data objects for
The reading of single bits is especially intended for evaluating the results of bit expressions.
The hexadecimal value "1B" is assigned to the data object
hex and its bits
are read from front to back. The output is "00011011", which corresponds to the binary display of decimal 27 or hexadecimal "1B".
DATA: len TYPE i, res TYPE i, hex TYPE xstring. hex = '1B'. len = XSTRLEN( hex ) * 8. WHILE sy-index <= len. GET BIT sy-index OF hex INTO res. WRITE (1) res NO-GAP. ENDWHILE.
nis smaller than or equal to