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

Currency

Former Member
0 Likes
732

Hi,

I have a Ztable with company code, plant , currency fields and others.

I have to validate the currency in the Ztable against the currency in the standard table of SAP.

Is there any function module available?

regards

7 REPLIES 7
Read only

anversha_s
Active Contributor
0 Likes
695

hi,

1. u can validate before inserting the currency into ztable.

2.

select single WAERS from TCURT into  wa_waers
    where waers = val_data_waers
    and SPRAS = 'EN'.

3. now chk the

sy-subrc

of above stmnt

4. if it is '0' insert, else reject

Regards

Anver

Read only

Former Member
0 Likes
695

Hi,

If u r validating selection screen then do as bewlo:

SELECT SINGLE kwert 
              INTO xxx-kwert
              WHERE ... IN s_...

Is there any check table refered against the currency field, if so use taht table for validating.

If u r asking for validation in the tabel u can refer the currecy field against a check table, so it will vlaidate automatically.

For Currency key u have to see table <b>TCURC.</b>

U can refer this code for currency conversion

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

http://www.sapdevelopment.co.uk/country/country_curr.htm

Reward if this helsp.

Message was edited by:

Judith Jessie Selvi

Read only

Former Member
0 Likes
695

Hi,

You can use foll currency fm :

Get the exchange rate using the function module READ_EXCHANGE_RATE.

Convert it to local currency by using CONVERT_TO_LOCAL_CURRENCY.

CONVERT_TO_FOREIGN_CURRENCY

Please reward for the same.

Read only

0 Likes
695

hi sachin,

how did u solve the issue with the above FM.

Regards

Anver

Read only

0 Likes
695

I dont want any currency conversions like from GBP to UDS or so..

I want to check if the currency in my Ztable is matching with the one which is maintained in standard table at the time of config or so.

If both the currencies are same, I have my logic for further processing.

Read only

0 Likes
695

Tell me the table name and field name, which field u r referring?

Also R u validating in the program? if so tell me the selection parameter.

Read only

0 Likes
695

check table

TCURC.

Regards

Prabhu