on 08-01-2008 2:24 PM
I am trying to select a date range with this query. When it is run without the WHERE clause, it works fine. When I add the WHERE clause, I get the error 'Received Alerts' (OAIB). Here is the code:
SELECT T0.DocNum, T0.DocDate, T0.CardName, T0.U_RMA_NUM, T1.ItemCode, T1.Dscription, T1.Quantity, T1.LineTotal, T2.Name[Return Reason Desc], T3.Name[Disposition Description],T0.Comments FROM ORDN T0 INNER JOIN RDN1 T1 ON T0.DocEntry = T1.DocEntry Left Outer JOIN [dbo].[@PRE_CUSTREA] T2 ON T0.U_RMA_CREAS = T2.Code Left Outer JOIN [dbo].[@PRE_RMADISP] T3 ON T0.U_RMA_DISP = T3.Code
WHERE T0.DocDate between [%0] and ['%1]
Does anyone have any ideas why this is erring out? Thanks for your help.
Hi Phyllis
Try the following without the single quotes:
WHERE T0.DocDate >= [%0] and T0.DocDate <= [%1]
Just a question, is this query being linked to an alert, or are you running it from the query manager?
Kind regards
Peter Juby
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am running this query under Query Manager. That did not work either. I am now getting an error that says Incorrect syntax near '0' Here is the latest code:
SELECT T0.DocNum, T0.DocDate, T0.CardName, T0.U_RMA_NUM, T1.ItemCode, T1.Dscription, T1.Quantity, T1.LineTotal, T2.Name[Return Reason Desc], T3.Name[PreGel Disposition Description],T0.Comments FROM ORDN T0 INNER JOIN RDN1 T1 ON T0.DocEntry = T1.DocEntry Left Outer JOIN [dbo].[@PRE_CUSTREA] T2 ON T0.U_RMA_CREAS = T2.Code Left Outer JOIN [dbo].[@PRE_RMADISP] T3 ON T0.U_RMA_DISP = T3.Code
Where T0.DocDate >= [%0] and T0.DocDate <=[%1]
Hi Phyllis,
I have tried to run your query without UDT. It works fine.
My suggestion is to tune your query to dig out which UDT is a trouble maker and make some changes to field type etc. accordingly.
Thanks,
Gordon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Phyllis
If you are using 2007 then you must use single quotes before and after the square brackets in variables for dates. I know that in some earlier versions, SAP did not require the single quotes for variables.
Kind regards
Peter Juby
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
7 | |
7 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.