Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

reports

Former Member
0 Likes
744

in reports there r different fields related to different currrencies like dollars,rupees etc. but how can we get total output in only one currency name like rupeees or dollars?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
715

hi r k,

u can do this by using control brake events is the loop and endloop.

regards..

seshu.

5 REPLIES 5
Read only

Former Member
0 Likes
715

Hi,

We need to use the currency conversion for this one ...

look at the below program how the conversion will be made

DATA: gd_fcurr TYPE tcurr-fcurr,
      gd_tcurr TYPE tcurr-tcurr,
      gd_date  TYPE sy-datum,
      gd_value TYPE i.

gd_fcurr = 'EUR'.
gd_tcurr = 'GBP'.
gd_date  = sy-datum.
gd_value = 10.

PERFORM currency_conversion USING gd_fcurr
                                  gd_tcurr
                                  gd_date
                         CHANGING gd_value.



* Convert value to Currency value 
*&---------------------------------------------------------------------*
*&      Form  currency_conversion
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_GD_FCURR  text
*      -->P_GD_TCURR  text
*      -->P_GD_DATE   text
*      <--P_GD_VALUE  text
*----------------------------------------------------------------------*
FORM currency_conversion  USING    p_fcurr
                                   p_tcurr
                                   p_date
                          CHANGING p_value.

  DATA: t_er        TYPE tcurr-ukurs,
        t_ff        TYPE tcurr-ffact,
        t_lf        TYPE tcurr-tfact,
        t_vfd       TYPE datum,
        ld_erate(12)   TYPE c.

  CALL FUNCTION 'READ_EXCHANGE_RATE'
    EXPORTING
*       CLIENT                  = SY-MANDT
      date                    = p_date
      foreign_currency        = p_fcurr
      local_currency          = p_tcurr
      TYPE_OF_RATE            = 'M'
*       EXACT_DATE              = ' '
   IMPORTING
      exchange_rate           = t_er
      foreign_factor          = t_ff
      local_factor            = t_lf
      valid_from_date         = t_vfd
*       DERIVED_RATE_TYPE       =
*       FIXED_RATE              =
*       OLDEST_RATE_FROM        =
   EXCEPTIONS
     no_rate_found           = 1
     no_factors_found        = 2
     no_spread_found         = 3
     derived_2_times         = 4
     overflow                = 5
     zero_rate               = 6
     OTHERS                  = 7
            .
  IF sy-subrc EQ 0.
    ld_erate = t_er / ( t_ff / t_lf ).
    p_value = p_value * ld_erate.
  ENDIF.
ENDFORM.                    " currency_conversion

can you close the threads whcih you got answers

Regards

Sudheer

Read only

Former Member
0 Likes
715

Hi RK,

If it is a report without using alvs,

You can calculate the total anounts by converting al the amounts into a single currency in a field and then summing it up.

If you r itab is like this

field1 amount currency

abc 100 USD

def 50 INR

gre 200 INR

and if you want to sum up according to a single currency say INR,

then calculate the anount in INR in an extra field.

loop at itab.
if itab-currency = 'USD'.
itab-amtinr = itab-ampunt * 45. "45 Rs = 1 USD
else.
itab-amtinr = itab-amount.
else.
modify itab index sy-tabix.
endif.
endloop.

to calculate the totals line:

loop at itab.
at last.
sum.
clear itab-amount.
clear itab-currency.
append itab.
endat.
endloop.

Regards,

Ravi

Read only

former_member15255
Active Participant
0 Likes
715

Hi,

There is a field with a description called "Value in Local Currency" so wat ever be the currency format of a particular document this field would give the document value in local currency this field is normally find in finance tables "BSIS,BSAS,BSID,BSAD,BSIK,BSAK,BSEG etc. the field name is "DBMTR"

regards

suresh

Read only

Former Member
0 Likes
716

hi r k,

u can do this by using control brake events is the loop and endloop.

regards..

seshu.

Read only

Former Member
0 Likes
715

Hi,

Hope that all your queries have been solved. It seems that there are many of your threads that have been asnwered and you have not awarded points to all who deserve that ... please award the needful points and do close the thread.

Regards.

Jayant .