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

round the value

Former Member
0 Likes
851

Hi all

i want to take the values before the ‘.’

Is there any F.M?

I declared a variable like currency

Eg: Value is 22,000.74

My output will be 22,000

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
818

check this example...

DATA: I TYPE I,

P TYPE P DECIMALS 2,

M TYPE F VALUE '-3.5',

D TYPE P DECIMALS 1.

P = ABS( M ). " 3,5

I = P. " 4 - business rounding

I = M. " -4

I = CEIL( P ). " 4 - next largest whole number

I = CEIL( M ). " -3

I = FLOOR( P ). " 3 - next smallest whole number

I = FLOOR( M ). " -4

I = TRUNC( P ). " 3 - integer part

I = TRUNC( M ). " -3

D = FRAC( P ). " 0.5 - decimal part

D = FRAC( M ). " -0.5

Hi all

i want to take the values before the ‘.’

Is there any F.M?

I declared a variable like currency

Eg: Value is 22,000.74

My output will be 22,000

7 REPLIES 7
Read only

Former Member
0 Likes
819

check this example...

DATA: I TYPE I,

P TYPE P DECIMALS 2,

M TYPE F VALUE '-3.5',

D TYPE P DECIMALS 1.

P = ABS( M ). " 3,5

I = P. " 4 - business rounding

I = M. " -4

I = CEIL( P ). " 4 - next largest whole number

I = CEIL( M ). " -3

I = FLOOR( P ). " 3 - next smallest whole number

I = FLOOR( M ). " -4

I = TRUNC( P ). " 3 - integer part

I = TRUNC( M ). " -3

D = FRAC( P ). " 0.5 - decimal part

D = FRAC( M ). " -0.5

Read only

andreas_mann3
Active Contributor
0 Likes
818

hi,

use commands: <b>trunc</b> and <b>frac</b> (->look F1)

A.

Read only

Former Member
0 Likes
818

Hai Priya,

You can use string+offset(length) to get the required result

Read only

0 Likes
818

You can use the function module 'ROUND'.

~Suresh

Read only

Former Member
0 Likes
818

Use SPLIT.. AT.

SPLIT <...>

AT '.'

INTO <v1>

<v2>.

- Saru

Read only

ibrahim_u
Active Participant
0 Likes
818

Define a variable that have no Decimals places. Ex:

data : sample type p ."decimals 0.

move '15256.256' to sample.

"sample has value 15256

if you want to use character type. u can


data : index type i.
data : sample type c value '15,256.256'.

data : begin of splitter occurs 0,
         word(20),
       end of splitter.

split sample at '.' into table splitter.

describe table splitter lines index.

clear sample.
loop at splitter from 1 to index.
  concatenate sample splitter-word into sample.
endloop.

condense sample no-gaps.

ibrahim

Read only

Former Member
0 Likes
818

hi ,

split '12.23' at '.' into var1 var1.