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

numeric question

Former Member
0 Likes
759

Hey,

I know this is a stupid simple question, but how can I obtaint the decimals from a number of type P (let's say 1023.45). I want to have in a variable that 45 value.

Thanks,

Andrew

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
735

Hi

declare 2 variables

put the number into a string

then use SPLIT command at decimal and separate the decimals and integer portion.

Regards

Anji

5 REPLIES 5
Read only

Former Member
0 Likes
736

Hi

declare 2 variables

put the number into a string

then use SPLIT command at decimal and separate the decimals and integer portion.

Regards

Anji

Read only

Former Member
0 Likes
735

hi,

syntax:

Data : num1 type p decimals 2.

Read only

Former Member
0 Likes
735

DATA : TEMP TYPE P DECIMALS 3.

I = TRUNC( TEMP ). " integer part

D = FRAC( TEMP ). "

In variable I, u will get integer part and in D fractional part.

Read only

Former Member
0 Likes
735

data : l_num type p decimals 2,

l_pre type i,

l_post type i.

l_num = 1023.45.

SPLIT l_num at '.' into l_pre l_post.

Read only

Former Member
0 Likes
735

USE THIS.<b>PROBLEM RESOLVED</b>

REPORT ZTESTU1 .

data : A TYPE I.

DATA : B TYPE VBAP-KWMENG.

DATA : C TYPE VBAP-KWMENG.

B = '1000.23499'.

A = B.

C = B MOD A.

WRITE:/ C.

REGARDS

AMIT SINGLA