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: 

Short dump --- cx_sy_zerodivide

Former Member
0 Kudos
6,516

Hi All,

A am getting a short on QA and here are details of the dump:

and all fields involved in the calculation are defined as follows:

mov_ave TYPE mbew-verpr,

priceunit TYPE mbew-peinh,

quantity TYPE resb-erfmg,

line_val TYPE resb-gpreis_2,

Runtime Errors BCD_ZERODIVIDE

Except. CX_SY_ZERODIVIDE

Date and Time 2009/01/22 15:17:16

-


-


Short text

Division by 0 (type P) in program "SAPMZMM0001"

-


-


What happened?

Error in the ABAP Application Program

The current ABAP program "SAPMZMM0001" had to be terminated because it has

come across a statement that unfortunately cannot be executed.

-


-


What can you do?

Note down which actions and inputs caused the error.

To process the problem further, contact you SAP system

administrator.

Using Transaction ST22 for ABAP Dump Analysis, you can look

at and manage termination messages, and you can also

keep them for a long time.

-


-


Error analysis

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_ZERODIVIDE', was not caught

and

therefore caused a runtime error.

The reason for the exception is:

In the current program "SAPMZMM0001", an arithmetic operation ('DIVIDE',

'/', 'DIV' or 'MOD') with a type P operand attempted to divide

by 0.

-


-


How to correct the error

If the error occurred in your own ABAP program or in an SAP

program you modified, try to remove the error.

If the error occures in a non-modified SAP program, you may be able to

find an interim solution in an SAP Note.

If you have access to SAP Notes, carry out a search with the following

keywords:

"BCD_ZERODIVIDE" "CX_SY_ZERODIVIDE"

"SAPMZMM0001" or "MZMM0001I01"

"CALC_MOVING_AVERAGE"

If you cannot solve the problem yourself and want to send an error

notification to SAP, include the following information:

1. The description of the current problem (short dump)

To save the description, choose "System->List->Save->Local File

(Unconverted)".

2. Corresponding system log

Display the system log by calling transaction SM21.

Restrict the time interval to 10 minutes before and five minutes

after the short dump. Then choose "System->List->Save->Local File

(Unconverted)".

3. If the problem occurs in a problem of your own or a modified SAP

program: The source code of the program

In the editor, choose "Utilities->More

Utilities->Upload/Download->Download".

4. Details about the conditions under which the error occurred or which

actions and input led to the error.

-


-


System environment

SAP-Release 700

Application server... "sapqec"

Network address...... "10.8.3.39"

Operating system..... "Windows NT"

Release.............. "5.2"

Hardware type........ "4x AMD64 Level"

Character length.... 16 Bits

Pointer length....... 64 Bits

Work process number.. 2

Shortdump setting.... "full"

Database server... "SAPQECD"

Database type..... "MSSQL"

Database name..... "QEC"

Database user ID.. "qec"

Char.set.... "C"

SAP kernel....... 700

created (date)... "Sep 25 2008 23:09:30"

create on........ "NT 5.2 3790 Service Pack 1 x86 MS VC++ 14.00"

Database version. "SQL_Server_8.00 "

Patch level. 179

Patch text.. " "

Database............. "MSSQL 7.00.699 or higher, MSSQL 8.00.194"

SAP database version. 700

Operating system..... "Windows NT 5.0, Windows NT 5.1, Windows NT 5.2, Windows

NT 6.0"

Memory consumption

Roll.... 16192

EM...... 12569520

Heap.... 0

Page.... 73728

MM Used. 2068832

MM Free. 2118384

-


-


User and Transaction

Client.............. 100

User................ "MOGAF"

Language key........ "E"

Transaction......... "ZMMB21 "

Transactions ID..... "F886E8DDB021F14B98330011259C0B23"

Program............. "SAPMZMM0001"

Screen.............. "SAPMZMM0001 0400"

Screen line......... 20

-


-


Information on where terminated

Termination occurred in the ABAP program "SAPMZMM0001" - in

"CALC_MOVING_AVERAGE".

The main program was "SAPMZMM0001 ".

In the source code you have the termination point in line 288

of the (Include) program "MZMM0001I01".

-


-


Source Code Extract

-


Line

