Query - Sales Register Report

Hi all,
I need a Customized Sales Tax/Service Tax Report,  Which should include the sales/Service returns also.
My SAP Business One Version is SAP 2005B, PL:38
Kindly help me.

try ---
SELECT T0.DocNum, T0.DocDate, T0.DocDueDate, T0.CardName, T1.StcCode, T1.StaCode, T1.TaxRate, T1.TaxSum, T1.BaseSum, T0.DocTotal, T0.PaidToDate FROM OINV T0 INNER JOIN INV4 T1 ON T0.DocEntry = T1.DocEntry WHERE T1.StcCode =[%0] and
T0.DocDate between [%01] and [%02]
group by T0.DocNum, T0.DocDate, T0.DocDueDate, T0.CardName, T1.StcCode, T1.StaCode, T1.TaxRate, T1.TaxSum, T1.BaseSum, T0.DocTotal, T0.PaidToDate
Edited by: somi mishra on Dec 17, 2008 4:22 PM

Similar Messages

  • Purchases / sales register report

    Hi,
    I have two problem in a purchases / sales register report.
    1) In the report of the purchases / sales register, SAP show me both purchases and sales also when I select only one or the other. How I show only one or the other in a report?
    2) There is a way to show at the end of report the totals divided by IVA codes?
    Best regards.

    Hi,
    This is SAP business one forum. Please find correct forum and repost your discussion to get quick assistance.
    Please close this thread here with helpful answer.
    Thanks & Regards,
    Nagarajan

  • Sales Register Report

    HI,
    my client want the report like below format
    Invoice date    Cust. Name   Invoice NO  Descrptn    Pymt term code  Invoice amount FI doc.No  Debit  Credit
    12.08.2011  Surj exp    9000001    Process chrge     0003     25000          5               25000     23750
                                                             VAT 5 %                                                                              1250
    is it possible in standard SAP the Above Report if yes give me the T-Code
    if no provide how to generate the report what are the table and field name i need to consider to generate the above report
    Regards,
    Prasanna

    Hi
    You can get the condition type description in the table T685T pass the KSCHL into this table and get the VTEXT
    For conditions get the VBRK-KNUMV and pass this into table KONV-KNUMV , here you will get all the KSCHL
    KBETR and KWERT
    For Accounting doc you can get it from BKPF-BELNR pass the VBRK-VBELN into this table and get the BELNR.
    Instead of  Debit and credit in your report format incluse these coloumns
    Processing Charges        VAT      CST     TOTAL
    10000                                 400        0        10400
    So that you can get these values through your condition types for CST & VAT.
    IF you want to go for debit & nCredit then in BSEG table you can get the Debit & Credit in SHKZG
    where H= credit & S=debit
    regards
    Prashanth

  • Sales Tax Register Report

    Hi Experts
    I want a sales register report in which sales document should be reconciled with credit note value of that particular invoice.
    For Example, if i make a invoice of Rs.100 in which Tax value is Rs. 4, after this i made a credit note on basis of this invoice of Rs. 50 .
    now in the report value should come of 50 and tax value of 2.
    Thanks with Regards
    Arvind Kumar Singh.

    Hi Arvind,
    Check /people/navneet.dhami/blog/2010/11/04/some-useful-sql-scripts link and modify the query as per your requirement.
    Thanks,
    Neetu

  • Sales and Purchase Register Reports

    Hi all
            Here i am asking how to get purchase and sales register reports in sap business one 2005?
    I tryed in Excel Reporter but Tax Breakup is not coming.
    Thanks & Regards
    Amit

    For Sales Register:
    SELECT M.DocNum AS 'AP Inv. #', M.DocDate as 'Date', M.CardName as 'Vendor Name',M.NumAtCard as 'Bill No. & Dt.',L.ItemCode, L.Dscription,L.LineTotal as 'Amount',L.vatsum ,L.PriceBefDi as 'Rate',
    (Select Sum(LineTotal) FROM INV1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as 'BED (Rs.)',
    (SELECT Sum(TaxSum) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as 'HSCess_New (Rs.)',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as 'EDCS (Rs.)',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as 'HECS (Rs.)',
    (SELECT Sum(TaxSum) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-10 and DocEntry=M.DocEntry) as ' CVD (Rs.) ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=5 and DocEntry=M.DocEntry) as ' Ser.Tax (Rs.) ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=6 and DocEntry=M.DocEntry) as 'CS on Ser.Tax (Rs.)',
    (SELECT Sum(TaxSum) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as 'HECS_ST (Rs.)',
    (Select Sum(LineTotal) From INV3 Q Where Q.DocEntry=M.DocEntry) AS 'Freight (Rs.)',
    M.WTSum AS 'TDS (Rs.)',
    M.DocTotal as 'Total (Rs.)'
    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]')
    GROUP BY
    M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,M.DocTotal,L.ItemCode,L.Dscription,L.LineTotal,L.vatsum,L.PriceBefDi
    ORDER BY
    M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,M.DocTotal,L.LineTotal,L.vatsum,L.PriceBefDi
    For Purchase Register:
    SELECT M.DocNum AS 'AP Inv. #', M.DocDate as 'Date', M.CardName as 'Vendor Name',M.NumAtCard as 'Bill No. & Dt.',
    (Select Sum(LineTotal) FROM PCH1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-90 and DocEntry=M.DocEntry) as 'ED (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-60 and DocEntry=M.DocEntry) as 'EDCS (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=7 and DocEntry=M.DocEntry) as 'HECS (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=10 and DocEntry=M.DocEntry) as ' CVD (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=5 and DocEntry=M.DocEntry) as ' Ser.Tax (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=6 and DocEntry=M.DocEntry) as 'CS on Ser.Tax (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=8 and DocEntry=M.DocEntry) as 'HECS_ST (Rs.)',
    (Select Sum(LineTotal) From PCH3 Q Where Q.DocEntry=M.DocEntry) AS 'Freight (Rs.)',
    M.WTSum AS 'TDS (Rs.)',
    M.DocTotal as 'Total (Rs.)'
    FROM OPCH M LEFT OUTER JOIN PCH1 L on L.DocEntry=M.DocEntry
    LEFT OUTER JOIN PCH4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
    LEFT OUTER JOIN PCH5 J ON M.DocEntry = J.AbsEntry
    LEFT OUTER JOIN PCH3 Q ON M.DocEntry = Q.DocEntry
    WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]')
    GROUP BY
    M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
    ORDER BY
    M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
    Hope this will help you,
    Regards,
    Neetu

  • Sales Register on XL Reporter

    Hi all,
    I opened a sales register report definition which is available in India localization.  I'm trying to work with this definition, but I'm getting an error called 'Security Settings in MS Excel prohibit XL Reporter from running'.  Please help me out in this regard.
    Also, please explain the basic procedures to work with the definitions provided in India localization.  Is there any documentation available?
    Thanks,
    Balaji

    Hi Balaji
    In the Ms excel goto > tools>macro>security and in the security level tab set it to low option.In the Trusted sources tab check both the options trust all installed add-ins and templates and trust access to visual basic project.
    Use the link below to read about how to use the sample reports
    https://websmp103.sap-ag.de/~form/sapnet?_SHORTKEY=01100035870000707457&_SCENARIO=01100035870000000183&_ADDINC=011000358700001192682007E&
    Regards
    Louis

  • 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

  • Sales register

    Hi,
    I want to retrive the 'AMOUNT'  field values in VF13  to sales register as a new column.
    please help me.
    If u don't understand it please aske me i will elaberate it.

    Hi
    SORRY I HAVE GIVEN WRONG TCODE.IT IS VK13.
    IN VK13 V R MAINTAING PRICING CONDITIONS.IN THIS LIST V CAN GET AMOUNT.
    I HAVE TO GET THAT DETAILS TO CUTOM SALES REGISTER REPORT.
    CAN U HELP ME HOW TO GET THOSE DETAILS.
    I WANT SELECT CONDITION

  • 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

  • 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

  • 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

  • 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

  • Query vs Sales Analysis Report

    I wrote a query that does virtually the same thing as a sales analysis report -- add up all invoice totals and calculate a gross sales number.
    In the sales analysis report ItemXXX has a total sales of $1456.94
    My query ItemXXX has a total sales of $1457.73
    A $.79 discrepancy which I assumed was a result of the fact that my query doesn't include A/R Credit Memos. Only some items have this discrepancy.
    The problem is that if I do an inventory posting list on the item there are no A/R Credit Memos listed. Only A/R Invoices, A/P Invoices, and A/P Goods Receipts.
    What other documents could be affecting this number? Any other things that could be causing this?
    Thanks,
    -Steve

    Hi Nagarajan,
    Im user of Sap Business One, i need the completly query for obtain the Sales Analysis Report
    i have this but in some items dont match
    SELECT  ItemCode,   
            Sum(TotFac) - SUM(TotNC) as  'FacturadoNeto',   
            Sum(GBrutaFac)-SUM(GbrutaNC) as  'GBruta',   
            Round((Sum(GBrutaFac)-SUM(GbrutaNC))/case when  (Sum(TotFac) - SUM(TotNC))= 0 then 1 else (Sum(TotFac) - SUM(TotNC)) end  *100,2) as '% Margen'   
    FROM (   
    SELECT    
    ItemCode = T1.ItemCode, 
    Marca = (Select T2.FirmName from OMRC T2 JOIN OITM T3 on T2.FirmCode = T3.FirmCode where T3.ItemCode=T1.Itemcode), 
    TotFac = Sum(T1.Linetotal),    
    GBrutaFac = SUM(T1.GrssProfit),   
    TotNc= 0,   
    GbrutaNC = 0   
    FROM OINV T0 (NOLOCK) INNER JOIN INV1 T1 (NOLOCK) ON T0.DocEntry = T1.DocEntry                                    
    WHERE (T0.[DocDate] >='20140101' AND  T0.[DocDate] <='20141231') 
      and T0.DocType  = 'I' -- solo facturas por articulos   
    Group by  T1.ItemCode  
    Union   
    SELECT    
    ItemCode = T1.ItemCode,   
    Marca = (Select T2.FirmName from OMRC T2 JOIN OITM T3 on T2.FirmCode = T3.FirmCode where T3.ItemCode=T1.Itemcode), 
    TotFac = 0,   
    GBrutaFac = 0,   
    TotNc= Sum(T1.LineTotal),    
    GbrutaNC = SUM(T1.GrssProfit)   
    FROM ORIN T0 (NOLOCK) INNER JOIN RIN1 T1 (NOLOCK) ON T0.DocEntry = T1.DocEntry                                    
    WHERE (T0.[DocDate] >='20140101' AND  T0.[DocDate] <='20141231')
      and T0.DocType  = 'I' -- solo NC por articulos   
    Group by T1.ItemCode 
    Union
    SELECT    
    ItemCode = T1.ItemCode,   
    Marca = (Select T2.FirmName from OMRC T2 JOIN OITM T3 on T2.FirmCode = T3.FirmCode where T3.ItemCode=T1.Itemcode), 
    TotFac = 0,   
    GBrutaFac = 0,   
    TotNc= Sum(T1.LineTotal),    
    GbrutaNC = SUM(T1.GrssProfit)   
    FROM ODPI T0 (NOLOCK) INNER JOIN DPI1 T1 (NOLOCK) ON T0.DocEntry = T1.DocEntry                                    
    WHERE (T0.[DocDate] >='20140101' AND  T0.[DocDate] <='20141231')     
      and T0.DocType  = 'I' -- solo Fact Anticipos por articulos   
    Group by T1.ItemCode
    ) T   
    Group by  ItemCode, Marca

  • Query to mimic the items tab of the Sales Analysis report.

    Hi there,
    I'm currently looking to create a query that mimics the behaviour of the Sales Analysis report in B1. The items tab of the Sales Analysis report provides all the data I require - the only issue is that I would like to merge this data with some other data regarding current on hand stock quantities etc. and therefore I would like to be able to pull out the query behind the Sales Analysis report.
    I'm assuming this cannot be done and therefore I'm attempting to build a query to replicate the results. The query needs to show Item No, Item Description, Quantity Sold, Sales Amt (in system currency), Gross Profit and Gross Profit % for items within a given period.
    If this can be done relatively easily, can the query then be modified to show all items (including items that haven't sold in the date range) merely with '0' for Quantity Sold, Sales Amt etc. if the item hasn't been sold in the period, and the appropriate figures if each of these columns if the item has sold. I assume some kind of CASE statement can be used to generate this.
    So the query needs to show Item No, Item Description, Current quantity in stock, Quantity Sold, Sales Amt (in system currency), Gross Profit and Gross Profit % for all items within a given date range.
    I hope you can assist me with this problem.
    Thanks
    Grant.

    Hi,
    Thanks Gordon that was exactly what I needed.
    I've been trying to add some additional columns to the query but I'm experiencing some errors and I can't quite tell why.
    Basically, here's the code from another working query I have which I wish to merge into the query you've suggested above:
    SELECT T0.[ItemCode],
    T0.[ItemName],
    T3.[ItmsGrpNam],
    T4.[Name] AS [Sub-Category],
    T5.[Name] AS [Sub-Sub-Category],
    T0.[CardCode] AS [Pref Supplier],
    T6.[FirmName] AS [Brand],
    T0.[U_Range],
    T0.[OnHand],
    CASE WHEN T0.[StockValue] = 0 THEN 0 ELSE T0.[StockValue] END AS [StockValue],
    T1.[Price] AS [PBK GBP Price],
    CASE WHEN T0.[OnHand] = 0 THEN T0.[LastPurPrc] ELSE T0.[StockValue]/T0.[OnHand] END AS [Ave Cost],
    CASE WHEN T0.[OnHand] = 0 THEN T1.[Price]-T0.[LastPurPrc] ELSE CASE WHEN T0.[OnHand] > 0 THEN T1.[Price]-T0.[StockValue]/T0.[OnHand] END END AS [Margin],
    CASE WHEN T0.[OnHand] = 0 AND T0.[LastPurPrc] = 0 THEN 0 ELSE CASE WHEN T0.[OnHand] > 0 AND (T0.[StockValue]/T0.[OnHand]) = 0 THEN 0 ELSE CASE WHEN T0.[OnHand] = 0 THEN (T1.[Price]-T0.[LastPurPrc])/T1.[Price]*100 ELSE CASE WHEN T0.[OnHand] > 0 THEN (T1.[Price]-T0.[StockValue]/T0.[OnHand])/T1.[Price]*100 END END END END AS [Margin %],
    T0.[LastPurPrc]
    FROM [dbo].[OITM]  T0 INNER JOIN [dbo].[ITM1]  T1 ON T0.ItemCode = T1.ItemCode INNER JOIN [dbo].[OITB]  T3 ON T0.ItmsGrpCod = T3.ItmsGrpCod LEFT OUTER JOIN [dbo].[@U_SUBCATEGORY]  T4 ON T0.U_Subcategory = T4.Code LEFT OUTER JOIN [dbo].[@U_SUBSUBCATEGORY]  T5 ON T0.U_SubSubCategory = T5.Code INNER JOIN OMRC T6 ON T0.FirmCode = T6.FirmCode
    WHERE T0.[OnHand] >= 0 and T0.U_Range not in ('E','X')  
    ORDER BY T0.[ItemCode]
    Essentially I just wish to add the fields which are specified in the query above, but not in the query you've already suggested:
    SELECT T0.ItemCode,
    Max(T0.ItemName),
    Max(IsNull(T0.OnHand,0)) 'In Stock',
    SUM(IsNull(T1.Quantity,0)) 'Quantity',
    Sum(IsNull(T1.LineTotal,0)) 'Sales Amt',
    SUM(IsNull(T1.GrssProfit,0)) 'Gross Profit',
    Case WHEN Sum(Isnull(T1.LineTotal,0)) = 0 THEN 0 ELSE
    SUM(IsNUll(T1.GrssProfit,0))/Sum(Isnull(T1.LineTotal,0)) * 100 END 'Gross Profit %'
    FROM dbo.OITM T0
    LEFT JOIN dbo.INV1 T1 ON T1.ItemCode=T0.ItemCode
    LEFT JOIN dbo.OINV T2 ON T2.DocEntry=T1.DocEntry AND T2.DocDate Between [%0] AND [%1]
    GROUP BY T0.ItemCode
    I was hoping it would be fairly straight forward but so far I've had limited success.
    What am I missing here?
    Thanks in advance!

Maybe you are looking for

  • SQL Report Program Name Status

    I have this report that I need to modify. The problem here is that some of our deployments uses the same program/package but different advertisement. For example, I have package "ABC version 1" with program name "Install ABC version 1". For this part

  • XML Unbounded values into one field - Message Mapping

    Dear All, I am trying to convert an unbounded multifield XML structure to a 0.1 field so that the maltiple values are mapped into a single fields in semi-colon seperated fasion. The source: <MT_dates>    <date>05-10-2011</date>    <date>10-11-2011</d

  • Existing settings do not carry over on updating. ie: tabs below.

    on updating firefox does not carry over and of the user adjusted settings. WTF in previous version I could hover over a thumnail with the curser and it would open to size in a new phantom window. was a great feature. I set firefox to check but not in

  • Hanging on Loading Screen

    We are using Presenter v7.07 and have a quiz embedded. When we export to presenter, the file 'hangs' on the loading screen. When we changed the 'viewer.xml' file to an older version of the file it works fine - although obviously we cannot use the old

  • Using TestStand Engine API in LabVIEW

    Hi all, I am currently working for a proejct where automation of testing is involved, For which NI LabVIEW and TestStand are used. My previous experience is in LabVIEW only and not in TestStand. In the current project I have to develop a UI where use