Application Development 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: 

Overflow for arithmetical operation (type P) in program

Former Member
0 Kudos

Hi Gurus,

I am trying to do multiplication of two quantities in this given code.

t_temp1-comp2_qty = v_comp1_qty * t_stpo2-menge.

But qunatity value is coming too large.

So I am getting the "Overflow for arithmetical operation (type P) in program "ZOUM_R021 ".

Actual code is like this.

LOOP AT t_stpo2 WHERE stlnr = t_mast2-stlnr.

t_temp1-idnrk = t_stpo2-idnrk.

t_temp1-bwkey = t_stpo2-werks.

t_temp1-stlnr = t_stpo2-stlnr.

t_temp1-comp2_qty = v_comp1_qty * t_stpo2-menge.

COLLECT t_temp1.

CLEAR t_temp1.

ENDLOOP.

wherer v_comp1_qty and t_stpo2-menge

is already calculated value.

Then please suggest how to avoid this overflow .

Regards,

Amit Kumar Singh

6 REPLIES 6

former_member181995
Active Contributor
0 Kudos

Amit,

What is the type of t_temp1-comp2_qty ?

0 Kudos

t_temp1-comp2_qty of type s032-mbwbest.

Former Member
0 Kudos

Hi,

declare the target variable in the similar way as shown below:

t_temp1-comp2_qty(30) type p decimal 4...

Regards,

Kunjal

Former Member
0 Kudos

Hi Amit,

Declare all the variables of type F (float), then you wont get the overflow error while multiplying....

Hope it helps

Regards,

Sujatha

matt
Active Contributor
0 Kudos

>

> Hi Amit,

>

> Declare all the variables of type F (float), then you wont get the overflow error while multiplying....

>

> Hope it helps

>

> Regards,

> Sujatha

Type F will lose accuracy. Better declare a type P of sufficient size to hold the product.

0 Kudos

Hi all,

I used like this.

DATA l_quant(16) TYPE p decimals 3.

My program is working for max of 14 length.

Still it's giving error if i give input more than 14 length data.

Please suggest is there any way to sort out this error.

Regards,

Amit Kumar Singh