form format_numeric using num_org num_tag.
data : lt_num type table of string with header line.
data : l_num(100) type c.
data : l_dec type string.
data : l_len type i.
data : l_temp_str01 type string.
data : l_temp_str02(1) type c.
data : l_temp_str03 type string.
move num_org to num_tag.
* 在字符串里加逗号
split num_tag at ‘.’ into table lt_num in character mode.
* 获取整数部分和小数部分
loop at lt_num.
l_temp_str01 = lt_num.
at first.
l_num = l_temp_str01.
endat.
at last.
l_dec = l_temp_str01.
endat.
endloop.
l_len = strlen( l_num ).
do l_len times.
l_len = l_len - 1.
l_temp_str02 = l_num+l_len(1).
concatenate l_temp_str03 l_temp_str02 into l_temp_str03.
enddo.
l_num = l_temp_str03.
clear : lt_num.
refresh : lt_num.
call function ‘RKD_WORD_WRAP’
exporting
textline = l_num
delimiter = ‘ ‘
outputlen = 3
* IMPORTING
* OUT_LINE1 =
* OUT_LINE2 =
* OUT_LINE3 =
tables
out_lines = lt_num
exceptions
outputlen_too_large = 1
others = 2.
if sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
clear : l_num.
loop at lt_num.
concatenate l_num ‘,’ lt_num into l_num.
endloop.
shift l_num by 1 places.
l_len = strlen( l_num ).
clear : l_temp_str03.
do l_len times.
l_len = l_len - 1.
l_temp_str02 = l_num+l_len(1).
concatenate l_temp_str03 l_temp_str02 into l_temp_str03.
enddo.
l_num = l_temp_str03.
* 重新赋值
clear : num_tag.
concatenate l_num ‘.’ l_dec into num_tag.