Application Development and Automation 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: 
Read only

truncate

Former Member
0 Likes
799

Hi,

How do I truncate the decimal part of a netprice whose domain is wert11 with length 11 and decimal places 2.

say I want to convert the value from 10000.00 to 10000.

I don't want the decimal part..1000.00 should be just 1000.

5 REPLIES 5
Read only

Former Member
0 Likes
775

Hi,

define variable like this.

DATA:num TYPE p decimals 0 VALUE '1000.00'.

write:/ num.

DATA:num TYPE p decimals 0 VALUE '1000.76'.

write:/ num.

rgds,

bharat.

Read only

Former Member
0 Likes
775

data: tvalue type i,

pvalue(6) type p decimal 2 value '100.00'.

tvalue = pvalue.

Read only

Former Member
0 Likes
775

Hi Abhishek,

do like this

data: v1(5) type p decimals 2 value '10.00',
      v2 type i.

v2 = v1.
write v2.

<b>Reward for helpful answers</b>

Satish

Read only

Former Member
0 Likes
775

Hi,

Use below to code to resolve your issue :

data : num1 type p DECIMALS 2 value '100.00'.

data : num2 type i.


num2 = num1.

write num2.

Thanks,

Sriram Ponna.

Read only

andreas_mann3
Active Contributor
0 Likes
775

hi,

there'S a special command :

REPORT ztrunc01.

PARAMETERS z(6) TYPE p DECIMALS 2 DEFAULT '10000.00'.

DATA : i(11), d(2).

i = trunc( z ).

d = frac( z ).

WRITE: / z, / i, d.

A.

Message was edited by:

Andreas Mann