ABAP將數字輸出前面補0

將數字輸出前面補0
Function:


CONVERSION_EXIT_ALPHA_INPUT
程式碼
DATA: test(5),
value LIKE regup-wrbtr VALUE 150.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = '150'
IMPORTING
output = test
EXCEPTIONS
OTHERS = 1.

WRITE : test.

--Result--
00150



UNPACK 也可以实现同样的功能.

DATA: L_INDEX(3).
DO 3 TIMES.
L_INDEX = L_INDEX + 1.
UNPACK L_INDEX TO L_INDEX.
WRITE:/ L_INDEX.
ENDDO.

--Result--
001
002
003

你可能感兴趣的:(abap)