Skip to Content

Back Order Query with IF included - New Learner

Hi all,

Apologies I am very new to learning how to write queries in SAP, I can do basic queries where I pick lots of information to display, however I am looking to write something more complex where the query only picks information up on specific terms.

For example, here is the basis of what I am wanting to find out: I need to run this query daily to check what lines have come through on back order in customers orders. We have a field in UDF where we specify whether customers allow back orders or not. I need to find out when lines are coming through (out of stock) on customers orders which don't allow back orders.

What is the correct way to do this?

Add a comment
10|10000 characters needed characters exceeded

  • Hi, Natalie:

    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 https://community.sap.com/resources/questions-and-answers (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).

    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).

    --Jerry

Assigned Tags

Related questions

1 Answer

  • Posted on Jul 25, 2020 at 11:19 PM

    Hi Natalie,

    Does this give you the answer you need?

    We use the field OCRD.PartDelivr as to whether customers accept backorders or not.

    If your UDF for backorders is different - then simply replace this field with T3.[PartDelivr] below.

    SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[Quantity]

    FROM ORDR T0

    INNER JOIN RDR1 T1 ON T0.[DocEntry] = T1.[DocEntry]

    INNER JOIN OITM T2 ON T1.[ItemCode] = T2.[ItemCode]

    INNER JOIN OCRD T3 ON T0.[CardCode] = T3.[CardCode]

    WHERE DATEDIFF(DD,T0.[DocDate],GETDATE())=0

    and T2.[OnHand] = 0

    and T3.[PartDelivr] = 'n'

    Cheers

    Rick

    Add a comment
    10|10000 characters needed characters exceeded

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.