ABAPGET_BIT - GET BIT

BAL_S_LOG - Application Log: Log header data   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.

GET BIT

Short Reference



Syntax

GET BIT bitpos OF byte_string INTO val.

Effect

This statement reads the bit at the bit position bitpos of the data object byte_string and assigns its value to the variable val.

The data object byte_string must be byte-type. bitpos is anumerical expression position of operand type i. The value of bitpos must be greaterthan 0, otherwise exceptions that cannot be handled will occur. The bit positions in byte_stringare counted from the beginning of the data object. If the value of bitpos is greater than the number of bits in byte_string, no bit is read and sy-subrc is set to 4.

System Fields

sy-subrcMeaning
0The value of the bit at position bitpos of byte_string was placed in the result field val.
4The value of bitpos is greater than the number of bits in byte_string and no bit was read

Notes

Example

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.

Exceptions

Non-Catchable Exceptions

  • Cause: n is smaller than or equal to 0.
    Runtime Error: BIT_OFFSET_NOT_POSITIVE







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


Length: 3476 Date: 20120522 Time: 062215     triton ( 136 ms )