Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Set bit in a xString ?

Former Member
0 Likes
554

Hi,

I would like to store bits in a xstring. Notice that the xstring has a variable length. The length can not be predefined.

To set the bit "1" at position "100" for example, I wrote the following code :

DATA : lw_x  TYPE xstring.

set bit 100  of lw_x.

It does not work :after execution, my xstring has a length "0" and the 100th bit is not set.

Could you please advise ?

Regards,

G.

2 REPLIES 2
Read only

Former Member
0 Likes
481

Hi,

DATA lw_x(200) TYPE x.

set bit 100  of lw_x.

Then you can assign that to the XSTRING variable.

Not tested it though.

Please check.

Thanks,

Shambu

Read only

0 Likes
481

Thanks Shambu for your anwer. Your solution works but it does not match my need :

I'd like to avoid to initiate my variables with a "Max fixed size" (I will deal with huge amount of data and I would like my program to be as performant as possible in term of memory comsumption).

In your suggestion, I allocate 200 bits in memory but only the first 100 bits are relevant.

Regards,

G.