2009 Sep 24 10:22 AM
Hi all,
i´ve got a string with value 773,35999999 and wan´t them converted to 773,36. Anybody knows how to this.
In my test I always get problems with the comma ',' if it´s a point the following coding works:
DATA: p TYPE string VALUE '773.35999999',
v TYPE ZTEST123." ( ZTEST123 is dec15 decimals 2.)
v = p.Any idea´s?
Thx, in advance,
Andy
2009 Sep 24 10:30 AM
Yò Andy,
check this out:
replace all occurrences of ',' in yourcommanotation with '.' .In alternative, you could check for some conversion FM, e.g. BAPI_CURRENCY_CONV_TO_EXTERNAL / INTERNAL, or PP_CATT_CONVERT_DECIMAL_POINT. But I guess the first one is the simplest way to obtain your desiderata.
2009 Sep 24 10:29 AM
2009 Sep 24 10:30 AM
Yò Andy,
check this out:
replace all occurrences of ',' in yourcommanotation with '.' .In alternative, you could check for some conversion FM, e.g. BAPI_CURRENCY_CONV_TO_EXTERNAL / INTERNAL, or PP_CATT_CONVERT_DECIMAL_POINT. But I guess the first one is the simplest way to obtain your desiderata.
2009 Sep 24 10:37 AM
see.. comma is just a display pattern. the actual way how its stored is 100.00 not 100,00. this is a user display setting in SU01.
but still if you are getting , in place of . in the input string. replace this by a '.'.
as :
DATA: p1 TYPE string VALUE '773,35999999'.
data : p2 type p DECIMALS 2.
REPLACE FIRST OCCURRENCE OF ',' in p1 WITH '.'.
p2 = p1.
WRITE : p2.
2009 Sep 24 10:44 AM
Is it possible ?
DATA: p TYPE string VALUE '773,35999999',
v TYPE p DECIMALS 2.
REPLACE ALL OCCURRENCES OF ',' IN p WITH '.'.
v = p.Kanagaraja L
2009 Sep 24 10:45 AM