2006 Oct 06 3:32 PM
hi friends,
In Lsmw i have a requirement of converting currency format to usersetting format for eg if the input is
1,2345.678 and my system settings is 1.2345,678
the conversion should convert from input format to usersetting format.
there are few subroutines which will do the work but the problem is the value we are getting at the end is not acceptable
for eg if we give input as 123.67 as input it will give result as 123.6700 it is adding extra zeros at the end
can any one suggest me a solution.
thanks and regards
srinivas
hi friends,
In Lsmw i have a requirement of converting currency format to usersetting format for eg if the input is
1,2345.678 and my system settings is 1.2345,678
the conversion should convert from input format to usersetting format.
there are few subroutines which will do the work but the problem is the value we are getting at the end is not acceptable
for eg if we give input as 123.67 as input it will give result as 123.6700 it is adding extra zeros at the end
can any one suggest me a solution.
thanks and regards
srinivas
2006 Oct 06 3:43 PM
Srini,
I have tried the same for converting the decimals.
Check the below logic:
DATA: lwa_usr01 TYPE usr01,
wa_eanl-zzpressure type zeanl-zzpressure, "(Dec 8, 3)
lws_press TYPE char10,
lws_pres_num TYPE char5,
lws_pres_dec TYPE char7,
Check for User's Decimal notation
SELECT SINGLE *
FROM usr01
INTO lwa_usr01
WHERE bname EQ sy-uname.
Convert Pressure from 0.00 to 0.0000000
IF NOT wa_eanl-zzpressure IS INITIAL.
lws_press = wa_eanl-zzpressure.
IF lwa_usr01-dcpfm EQ c_x.
ELSEIF lwa_usr01-dcpfm IS INITIAL.
TRANSLATE lws_press USING '. '.
TRANSLATE lws_press USING ',.'.
CONDENSE lws_press NO-GAPS.
ENDIF.
SPLIT lws_press AT '.' INTO lws_pres_num lws_pres_dec.
CONDENSE: lws_pres_num, lws_pres_dec.
CONCATENATE lws_pres_dec '0000' INTO lws_pres_dec.
CONCATENATE lws_pres_num lws_pres_dec INTO
lws_pressure SEPARATED BY '.'.
ENDIF.
Regards,
PRakash.
2006 Oct 06 4:10 PM
Hi,
look at the below program:-
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
Regards
Sudheer
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |