smartforms不显示前导0

之前都是smartforms显示前导0,但是不想让它显示。昨天碰到一个非常有意思的状况,想让编码显示前导0确没有显示了!下面是解决过程:

 

字段类型:char8

症状:

无论前面000333是几个0都不显示!

 

尝试方法:

1. unpack xx to xx。

补上前导0,debug中看到确实也补上了前导0,但是没用。

 

2. CONVERSION_EXIT_ALPHA_INPUT

通1的效果,仍然没用

 

前面两种方法我觉得应该是smartforms中的问题,于是:

3. 参数设置

&fields(8)& 强制显示8位,还是不行

&fields(*)& 显示原始长度,还是不行

 

到此我非常困惑了,是不是字符型的不能显示前导0啊?我记得是可以的啊。于是换了一个类型raw,成功了!

RAW: Uninterpreted byte string. Fields of type RAW may have only a maximum length of 255 in tables. If longer raw fields are required in tables, you should select data type LRAW.是help上的解释。

Note: the RAW data type is mapped to the string class of the Standard C++ Library, but care must be taken when using this object. When the application program calls a field getter function (Get ()) on a field of RAW type and retrieves a string object, the string object encapsulates a character array of length equal to the ABAP-defined length of the field. The character array encapsulated inside the string object may contain null character in the beginning or the middle of the array, therefore this array cannot be treated as a normal character string. Using cout of the iostream class would output a truncated character string, terminated by the first null character. Also, when the application program calls a field setter function (Set ()), the argument passed is void* , a pointer that points to the raw byte array to be copied to the intended field.

貌似和char没有太大区别,只不过sap似乎对这个类型的没有做过任何处理。不管怎样,解决了问题。

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值