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: 

FM to convert number

Former Member
0 Kudos

i want to convert number with , to without

example:

3,111 to 3111

8 REPLIES 8

Former Member
0 Kudos

Hello Rani,

You can multiply your number.

Data: num type p decimals 3.

num = 3,111.

num = num * 1000.

write num.

you should have 3111.

Hope this helps,

Gabriel

Former Member
0 Kudos

Write this number into character field and then you can remove the , and . from the character fields using REPLACE command.

Regards

Aman

Former Member
0 Kudos
chk out this program

REPORT ychatest.

DATA mqty TYPE p DECIMALS <b>3</b> VALUE '1234.45'.

DATA : x TYPE i,
        chspec(30).

MOVE mqty TO chspec.
CONDENSE chspec.
x = STRLEN( chspec ) .

IF x LE 3.
  chspec = ''.
ELSEIF x = 4.
  chspec = '_,___'.
ELSEIF x = 5.
  chspec = '__,___'.
ELSEIF x = 6.
  chspec = '_,__,___'.
ELSEIF x = 7.
  chspec = '_,__,___'.
ENDIF.

WRITE: mqty  USING EDIT MASK chspec.

reward pts if helpful

Message was edited by: Sekhar

Message was edited by: Sekhar

Former Member
0 Kudos

Hi rani,

Just define one character variable and move your field value to that character variable.

data:v_field(10) type c.

MOVE your work area field TO v_field.

Cheers,

Bujji.

Former Member
0 Kudos

Hi Rani,

I did not find any fm for your functinality.

However you can acheive the same by running the following code :

data : a type string,

b type string,

c type string,

DELIMITER(1) VALUE ','.

a = '3,111' .

split a at DELIMITER into b c.

a = ''.

concatenate b c into a.

write a.

Regards,

Kunal.

andreas_mann3
Active Contributor
0 Kudos

hi,

try:

parameters qty type bseg-menge default '3.111'.
data i type i.
data z type i.
describe field qty decimals i.
z = qty * 10 ** i.

Andreas

Former Member
0 Kudos

copy into character string and replace the delimiter with space and condense.

finally shift into nummeric value if further it is used for amy manipulations.

Former Member
0 Kudos

Rani,

Its very simple. Just need to write variable into another as follows..

Write var1 to var2 no-grouping.

thats it!!

Cheers,

Nilesh