Good Evening to all,
can anybody explains me how SET BIT bitpos OF byte_string [TO val] get works.
I concluded that it will set the bit of position (bitpos) of string (byte_string).
buti am nt getting how it works ?
can anybody briefly explains me how this get works and how this program works?
DATA hex TYPE x LENGTH 1.
DO 8 TIMES.
CLEAR hex.
SET BIT sy-index OF hex. "how it works
WRITE hex.
ENDDO.
output is: 80 40 20 10 08 04 02 01
Through each loop iteration, the variable hex is cleared, so contains binary value 00000000.
First time through the loop. sy-index is 1, and so bit 1 is set, so you have binary value 00000001. Which is hex 01.
Next time through the loop, sy-index is 2, and so bit 2 is set, so you have binary value 00000010. Which is hex 02.
Next time through the loop, sy-index is 3, and so bit 3 is set, so you have binary value 00000100. Which is hex 04.
and so on.
matt
Add a comment