SAP ABAP 理解RAWSTRING(XSTRING) 类型

文章通过示例展示了ABAP中的不同字符串类型,如RAWSTRING,STRING和SSTRING的特性。SSTRING最大长度限定为255,而RAWSTRING无长度限制但不支持中文等特定字符。XSTRING在遇到不支持的字符时会停止并可能填充0,这使得它在某些情况下适合作为加密协议使用。

用F1查看的时候,这里是这样说的:

The types RAWSTRING and STRING have a variable length. A maximum length for these types can be specified, but has no upper limit.

The type SSTRING is available as of release 6.10 and it has a variable length. Its maximum length must be specified and is limited to 255. The advantage of this type compared with CHAR, is that it is assigned to the ABAP type string.

效果如下:

用几个例子说明一下

例子1:

 DATA str TYPE sSTRING.

DATA str1 TYPE string.

DATA str2 TYPE xstring."这个就是rawstring类型

DATA STR3 TYPE STRING.

str = '好好学习'.

str1 = str.

str2 = str.

WRITE :/ 'str1:',str1.

ULINE.

WRITE :/ 'str2:',str2.

ULINE.

STR3 = STR2.

WRITE :/ 'str3:',STR3.

ULINE.

结果:

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值