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

ABAP - arithematic overflow error

Former Member
0 Likes
1,032

hi folks,

I am getting an error for arithematic overflow not in the main program but in one of the include programs. how to fix it. Any ideas...

thanks'

Santhosh

7 REPLIES 7
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
823

You will need to post the relevant code. The exact section of code causing the error as well as the DATA statements for the variables

Regards,

Rich Heilman

Read only

0 Likes
823

hi Rich,

he code goes like this in the include program.

loop at p_cell_otf into l_otfline

to l_blockend

where tdprintcom = pc_id_color_text.

endloop.

if sy-subrc = 0.

append l_otfline to l_lastinfo.

endif.

  • get corrected value for l_blockpos: should be the position

  • set by the command of 'positioning' (last in the block).

  • look for 'last' ST command

-


> the error occurs l_index = l_blockend.

while l_flag eq c_true.

l_index = l_index - 1.

read table p_cell_otf into l_otfline index l_index.

if l_otfline-tdprintcom <> pc_id_codepage and

l_otfline-tdprintcom <> pc_id_call_font and

l_otfline-tdprintcom <> pc_id_space_width and

l_otfline-tdprintcom <> pc_id_uline and

l_otfline-tdprintcom <> pc_id_color_text and

l_otfline-tdprintcom <> pc_id_move_to and

l_otfline-tdprintcom <> pc_id_md_after_par.

The data variables include

data:customer_id type knc1-kunnr,

scan_code type zzscan,

scan_number type zzscan,

icode1 type C value '0',

nvalue_scancode type I,

icode2 type knb1-xausz,

icode(2) type C,

w_date type d,

from_date(8) type c,

to_date(8) type c,

fdate(12) type C,

conversionstring type string,

custno type knc1-kunnr,

advertiserno type knc1-kunnr,

amount(9) type C,

numc_amount(9) type N,

bpartner(10) type n,

len type I,

bdate(10) type c,

addspace type I,

The program was running fine till thursday evening and later on ftriday they changed on some printer settings and stuff like that. Is that related to it because this includes in the smartform that I periodically print.

I go for the print preview and just it gets hanged there.

Any leads would be just great..

thanks

Santhosh

Read only

0 Likes
823

This is the line where the program abends?

l_index = l_blockend.

How are the two fields above typed?

Regards,

Rich Heilman

Read only

0 Likes
823

hi Rich,

I am sorry ,the error occurs at

l_index = l_index - 1.

here the include program generates

l_index type sy-tabix and so is l_blend. From the code it looks like it's related to printer reading the data into some output table.

In short the The error analysis shows

'whole number overflow on subtraction'.

he reason for termination in the current program is subtracting the number 1 from the number "-2147483648" (using operation - or 'SUBTRACT') RESULTED IN THE VALUE GREATER THAN 2147483647 or smaller than 2147483648. which results in a whole number overflow.

in the debugg mode if I check l_index has value 8 and how

"-2147483648" this came no idea.

Thanks for your help in advance.

Santhosh

Read only

0 Likes
823

My first thought would be that you are stuck in an endless loop. Without debugging myself, I can't be certain.



while l_flag eq c_true.

l_index = l_index - 1.

read table p_cell_otf into l_otfline index l_index.

if l_otfline-tdprintcom <> pc_id_codepage and
l_otfline-tdprintcom <> pc_id_call_font and
l_otfline-tdprintcom <> pc_id_space_width and
l_otfline-tdprintcom <> pc_id_uline and
l_otfline-tdprintcom <> pc_id_color_text and
l_otfline-tdprintcom <> pc_id_move_to and
l_otfline-tdprintcom <> pc_id_md_after_par.


In this code(above), you are looping and decrenting L_INDEX by 1 untill some condition is satisfied. How does L_FLAG become TRUE? If it becomes true by the IF statement being satisfied, then I would check in the "printer settings" in which you said have been recently changed.

Anyway, not sure why L_INDEX is showing 8 in debug mode.

Regards,

Rich Heilman

Read only

0 Likes
823

hi Rich, Thanks for the information,

Yes you are right it's going into an endless loop. And the 'l_flag eq c_true' is becoming true and l_index which starts with with 8 (Is it something spool retention days because in the printer settings that number is 😎 it decrements and goes to the negative value that where it is getting the overflow condition.

one more thing is there any otherway that I could send the entire code it is around 1000 lines. I think you could help me in this regard.

because I am not able to understand whether it is due printer settings or some missing piece in the program from my side.

thanks for your help Rich.

Read only

Former Member
0 Likes
823

Just check which code line is having the problem.

Then check the fields used in that .

increase the field length of number ( P type I guess )type fileds.

or post the code line on SDN and get the exact answer from someone

Cheers,

Ram