SAP ABAP汇率转化

2023-10-13 19:22:14 浏览数 (1)

以下代码用户在程序中做汇率转化,请斧正。

代码语言:javascript复制
      LV_LOCAL_WAERS = 'CNY'.

      CLEAR LV_LOCAL_DMBTR.
      CLEAR LV_DATE.
      IF LS_EKBE-WAERS NE LV_LOCAL_WAERS.

        LV_DATE = LS_EKBE-BUDAT.
        CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
          EXPORTING
            DATE             = LV_DATE
            FOREIGN_AMOUNT   = LS_EKBE-DMBTR
            FOREIGN_CURRENCY = LS_EKBE-WAERS
            LOCAL_CURRENCY   = LV_LOCAL_WAERS
          IMPORTING
            LOCAL_AMOUNT     = LV_LOCAL_DMBTR
          EXCEPTIONS
            NO_RATE_FOUND    = 1
            OVERFLOW         = 2
            NO_FACTORS_FOUND = 3
            NO_SPREAD_FOUND  = 4
            DERIVED_2_TIMES  = 5
            OTHERS           = 6.
        IF SY-SUBRC <> 0.
        ENDIF.
      ELSE.
        LV_LOCAL_WAERS = LS_EKBE-WAERS.
        LV_LOCAL_DMBTR = LS_EKBE-DMBTR.
      ENDIF.

0 人点赞