Skip to Content

ADOC and ADO1 Query


I created the query to pull qty change on Sales orders. My criteria to pull only open Orders. Query result is showing he status "Open", but the order is actually closed. How do I fix that?

SELECTT2.DocNum,T2.[DocStatus], T2.[CardName],T2.[NumAtCard], T1.LineNum+1 as 'Line', 'Qty' as 'Field',cast(T1.Quantity as varchar(18)) as 'OldValue', cast(T0.Quantity as varchar(18)) as 'NewValue', T2.UpdateDate, T4.[U_Name] as 'UpdatedBy', T2.[DocTime] FROM ADOC T2 JOIN ADO1 T1 ON T2.docentry = T1.docentry AND T2.Objtype = T1.Objtype and T1.Loginstanc = T2.LogInstanc-1 JOIN ADO1 T0 ON T2.docentry = T0.docentry AND T2.Objtype = T0.Objtype AND T1.LineNum = T0.LineNum INNER JOIN OUSR T4 ON T2.UserSign2 = T4.INTERNAL_K AND T0.LogInstanc = T2.Loginstanc WHERE T0.Quantity<>T1.Quantity AND T2.[DocStatus] = 'O' and T2.ObjType= 17 and T0.[LineStatus] = 'O' and T0.ObjType= 17

Thank you

Add a comment
10|10000 characters needed characters exceeded

  • Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time, I recommend that you familiarize yourself with (if you haven't already), as it provides tips for preparing questions that draw responses from our members. For example, you can outline what steps you took to find answers (and why they weren't helpful), share screenshots of what you've seen/done, make sure you've applied the appropriate tags, and use a more descriptive subject line. The more details you provide, the more likely it is that members will be able to assist you.

    Should you wish, you can revise your question by selecting Actions, then Edit (although once someone answers your question, you'll lose the ability to edit the question -- but if that happens, you can leave more details in a comment).

    Finally, if you're hoping to connect with readers, please consider adding a picture to your profile. Here's how you do it: By personalizing your profile with a photo of you, you encourage readers to respond.

    Julia, SAP Community Moderator

Assigned Tags

Related questions

0 Answers

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.