金额和数量转换,有些为负的需要先把负号去掉。
DATA l_dcpfm LIKE usr01-dcpfm.
SELECT SINGLE dcpfm INTO l_dcpfm
FROM usr01
WHERE bname = sy-uname.
IF lv_string CS '-'.
SPLIT lv_string AT '-' INTO gs_out-erfmg_c lv_string2.
ELSE.
gs_out-erfmg_c = lv_string.
ENDIF.
CALL FUNCTION 'UNITS_STRING_CONVERT'
EXPORTING
units_string = gs_out-erfmg_c
dcpfm = l_dcpfm "此时为X
* MLLN = 'M'
* TSND = 'T'
IMPORTING
units = gs_out-erfmg
EXCEPTIONS
invalid_type = 1
OTHERS = 2.
IF lv_string CS '-'.
gs_out-erfmg = 0 - gs_out-erfmg.
ENDIF.
日期转换
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = gs_out-budat_c
* ACCEPT_INITIAL_DATE =
IMPORTING
date_internal = gs_out-budat
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.
IF sy-subrc = 0.
ENDIF.