Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7134024
  • 博文数量: 655
  • 博客积分: 10264
  • 博客等级: 上将
  • 技术积分: 8278
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-04 17:47
个人简介

ABAP顾问

文章分类

全部博文(655)

文章存档

2017年(2)

2014年(8)

2013年(3)

2012年(2)

2011年(18)

2010年(102)

2009年(137)

2008年(274)

2007年(134)

分类:

2007-07-17 17:39:02

*&---------------------------------------------------------------------*
*& Report  Z_BARRY_CONVERT_CURRENCY                                    *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

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 .

 

注意点:

1.Exporting各个参数一定不能用常量,要用变量

2.汇率存放在表:TCURR中,另外TCUR*有关于汇率的其他数据

3.碰到比较变态的货币,例如日元,它们是没有小数点的,系统内存储的和你看到的不同,有个BAPI可以使用:BAPI_CURRENCY_CONV_TO_INTERNAL

4.维护汇率的Tcode:OB07、OB08
阅读(7808) | 评论(4) | 转发(0) |
0

上一篇:ABAP OO Control

下一篇:CLASS_ALV_F4_LISTBOX

给主人留下些什么吧!~~

chinaunix网友2009-09-23 16:00:15

Exporting各个参数一定不能用常量,要用变量 -----我想知道为什么?我用的时候就用常量的,谢谢!

qdbarry2009-02-19 19:49:12

谢谢赏脸:)

chinaunix网友2008-11-20 22:12:18

dear Barry this isi the first time to thank you here for your kind help of long time, you help to solve any difficulty, I wish you can do better here, wish your blog better and better, i will keep eye on any longer, thanks again!

chinaunix网友2008-11-20 17:39:36

老白老師,你是我的偶像。每次我遇到問題Goole 或百度時,總會把我指引到你的博客,然後迎紉而解。請允許我飽含熱情的對你說聲:謝謝,灰常感謝!