Sales Register Query

hi All,
I have this query which is working fine as desired. I want to include selection criteria of "FROM" to "To" date in this query.
SELECT DISTINCT T0.Docentry, T0.[U_ManualInvoiceNum] as 'Bill No.', CONVERT(VARCHAR(10), T0.[DOCDATE], 3) AS DOCDATE, T0.[CardName] as 'Customer Name' ,  T1.[Dscription] as 'Item Description',  T1.[Quantity], T1.[Price] as 'Price', T1.[TaxCode],
( T1.LineTotal ) as 'Basic' ,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=-90 and INV4.docentry=T0.Docentry and INV4.linenum = T1.Linenum )BED,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=-60 and INV4.docentry=T0.Docentry and INV4.linenum = T1.Linenum)Cess,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=9 and INV4.docentry=T0.Docentry and INV4.linenum = T1.linenum)HeCess,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=1 and INV4.docentry=T0.Docentry and INV4.linenum = T1.linenum)VAT,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=8 and INV4.docentry=T0.Docentry and INV4.linenum = T1.linenum)CST,
T0.[Comments] FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry --INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode inner join INV4 T3 on T1.Docentry =T3.docentry and T1.LineNum=T3.LineNum inner join CRD7 T4 on T0.cardcode = T4.Cardcode
For browse
I tried using the below mentioned query to get the date selection but it still shows all the invoices created in the system and not between specified dates.
DECLARE @FromDate DateTime
DECLARE @ToDate DateTime
/* SELECT T0.DocDate FROM OINV T0 where T0.DocDate >=[%0] */
SET @FromDate = [%0]
/* SELECT T0.DocDate FROM OINV T0 where T0.DocDate <=[%0] */
SET @ToDate = [%1]
Thanks,
Joseph

Hi,
I have these two reports for Sale register which may be useful to many so pasting it here,
BILL WISE SALE REGISTER
DECLARE @startDate DATETIME, @endDate DATETIME, @dummy INTEGER
SELECT TOP 1 @dummy = DocNum  from OINV T0 where T0.DocDate >=[%1] and T0.DocDate <= [%2]
Select @startDate='[%1]' ,@endDate = '[%2]'
SELECT DISTINCT T0.Docentry, T0.[DocNum], T0.[DOCDATE] as 'Bill Date', T0.[CardName] as 'Customer Name' ,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=-90 and INV4.docentry=T0.Docentry  )BED,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=-60 and INV4.docentry=T0.Docentry )Cess,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=9 and INV4.docentry=T0.Docentry )HeCess,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=1 and INV4.docentry=T0.Docentry )VAT,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=8 and INV4.docentry=T0.Docentry )CST,
T0.[Comments] FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry and T1.Targettype <> 14
WHERE T0.DocDate >=@startDate and T0.DocDate <= @endDate
For Browse
Item Wise Sale Register
DECLARE @startDate DATETIME, @endDate DATETIME, @dummy INTEGER
SELECT TOP 1 @dummy = DocNum  from OINV T0 where T0.DocDate >=[%1] and T0.DocDate <= [%2]
Select @startDate='[%1]' ,@endDate = '[%2]'
SELECT DISTINCT T0.Docentry, T0.[DocNum] as 'Bill No.', CONVERT(VARCHAR(10), T0.[DOCDATE], 3) AS 'Bill date', T0.[CardName] as 'Customer Name' ,  T1.[Dscription] as 'Item Description',  T1.[Quantity], T1.[Price] as 'Price', T1.[TaxCode],
( T1.LineTotal ) as 'Basic' ,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=-90 and INV4.docentry=T0.Docentry and INV4.linenum = T1.Linenum )BED,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=-60 and INV4.docentry=T0.Docentry and INV4.linenum = T1.Linenum)Cess,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=9 and INV4.docentry=T0.Docentry and INV4.linenum = T1.linenum)HeCess,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=1 and INV4.docentry=T0.Docentry and INV4.linenum = T1.linenum)VAT,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=8 and INV4.docentry=T0.Docentry and INV4.linenum = T1.linenum)CST,
T0.[Comments] FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
WHERE T0.DocDate >=@startDate and T0.DocDate <= @endDate and T1.TargetType <> 14
For Browse
Thanks,
Joseph

