Skip to Content
avatar image
Former Member

SQl Report - Sales Orders closed today

Hi All

in our business, it may take multiple deliveries before a Sales Order is completed and closed. I've managed to write the following query (with my limited skills) but it would only appear to pick up a Sales Order that is closed when delivered in full by a single delivery....

SELECT T0.[DocNum], T0.[CardCode], T0.[CardName],T0.[UpdateDate] AS 'Closed On' FROM ORDR T0 WHERE T0.[DocStatus] ='C' AND T0.[UpdateDate] >= GETDATE () - 4

I want to be able to produce a report that is triggered when the Sales Order is closed as a result of the last delivery to close that order.

Could anyone assist please?

Many thanks

Derek

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    May 26, 2017 at 07:46 AM

    Hi Derek,

    It seems you want to know last delivery date against sales order.

    You can make join with Delivery (ODLN & DLN1) by baseentry and baseline and find max delivery date by group by and having clause.

    Regards,

    Zuber Kazi

    Add comment
    10|10000 characters needed characters exceeded

  • May 26, 2017 at 01:14 PM

    Hi,

    Please check this thread https://archive.sap.com/discussions/thread/3631338

    Regards,

    Nagarajan

    Add comment
    10|10000 characters needed characters exceeded