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

Converting Comma into Dot for Amount value

Former Member
0 Likes
10,065

Hi All,

I need to convert the amount value in comma to dot say 1000,00 to 1000.00.Any function module is there to convert it.After converting it i need to pass this value as exporting parameter to a function module having data type as character(lenght 13).

Thnks

Deb

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,310

Hello Deb,

Try the code below:


DATA:
V_AMT  TYPE WRBTR VALUE '5000,00',
V_INT1 TYPE NUMC10,
V_DEC1 TYPE NUMC2,
V_DATA TYPE CHAR13.

V_INT1 = TRUNC( V_AMT ).
V_DEC1 = FRAC( V_AMT ).


CONCATENATE V_INT1 '.' V_DEC1 INTO V_DATA.

WRITE: V_DATA.

Hope this helps.

BR,

Suhas

9 REPLIES 9
Read only

Former Member
0 Likes
2,310

Goto System->User Profile->Own data

Defaults tab..Maintain the desired one in field Decimal Notation

Read only

Former Member
0 Likes
2,310

Hi,

Check the table USR01 for user defaults (DCPFM), based on the value you change the decimal notation.

Hope it helps!!

let me know for any further help!!

Regards,

Pavan

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,311

Hello Deb,

Try the code below:


DATA:
V_AMT  TYPE WRBTR VALUE '5000,00',
V_INT1 TYPE NUMC10,
V_DEC1 TYPE NUMC2,
V_DATA TYPE CHAR13.

V_INT1 = TRUNC( V_AMT ).
V_DEC1 = FRAC( V_AMT ).


CONCATENATE V_INT1 '.' V_DEC1 INTO V_DATA.

WRITE: V_DATA.

Hope this helps.

BR,

Suhas

Read only

Former Member
0 Likes
2,310

Hello Suhas,

I guess, the decimal notation is not constant value (.), it will vary based on the user defaults...

so it should dynamically change based on the user defaults.

Regards,

Pavan

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,310

Hello Vishnu,

That is what i have done. FRAC returns me the "Value of the decimal places of the argument ". It does not depend on the decimal separator.

BR,

Suhas

Read only

Former Member
0 Likes
2,310

Hi,

Either maintain it in the User profile if you always want to run this way.

Maintain whichever decimal notation is preferred. This has tobe done for the user who will be executing the report..

Or you wish to change onlyin your report then you may use TRANSLATE wa_text USING ',..,' at the time of output..

Read only

Former Member
0 Likes
2,310

Hi,

Use

replace all occurrences of ',' in <your field name> with '.'.

Read only

Former Member
0 Likes
2,310

Hi Debabrata,

Did you try with REPLACE statement ?

Check this code snippet:

DATA: a TYPE string VALUE '5000,00'.
REPLACE ALL OCCURRENCES OF ',' IN:
        a WITH '.' .
WRITE a.

Read only

0 Likes
2,310

Hi,

Have a look at the following Thread, it will solve out your problem

[Replace , with . or space|;

Kind Regards,

Faisal