Skip to Content
0
Former Member
May 02, 2014 at 02:39 PM

Sales analysis report - in query form?

1003 Views

Good afternoon. Looking for a bit if help/advice.

I'm not a complete novice to SAP but what I need is confusing me slightly. I understand the sales analysis report uses many different table as part of its calculations. A company I've recently began working for, who has had SAP for a while, has used sales analysis reports alongside some bespoke reports that are reporting different data.

Here is their report:

SELECT T0.[DocNum] AS 'Invoice No.', CONVERT(VARCHAR(10),T0.[DocDate], 103) AS 'Invoice Date', T0.[NumAtCard] AS 'Cust Order No.', T4.[ItemCode], T5.[U_MSKU] AS 'Manuf SKU', T4.[Dscription] AS 'Description', T6.[ItmsGrpNam] AS 'Item Group', T4.[Quantity], T4.[Price] AS 'Net Unit Price', T4.[LineTotal] AS 'Net/Line Total', T0.[U_ClientNam] AS 'Client Name', T2.[Name] AS 'Division', T1.[Name] AS 'Business Unit', T3.[StreetS] AS 'Ship-to Street', T3.[CityS] AS 'Ship-to City', T3.[ZipCodeS] AS 'Ship-to Postcode'

FROM OINV T0

LEFT JOIN [dbo].[@BUSINESSUNITS] T1 ON T0.U_Bizunits = T1.Code

LEFT JOIN [dbo].[@DIVISIONS] T2 ON T0.U_Division = T2.Code

INNER JOIN INV12 T3 ON T0.DocEntry = T3.DocEntry

INNER JOIN INV1 T4 ON T0.DocEntry = T4.DocEntry

INNER JOIN OITM T5 ON T4.ItemCode = T5.ItemCode

INNER JOIN OITB T6 ON T5.ItmsGrpCod = T6.ItmsGrpCod

WHERE T0.[DocDate] BETWEEN [%0] AND [%1] AND T0.[CardCode] = [%2]

It just doesn't give the same totals as the sales analysis report but I can't reproduce the sales analysis report. How would I go about getting the right figures? Because what we ideally need is to filter the sales analysis results by some of our custom fields:

[U_ClientNam], [Name] etc.

How would I go about this? Can I extract parts of the sales analysis report somehow and run it as a query I can manipulate?

Thanks.