转换程序 Conversion

发个帖---转换程序

今天遇到一个问题,在定义cost center的时候,输入的编号是1234,可是table里存储的是‘0000001234’,很是纳闷;
于是乎查看了一下Field:KOSTL的定义,domain也是KOSTL,domain定义的 其中一项 Convers. routine定义的是: ALPHA,这是啥咚咚,F1查看,如下:
Conversion routine
Conversion takes place when converting the contents of a screen field from display format to SAP-internal format and vice versa and when outputting with the ABAP statement WRITE, depending on the data type of the field.

If standard conversion is not suitable, it can be overridden by specifying a conversion routine in the underlying domain.

A conversion routine is identified by its five-place name and is stored as a group of two function modules. The function modules have a fixed naming convention. The following function modules are assigned to conversion routine xxxxx:

CONVERSION_EXIT_xxxxx_INPUT
CONVERSION_EXIT_xxxxx_OUTPUT
The INPUT module performs the conversion from display format to internal format. The OUTPUT module performs the conversion from internal format to display format.

If a screen field refers to a domain with a conversion routine, this conversion routine is executed automatically each time an entry is made in this screen field or when values are displayed with this screen field.
原来是定义的转换程序,在Screen中输入1234之后,调用了
CONVERSION_EXIT_ALPHA_INPUT 将 1234 转换成了0000001234,存贮到table中,而在从table读出的时候,相反调用
CONVERSION_EXIT_ALPHA_OUTPUT 将 0000001234 转换成1234 Dispay。。。。
呵呵,为什么这样呢,有啥好处?

为了排序~~~
比如:
1,
2,
3,
11,
12,
如果按原有长度存贮,排序出来后会是这样:
1,
11,
12,
2,
3,
在前面加了定长0,就不会出现这个问题了


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/190059/viewspace-476579/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/190059/viewspace-476579/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值