原贴地址:http://fuhesap.com/SAP/179.html
SHIFT str LEFT DELETING LEADING ‘0’.
如果要在layout显示不出前面的0 格式: &字段(zc)&
如果要在layout显示不出小数点后面的0 格式: &字段(.0)&
去,号
REPORT z_m.
DATA curr TYPE c.
curr=’123,456,789.00 ‘.
while sy-subrc=0.
replace ‘,’ with ” into curr.
endwhile.
condense curr no-gaps.
去掉后置0
data p_number(20) value ‘56.500’.
CALL FUNCTION ‘STRING_REVERSE’
EXPORTING
string = P_number
lang = ‘1’
IMPORTING
RSTRING = P_number
EXCEPTIONS
TOO_SMALL = 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.
shift P_number left deleting leading ‘0’.
CALL FUNCTION ‘STRING_REVERSE’
EXPORTING
string = P_number
lang = ‘1’
IMPORTING
RSTRING = P_number
EXCEPTIONS
TOO_SMALL = 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.
write:/ P_number.
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/18301.html