• CONVERT_TO_LOCAL_CURRENCY(货币汇率转换) 按日期取汇率


    REPORT  z_barry_convert_currency                .
    DATA: jine  LIKE bseg-wrbtr  .
    DATA: date LIKE sy-datum .
    DATA: curr_ex LIKE bapicurr-bapicurr .
    date = ‘20060831′ .
    DATA: fa LIKE bseg-wrbtr ,
          fc LIKE t001-waers ,
          lc LIKE t001-waers ,
          ty LIKE tcurr-kurst .
    fa = 100.
    fc = ‘JPY’ .
    lc = ‘RMB’ .
    ty = ‘M’.
    curr_ex = fa .
    CALL FUNCTION ‘BAPI_CURRENCY_CONV_TO_INTERNAL’
      EXPORTING
        currency             = fc
        amount_external      = curr_ex
        max_number_of_digits = 13
      IMPORTING
        amount_internal      = fa.
    CALL FUNCTION ‘CONVERT_TO_LOCAL_CURRENCY’
      EXPORTING
        date             = date
        foreign_amount   = fa
        foreign_currency = fc
        local_currency   = lc
        type_of_rate     = ty
      IMPORTING
        local_amount     = jine
      EXCEPTIONS
        no_rate_found    = 1
        OTHERS           = 2.
    WRITE:/ jine .

    注意点:

    1.Exporting各个参数一定不能用常量,要用变量

    2.汇率存放在表:TCURR中,另外TCUR*有关于汇率的其他数据

    3.碰到比较变态的货币,例如日元,它们是没有小数点的,系统内存储的和你看到的不同,有个BAPI可以使用:BAPI_CURRENCY_CONV_TO_INTERNAL

    4.维护汇率的Tcode:OB07、OB08
    5.还有一个FM:CONVERT_TO_FOREIGN_CURRENCY,和CONVERT_TO_LOCAL_CURRENCY基本没有区别,可以任选一个使用
  • 相关阅读:
    $.each
    KBASP.NET 2.0 網站部署的變革
    详尽解析window.event对象
    Jquery1.2.6 源码分析
    索引学习2聚族索引、非聚族索引、组合索引
    在C#中使用WIA获取扫描仪数据
    Adobe Photoshop CS5简体中文版+完美破解方法
    j2me开发图片加载
    数据库操作
    WPF之DataGrid应用
  • 原文地址:https://www.cnblogs.com/datie/p/11447054.html
Copyright © 2020-2023  润新知