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

regarding 0.5

Former Member
0 Likes
1,478

hi experts,

i m dividing 1 by 2 ,but it is not wrking,

the variable which is i m using of type c is

not taking 0.5 ,plz help me to sort out this,what will

be the type of variable for storing 0.5.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,142

Hi,

take

variable as type P decimals 2.

Regards,

Srinivas

5 REPLIES 5
Read only

Former Member
0 Likes
1,142

i guess SAP has not yet defined such a type to store 0.5

pk

Read only

Former Member
0 Likes
1,143

Hi,

take

variable as type P decimals 2.

Regards,

Srinivas

Read only

Former Member
0 Likes
1,142

Hi Rajat.

Use the following code:

REPORT ZNITIN_TEST.

data: n1 type i value '1',

n2 type i value '2',

n3 type p decimals 2.

n3 = n1 / n2.

write: n3.

Hope this will help you.

Regards,

Nitin.

Read only

Former Member
0 Likes
1,142

try this:


data: val type p length 3 decimals 1.

val = 1 / 2.

val will have 0.5

Read only

Former Member
0 Likes
1,142

Hi Raja,

try this below code. it will work.

data: c_p type p decimals 1,

c_1 type p decimals 1 value '1',

c_2 type p decimals 1 value '2'.

start-of-selection.

c_p = c_1 / c_2.

write :/10 c_p.

Regrads,

Siva.