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: 

Removal of decimal

Former Member
0 Kudos

Hi,

In my pgm,I declared one variable(stores the amount value) which s of type 'BAPICURR-BAPICURR'(in order to put the commas in the amount).Now the requirement is,I have to put only the commas not the decimal place.

EX:

input:1234325

expected o/p:1,234,325.

Output I m getting is :1,234,325.0000

I need to remove that 4 zeroes.

Suggest me the solution.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

Now the decimal problem s solved.But I m not getting the commas

I need commas but no decimal value.

12 REPLIES 12

Former Member
0 Kudos

use conversion_exit_alpha_input or offset

Former Member
0 Kudos

this fm s 4 the removal of trailing zeroes.

i need to remove the zeroes at the end

Former Member
0 Kudos

HI ...

you can use

Conversion_exit_alpha_output to remove the zeros

or you can convert these to char

Regards

Prashant

Edited by: Prashant singh on Oct 20, 2008 12:25 PM

Edited by: Prashant singh on Oct 20, 2008 12:26 PM

Former Member
0 Kudos

Hi,

Check below piece of code:

DATA:
  v_var1 TYPE bapicurr-bapicurr VALUE '12345',
  v_var2(20) TYPE c.

WRITE:
v_var1 TO v_var2 DECIMALS 0.

WRITE:
v_var2.

Thanks & Regards,

Navneeth K.

Former Member
0 Kudos

Try this,


data amt(6) type p decimals 3 value '123.450'.
data amt1(6) type p decimals 2.
data amt_c(6) type c.
unpack amt to amt_c.
shift amt_c right deleting trailing '0'.
translate amt_c using ' 0'.
pack amt_c to amt1.

write amt1.

If you want to eliminate the decimals completely, then simply specify decimals 0.

data amt(6) type p decimals 0 value '123.450'.

regards,

Advait

Edited by: Advait Gode on Oct 20, 2008 12:28 PM

former_member188685
Active Contributor
0 Kudos

i am not sure how you are doing.., i just tried this way, it is working fine. check it once.

data: decp type p decimals 0.
data: number(10).

number = 1234325.

decp = number.

write decp.

Former Member
0 Kudos

Hi

Try this

DATA : VAL1 TYPE BAPICURR_D VALUE '12345.0000',
       VAL2 TYPE p DECIMALS 0.

VAL2 = VAL1.

WRITE : VAL1,
        VAL2.

Regards

former_member226519
Active Contributor
0 Kudos

use WRITE ... USING EDIT MASK

see docu there

Former Member
0 Kudos

Hi

Now the decimal problem s solved.But I m not getting the commas

I need commas but no decimal value.

0 Kudos

My above piece of code, does display commas, it removes decimals.

Former Member
0 Kudos

Thanks navneeth.. Its working

Former Member
0 Kudos

Hi,

You can do a simple thing.

While declaring your variable use the following thing.

DATA: VAR TYPE p DECIMALS 0.

It should help you.

Thanks

Edited by: Nitesh Kumar on Oct 20, 2008 1:08 PM