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-set - Bit Function
Bit functions process individual bits and return byte-like results. At present, the one bit function is available:
Other versions: 7.31 | 7.40 | 7.54
Syntax
... bit-set( arg ) ...
This function expects an integer numerical value as an argument. The argument is a
numerical expression position of the type i.
If the argument is positive, the function creates a result of the type xstring,
in which the bit has the value 1 in the position specified by the argument. All other bits have the value 0.
If the argument has the value 0, the result is an empty string.
If the argument is negative, the function creates a result of the type xstring,
in which all bits up to and including the position specified by the argument have the value 1, and all bits behind this position have the value 0.
The length of the result is the minimum number of bytes needed to include the set bits.
The function can be used in all positions in which a bit expression can be used, particularly in bit expressions themselves.
Notes
- The function
boolx
is a bit function in principle, but due to its properties is handled as a logical function.
- Unlike the statement
SET BIT
, the result field does not need to be filled first.