Application Development 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: 

currency decimal notation conversion

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

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

0 Kudos

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

0 Kudos

Hi Kevin,

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

Thanks,

Aditya

0 Kudos

Hi,

PL check this function Module HRGPBS_HER_FORMAT_AMOUNT.

SAP also does more or less similar stuf..

Regards,

Suresh Datti

Former Member
0 Kudos

Hi Kevin,

You can use :

Write <CURRENCYFILED> USING CURRENCY 'USD'.

This will convert the Commas to decimal points.

Lanka

0 Kudos

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.

Former Member
0 Kudos

Hi Kevin,

You can use EDIT MASK statement.

like...

DATA: TEST LIKE VBAP-NETPR.

TEST = '1000000,23'.

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

0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

former_member229982
Participant
0 Kudos

Use T-code OY01 and change decimal point notification