ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Currency conversion using FM

Currency conversion using FM

原创 Linux操作系统 作者:solisnail 时间:2012-04-27 16:47:59 0 删除 编辑
It was about foreign currency convert to local.
The factor in 'read_exchange_rate' was read from table tcurf, maintain by tc:obbs;
The code was below:
DATA
:
      
        l_factor1 TYPE p DECIMALS 3,
        l_factor2 TYPE p DECIMALS 3,

        l_er TYPE tcurr-ukurs, "
        l_ff TYPE tcurr-ffact,
        l_lf TYPE tcurr-tfact,
        l_erate(12TYPE c.
  CALL FUNCTION 'READ_EXCHANGE_RATE'
    EXPORTING
      date             = sy-datum
      foreign_currency = COMM_STRUCTURE-doc_currcy
      local_currency   = COMM_STRUCTURE-loc_currcy
      type_of_rate     = 'M'
    IMPORTING
      exchange_rate    = l_er
      foreign_factor   = l_ff
      local_factor     = l_lf
    EXCEPTIONS
      no_rate_found    = 1
      no_factors_found = 2
      no_spread_found  = 3
      derived_2_times  = 4
      overflow         = 5
      OTHERS           = 6.
  IF sy-subrc EQ 0.
    l_erate = l_er / ( l_ff / l_lf ).
    CALL FUNCTION 'CURRENCY_CONVERTING_FACTOR'
        EXPORTING
          currency = COMM_STRUCTURE-loc_currcy
        IMPORTING
          factor   = l_factor1.
    CALL FUNCTION 'CURRENCY_CONVERTING_FACTOR'
        EXPORTING
          currency = COMM_STRUCTURE-doc_currcy
        IMPORTING
          factor   = l_factor2.
       RESULT = COMM_STRUCTURE-netval_inv *
         l_erate / ( l_factor1 / l_factor2 ).

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22792542/viewspace-722386/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 极点郑码url
下一篇: Delta in BW
请登录后发表评论 登录
全部评论

注册时间:2011-04-07

  • 博文量
    18
  • 访问量
    21578