1 *汇率可以去表TCURR查看
2 *注:有些货币如JPY内部金额和外部金额是不一样的,需要调用函数转换,再进行汇率转换
3 DATA:for_cur TYPE waers,
4 for_am TYPE ukm_comm_actual_item,
5 loc_cur TYPE waers,
6 loc_am TYPE ukm_comm_actual_item.
7
8 loc_cur = 'CNY' .
9 for_cur = 'USD' .
10 for_am = '123' .
11
12 for_am = for_am * 100 .
13
14 CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
15 EXPORTING
16 * CLIENT = SY-MANDT
17 date = sy-datum
18 foreign_amount = for_am
19 foreign_currency = for_cur
20 local_currency = loc_cur
21 * RATE = 0
22 * TYPE_OF_RATE = 'M'
23 * READ_TCURR = 'X'
24 IMPORTING
25 * EXCHANGE_RATE =
26 * FOREIGN_FACTOR =
27 local_amount = loc_am
28 * LOCAL_FACTOR =
29 * EXCHANGE_RATEX =
30 * FIXED_RATE =
31 * DERIVED_RATE_TYPE =
32 EXCEPTIONS
33 no_rate_found = 1
34 overflow = 2
35 no_factors_found = 3
36 no_spread_found = 4
37 derived_2_times = 5
38 OTHERS = 6.
39
40 IF loc_am IS NOT INITIAL .
41 loc_am = loc_am / 100 .
42 ENDIF .