‎2005 Jun 25 5:12 PM
Hi People,
I have to remove comma from the currency and weight fields How can do that? Can somebody please help? Also if I have to round off a number how can I do that?
Thanks & regards,
AM
‎2005 Jun 25 5:27 PM
Hi ,
There are couple ways of doing it
The best one is to use 'REPLACE' command .... check the syntax by pressing F1 , and replace comma by space and then use 'CONDENSE' statement.
Regards ,
vivek
‎2005 Jun 25 5:27 PM
Hi ,
There are couple ways of doing it
The best one is to use 'REPLACE' command .... check the syntax by pressing F1 , and replace comma by space and then use 'CONDENSE' statement.
Regards ,
vivek
‎2005 Jun 25 7:52 PM
To round:
type "round" in your ABAP.
Put your cursor over "round".
Press F1
‎2005 Jun 26 5:07 AM
Please understand that commas / decimals are displayed in currency amount / qty fileds are displayed as per the user profile defaults ...and does not exactly exist in database tables ...in db table it is kept simply as a number with no comma / decimal only when you display it using any utility SE16 / Se11 / your programs...then you see the comma / decimals as per your user profile defaults.
In case you want the comma to be removed within your program , you can copy the amount value into a char variable and then use REPLACE.
You can check ROUND , FLOOR or CEIL function commands and check which one is suitable for your case.
Press F1 to see the details of these commands.
Cheers,
Ram
‎2005 Jun 27 9:08 AM
The 'TRANSLATE' statement is very useful, especially for what you have to do.
TRANSLATE w_amount using ', '.Regards,
Erwan.
‎2005 Jun 27 10:10 AM
Hi,
Try this out
REPORT demo_data_function .
numeric datatypes
DATA n TYPE p DECIMALS 2.
DATA m TYPE p DECIMALS 2 VALUE '-5.55'.
n = abs( m ). WRITE: 'ABS: ', n.
n = sign( m ). WRITE: / 'SIGN: ', n.
n = ceil( m ). WRITE: / 'CEIL: ', n.
n = floor( m ). WRITE: / 'FLOOR:', n.
n = trunc( m ). WRITE: / 'TRUNC:', n.
n = frac( m ). WRITE: / 'FRAC: ', n.
Try excuting this program.
‎2005 Jun 27 10:11 AM
Hi,
Try this out
REPORT demo_data_function .
numeric datatypes
DATA n TYPE p DECIMALS 2.
DATA m TYPE p DECIMALS 2 VALUE '-5.55'.
n = abs( m ). WRITE: 'ABS: ', n.
n = sign( m ). WRITE: / 'SIGN: ', n.
n = ceil( m ). WRITE: / 'CEIL: ', n.
n = floor( m ). WRITE: / 'FLOOR:', n.
n = trunc( m ). WRITE: / 'TRUNC:', n.
n = frac( m ). WRITE: / 'FRAC: ', n.
Try excuting this program.
Also try this one to round off
DATA: pack TYPE p DECIMALS 0.
pack = 1 / 3 * 3.
WRITE pack.
O/p will be 1.
‎2005 Jun 27 10:35 AM
Hi,
Check this sample.
data v type mara-ntgew value '56.6'.
data cur(15) value '56,000'.
data int type i.
<b>int = v.</b>
write int.
<b>replace ',' with '' into cur.</b>
write cur.