SAP匯率轉換的操作

2021-06-16 06:46:06 字數 2734 閱讀 4957

今天碰到需要進行匯率轉換的操作,下面**挺有用的。

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 .

report ztest.

data: usd type wrbtr, jpy type wrbtr, jpy_e type bapicurr-bapicurr.

data: usd_k type waers, jpy_k type waers.

data: ret type bapireturn.

jpy = '10000.01'.

usd_k = 'usd'.

jpy_k = 'jpy'.

call function 'convert_to_local_currency'

exporting

date                    = sy-datum

foreign_amount          = jpy

foreign_currency        = jpy_k

local_currency          = usd_k

importing

local_amount            = usd

.write: jpy currency jpy_k, jpy_k,

usd currency usd_k, usd_k.

uline.

jpy_e = jpy.

call function 'bapi_currency_conv_to_internal'

exporting

currency                   = jpy_k

amount_external            = jpy_e

max_number_of_digits       = 23

importing

amount_internal            = jpy

return                     = ret

.if ret is not initial.

message id ret-code(2) type ret-type number ret-code+2(3)

with ret-message_v1 ret-message_v2 ret-message_v3 ret-message_v4.

endif.

call function 'convert_to_local_currency'

exporting

date                    = sy-datum

foreign_amount          = jpy

foreign_currency        = jpy_k

local_currency          = usd_k

importing

local_amount            = usd.

write: jpy currency jpy_k, jpy_k,

usd currency usd_k, usd_k.

注意點:

1.exporting各個引數一定不能用常量,要用變數

2.匯率存放在表:tcurr中,另外tcur*有關於匯率的其他資料

3.碰到比較**的貨幣,例如日元,它們是沒有小數點的,系統內儲存的和你看到的不同,有個bapi可以使用:bapi_currency_conv_to_internal

4.維護匯率的tcode:ob07、ob08

5.匯率轉換的函式都在lscunuxx程式中

SAP 外幣金額 匯率 轉換

sap中對於金額和匯率欄位的處理 一般是會計相關的,如果會計發票,銷售發票,採購發票等 有點特殊,並不是說你多少就在系統表中寫多少,有些貨幣的金額會進行除以乙個值 一般是100 所有這些金額在取出來的時候得進行相應的轉換,而有些匯率是會乘以一定的係數 一般也是100 所以我們在通過匯率計算的時候需要...

Python實現匯率轉換操作

1,分析計算部分 2,將問題分為輸入,處理以及輸出三部分 3,設計演算法進行計算。輸入 人民幣金額 處理 匯率計算 輸入 匯率 輸出。開啟pycharm file new project 選擇目錄或者新建,預設interpreter是anaconda create 是否在當前視窗建立還是在乙個新的視...

06 匯率轉換

1.一直輸入,直到使用者選擇退出 coding utf 8 功能 匯率兌換 版本 3.0 功能 一直輸入,指導使用者選擇退出 rate 6.77 go on y while go on y currency str input 請輸入帶單位的貨幣金額 如cny100,usd100 flag curr...