ABAP 字符型数据add前置0以及remove前置0函数

data: w_char type char10 value '0000004506',

w_char2 type char10,

w_char3 type char10 value '4506',

w_char4 type char8,

w_char5 type char4

.


* no leading-zero

write w_char to w_char2 no-zero.


* add leading-zero

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' "add front 0

EXPORTING

INPUT = w_char3

IMPORTING

OUTPUT = w_char4

.

* delete leading-zero

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' "remove front 0

EXPORTING

INPUT = w_char4

IMPORTING

OUTPUT = w_char5

.

write: / w_char, "0000004506

/ w_char2, "(space)4506

/ w_char3, "4506

/ w_char4, "00004506

/ w_char5 . "4506

你可能感兴趣的:(remove)