ABAP-货币汇率转换函数

本文介绍了在ABAP编程中如何使用SY-MANDTAPI进行货币转换,涉及特定货币类型(如JPY),并展示了如何调用CONVERT_TO_LOCAL_CURRENCY函数,处理不同货币间的汇率转换,确保金额一致性。
摘要由CSDN通过智能技术生成
*汇率可以去表TCURR查看
*注:有些货币如JPY内部金额和外部金额是不一样的,需要调用函数转换,再进行汇率转换
DATA:for_cur TYPE waers,
    for_am TYPE ukm_comm_actual_item,
    loc_cur TYPE waers,
    loc_am TYPE ukm_comm_actual_item.

loc_cur = 'CNY' .
for_cur = 'USD' .
for_am = '123' .

for_am = for_am * 100 .

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
  EXPORTING
*        CLIENT = SY-MANDT
    date = sy-datum
    foreign_amount = for_am
    foreign_currency = for_cur
    local_currency = loc_cur
*        RATE = 0
*       TYPE_OF_RATE = 'M'
*       READ_TCURR = 'X'
  IMPORTING
*       EXCHANGE_RATE =
*       FOREIGN_FACTOR =
    local_amount = loc_am
*     LOCAL_FACTOR =
*       EXCHANGE_RATEX =
*       FIXED_RATE =
*       DERIVED_RATE_TYPE =
  EXCEPTIONS
    no_rate_found = 1
    overflow = 2
    no_factors_found = 3
    no_spread_found = 4
    derived_2_times = 5
    OTHERS = 6.

IF loc_am IS NOT INITIAL .
  loc_am = loc_am / 100 .
ENDIF .
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值