Quantcast
Channel: SCN: Message List - ABAP Development
Viewing all articles
Browse latest Browse all 10425

Re: Bit Programming in ABAP

$
0
0

It seems, offsets can only be used for hexadecimal objects. Can It be used for decimal objects??

 

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.

 

In the above example, I want to pass decimal value through hex variable(type p) and get desired result. Well, I don't think , It is possible through offsets. Is it?


Viewing all articles
Browse latest Browse all 10425

Trending Articles