今天遇到一个问题,在定义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/