02-24-2006 7:14 PM
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
02-24-2006 7:29 PM
Hi Kevin,
You can use EDIT MASK statement.
like...
DATA: TEST LIKE VBAP-NETPR.
TEST = '1000000,23'.
WRITE:/ TEST USING EDIT MASK '_______.__'.
02-24-2006 7:20 PM
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
02-24-2006 7:31 PM
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
02-24-2006 7:34 PM
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
02-24-2006 8:06 PM
Hi Kevin,
Did you find the solution other than offsets and translate statement.
Thanks,
Aditya
02-24-2006 8:37 PM
Hi,
PL check this function Module HRGPBS_HER_FORMAT_AMOUNT.
SAP also does more or less similar stuf..
Regards,
Suresh Datti
02-24-2006 7:25 PM
Hi Kevin,
You can use :
Write <CURRENCYFILED> USING CURRENCY 'USD'.
This will convert the Commas to decimal points.
Lanka
02-24-2006 7:28 PM
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.
02-24-2006 7:29 PM
Hi Kevin,
You can use EDIT MASK statement.
like...
DATA: TEST LIKE VBAP-NETPR.
TEST = '1000000,23'.
WRITE:/ TEST USING EDIT MASK '_______.__'.
02-24-2006 7:34 PM
02-24-2006 7:36 PM
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.
02-25-2006 7:55 AM
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
02-25-2006 7:57 AM
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
10-15-2011 8:29 AM