SourceCde

-


258

WHEN '10'.

259

SET PARAMETER ID 'KOS' FIELD kostl.

260

SET PARAMETER ID 'CAC' FIELD '1000'.

261

CALL TRANSACTION 'KS03' AND SKIP FIRST SCREEN.

262

263

WHEN '20'.

264

SET PARAMETER ID 'PRO' FIELD wbs.

265

CALL TRANSACTION 'CJ13' AND SKIP FIRST SCREEN.

266

267

WHEN '30'.

268

SET PARAMETER ID 'ANR' FIELD order_nr.

269

CALL TRANSACTION 'IW33' AND SKIP FIRST SCREEN.

270

271

WHEN '40'.

272

273

WHEN OTHERS.

274

275

ENDCASE.

276

277

ENDIF.

278

279

ENDMODULE. " USER_COMMAND_0300 INPUT

280

&----


281

*& Module calc_moving_average INPUT

282

&----


283

  • text

284

----


285

MODULE calc_moving_average INPUT.

286

      • Ziyaad 29/11/07 ***

287

  • item_tab-line_val = item_tab-mov_ave * item_tab-quantity.

>>>>>

item_tab-line_val = item_tab-mov_ave / item_tab-priceunit * item_tab-quantity.

289

      • Ziyaad 29/11/07 ***

290

MODIFY item_tab

291

INDEX item_c-current_line.

292

293

tot_reservation = tot_reservation + item_tab-line_val.

294

295

ENDMODULE. " calc_moving_average INPUT

296

297

*&SPWIZARD: INPUT MODULE FOR TC 'ITEMS'. DO NOT CHANGE THIS LINE!

298

*&SPWIZARD: PROCESS USER COMMAND

299

300

MODULE items_user_command INPUT.

301

IF sy-ucomm NE space.

302

save_okcode = sy-ucomm.

303

ENDIF.

304

ok-code = sy-ucomm.

305

PERFORM user_ok_tc USING 'ITEMS'

306

'ITEM_TAB'

307

'SEL'

10 REPLIES 10

rainer_hbenthal
Active Contributor
1,620

Division by zero is not allowed since hunderds of years.

Former Member
0 Kudos
1,620


287 	

    * item_tab-line_val = item_tab-mov_ave * item_tab-quantity. 

>>>>> 	item_tab-line_val = item_tab-mov_ave / item_tab-priceunit * item_tab-quantity. 

I feel you are supplying 0 to either priceunit or quantity.That can be only reason why this problem pops up.

amit_khare
Active Contributor
0 Kudos
1,620

Before this statement -

item_tab-line_val = item_tab-mov_ave / item_tab-priceunit * item_tab-quantity.

Just check whether item_tab-priceunit or item_tab-quantity are not equal to 0.

0 Kudos
1,620

Hi All,

I have seen your respond with regards to this and i did have a look at it but the all the fields are more zero. Guys don't you think that maybe it's because the priceunit is using mbew-peinh of which is of type dec, maybe the calculation does not allow the dec in the division.

Best Regards,

Fred.

0 Kudos
1,620

Dec are allowed as denominator for division.

CX_SY_ZERODIVIDE -> this exception occurs only when youa re dividing with zero.

former_member156446
Active Contributor
0 Kudos
1,620
* item_tab-line_val = item_tab-mov_ave * item_tab-quantity. 
 lv_temp = item_tab-priceunit * item_tab-quantity.
if  lv_temp GT 
            item_tab-line_val = item_tab-mov_ave / item_tab-priceunit * item_tab-quantity.
endif.

Former Member
0 Kudos
1,620

Hi Fred

Try to put a condition...

IF NOT denominator IS INITIAL.

              • perform ur division*********

ENDIF.

Thanks

Geetha

Former Member
0 Kudos
1,620

Hi,

Short dump says you are performing a division by 0.

May be that is not your intention but the denominator is becoming 0 before division.

Just debug the program and see why this denominator is becoming 0.

Mubeen

Former Member
0 Kudos
1,620

This message was moderated.

mangesh_sonawane
Participant
0 Kudos
1,620

Hello ,

If you are using oo concept then u can use try and catch block to caught the exceptions.

Regards,

Mangesh Sonawane