Skip to Content
0
Sep 03, 2013 at 05:45 AM

Help With Query For Credit Value By Date Range

137 Views

Hello All

I have written a query to check for all credit notes entered in SAP between a date range

It works fine, but i need to tweek it a bit and i have been unable to do so

The query is as below

SELECT T0.[DocDate],

T0.[CardName],

T0.[NumAtCard],

T0.[DocNum],

T1.[ItemCode],

T1.[Dscription],

T1.[Quantity],

T1.[PriceBefDi],

T1.[DiscPrcnt],

T1.[LineTotal],

T0.[Comments]

FROM ORIN T0 INNER JOIN RIN1 T1 ON T0.DocEntry = T1.DocEntry

WHERE T0.[DocDate] > [%0] and T0.[DocDate] < [%1]

ORDER BY T0.[DocDate]

What i want to achieve is

I need the query to group by customer and show sub total for each customer

I need the query to only show credit notes that have the word GRA# in the remarks column

The reason being is people make mistakes sometime and sometimes a credit note needs to be entered to correct the error

I want the query to exclude these credit notes. All genunine returns have the word GRA# in the remarks column

Is this possible?