cancel
Showing results for 
Search instead for 
Did you mean: 

Arithmetic overflow error converting expression to data type datetime

former_member1133820
Participant
0 Kudos

Dear Experts,

I try to generate one SAP query to find out the transfer quantity of stock (open balance & closing balance of stock). It got error when I try to execute it. Below is the query:

SELECT T0.[DocDate], T0.[InQty], T0.[OutQty], T0.[CalcPrice], T0.[TransType], T0.[Warehouse], T0.[JrnlMemo], T0.[BASE_REF], T0.[RevalTotal], T0.[Price], T0.[TransValue], T1.[ItemCode], T1.[ItemName],T2.[CardName], T3.[ItmsGrpNam] FROM OINM T0  INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode INNER JOIN OITB T3 ON T1.ItmsGrpCod = T3.ItmsGrpCod INNER JOIN ODLN T2 ON T0.BASE_REF=T2.DocNum AND T0.TransType=T2.ObjType WHERE T3.[ItmsGrpNam] = 'Finished Goods' AND T0.[Warehouse] = 'FG01' AND (T0.[DocDate] >=[%0] AND T0.[DocDate] <=[%1]) AND (T0.[InQty]<>0 OR  T0.[OutQty] <>0 OR  T0.[Price]<>0) ORDER BY T0.Warehouse, T3.ItmsGrpNam, T1.ItemCode

I get the "Arithmetic overflow error converting expression to data type datetime" error message.

Anyone here can tell me what is it about?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Try change to:


T0.[DocDate] Beteen [%0] AND [%1]

or


T0.[DocDate] Beteen '[%0]' AND '[%1]'

Have you got the date selection screen open before error message?

Thanks,

Gordon

former_member1133820
Participant
0 Kudos

Yup, I got the date selection screen open before error message.

Answers (3)

Answers (3)

Former Member
0 Kudos

Please close your thread by mark it is answered since your problem solved.

Former Member
0 Kudos

I have tried that no problem with your query. Have you tested by my way?

former_member1133820
Participant
0 Kudos

it's worked.

thx, Gordon.

bhavank_gajjar
Active Contributor
0 Kudos

Hi..

In your query where is the formula for opening balance??

Regards,

Bhavank

former_member1133820
Participant
0 Kudos

Actually I'm still in the progress of writing the query to find the open balance & closing balance of stock using the OINM table.