Ulusal Para Birimleri Fonksiyonu

Ulusal para birimi : WAERS 
2. Ulusal pb : HWAE2 -
3. ulusal para birimi HWAE3

function zfi_get_additional_currency.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(I_BUKRS) TYPE  BUKRS
*"  EXPORTING
*"     VALUE(E_HWAER) TYPE  HWAER
*"     VALUE(E_HWAE2) TYPE  HWAE2
*"     VALUE(E_HWAE3) TYPE  HWAE3
*"----------------------------------------------------------------------

  data: ls_t001 type t001.
  data: ls_t001a type t001a.

  select single into ls_t001
         from t001 where bukrs = i_bukrs.
  check sy-subrc eq 0.

  select single into ls_t001A
         from t001A where bukrs = i_bukrs.
  check sy-subrc eq 0.


  E_HWAER = ls_t001-waers.
  PERFORM f_waehrung using ls_t001
                           ls_t001A
                           ls_t001A-curtp
                changing E_HWAE2 .


  PERFORM f_waehrung using ls_t001
                           ls_t001A
                           ls_t001A-curtp2
                changing E_HWAE3 .
endfunction.



form f_waehrung USING    prm_t001 type t001
                         prm_t001A type t001A
                         prm_curtp LIKE t001a-curtp
                changing chn_waers type  waers.
data: ls_t000 type t000.
data: ls_t005 type t005.
data: ls_t880 type t880.
SELECT SINGLE into ls_t000 FROM t000
             WHERE mandt = sy-mandt.
SELECT SINGLE into ls_t005 FROM t005
       WHERE land1 = prm_t001-land1.
      SELECT SINGLE into ls_t880 fROM t880
             WHERE rcomp = prm_t001-rcomp.

CASE prm_curtp.
    WHEN `11` OR `12`.                 " Hauswährung
      chn_waers = prm_t001-waers.
    WHEN `30` OR `31` OR `32`.         " Konzernwährung
        chn_waers = ls_t000-mwaer.
    WHEN `40`.                         " Hartwährung
        chn_waers = ls_t005-curha.
    WHEN `50`.                         " Indexwährung
        chn_waers = ls_t005-curin.
    WHEN `60`.                         " Gesellschaftswährung
        chn_waers = ls_t880-curr.
  ENDCASE.


endform.