DATA:LV_FOREIGN_CURRENCY LIKE TCURR-FCURR.
DATA:LV_RATE LIKE VBRP-KURSK,
LV_FACT TYPE I.
LV_FOREIGN_CURRENCY = GS_XVBAP-WAERK.
CALL FUNCTION 'READ_EXCHANGE_RATE'
EXPORTING
CLIENT = SY-MANDT
DATE = SY-DATUM
FOREIGN_CURRENCY = LV_FOREIGN_CURRENCY
LOCAL_CURRENCY = 'CNY'
TYPE_OF_RATE = 'M'
IMPORTING
EXCHANGE_RATE = LV_RATE
FOREIGN_FACTOR = LV_FACT
EXCEPTIONS
NO_RATE_FOUND = 1
NO_FACTORS_FOUND = 2
NO_SPREAD_FOUND = 3
DERIVED_2_TIMES = 4
OVERFLOW = 5
ZERO_RATE = 6
OTHERS = 7.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
- 这个函数不能通过SE37进行测试
- LOCAL_CURRENCY = 'CNY'这个只能是CNY,然后取汇率
- 汇率 = ( LV_RATE / LV_FACT )
网友评论