cancel
Showing results for 
Search instead for 
Did you mean: 

Round of Number

Former Member
0 Kudos

Hi experts

Iam trying to multiply

Data : l_answer type i.

l_answer = 1 * 1.5

I would get a answer as 2

But what i want is 1 , i just need to exclude values after decimals , meaning i dont want values to get rounded off

Accepted Solutions (1)

Accepted Solutions (1)

former_member40425
Contributor
0 Kudos

Hi,

You can use type casting.

Example:

data: var_float TYPE p DECIMALS 2 VALUE '1.5',

var_int TYPE i.

var_int = var_float .

var_int ll be having value 1

I hope it helps

Regards,

Rohit

Edited by: Rohit Makkar on May 7, 2009 11:54 AM

Answers (4)

Answers (4)

Former Member
0 Kudos

Try using data type p

data: l_f type p DECIMALS 3 .

Former Member
0 Kudos

Hi,

just refer to this link it might help you

thanks

arjun_thakur
Active Contributor
0 Kudos

Hi,

You can try like this:


Data : l_answer type string.
data l_ans type string.
data l_ans1 type string.

l_answer = 1 * '1.5' .

split l_answer at '.' INTO: l_ans l_ans1.

Regards

Arjun

P.S.: Please post ABAP related questions in ABAP,general forum.

Former Member
0 Kudos

Hi,

Please post the same in ABAP General fourm.

Regards,

Lekha.