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

Syntax Error - Division 0 type P

Former Member
0 Likes
4,380

Hi Gurus,

Can you help me with this? Error was Division 0 type p.

Thanks for your BIG HELP!!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,632

Hi


This is the error

Source Code

13 REPLIES 13
Read only

Former Member
0 Likes
3,632

Hi Neezaa,

From the DUMP snapshot, it doesnt seem that it is division by 0 error.

It looks like your select statement is incomplete.

The reasons can be:

1)Use INTO clause in the select.

2)If you dont want to use INTO then declare the tables using TABLES statement.(This is obsolete)

Thanks,

Shilpa Bansal.

Read only

harshsisodia31
Participant
0 Likes
3,632

Hi Neezaa,

Can elaborate your issue a little ?

Read only

0 Likes
3,632

Hi Harsh,

Have you used Select single in your prog,

If yes, mention the table name in TABLES statement or else.

DATA: lv_stru type <ztable name>.

now you can change your code like

select single * from <ztable> into lv_stru.

This is resolve your issue.

Arivazhagan S

Read only

Former Member
0 Likes
3,632

Hi,

Can you please send source code extract of the statement where this dump occured.

Read only

Former Member
0 Likes
3,632

Hi Neezaa,

Please post screenshot for source code extract where the dump is occurring. You can see it in ST22. We can help you further after looking at it.

Regards,

Sheetal A.

Read only

Former Member
0 Likes
3,633

Hi


This is the error

Source Code

Read only

0 Likes
3,632

Seems ITAB_D-Nsp is initial in this case thats why u getting dump.

Try by making below modifications.

IF NOT itab_d-nsp is INITIAL.

  itab_d-nios = itab_d-nil/itab_d-nsp * 100.

ENDIF.

Read only

0 Likes
3,632

Hi,

The earlier screenshot showed a different error.

Well to avoid this division by 0 error just use following statement:

If itab_d-nsp is not initial.

itab_d-nios = itab_d-nil/itab_d-nsp * 100.

endif.

Read only

0 Likes
3,632

Hi Neezaa,

You are getting error because itab_d-nsp is having value as 0. You cannot divide by zero without handling the exception. So my advise would be whenever you are dividing by zero just check before that if the value is initial or not. Please do as suggested by and Shilpa Bansal.

Regards,

Sheetal.

Read only

0 Likes
3,632

hi  neezaa,

try replacing line 507 by snippet

if itab_d-nsp eq 0.

    itab_d-nios = itab_d-nil.

elseif itab_d-nsp ne 0.

itab_d-nios = itab_d-nil/itab_d-nsp * 100.

endif.

Hope it solves ur problem.

Read only

dibyajeeban_jena
Active Participant
0 Likes
3,632

This error is coming because , in run time 'itab_d-nsp*100 ' is  zero .

to  avoid this , put condition like

IF itab_d-nsp IS NOT INITIAL .

Iitab_d-nios = itab_d-nil / itab_d-nsp*100 .

ENDIF .

Regards

DJ .

Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
3,632

Hi Neeza

The earlier dump and this one both are different. One is because you have not declarared target work area to hold value during select and second is because of divide by zero error. Please put an if clasue before diving to check if it is not initial then only proceed

Nabheet

Read only

Former Member
0 Likes
3,632

Hello Neezaa Dee ,

This is because of Zero value in the field itab_d-nsp.

So before calculting just check with itab_d-nsp not equal to zero...

****Note Use brackets for the calcultions [ Ex : A = B +  ( C * 100 )  or  A = ( B +   C )  * 100  ]

follow the below code ..

IF ITAB_D-NSP <> 0.

   ITAB_D-NIOS  = ( ITAB_D-NIL / ITAB_D-NSP  ) 100.

ENDIF.



or otherwise follow Mr.Hitesh Wankhede said above...


Thanks,

Vijay SR