Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3184

Help simplify SQL report

$
0
0

Hi guys. Well its just that i came up with this code and every time i run it in Query generator. i always end up in shutting down of SAP "run out of memory". So i thought maybe the code is too complicated or its the system itself that cant prepare the report.

 

 

SELECT 'AR Invoice',

T0.[DocDate] AS 'Posting Date of Invoice',

T0.[DocNum] AS 'Invoice Number', T2.[CardName] AS 'Customer/Vendor Name',

T0.[DocTotal] AS 'Invoice Amount',

T1.[SumApplied] AS 'Collected Amount',

T2.[DocNum] AS 'Collection Reference',

T2.[DocDate] AS 'Posting Date of Collection',

T3.[SlpName] AS 'Salesman',

T4.[ItemCode],

T4.[ItemName],

T5.[ItmsGrpNam],

T6.[Price]

FROM  [dbo].[OINV] T0  INNER  JOIN [dbo].[RCT2] T1  ON  T1.[DocEntry] = T0.[DocEntry] 

INNER  JOIN [dbo].[ORCT] T2  ON  T2.[DocNum] = T1.[DocNum]

INNER  JOIN [dbo].[OSLP] T3  ON  T3.SlpCode= T0.SlpCode

INNER  JOIN [dbo].[OITM] T4  ON  T4.ItemCode= T4.ItemCode

INNER  JOIN [dbo].[OITB] T5  ON  T4.ItmsGrpCod= T5.ItmsGrpCod

INNER  JOIN [dbo].[ITM1] T6  On  T4.ItemCode= T6.ItemCode

WHERE T2.[DocDate] >= [%0] AND T2.[DocDate] <= [%1]

 

 

 

 

UNION ALL

 

 

SELECT 'AR Credit Memo',

T0.[DocDate] AS 'Posting Date of Invoice',

T0.[DocNum] AS 'Invoice Number', T2.[CardName] AS 'Customer/Vendor Name',

T0.[DocTotal] AS 'Invoice Amount',

T1.[SumApplied] AS 'Collected Amount',

T2.[DocNum] AS 'Collection Reference',

T2.[DocDate] AS 'Posting Date of Collection',

T3.[SlpName] AS 'Salesman',

T4.[ItemCode],

T4.[ItemName],

T5.[ItmsGrpNam],

T6.[Price]

FROM  [dbo].[OINV] T0  INNER  JOIN [dbo].[RCT2] T1  ON  T1.[DocEntry] = T0.[DocEntry] 

INNER  JOIN [dbo].[ORCT] T2  ON  T2.[DocNum] = T1.[DocNum]

INNER  JOIN [dbo].[OSLP] T3  ON  T3.SlpCode= T0.SlpCode

INNER  JOIN [dbo].[OITM] T4  ON  T4.ItemCode= T4.ItemCode

INNER  JOIN [dbo].[OITB] T5  ON  T4.ItmsGrpCod= T5.ItmsGrpCod

INNER  JOIN [dbo].[ITM1] T6  On  T4.ItemCode= T6.ItemCode

WHERE T2.[DocDate] >= [%0] AND T2.[DocDate] <= [%1]

 

 

I just wanted to see the informations on the invoice containing the invoice date, invoice amount, salesman, collected amount, collection ref #, AR CM #, AR CM amt, AR CM date, items sold, item price, profit.

 

Will it be possible? Thanks all!!


Viewing all articles
Browse latest Browse all 3184

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>