ABAP Characterc and HEX

简介: Created by Wang, Jerry, last modified on Dec 20, 2014

Created by Wang, Jerry, last modified on Dec 20, 2014


image.png

bit processing: http://help.sap.com/saphelp_nw04/helpdata/en/b6/e7d716f46711d195200000e8353423/frameset.htm

image.png

Setting Bits


To set an individual bit, use the statement

SET BIT OF [TO ].

This statement sets the bit at position of field to 1 (or to the value of field ). The system must be able to interpret field as a positive integer. The field must have data type X. The field must contain the value 0 or 1. If the bit is set, SY-SUBRC is set to 0. If is greater than the length of , SY-SUBRC is unequal to zero. If or contain invalid values, a runtime error occurs.


DATA HEX(3) TYPE X.

SET BIT: 09 OF HEX TO 1,

10 OF HEX TO 0,

11 OF HEX TO 1,

12 OF HEX TO 1,

13 OF HEX TO 0,

14 OF HEX TO 1,

15 OF HEX TO 0,

16 OF HEX TO 1.

WRITE HEX.

The bits of the second byte in the three-character hexadecimal field HEX are set to ‘10110101’, and the list output is as follows:

00B500

The decimal value of the second byte is 181.


Hexadecimal Type

The remaining non-numeric type - X - always interprets individual bytes in memory. One byte is represented by a two-digit hexadecimal display. The fields with this type are called hexadecimal fields. In hexadecimal fields, you can process single bits.


0A


image.png

00 是一个字节


32是一个字节


31 00 20 00 一共4个字节


x length 4 4个字节。


字符串变量char1的1对应3100


char2 的1对应31002000


2000代表空格

image.png

char1 : UTF16 两个字节代表1个字符。 1个字节8位,2个16位

image.png


image.png



Byte order

Determines the order in which a number of the data types i, decfloat16, decfloat34, f, s or a character in a Unicode system is stored in the memory. A distinction is made between big and little endian. In the former case, the system writes the byte with the highest level, and in the second case the byte with the lowest level, to the first position in the memory. The byte order on the current application server can be derived from the static attribute ENDIAN in the system class CL_ABAP_CHAR_UTILITIES.

image.pngimage.pngimage.png



相关文章
|
5月前
|
开发者 供应链 BI
SAP ABAP CALL SUBSCREEN 代码解析
SAP ABAP CALL SUBSCREEN 代码解析
|
5月前
|
存储 数据处理 开发者
ABAP 如何把 unicode 代码点转换成字符
ABAP 如何把 unicode 代码点转换成字符
|
SQL 关系型数据库 Unix
SAP ABAP FOR ALL ENTRIES 的用法
SAP ABAP FOR ALL ENTRIES 的用法
|
5月前
|
UED
关于 ABAP 异常 CX_SY_CONVERSION_NO_NUMBER
关于 ABAP 异常 CX_SY_CONVERSION_NO_NUMBER
|
3月前
|
编解码 测试技术 Python
【Python】已解决:UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 0-1: ordinal not i
【Python】已解决:UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 0-1: ordinal not i
235 1
|
11月前
|
存储 程序员 数据库
什么是 SAP ABAP 的 Conversion Exits
什么是 SAP ABAP 的 Conversion Exits
|
12月前
什么是 SAP ABAP System Fields
什么是 SAP ABAP System Fields
|
数据库 索引
SAP ABAP Append structure 介绍
SAP ABAP Append structure 介绍
ABAP Decimal byte
Sent: Monday, November 30, 2009 1:52 PM
155 0
ABAP Decimal byte