Similar Messages

  • Query For Sale Register

    Hi Expert I am trying a query in this query i got these feild - TransType,Docdate,Docnum,CardName,Tinno,Impoexp,Exportsale,Outward Transfer/Central Sale,form No,Total sale,Local sale,Taxcode, output tax amount total Sale including Tax,Receiver Location . Through This Query----
    select tmp1.form as [TRANS TYPE],tmp1.Docdate,tmp1.DocNum,tmp1.CardName,tmp1.TaxId11 as [TIN NO.],tmp1.IMPOREXP ,tmp1.Import as [EXPORT SALE],tmp1.INVTRANS as 'OutWard Transfer/Central Sale',tmp1.FormNo ,tmp1.Import+tmp1.INVTRANS 'TotalSale',tmp1.B4Tax as [LOCAL SALE],tmp1.TaxCode AS [TAX CODE],tmp1.VatSum as [OUTPUT TAX AMOUNT] ,tmp1.DocTotal 'TOTAL SALE INCLUDING TAX' ,tmp1.Location AS [RECEIVER LOCATION] from ( SELECT 1 'Order1','Sales-N' 'Form', T0.Docdate,T0.DocNum ,T0.CardName,T2.TaxId11 ,(case when t3.TfcId=1 then T0.DocTotal else 0 end)DocTotal ,(case when t3.TfcId=2 then T0.DocTotal else 0 end) 'INVTRANS' ,'' 'FormNo' , (case when t3.TfcId=1 then T1.TaxCode else null end)TaxCode ,(case when t3.TfcId=1 then T0.VatSum else 0 end)VatSum, (case when t3.TfcId=1 then (T0.Doctotal-T0.VatSum-t0.totalexpns) else 0 end) 'B4Tax' ,T2.IMPOREXP, 0 'Import' ,T5.Location FROM [dbo].[OINV] T0 Left Outer Join INV1 T1 ON T0.DocEntry = T1.DocEntry left outer join INV12 T2 on T0.DocEntry = T2.DocEntry left outer join OSTC T3 on T1.TaxCode = T3.Code left Outer join owhs T4 on T4.whsCode = T1.WhsCode left OUTER Join OLCT T5 on T5.Code = T4.Location where T1.LineNum = (select Top 1 linenum from INV1 where INV1.DocEntry = T0.DocEntry ) and T3.TfcId in('1','2') and T2.IMPOREXP 'Y' and T0.DocType = 'I' and t0.docdate>='[%0]' and t0.docdate<='[%1]' Union SELECT 2 'Order1','Sales-Y' 'Form',T0.Docdate,T0.DocNum ,T0.CardName,T2.TaxId11 ,0 ,0,'','', 0,0 ,T2.IMPOREXP,T0.DocTotal 'Import' ,T5.Location FROM [dbo].[OINV] T0 Left Outer Join INV1 T1 ON T0.DocEntry = T1.DocEntry left outer join INV12 T2 on T0.DocEntry = T2.DocEntry left outer join OSTC T3 on T1.TaxCode = T3.Code left Outer join owhs T4 on T4.whsCode = T1.WhsCode left OUTER Join OLCT T5 on T5.Code = T4.Location where T1.LineNum = (select Top 1 linenum from INV1 where INV1.DocEntry = T0.DocEntry ) --and T3.TfcId = 1 and T2.IMPOREXP = 'Y' and T0.DocType = 'I' and t0.docdate>='[%0]' and t0.docdate<='[%1]' union select tmp3.Order1,'INV' 'Form', tmp3.DocDate,tmp3.DocNum,tmp3.[CardName], tmp3.TaxId11,0,sum(tmp3.DocTotal) 'INVTRANS',isnull(tmp3.FormNo,'') 'FormNo' ,'' 'TaxCode', 0 'VatSum', 0 'B4Tax', '' 'IMPOREXP' , 0 'Import', tmp3.fromloc from (SELECT 3 'Order1',T4.Location 'fromloc',T0.[DocNum], T0.[DocDate],T0.U_INV_Transferor, T0.[CardName] ,T6.Transcat,(t10.credit)DocTotal ,T0.U_TIN_NO, T9.TaxId11,T6.FormNo FROM OWTR T0 INNER JOIN WTR1 T1 ON T0.DocEntry = T1.DocEntry AND T1.LINENUM = 0 AND Substring(T0.Filler,1,3) <> Substring(T1.WhsCode,1,3) INNER JOIN WTR12 T6 ON T0.DocEntry = T6.DocEntry INNER JOIN OJDT T7 ON T0.TransId = T7.TransId and T0.objtype = T7.transtype inner join jdt1 t10 on t7.transid=t10.transid left outer join owhs T2 on T2.whsCode = T0.filler left Outer join owhs T3 on T3.whsCode = T1.WhsCode left OUTER Join OLCT T4 on T4.Code = T2.Location left OUTER Join OLCT T5 on T5.Code = T3.Location left outer join OCRD T8 on T0.CardCode = T8.CardCode left outer join (select * from crd7 where crd7.addrtype = 'S') T9 on T8.CardCode = T9.CardCode and isnull(T9.Address,'') '' where T0.Jrnlmemo 'Cancelled' and isnull(T0.Comments,'') not like 'Inventory transfer no. % has been cancelled' --and T4.Location = 'MUMBAI' and t0.docdate>='[%0]' and t0.docdate<='[%1]' ) tmp3 group by tmp3.Order1, tmp3.DocDate,tmp3.DocNum,tmp3.U_INV_Transferor, tmp3.TaxId11,tmp3.[CardName], tmp3.U_TIN_NO,tmp3.FormNo, tmp3.fromloc union SELECT 4 'Order1','AR Credit-N' 'Form', T0.Docdate,T0.DocNum ,T0.CardName,T2.TaxId11 ,(case when t3.TfcId=1 then -T0.DocTotal else 0 end)DocTotal ,0 'INVTRANS','' 'FormNo' , (case when t3.TfcId=1 then T1.TaxCode else null end)TaxCode ,(case when t3.TfcId=1 then -T0.VatSum else 0 end)VatSum, (case when t3.TfcId=1 then -(T0.Doctotal-T0.VatSum-t0.totalexpns) else 0 end) 'B4Tax' ,T2.IMPOREXP, 0 'Import' ,T5.Location FROM [dbo].[ORIN] T0 Left Outer Join RIN1 T1 ON T0.DocEntry = T1.DocEntry left outer join RIN12 T2 on T0.DocEntry = T2.DocEntry left outer join OSTC T3 on T1.TaxCode = T3.Code left Outer join owhs T4 on T4.whsCode = T1.WhsCode left OUTER Join OLCT T5 on T5.Code = T4.Location where T1.LineNum = (select Top 1 linenum from RIN1 where RIN1.DocEntry = T0.DocEntry ) and T0.DocType = 'I' and T3.TfcId = 1 and T2.IMPOREXP <> 'Y' and t0.docdate>='[%0]' and t0.docdate<='[%1]' union SELECT 5 'Order1','AR Credit-Y' 'Form',T0.Docdate,T0.DocNum ,T0.CardName,T2.TaxId11 ,0 ,0,'','', 0,0 ,T2.IMPOREXP,-T0.DocTotal 'Import' ,T5.Location FROM [dbo].[ORIN] T0 Left Outer Join RIN1 T1 ON T0.DocEntry = T1.DocEntry left outer join RIN12 T2 on T0.DocEntry = T2.DocEntry left outer join OSTC T3 on T1.TaxCode = T3.Code left Outer join owhs T4 on T4.whsCode = T1.WhsCode left OUTER Join OLCT T5 on T5.Code = T4.Location where T1.LineNum = (select Top 1 linenum from RIN1 where RIN1.DocEntry = T0.DocEntry ) --and T3.TfcId = 1 and T2.IMPOREXP = 'Y' and T0.DocType = 'I' and t0.docdate>='[%0]' and t0.docdate<='[%1]' )tmp1 --where Tmp1.Location = 'SAHIBABAD' order by docdate, order1
    Now i want modifiy this report like TransType,Docdate,Docnum,CardName,Tinno,Impoexp,Exportsale,Central Sale,TAx Code of central Tax,TAx Amount of central Tax,form No,Total sale,Local sale,Taxcode, output tax amount total Sale including Tax,Inventory Transfer Doctotal,Receiver Location .
    Thanks in Advance & regard Khan

    Hi Khan,
    Can you share your solved Sales Register query with us?
    Regards,
    Vincent

  • Query for Itemwise Sales Register

    Hi Guys,
    Below is the query i have used to run Sales Register.But we need the sales register based on item wise and those Excise Duty calculations are needed for item wise instead of total document wise.
    Pls update the query ...
    SELECT M.DocNum AS 'Inv.No ', M.DocDate as 'Date', M.CardName as 'Customer Name',L.Dscription,L.Quantity,L.Price,
    (Select Sum(LineTotal) FROM INV1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
    (SELECT Avg(TaxRate) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT % ',
           (SELECT Sum(TaxSum) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST % ',
           (SELECT Sum(TaxSum) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT % ',
           (SELECT Sum(TaxSum) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as ' VAT% ',
           (SELECT Sum(TaxSum) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as 'VAT12.5 ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST 2% ',
           (SELECT Sum(TaxSum) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST @2 ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST % ',
           (SELECT Sum(TaxSum) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED % ',
           (SELECT Sum(TaxSum) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess% ',
           (SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' HCess % ',
           (SELECT Sum(TaxSum) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' Hcess ',
    L.LineTotal as 'Row Total (Rs.)',M.DocTotal as 'Doc Total'
    FROM OINV M LEFT OUTER JOIN INV1 L on L.DocEntry=M.DocEntry
    LEFT OUTER JOIN INV4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
    LEFT OUTER JOIN INV5 J ON M.DocEntry = J.AbsEntry
    LEFT OUTER JOIN INV3 Q ON M.DocEntry = Q.DocEntry
    WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]')  AND TargetType ! = 14
    GROUP BY
    M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal
    ORDER BY
    M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal
    Regards, Vamsi.

    Hi Guys, Below is the query i have used to run Sales Register.But we need the sales register based on item wise and those Excise Duty calculations are needed for item wise instead of total document wise. Pls update the query ...
    SELECT M.DocNum AS 'Inv.No ', M.DocDate as 'Date', M.CardName as 'Customer Name',
    L.Dscription,L.Quantity,L.Price, (Select Sum(LineTotal)
    FROM INV1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)', (SELECT Avg(TaxRate)
    FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT % ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST % ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT % ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as ' VAT% ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as 'VAT12.5 ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST 2% ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST @2 ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST % ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED % ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess% ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' HCess % ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' Hcess ',
    L.LineTotal as 'Row Total (Rs.)',M.DocTotal as 'Doc Total'
    FROM OINV M LEFT OUTER JOIN INV1 L on L.DocEntry=M.DocEntry
    LEFT OUTER JOIN INV4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
    LEFT OUTER JOIN INV5 J ON M.DocEntry = J.AbsEntry
    LEFT OUTER JOIN INV3 Q ON M.DocEntry = Q.DocEntry
    WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]') AND TargetType ! = 14
    GROUP BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotalORDER BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal

  • Purchase Register, sale register, & Cenvat Tax Register

    How to Create Purchase register, Sales Register, Cenvat Tax Register with total Balance
    Regds
    Edited by: Philip Eller on Jun 4, 2008 8:36 AM

    Hi Sashi,
    Create a user query from Query Wizard for
    Sales Register from Tables -OINV,INV4.
    Purchase Register from Tables - OPCH,PCH4.
    Hope above answer will helpful to you.
    Jeyakanthan.

  • Reports - Sales Register / Billing list

    Hi gyes,
    Pl provide me the transaction code (other than VF23, VF03, J1I2) to get the invoice/billing list OR sales register. My minimum requirement is to have the basic sales report with - Date, Invoice Doc No., Name of the Customer, Material, Qty, Gross Amt, Excise, VAT/CST, Freight etc. in one report.

    Hi,
    Go to help.sap.com and search with the cube name. At the right hand side list, click Query, it will give you all the queries built on top of that Infocube.
    Amit

  • Is there  any standard report in ecc for purchase,sales register

    Hi,      I woud ike to know wether there is any standard transaction for sales, purchase, pending purchase, pending sales register.
    Regards,
    Arnab.

    Arnab,
    there are tcodes like VA26, which will give you these details...
    for more informations, just press F4 on abap editor program name place... select sap applications, expand the node SD, goto SD-IS, then SD-IS-ERP then open the node VREP... there you will find the reports.. you can search for other places as well..
    more oever.. to get specific data you can go for a custom report or a custom SAP query..
    btw.. is this your user id
    regards,
    Somu

  • Subtotal of quantity in cust wise sales register

    Hi Experts....................
    please ref to the following query which provides customer wise sales register report, now what we require is sum total of quantity of a particular item code for particular customer
    e.g:- if on 01/04/09 customer A purchase 100 items of item code i1
    and on 06/04/09 customer A purchase 275 items of item code i1
    in the required report should display 100 + 275 = 375 for item code i1 & for same customer.......................................................................................................................................
    SELECT distinct
    1 as sr,'Invoice' [Document Type],
    t0.docentry,
    T0.[CardCode] as 'BP Number',
    T0.[CardName] as 'BP name',
    t0.numatcard as 'Vendor reference No.',
    t0.u_loc as 'Location name' ,
    t4.state,
    T0.[DocNum] as 'Document Number',
    --T0.[DocType],
    t0.docdate,
    ISNULL(T1.ItemCode,'Service Item') AS 'Item Code',
    T1.[Dscription],
    T1.[Quantity]  AS 'Quantity',
    t3.name as 'MAG',
    t1.linetotal as 'Net Amount',
    t1.vatsum as 'Tax Amount',
    (t1.linetotal + t1.vatsum) as 'Invoice Value'
    FROM [dbo].[OINV]  T0
    INNER JOIN [dbo].[INV1]  T1 ON T0.DocEntry = T1.DocEntry left outer join owhs t4 on t1.whscode = t4.whscode
    LEFT JOIN [dbo].[OITM] T2 ON T1.ItemCode = T2.ItemCode
    LEFT JOIN [dbo].[@ITMG]  T3 ON T2.U_itmg = T3.Code
    WHERE
    T0.[DocType] = 'I'
    and t0.cardcode between [%3] and [%4] and t0.docdate >= [%1]and t0.docdate <=[%2]
    union
    SELECT distinct 2,'Credit Memo' [Document Type],
    t0.docentry,
    T0.[CardCode] as 'BP Number',
    T0.[CardName] as 'BP Name',
    t0.numatcard as 'Vendor reference No.',
    t0.u_loc as 'Location name' ,
    t4.state,
    T0.[DocNum] as 'Document Number',
    --T0.[DocType],
    t0.docdate,
    ISNULL(T1.ItemCode,'Service Item') AS 'Item Code',
    T1.[Dscription],
    -T1.[Quantity] AS 'Quantity',
    t3.name as 'MAG',
    -t1.linetotal as 'Net Amount',
    -t1.vatsum as 'Tax Amount',
    -(t1.linetotal + t1.vatsum) as 'Invoice Value'
    FROM [dbo].[ORIN]  T0
    INNER JOIN [dbo].[RIN1]  T1 ON T0.DocEntry = T1.DocEntry left outer join owhs t4 on t1.whscode = t4.whscode
    LEFT JOIN [dbo].[OITM] T2 ON T1.ItemCode = T2.ItemCode
    LEFT JOIN [dbo].[@ITMG]  T3 ON T2.U_itmg = T3.Code
    WHERE
    T0.[DocType] = 'I'
    and t0.cardcode between [%3] and [%4] and t0.docdate >= [%1]and t0.docdate <=[%2]
    union
    SELECT distinct
    1 as sr,'Invoice' [Document Type],
    t0.docentry,
    T0.[CardCode] as 'BP Number',
    T0.[CardName] as 'BP name',
    t0.numatcard as 'Vendor reference No.',
    t0.u_loc as 'Location name' ,
    t4.state,
    T0.[DocNum] as 'Document Number',
    --T0.[DocType],
    t0.docdate,
    ISNULL(T1.ItemCode,'Service Item') AS 'Item Code',
    T1.[Dscription],
    T1.[Quantity] AS 'Quantity',
    t3.name as 'MAG',
    t1.linetotal as 'Net Amount',
    t1.vatsum as 'Tax Amount',
    (t1.linetotal + t1.vatsum) as 'Invoice Value'
    FROM [dbo].[OINV]  T0
    INNER JOIN [dbo].[INV1]  T1 ON T0.DocEntry = T1.DocEntry left outer join owhs t4 on t1.whscode = t4.whscode
    LEFT JOIN [dbo].[OITM] T2 ON T1.ItemCode = T2.ItemCode
    LEFT JOIN [dbo].[@ITMG]  T3 ON T2.U_itmg = T3.Code
    WHERE
    T0.[DocType] = 'S'
    and t0.cardcode between [%3] and [%4] and t0.docdate >= [%1]and t0.docdate <=[%2]
    union
    SELECT distinct
    2,'Credit Memo' [Document Type],
    t0.docentry,
    T0.[CardCode] as 'BP Number',
    T0.[CardName] as 'BP Name',
    t0.numatcard as 'Vendor reference No.',
    t0.u_loc as 'Location name' ,
    t4.state,
    T0.[DocNum] as 'Document Number',
    --T0.[DocType],
    t0.docdate,
    ISNULL(T1.ItemCode,'Service Item') AS 'Item Code',
    T1.[Dscription],
    -T1.[Quantity] AS 'Quantity',
    t3.name as 'MAG',
    -t1.linetotal as 'Net Amount',
    -t1.vatsum as 'Tax Amount',
    -(t1.linetotal + t1.vatsum) as 'Invoice Value'
    FROM [dbo].[ORIN]  T0
    INNER JOIN [dbo].[RIN1]  T1 ON T0.DocEntry = T1.DocEntry left outer join owhs t4 on t1.whscode = t4.whscode
    LEFT JOIN [dbo].[OITM] T2 ON T1.ItemCode = T2.ItemCode
    LEFT JOIN [dbo].[@ITMG]  T3 ON T2.U_itmg = T3.Code
    WHERE
    T0.[DocType] = 'S'
    and t0.cardcode
    between [%3] and [%4] and t0.docdate >= [%1]and t0.docdate <=[%2]
    ketan....
    Edited by: ketan.k.pande on Dec 22, 2009 7:53 AM

    Hi Ketan,
    If you want to get those sub totals, you have to create a new query to omit all details.  You could only leave few fields like:
    T0.[CardCode] as 'BP Number',
    T0.[CardName] as 'BP name',
    ISNULL(T1.ItemCode,'Service Item') AS 'Item Code',
    MAX(T1.[Dscription] ),
    SUM(T1.[Quantity])
    Group By T0.[CardCode], T0.[CardName],T1.ItemCode
    Thanks,
    Gordon

  • URGENT : REPORT for sales register

    Hi Guys,
    Anybody is having the report on sales register? logic follows like this:-
    The logic which needs to be developed is, as per input criteria given by user, which will be sales organization, plant & date range.Program needs to pick all the billing document which will satisfy the above criteria.
    Except for document cateroty N i.e. invoice cancellation (VBRK -VBTYP not equal to N) and which are marked for cancellation (VBRK-FKSTO not equal to
    X)
    From the VBRK table pick up the document condition number (VBRk-KNUMV) and then go to KONV table you will find all condition with value over their. Pick up the values as per condition type and print it. (Condition types are already mentioned in format attached).
    Their are 3 different format they have asked for, the format types will depend on the plant i.e. if plant start with 21 then it is RMC plant and accordingly appropriate format needs to be picked. Please check config for plant descrption.
    By looking at format, i feel that some changes needs to be done into it like their is no material number or descprtion mentioned in format but qty & base rate fields their. Now whether register needs to printed for every line item in invoice or ony one line item for every invoice i.e.
    consoliadted  per invoice number. If it is consolidated then what about base rate which can be different for each line item. In this case what rate needs to be print.
    Always print the invoice values line item by line item, giving each line item quantity, base price, and other pricing conditions but should have facility to sum up     fields like Quantity, Base price, all pricing conditions each customer wise. 
    I have to get this report in ALV format.
    I will reward points for useful answers.
    My mail id is [email protected]
    Waiting for reply...
    Thanks,
    Sundeep.

    Hi
          If you are using sales and operation planning in make to stock scenario its simple . As You input target sale plan and target production plan for whole one year (MC84) . So this data can be pulled out from the tables .
    For Action Need to be taken and revision you may need to have new table .
    Neal

  • Sales Analysis Query

    Dear Experts,
    Want to Sales Analysis Query same as Sales Analysis in SAP
    In standard SAP when we run report with anual slection criteria for eg, 01/04/2010 To 31/03/12
    it's show in one column not display in compare with Quaterwise & Monthwise report.
    Result for query is
    Customer Code, Customer Name, Year2010 (Sales), Year2011 (Sales), Year2012 (Sales)
    Please help me.
    BR
    Deep

    Ok........
    It was my query mistake.......
    Please try this......
    SELECT Distinct T0.CardCode,T0.CardName, 
    (isnull((SELECT SUM((case when SUBSTRING((CONVERT(VARCHAR(11),T4.DOCDATE,106)),8,11) like '2006%' then T4.LineTotal else 0 end))
          FROM INV1 T4 WHERE T4.ItemCode=T1.ItemCode ),0)) '2006',
    (isnull((SELECT SUM((case when SUBSTRING((CONVERT(VARCHAR(11),T4.DOCDATE,106)),8,11) like '2007%' then T4.LineTotal else 0 end))
          FROM INV1 T4 WHERE T4.ItemCode=T1.ItemCode ),0)) '2007',
    (isnull((SELECT SUM((case when SUBSTRING((CONVERT(VARCHAR(11),T4.DOCDATE,106)),8,11) like '2008%' then T4.LineTotal else 0 end))
          FROM INV1 T4 WHERE T4.ItemCode=T1.ItemCode ),0)) '2008',
    (isnull((SELECT SUM((case when SUBSTRING((CONVERT(VARCHAR(11),T4.DOCDATE,106)),8,11) like '2009%' then T4.LineTotal else 0 end))
          FROM INV1 T4 WHERE T4.ItemCode=T1.ItemCode ),0)) '2009',
    (isnull((SELECT SUM((case when SUBSTRING((CONVERT(VARCHAR(11),T4.DOCDATE,106)),8,11) like '2010%' then T4.LineTotal else 0 end))
          FROM INV1 T4 WHERE T4.ItemCode=T1.ItemCode ),0)) '2010',
    (isnull((SELECT SUM((case when SUBSTRING((CONVERT(VARCHAR(11),T4.DOCDATE,106)),8,11) like '2011%' then T4.LineTotal else 0 end))
          FROM INV1 T4 WHERE T4.ItemCode=T1.ItemCode ),0)) '2011',
    (isnull((SELECT SUM((case when SUBSTRING((CONVERT(VARCHAR(11),T4.DOCDATE,106)),8,11) like '2012%' then T4.LineTotal else 0 end))
          FROM INV1 T4 WHERE T4.ItemCode=T1.ItemCode ),0)) '2012'
    FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
    Group By SUBSTRING((CONVERT(VARCHAR(11),T0.DOCDATE,106)),8,11), T1.ItemCode, T0.CardName, t0.CardCode
    Regards,
    Rahul

  • Purchase register query based on down payment invoice

    Hai All,
    I am creating an invoice based on purchase order.The vat  tax is being calculated in the downpayment. I want the vat to be displayed in the downpayment invoice as well as the a/p invoice but i m not getting it in the a/p invoice. Pls guide me with the linking of tables to get the query working. I have formatted the fields req but could not link the tables...Pls guide me with that...
    Thanks & Regards,
    Neela

    Hi Neela,
    Check the thread.
    Re: Purchase register query based on down payment invoice
    FROM PCH1 T0
    INNER JOIN OPCH T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN OSLP T2 ON T0.SlpCode = T2.SlpCode
    LEFT OUTER JOIN PCH12 T3 ON T1.DocEntry = T3.DocEntry
    LEFT JOIN ODPI T4 ON T1.CardCode = T4.CardCode
    INNER JOIN DPO1 T5 ON T0.ItemCode = T5.ItemCode
    Close the thread, if issue solved.
    Regards,
    Madhan.

  • Sales Register xl report

    Hi All,
         Sales Register xl report is not working properly.  I have generated Sales Register xl report but i am not getting correct values.please explain what is the  problem.
    Edited by: silpa n on Nov 13, 2008 11:05 AM

    Hi Silpa,
    For you question of Excise i have the table wher to upload the thing but you have to create seperate template from DTW and then you can migrate.
    Regards
    Chidambaram

  • Purchse Register & sales register

    Hi,
    Dose anybody had developed a report for Purchase register & Sales register which includes the Excise as well as VAT values in it.
    I want the dump of the program as I am running very much short of time..
    Kindly help.
    Regards

    awuewuyet

  • SALES REGISTER & PURCHASE REGISTER

    HI
    EXPERTS
    CAN ANY ONE HELP ME REGARDING SALES REGISTER & PURCHASE REGISTER. IT IS A REQUIREMENT  AT IMPLMENTATION PAHSE. IS THERE ANY DOCUMENT AVAILABLE PLZ FORWARD THAT TO ME.

    HI
    EXPERTS
    CAN ANY ONE HELP ME REGARDING SALES REGISTER & PURCHASE REGISTER. IT IS A REQUIREMENT  AT IMPLMENTATION PAHSE. IS THERE ANY DOCUMENT AVAILABLE PLZ FORWARD THAT TO ME.

  • Purchase register and sales register

    Dear sir,
    how to show purchase register & sales register ?
    if any t-code pls send it.

    Hi,
    plz check the Sap EA- Acg- FA- AR or AP - Information system - Customer Balances or Vendor bal.
    Regards
    Manish

  • Purchase & Sales register India-J1IPUR/ J1ISAL

    Hello,
    We are planning to implement to use Standard SAP Provided program for Purchase register (J1IPUR) and Sales register (J1ISAL).
    Wanted to know the how useful the same is keeping in mind the Indian Tax Regulatory requirements.
    Thanks

    J1IPUR is updated by note 1993972.  I have had an open OSS message for over a year on this report.  We are now up to version 7 of the note.  The developer of this report cannot seem to figure out how to write code that works.  One version of the note fixed the timeout issue but then failed to return any data.  The latest solution from the developer is that the report needs to be run in background to get it to complete without timing out.
    I made some simple code changes and now it runs in seconds.  I suggested these back to the developer and am waiting on a new release of the note.
    There is also a problem in the code that it selects the entire contents of the MKPF table into an internal table when it does not need the data.  This also causes a memory dump.  I have this one back to the developer waiting on a response.
    This report is definitely not production ready.  For a legal report, it is amazing to me that SAP could release this report in such a state and then take over a year to correct the problem(s).  It seems as though this was released with little to no testing.  If it was tested, it was in a system with 10 PO's and 10 Sales orders. 
    If you do decide to go down this path, I strongly suggest adding a couple of indexes to RSEG.  Without them the report is unusable if you have many documents in the system.

Maybe you are looking for

  • Can't Install a Fax Modem - Snow Leopard thinks it is a printer

    We have 4 computers on a network three of which are running Snow Leopard. The fourth is a G5 running tiger with an internal modem. I have set this up to send faxes and allow other computers to use it and Printer sharing is enabled. When I try and ins

  • How do I get CC to recognise that I don't hvae LR installed to install it.

    I have been very happy using LR 5.2 beta, now its life is up I have to reinstall LR. CC says LR is up to date, I delete LR 5.2 beta, but CC thinks its still there and so I cannot renstall it. I cannot download LR now, three wasted days trying when I

  • Will Apple repair?

    I have a 3G ipod, but unfortunately the battery has completed died this weekend (or something else is wrong). I would like to try to get it fixed, so I have a few questions: 1. Will Apple still repair these ipods even though they are 5+ years old? Ca

  • How to submit a report to printer with specified language?

    hi all,    It's very strange that there's no parameter which can specify language when submit a report to printer, then how can I print Chinese when logon in English? I can display Chinese correctly in screen and spool by set the SY-LANGU = '1', but

  • Can't import Flip Mino HD video to iMovie 08, please help?

    when i connect my flip mino to the USB port, then open up iMovie, the video clips appear and ask me to import. I click on import all, then click to save the clips to my connected external Hard drive. I continue to get an error import message. I've tr