'CURRENCY_AMOUNT_DISPLAY_TO_SAP' 해당 통화의 금액을 DB에 저장할 때의 금액형태로 변경
100 KRW -> 1.00 KRW
100 USD -> 100.00 USD
DATA : g_amt TYPE p,
gr_amt TYPE p.
CLEAR : g_amt, gr_amt.
g_amt = 1000.
WRITE : / g_amt.
CALL FUNCTION 'CURRENCY_AMOUNT_DISPLAY_TO_SAP'
EXPORTING
currency = 'KRW'
amount_display = g_amt
IMPORTING
amount_internal = gr_amt
EXCEPTIONS
internal_error = 1.
WRITE : / gr_amt, 'KRW' .
CALL FUNCTION 'CURRENCY_AMOUNT_DISPLAY_TO_SAP'
EXPORTING
currency = 'USD'
amount_display = g_amt
IMPORTING
amount_internal = gr_amt
EXCEPTIONS
internal_error = 1.
WRITE : / gr_amt, 'USD'.
*******************************************************
'CONVERT_TO_FOREIGN_CURRENCY' : Currency별 환율 컨버젼 함수
해당일의 환율정보를 참조해서 Currency 별 금액을 바꿔주는 함수.
DATA: l_dmbtr LIKE bseg-dmbtr,
l_rate LIKE bkpf-kursf.
CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'
EXPORTING
date = sy-datum
foreign_currency = 'USD' "FORIGN_CURRENCY 에는 결과치로 나올 Currency type
local_amount = '1000'
local_currency = 'KRW' "LOCAL_CURRENCY 에는 입력되는 Currency type
type_of_rate = 'M' " 'M', 'BS', 'PL'
read_tcurr = 'X'
IMPORTING
exchange_rate = l_rate
foreign_amount = l_dmbtr
EXCEPTIONS
no_rate_found = 1
overflow = 2
no_factors_found = 3
no_spread_found = 4
derived_2_times = 5
OTHERS = 6.
WRITE : / '1USD =>' , l_rate, 'KRW' .
WRITE : / '1000KRW =>', l_dmbtr, 'USD'.
*l_rate : 1USD가 몇 KRW
*l_dmbtr : 1000 KRW -> 몇 USD
100 KRW -> 1.00 KRW
100 USD -> 100.00 USD
DATA : g_amt TYPE p,
gr_amt TYPE p.
CLEAR : g_amt, gr_amt.
g_amt = 1000.
WRITE : / g_amt.
CALL FUNCTION 'CURRENCY_AMOUNT_DISPLAY_TO_SAP'
EXPORTING
currency = 'KRW'
amount_display = g_amt
IMPORTING
amount_internal = gr_amt
EXCEPTIONS
internal_error = 1.
WRITE : / gr_amt, 'KRW' .
CALL FUNCTION 'CURRENCY_AMOUNT_DISPLAY_TO_SAP'
EXPORTING
currency = 'USD'
amount_display = g_amt
IMPORTING
amount_internal = gr_amt
EXCEPTIONS
internal_error = 1.
WRITE : / gr_amt, 'USD'.
*******************************************************
'CONVERT_TO_FOREIGN_CURRENCY' : Currency별 환율 컨버젼 함수
해당일의 환율정보를 참조해서 Currency 별 금액을 바꿔주는 함수.
DATA: l_dmbtr LIKE bseg-dmbtr,
l_rate LIKE bkpf-kursf.
CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'
EXPORTING
date = sy-datum
foreign_currency = 'USD' "FORIGN_CURRENCY 에는 결과치로 나올 Currency type
local_amount = '1000'
local_currency = 'KRW' "LOCAL_CURRENCY 에는 입력되는 Currency type
type_of_rate = 'M' " 'M', 'BS', 'PL'
read_tcurr = 'X'
IMPORTING
exchange_rate = l_rate
foreign_amount = l_dmbtr
EXCEPTIONS
no_rate_found = 1
overflow = 2
no_factors_found = 3
no_spread_found = 4
derived_2_times = 5
OTHERS = 6.
WRITE : / '1USD =>' , l_rate, 'KRW' .
WRITE : / '1000KRW =>', l_dmbtr, 'USD'.
*l_rate : 1USD가 몇 KRW
*l_dmbtr : 1000 KRW -> 몇 USD
감사합니다