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: 

How to remove decimal places

Former Member
0 Kudos

Hi,

Is there any function module which removes decimal places.

The following are the values that are currently getting printed. I would like to remove comma and dot (decimal).

33.982.011,00 12.6292.50

80.903.177,00 41.61

8 REPLIES 8

Former Member
0 Kudos

Hi,

Not sure if there is any such FM.

Use "Replace all occurrences of " in the program to remove decimals/comma/ ....

Regards,

Srini.

former_member182387
Active Participant
0 Kudos

Hi,

If you remove the decimal places means, it will become a wrong value like Rs 100.50 (Hundred and 5o paise) will become rs 10050 (ten thousands and 50) .

Eventhough you want to remove the decimal places means, use REPLACE command as mentioned by the previous poster.

Sample code

PARAMETER w_value(10) TYPE C.

REPLACE ALL OCCURRENCES OF '.' IN w_value WITH space.

CONDENSE w_value.

WRITE w_value.

Thanks and Regards,

Senthil Kumar Anantham.

former_member536879
Active Contributor
0 Kudos

Hi,

Whats the data type of that field. Move that field into a character type field and check after that.

Hope this might help you.

With Regards,

Sumodh.P

Former Member
0 Kudos

Hi

Try the FM /TDAG/CP_LB25_REPLACE

bbalci
Contributor
0 Kudos

Hi Mohammed,

You can use a text variable and write the value without decimals with WRITE command like this :

DATA gv_quantity TYPE p DECIMALS 2.

DATA gv_text(20).

gv_quantity = '126292.40'.

WRITE gv_quantity TO gv_text DECIMALS 0 LEFT-JUSTIFIED.

Now variable gv_text shows '126292' without dot and decimal places.

if you want to get rid of decimal value in variable it self use FLOOR command like this :

gv_quantity = FLOOR( gv_quantity ).

I hope it helps.

Bulent.

Edited by: Bulent Balci on Jul 9, 2010 10:58 AM

Former Member
0 Kudos

Hi Mohammed,

Go to the attributes of the program and check the "Fixed Point Arithmetic" option. I think this will solve your problem.

Former Member
0 Kudos

Print the value as it is coming from the database without converting it to the user format or reference to any currency. Be careful with currencies like 'YEN'.

Regards,

Nilesh.

ThomasZloch
Active Contributor
0 Kudos

Frequently discussed topic, please search for information before posting.

Thread locked.

Thomas