测试代码:
REPORT ZTEST_BOL.
data: lv0 type x length 1,
lv1 type x length 1,
lv2 type x length 1,
lv3 type x length 1,
lv4 type x length 1,
lv5 type x length 1,
lv6 type x length 1,
lv7 type x length 1,
lv8 type x length 1.
lv0 = boolx( bit = 0 bool = ( 1 < 2 ) ).
lv1 = boolx( bit = 1 bool = ( 1 < 2 ) ).
lv2 = boolx( bit = 2 bool = ( 1 < 2 ) ).
lv3 = boolx( bit = 3 bool = ( 1 < 2 ) ).
lv4 = boolx( bit = 4 bool = ( 1 < 2 ) ).
lv5 = boolx( bit = 5 bool = ( 1 < 2 ) ).
lv6 = boolx( bit = 6 bool = ( 1 < 2 ) ).
lv7 = boolx( bit = 7 bool = ( 1 < 2 ) ).
lv8 = boolx( bit = 8 bool = ( 1 < 2 ) ).
FIELD-SYMBOLS: <lv_c> TYPE char1.
data: lv type char1.
lv = '1'.
DATA: len TYPE i,
res TYPE i,
hex TYPE xstring,
lv_name TYPE string.
FIELD-SYMBOLS: <lv_temp> TYPE x." length 1.
DO 9 TIMES.
DATA(lv_index) = sy-index - 1.
lv_name = 'LV' && lv_index.
ASSIGN (lv_name) TO <lv_temp>.
ASSERT sy-subrc = 0.
WRITE: lv_name COLOR COL_NEGATIVE.
len = xstrlen( <lv_temp> ) * 8.
WHILE sy-index <= len.
GET BIT sy-index OF <lv_temp> INTO res.
WRITE (1) res NO-GAP.
ENDWHILE.
ULINE.
ENDDO.
输出:
debugger里观察到的value:( Any byte values, 00 to FF )
新建一个记事本文件,输入字符1,save as成ANSI:
则其hexadecimal value如下:
save as UTF-8:
save as Unicode: