Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing Internal Data →  Character String and Byte String Processing →  Expressions and Functions for Byte String Processing →  Byte String Functions 

Bit Functions

The example demonstrates how bit-set works.

Other versions: 7.31 | 7.40 | 7.54

Source Code

    DATA: hex TYPE xstring,
          txt TYPE string.
    DO.
      CALL SELECTION-SCREEN 100 STARTING AT 10 10.
      IF sy-subrc = 0.
        IF ABS( number ) <= 200.
          hex = BIT-SET( number ).
          txt = hex.
          MESSAGE txt TYPE 'I'.
        ELSE.
          MESSAGE 'Number in Example must not exceed 200'
            TYPE 'I'
            DISPLAY LIKE 'E'.
        ENDIF.
      ELSE.
        RETURN.
      ENDIF.
    ENDDO.

Description

The output of the program shows how bits are set a specified position and how the result is assigned to a byte string whose content is represented by a text string.