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 decimal notation conversion

Former Member
0 Likes
5,833

I am getting finacial values from a subsidary company in comma notation instead of the decimal notation. It is clear that their user profiles are setup with this in mind and they don't want to change them. Is there a function out there that converts comma to decimal i.e. 123,45 -> 123.45?

Thanks,

Kevin

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,869

Hi Kevin,

You can use EDIT MASK statement.

like...

DATA: TEST LIKE VBAP-NETPR.

TEST = '1000000,23'.

WRITE:/ TEST USING EDIT MASK '_______.__'.

13 REPLIES 13
Read only

Former Member
0 Likes
2,869

define lv_field as character field of ur required length

move currency field to lv_field.

use "translate lv_field using ', .'.

i think this helps you.

Thanks

Aditya

Read only

0 Likes
2,869

Hi Aditya, yes I agree that is starting to look like the only option, strip out commas and decimals and then move the value into a 2 decimal field. I'm just surprised there isn't a fcn or a BAPI to handle this.

Thanks,

Kevin

Read only

0 Likes
2,869

i also tried alot. because while developing some poyroll programs, i encountered the same problem. this was the only solution i got or you can use offsets.

Thanks,

Aditya

Read only

0 Likes
2,869

Hi Kevin,

Did you find the solution other than offsets and translate statement.

Thanks,

Aditya

Read only

0 Likes
2,869

Hi,

PL check this function Module HRGPBS_HER_FORMAT_AMOUNT.

SAP also does more or less similar stuf..

Regards,

Suresh Datti

Read only

Former Member
0 Likes
2,869

Hi Kevin,

You can use :

Write <CURRENCYFILED> USING CURRENCY 'USD'.

This will convert the Commas to decimal points.

Lanka

Read only

0 Likes
2,869

Hi Lanka, thanks for the response but I tried that earlier and it doesn't work. However, just to be clear I'm getting the values in euro form and want them in US form.

Read only

Former Member
0 Likes
2,870

Hi Kevin,

You can use EDIT MASK statement.

like...

DATA: TEST LIKE VBAP-NETPR.

TEST = '1000000,23'.

WRITE:/ TEST USING EDIT MASK '_______.__'.

Read only

0 Likes
2,869

This may work a litle better for ya.



report zrich_0004.

data: c(100) type c.
data: length type i.
data: offset type i.


c = '1223,54'.

length = strlen( c ).


offset = length - 3.

translate c+offset(1) using ',.'.

write:/ c.

REgards,

Rich Heilman

Read only

Former Member
0 Likes
2,869

try this

&----


*& Report YCHATEST *

*& *

&----


*& *

*& *

&----


REPORT YCHATEST .

data: l_amnt(25) type c value '123.456.645,60'.

replace all occurrences of ',' in l_amnt with '#'.

replace all occurrences of '.' in l_amnt with ','.

replace all occurrences of '#' in l_amnt with '.'.

write : l_amnt.

Read only

Former Member
0 Likes
2,869

Hi Kevin,

Even though at display your currency value is shown as 123,45. internally if you check it out in debug mode the value will be stored in decimal notation itself in the currency field,but only difference would be in the number of decimal places like 123,45 would be stored as 12.345, if this is the case then use the BAPI,

BAPI_CURRENCY_CONVERT_TO_EXTERNAL which will give you the exact value in decimal format for the currency value,later you can use this to display in US currency using write.

Regards,

Raghavendra

Read only

Former Member
0 Likes
2,869

HI Kevin May

USE THIS CODE: IT TAKES CARE OF DECIMAL NOTATION BASED ON USER PROFILE.

WHAT EVER MAY BE THE USER PROFILE FOR DECIMAL NOTATION.

<b>

FIELD_NUM = 1,233.50

</b>

OR

<b>

FIELD_NUM = 1.233,50

</b>

OR

<b>

FIELD_NUM = 1 233,50

</b>

***************************************

SELECT SINGLE DCPFM FROM USR01
                       INTO VAR_DCPFM WHERE BNAME EQ SY-UNAME.

          IF VAR_DCPFM EQ 'X'.
            REPLACE ALL OCCURRENCES OF ',' IN: FIELD_NUM WITH ''.
*            TRANSLATE FIELD_NUM USING ','.
          ELSEIF VAR_DCPFM EQ ''.
            REPLACE ALL OCCURRENCES OF '.' IN: FIELD_NUM WITH ''.
*            TRANSLATE FIELD_NUM USING '.'.
            TRANSLATE FIELD_NUM USING ',.'.
          ELSEIF VAR_DCPFM EQ 'Y'.
            TRANSLATE FIELD_NUM USING ',.'.
          ENDIF.

***************************************

THIS CODE WILL WILL RESULT INTO : <b>

FIELD_NUM = 1233.50

</b>

CHEERS,

VIJAY RAHEJA

Read only

former_member229982
Participant
0 Likes
2,869

Use T-code OY01 and change decimal point notification