Vat purchasing report

Hi All,
There is a requirement in vat purchasing report to group the ap invoices based on the tax rate and it should print the sum of all the lines of one purticular rate(say 12) and then its line amout, and then sum of tax amount and in the second line .
For Example:
I have created 2 invoices 100 and 101
the report should print first the data of invoice 100
invoice 100 has 2 lines 5000 and 4000 and taxes 600 and 400 and invoice total.
the report should group invoices based on tax rate ,then sum the invoice line amount(<>'TAX') of that particular tax rate (12 ) and in the second line it should print for taxrate (10) sumof line amount..
Invoiceno. date ..... tax rate Sum(line amount) sum(tax amount) invoce total
100 2-2-2010 12 5000 600 11000
10 4000 400
101 2-3-2010 12 4000 560 7710
5 3000 150
0 2000
Can any one please tell me how this can be achieved either in sql /Rdf
Edited by: Jana on Mar 5, 2010 2:54 PM
Edited by: Jana on Mar 5, 2010 2:58 PM
Edited by: Jana on Mar 5, 2010 2:58 PM
Edited by: Jana on Mar 5, 2010 3:00 PM

Vat Reports are available in XL Reporter File Formats.
These files are located in the following folder of the Installation CD
Packages\Country-Specific Content\India"
To import them into XLreporter, please start the XLRreporter and then import them from the Xlreporter menu.
Check this SAP Note: 1074474 The XL reports provided by SAP for Indian Localisation
[https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/smb_searchnotes/display.htm?note_langu=E&note_numm=1074474]

Similar Messages

  • VAT-Purchase Register

    Hi Experts,
    I have got requirements for a user about VAT purchase register.As I am new to this module....
    Can u please provide me some sample code or any other info. on this....... the details are some thing like this.....
    Internal document reference no.     Internal document date     Inventory Type     PO number     PO date     Vendor     Invoice no. of vendor     Invoice date     Invoice amount     VAT registration No.     CST registration number     State in which Vendor is registered     Value of purchases from out of Gujarat State against C form                    Value of purchases from out of Gujarat State - other than C form                    Value of purchases from Gujarat State                         Import     Purchase from unregistered dealer

    F.12 or S_ALR_87012357 , Hope this reports may fulfill your requirements.

  • Question on Belgian VAT Purchase Journal

    HI,
    Can some one help me with Belgian VAT Reports.
    There is a report called Belgian VAT purchase journal, which is Oracle Standrad. We found that the report displays incorrect calculations for certain AP transactions.
    For some of the transactions (with offset tax) on this report , Invoice amount with VAT is always less than Invoice Amount with out VAT, where as we expect Invoice Amount with VAT to be more than Invoice Amount with out VAt.
    Can you please let us know if you are aware of any similar issues with Belgian VAT Purchase Journal and also suggest your views on how to resolve the issue.
    Many Thanks
    Kotesh

    HI,
    Can some one help me with Belgian VAT Reports.
    There is a report called Belgian VAT purchase journal, which is Oracle Standrad. We found that the report displays incorrect calculations for certain AP transactions.
    For some of the transactions (with offset tax) on this report , Invoice amount with VAT is always less than Invoice Amount with out VAT, where as we expect Invoice Amount with VAT to be more than Invoice Amount with out VAt.
    Can you please let us know if you are aware of any similar issues with Belgian VAT Purchase Journal and also suggest your views on how to resolve the issue.
    Many Thanks
    Kotesh

  • VAT Related Report

    Hi All,
    Is it possible to generate a VAT related report in SAP B1? Our requirement is
    Total Turnover     Sales Reutrns     Discount (Other than discount reflected in Invoice-Credit Notes Only)     Branch Transfer Value Outward     Branch Transfer Value Inward     Taxable Turnover     Tax Collected     Value Of local purchase @ 4%     Value of Interstate Purchase at 2%     Value of Interstate Purchase at 3%     Value of Imported Goods     Value of Other Purchases if any     Total Value of Interstate purchase     Input Tax Paid     B/F from previous month     Balance Tax Payable
    From where i have to pick all these details? Can some one help me in creating this query

    hi,
    Check reports in this link
    Implementing SAP Business One for India Localization
    /people/satish.kumarmovva/blog/2008/08/27/implementing-sap-business-one-for-india-localization
    Jeyakanthan

  • How do i get purchase Report.

    Hello All
    u201CHow do I get a purchase report from u2013 to date.  The report should be display each individual row itemu2019s  quantity, unit price, Assessable value, Base amount, tax amount .  i.e BED amount, Cess , HSCess, VAT, CST etc.u201D
    Regards
    Santhosh.K

    Try this
    Select T0.docnum,
    (select seriesname from nnm1 where series=T0.series) as InvSeries,
    T0.DocDate,T0.CardName,T0.NumatCard as 'Customer Reference',
    (select T8.TaxId11 from pch12 T8 where T8.docentry=T1.docentry) as 'TIN No.',
    T1.ItemCode,T1.Dscription,T1.AssblValue,
    CAST(T1.Quantity as Decimal(10,3)) as Quantity,T1.unitMsr as UOM,
    T1.currency,
    T1.PriceBefDi as 'Unit Price',T1.DiscPrcnt as 'Row Discount',
    CAST(T1.Price as Decimal(10,2)) as Price,
    CAST(T1.LineTotal as Decimal(14,2)) as Basic,
    T0.DiscPrcnt as 'Doc Discount',
    isnull((select sum(O1.Transvalue) from OINM O1,PDN1 N1,OPDN N0
    where
    N0.Docentry=N1.docentry and O1.Itemcode=N1.Itemcode and N1.TrgetEntry=T0.Docentry
    and O1.Warehouse=N1.WhsCode
    and O1.BASE_REF=N0.Docnum
      and O1.TransType = 20 and
    N1.Targettype=18),0) as 'GRPO Price',
    isnull((select sum(O1.Transvalue) from OINM O1
    where
    O1.Itemcode=T1.Itemcode
    and O1.Warehouse=T1.WhsCode
    and O1.BASE_REF=T0.Docnum
      and O1.TransType = 18),0) as 'Price Difference ',
    isnull((select sum(O1.Transvalue) from OINM O1,OIPF L0 inner join
    IPF1 L1 on L0.Docentry=L1.Docentry,PDN1 N1
    where
    O1.Itemcode=T1.Itemcode
    and O1.Warehouse=T1.WhsCode
    and O1.BASE_REF= L0.DocNum and
    L1.BaseEntry = N1.Docentry and
    N1.TrgetEntry=T0.Docentry
    and O1.TransType = 69),0) as 'Lande Cost',
    (SELECT T6.[BaseDocNum]
    FROM OPDN T5  INNER JOIN PDN1 T6 ON T5.DocEntry = T6 .DocEntry
    Where(T5.[DocType]='I') and (T5.[DocNum]=T1.[BaseDocNum]) and (T6.[DocEntry] = T1.[BaseEntry])
    and (T6.[LineNum]=T1.[BaseLine]) and (T6.[BaseType]='22')
    ) as PONumber,
    (SELECT T7.[DocDate] FROM OPOR T7 WHERE T7.[DocEntry]=(SELECT T6.[BaseEntry]
    FROM OPDN T5  INNER JOIN PDN1 T6 ON T5.DocEntry = T6 .DocEntry
    Where(T5.[DocType]='I') and (T5.[DocNum]=T1.[BaseDocNum]) and (T6.[DocEntry] = T1.[BaseEntry])
    and (T6.[LineNum]=T1.[BaseLine]) and (T6.[BaseType]='22')
    ) ) as PODate,
    isnull((select sum(taxsum) from pch4 where pch4.docentry=T0.docentry and pch4.LineNum=T1.Linenum and
                        pch4.statype=-90 ),0) as BasicExcise,
    isnull((select sum(taxsum) from pch4 where pch4.docentry=T0.docentry and pch4.LineNum=T1.Linenum and
                        pch4.statype=-60 ),0) as ExciseCess,
    isnull((select sum(taxsum) from pch4 where pch4.docentry=T0.docentry and pch4.LineNum=T1.Linenum and
                        pch4.statype=7 ),0) as Excisecess_he,
    isnull((select Min(BaseSum) from pch4 where pch4.docentry=T0.docentry and pch4.LineNum=T1.Linenum
                   and pch4.statype not in (-90,-60,7)),0) as TaxableTurnover,
    isnull((select sum(taxsum) from pch4 where pch4.docentry=T0.docentry and pch4.LineNum=T1.Linenum and
                        pch4.statype=4 and taxrate=10),0) as cst10,
    isnull((select sum(taxsum) from pch4 where pch4.docentry=T0.docentry and pch4.LineNum=T1.Linenum and
                        pch4.statype=4 and taxrate=12.5),0) as cst12,
    isnull((select sum(taxsum) from pch4 where pch4.docentry=T0.docentry and pch4.LineNum=T1.Linenum and
                        pch4.statype=4 and taxrate=3),0) as cst3,
    isnull((select sum(taxsum) from pch4 where pch4.docentry=T0.docentry and pch4.LineNum=T1.Linenum and
                        pch4.statype=4 and taxrate=2),0) as cst2,
    isnull((select sum(taxsum) from pch4 where pch4.docentry=T0.docentry and pch4.LineNum=T1.Linenum and
                        pch4.statype=4 and taxrate not in (10,12.5,3,2)),0) as cst_others,
    isnull((select sum(taxsum) from pch4 where pch4.docentry=T0.docentry and pch4.LineNum=T1.Linenum and
                        pch4.statype=1 and taxrate=4),0) as VAT4,
    isnull((select sum(taxsum) from pch4 where pch4.docentry=T0.docentry and pch4.LineNum=T1.Linenum and
                        pch4.statype=1 and taxrate=12.5),0) as VAT12,
    isnull((select sum(taxsum) from pch4 where pch4.docentry=T0.docentry and pch4.LineNum=T1.Linenum and
                        pch4.statype=1 and taxrate=0),0) as VAT0,
    isnull((select sum(taxsum) from pch4 where pch4.docentry=T0.docentry and pch4.LineNum=T1.Linenum and
                        pch4.statype=1 and taxrate not in (4,12.5,0)),0) as VAT_others,
    isnull((select sum(taxsum) from pch4 where pch4.docentry=T0.docentry and pch4.LineNum=T1.Linenum and
                        pch4.statype=9),0) as tcs,
    isnull((select sum(linetotal) from pch3 where pch3.docentry=T0.docentry and
    T1.linenum=(Select Max(Linenum) from PCH1 T3 where T3.DocEntry=T0.DocEntry)),0 ) as Other_expenses,
    T1.Gtotal as Itemwise_grossTotal,
    isnull(( select Rounddif from OPCH  T4 where T4.docentry=T0.Docentry and
            T1.linenum=(Select Max(Linenum) from PCH1 T3 where T3.DocEntry=T0.DocEntry)),0) as Inv_RoundDiff,
    isnull(( select DocTotal from OPCH  T5 where T5.docentry=T0.Docentry and
            T1.linenum=(Select Max(Linenum) from PCH1 T3 where T3.DocEntry=T0.DocEntry)),0)  as Inv_grosstotal
    from Opch T0, pch1 T1,OITM M1 INNER JOIN OITB B1 ON M1.ItmsGrpCod=B1.ItmsGrpCod
    where (T0.DocType='I') and T0.docentry=T1.docentry and (T0.DocDate between '[%0]' and '[%1]')
    Union All
    Select
    T0.docnum,
    (select seriesname from nnm1 where series=T0.series) as InvSeries,
    T0.DocDate,T0.CardName,T0.NumatCard as 'Customer Reference',
    (select T8.TaxId11 from RPC12 T8 where T8.docentry=T1.docentry) as 'TIN No.',
    T1.ItemCode,T1.Dscription,T1.AssblValue,
    CAST(T1.Quantity as Decimal(10,3)) as Quantity,T1.unitMsr as UOM,T1.currency,
    T1.PriceBefDi as 'Unit Price',T1.DiscPrcnt as 'Row Discount',
    -1*CAST(T1.Price as Decimal(10,2)) as Price,
    -1*CAST(T1.LineTotal as Decimal(14,2)) as Basic,
    T0.DiscPrcnt as 'Doc Discount',
    0 as 'GRPO Price',
    -1*isnull((select sum(O1.Transvalue) from OINM O1
    where
    O1.Itemcode=T1.Itemcode
    and O1.Warehouse=T1.WhsCode
    and O1.BASE_REF=T0.Docnum
      and O1.TransType = 19),0) as 'Price Difference ',
    0 as 'Landed Cost',
    (SELECT T6.[BaseDocNum]
    FROM OPDN T5  INNER JOIN PDN1 T6 ON T5.DocEntry = T6 .DocEntry
    Where(T5.[DocType]='I') and (T5.[DocNum]=T1.[BaseDocNum]) and (T6.[DocEntry] = T1.[BaseEntry])
    and (T6.[LineNum]=T1.[BaseLine]) and (T6.[BaseType]='22')
    ) as PONumber,
    (SELECT T7.[DocDate] FROM OPOR T7 WHERE T7.[DocEntry]=(SELECT T6.[BaseEntry]
    FROM OPDN T5  INNER JOIN PDN1 T6 ON T5.DocEntry = T6 .DocEntry
    Where(T5.[DocType]='I') and (T5.[DocNum]=T1.[BaseDocNum]) and (T6.[DocEntry] = T1.[BaseEntry])
    and (T6.[LineNum]=T1.[BaseLine]) and (T6.[BaseType]='22')
    ) ) as PODate,
    -1*isnull((select sum(taxsum) from RPC4 where RPC4.docentry=T0.docentry and RPC4.LineNum=T1.Linenum and
                        RPC4.statype=-90 ),0) as BasicExcise,
    -1*isnull((select sum(taxsum) from RPC4 where RPC4.docentry=T0.docentry and RPC4.LineNum=T1.Linenum and
                        RPC4.statype=-60 ),0) as ExciseCess,
    -1*isnull((select sum(taxsum) from RPC4 where RPC4.docentry=T0.docentry and RPC4.LineNum=T1.Linenum and
                        RPC4.statype=7 ),0) as Excisecess_he,
    -1*isnull((select Min(BaseSum) from RPC4 where RPC4.docentry=T0.docentry and RPC4.LineNum=T1.Linenum
                   and RPC4.statype not in (-90,-60,7)),0) as TaxableTurnover,
    -1*isnull((select sum(taxsum) from RPC4 where RPC4.docentry=T0.docentry and RPC4.LineNum=T1.Linenum and
                        RPC4.statype=4 and taxrate=10),0) as cst10,
    -1*isnull((select sum(taxsum) from RPC4 where RPC4.docentry=T0.docentry and RPC4.LineNum=T1.Linenum and
                        RPC4.statype=4 and taxrate=12.5),0) as cst12,
    -1*isnull((select sum(taxsum) from RPC4 where RPC4.docentry=T0.docentry and RPC4.LineNum=T1.Linenum and
                        RPC4.statype=4 and taxrate=3),0) as cst3,
    -1*isnull((select sum(taxsum) from RPC4 where RPC4.docentry=T0.docentry and RPC4.LineNum=T1.Linenum and
                        RPC4.statype=4 and taxrate=2),0) as cst2,
    -1*isnull((select sum(taxsum) from RPC4 where RPC4.docentry=T0.docentry and RPC4.LineNum=T1.Linenum and
                        RPC4.statype=4 and taxrate not in (10,12.5,3,2)),0) as cst_others,
    -1*isnull((select sum(taxsum) from RPC4 where RPC4.docentry=T0.docentry and RPC4.LineNum=T1.Linenum and
                        RPC4.statype=1 and taxrate=4),0) as VAT4,
    -1*isnull((select sum(taxsum) from RPC4 where RPC4.docentry=T0.docentry and RPC4.LineNum=T1.Linenum and
                        RPC4.statype=1 and taxrate=12.5),0) as VAT12,
    -1*isnull((select sum(taxsum) from RPC4 where RPC4.docentry=T0.docentry and RPC4.LineNum=T1.Linenum and
                        RPC4.statype=1 and taxrate=0),0) as VAT0,
    -1*isnull((select sum(taxsum) from RPC4 where RPC4.docentry=T0.docentry and RPC4.LineNum=T1.Linenum and
                        RPC4.statype=1 and taxrate not in (4,12.5,0)),0) as VAT_others,
    -1*isnull((select sum(taxsum) from RPC4 where RPC4.docentry=T0.docentry and RPC4.LineNum=T1.Linenum and
                        RPC4.statype=9),0) as tcs,
    -1*isnull((select sum(linetotal) from RPC3 where RPC3.docentry=T0.docentry and
    T1.linenum=(Select Max(Linenum) from RPC1 T3 where T3.DocEntry=T0.DocEntry)),0 ) as Other_expenses,
    -1*T1.Gtotal as Itemwise_grossTotal,
    -1*isnull(( select Rounddif from ORPC  T4 where T4.docentry=T0.Docentry and
            T1.linenum=(Select Max(Linenum) from RPC1 T3 where T3.DocEntry=T0.DocEntry)),0) as Inv_RoundDiff,
    -1*isnull(( select DocTotal from ORPC  T5 where T5.docentry=T0.Docentry and
            T1.linenum=(Select Max(Linenum) from RPC1 T3 where T3.DocEntry=T0.DocEntry)),0)  as Inv_grosstotal
    from ORPC T0, RPC1 T1,OITM M1 INNER JOIN OITB B1 ON M1.ItmsGrpCod=B1.ItmsGrpCod
    where (T0.DocType='I') and T0.docentry=T1.docentry and (T0.DocDate between '[%0]' and '[%1]')

  • CR2008 Purchasing Report needed

    Hi
    Has anyone created a Purchasing report in Crystal Reports 2008 based on AP Invoices and AP Credit Notes. I have created a WPA (Weekly Purchase Analysis) report but based off AP Invoice table (OPCH & PCH1), now the company is wanting to have Credit Notes added to this report.
    I have created a UDF called WPA on the OPCH form which is a Mandatory field so when running the WPA Report you can run it by WPA # and Project to get your results (Parameter), now how will I acheive this by adding the AP Credit Note fields ORPC & RPC1 to the report so if I create x2 Invoice's (different suppliers) for say WPA # 1010 and I Credit one, on the WPA Report I will want to see Invoice 1 (NumCard = 1) = R100, Invoice 2 (NumCard = 2) = 100, Credit Note 1 (NumCard = 2) = -100, Total = 100.
    Any suggestions or ideas will be most helpful.
    Regards
    Kurt Walters

    Hi Kurt,
    That is possible using "Shared Variable".
    Check this link: [Sub-report data in report|Sub-report data in report].
    1.Initialize a shared variable in Report.
    2.Pass the Credit memo value to the 'Shared variable' in Sub-report
    3.Now create a formula in Report like
          Sub-total = {Invoice total} - {SharedVariable}
    In order to know more about shared variable, post a separate question in [SAP Crystal Reports Design - Forum|SAP Crystal Reports;.
    Hope this helps.
    Regards,
    Bala

  • Reg:Vendor Sales & purchase report

    Dear All,
    We need one customzied report which is having the details about Vendor Sales & purchase transactions , if we are giving the input vendor or customer , fiscal year, comapany code, & fiscal period as the input means we need the details about the vendor sales and purchase report.
    Thanks,
    Sanakar M

    You can purchase the custom report from vendors called consultants or employees with developer keys.
    If you input the type as ABAPER, then you have the options and (hopefully) a good quality report.
    I am sure this will work....
    Cheers,
    Julius

  • Division wise Purchase Report

    In Import Purchase process how to get the report for division wise purchase,
    some material from USA some from France, and some other countries
    we need to get country wise purchase reports. how it will be possible in sap

    Use report MC$4,here enter purchase organization,_vendor country_,vendor,plant & finally period.

  • Purchasing Report Errors - Please Help

    Hey everyone!
    I am an SAP newb so bear with me please. I am having issues with a the Purchasing report on our system.
    The report takes parameters determining the time period for which the report is to be run, ex: from Jan 1 2008 - Aug 1 2008.
    The values returned by the report are:
    Item code
    Vendor
    Item Name
    Purch Unit
    Available units
    Units on Order (how many are currently dedicated to an already placed order)
    Purchase Factor
    Purchase Price
    Purchase Currency
    Avg Price
    Price
    Stock Value
    MonthToDate Sales (calculates total sales for item within time period)
    Average Sales (calculates the average sale for item within time period)
    Sales Factor
    Month on Order
    Month on Stock
    The Problems are occuring with: Month to Date Sales and Average Sales. As well as Month on Order and Month on Stock, however these are secondary.
    The report in SAP is as follows:
    BEGIN
    declare @FrmWhs varchar(8),
    @ToWhs varchar(8),
    @WhsLst varchar(254),
    @GroupCode int,
    @FrmItm varchar(20),
    @ToItm varchar(20),
    @MthAgo int,
    @GroupName varchar(20),
    @HistStart varchar(6),
    @HistEnd varchar(6),
    @ShowInactive varchar(1)
    SELECT @FrmWhs = T0.U_FrmWhs,
    @ToWhs = T0.U_ToWhs,
    @WhsLst = T0.U_WhsLst,
    @GroupCode = T1.ItmsGrpCod,
    @FrmItm = T0.U_FrmItm,
    @ToItm = T0.U_ToItm,
    @MthAgo = T0.U_MthAgo,
    @HistStart = T0.U_Hist1,
    @HistEnd = T0.U_Hist2,
    @ShowInactive = T0.U_Inact
    FROM dbo.@XXPURCH T0, dbo.OITB T1
    WHERE T0.U_FrmWhs = '%0'
    AND T0.U_ToWhs = '%1'
    AND T0.U_WhsLst = '%2'
    AND T1.ItmsGrpNam = '%3'
    AND T1.Locked = 'X'
    AND T0.U_FrmItm = '%4'
    AND T0.U_ToItm = '%5'
    AND T0.U_MthAgo = %6
    AND T0.U_Hist1 = '%7'
    AND T0.U_Hist2 = '%8'
    AND T0.U_Inact = '%9'
    SET @GroupName = '%3'
    IF @GroupName = ''
    SET @GroupCode = 0
    ELSE
    SELECT @GroupCode = T2.ItmsGrpCod
    FROM dbo.OITB T2
    WHERE T2.ItmsGrpNam = @GroupName
    SET @FrmWhs = '%0'
    SET @ToWhs = '%1'
    SET @WhsLst = '%2'
    SET @FrmItm = '%4'
    SET @ToItm = '%5'
    SET @MthAgo = %6
    SET @HistStart = '%7'
    SET @HistEnd = '%8'
    SET @ShowInactive = '%9'
    exec dbo.xxPurchReport @FrmWhs,@ToWhs,@WhsLst,@GroupCode,@FrmItm,@ToItm,@MthAgo,@HistStart,@HistEnd,@ShowInactive
    I do not fully understand how the SQL query (the stored procedure) dbo.xxPurchasing Report calculates these numbers. If it is helpful, I could post the SQL query in its entirety or in part.
    Thank you very much for your willingness to help. It is quite frustrating for me and it is so great to have knowledgeable people here to help
    -Harrison

    Thanks. That makes sense.
    I am not a database guy, but from my limited knowledge, so here is the query in its entirety:
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_NULLS ON
    GO
    ALTER  proc xxPurchReport (
         @FromWhs varchar(8) = null,
         @ToWhs varchar(8) = null,
            @WhsList varchar(255) = null,
            @GroupCode int = null,
         @FromItem varchar(20) = null,
         @ToItem varchar(20) = null,
         @MonthsAgo int = 1,
            @HistStart varchar(6) = null,
            @HistEnd varchar(6) = null,
            @ShowInactive char(1) = 'Y')
    AS
    begin
        set NOCOUNT ON
        DECLARE @StartDate datetime,
                @EndDate datetime,
                @Today datetime,
                @Periods int
        CREATE TABLE #tempwhs(WhsCode varchar(8))
        if @WhsList is null or LTRIM(RTRIM(@WhsList)) = ''
        BEGIN
           if @FromWhs is null
              set @FromWhs = ''
           if @ToWhs is null or LTRIM(RTRIM(@ToWhs)) = ''
              set @ToWhs = 'ZZZZZZZZ'
           insert into #tempwhs
           select WhsCode
             from OWHS
            where WhsCode between @FromWhs and @ToWhs
        END
        ELSE
        BEGIN
           set @WhsList = ',' + @WhsList + ','
           insert into #tempwhs
           select WhsCode
             from OWHS
            where charindex(',' + WhsCode + ',',@WhsList) > 0
        END
        if @GroupCode = 0
           set @GroupCode = null
        if @FromItem is null
           set @FromItem = ''
        if @ToItem is null or LTRIM(RTRIM(@ToItem)) = ''
            set @ToItem = 'ZZZZZZZZZZZZZZZZZZZZ'
        if @MonthsAgo is null
           set @MonthsAgo = 0
        if @MonthsAgo > 0
           set @MonthsAgo = @MonthsAgo * -1
        select @StartDate = dateadd(mm,@MonthsAgo,cast(cast(year(getdate()) as varchar(4)) + right(cast(month(getdate()) + 100 as varchar(3)),2) + '01' as datetime)),
               @EndDate = dateadd(mi,-1,dateadd(mm,@MonthsAgo,dateadd(mm,1,cast(cast(year(getdate()) as varchar(4)) + right(cast(month(getdate()) + 100 as varchar(3)),2) + '01' as datetime)))),
               @Today = cast(convert(varchar(8),getdate(),112) as datetime)
        if isnull(@HistStart,'') = '' or isnull(@HistEnd,'') = ''
           select @HistEnd = left(convert(varchar(8),@StartDate - 1,112),6),
                  @HistStart = left(convert(varchar(8),dateadd(yyyy,-1,@StartDate),112),6)
        select @Periods = count(distinct period)
          from XXSalesHistory
         where period between @HistStart and @HistEnd
         select itemcode,whscode,cast(round(cast(sum(totsale) as decimal(12,5)) / @Periods,2) as decimal(12,5)) as AvgSale,
                cast(round(cast(sum(totqty) as decimal(12,5)) / @Periods,0) as int) as AvgQty
           into #tmpavg
           from XXSalesHistory
          where period between @HistStart and @HistEnd
          group by itemcode,whscode
          order by 1
        Select ItmGrp.ItmsGrpNam,lines.ItemCode,lines.WhsCode,
               items.CardCode as DefaultVendor,items.ItemName,
               whs.OnHand,items.SalUnitMsr as SaleUnit,items.BuyUnitMsr as PurchUnit,whs.IsCommited,
               (whs.OnHand - whs.IsCommited) as Available,whs.OnOrder,items.PurFactor2,
               isnull(purprc.Price,0) as PurchasePrice,
               isnull(purprc.Currency,'USD') as PurchCurrency,
               cast(whs.OnHand / (CASE WHEN items.PurFactor2 = 0 THEN 1 ELSE items.PurFactor2 END) as decimal(16,2)) as CS,
               whs.AvgPrice,prc.Price,isnull(prc.Currency,'USD') as Currency,isnull(whs.StockValue,0) as StockValue,
               cast(sum(case lines.usebaseun
                   when 'Y' then   Lines.OpenCreQty
                   else ( Lines.OpenCreQty  * Items.NumInSale) end) as integer) as MtdSales,
               isnull(hst.AvgQty,0) as AvgSales,items.SalFactor2
          into #temprpt
          From OINV Main,
               INV1 Lines,
               OITM Items,
               OITB ItmGrp,
               OITW whs
                    left outer join #tmpavg hst
                         on hst.ItemCode = whs.ItemCode and hst.WhsCode = whs.WhsCode,
               ITM1 prc,
               ITM1 purprc
         Where Main.DocDate between @StartDate and @EndDate
           And Main.Instance = 0
           And Main.Canceled = 'N'
           and Main.DocEntry = Lines.DocEntry and lines.LineTotal <> 0
           and lines.ItemCode between @FromItem and @ToItem
           and lines.whscode collate database_default in (select WhsCode from #tempwhs)
           and Items.ItemCode = Lines.ItemCode
           and items.PrchseItem = 'Y'
           and (@ShowInactive = 'Y' or Items.frozenfor = 'N')
           and ItmGrp.ItmsGrpCod = Items.ItmsGrpCod
           and ItmGrp.ItmsGrpCod = isnull(@GroupCode,ItmGrp.ItmsGrpCod)
           and whs.ItemCode = lines.ItemCode and whs.WhsCode = lines.WhsCode
           and prc.ItemCode = items.Itemcode
           and prc.PriceList = (CASE WHEN whs.whscode = '02' THEN 6 else 2 END)
           and purprc.ItemCode = items.Itemcode
           and purprc.PriceList = (CASE WHEN whs.whscode = '02' THEN 10 else 1 END)
         Group BY
            ItmGrp.ItmsGrpNam,lines.ItemCode,lines.WhsCode,
            items.CardCode,items.ItemName,
            whs.OnHand,items.SalUnitMsr,items.BuyUnitMsr,whs.IsCommited,whs.OnOrder,items.PurFactor2,purprc.Price,isnull(purprc.Currency,'USD'),
            cast(whs.OnHand / (CASE WHEN items.PurFactor2 = 0 THEN 1 ELSE items.PurFactor2 END) as decimal(16,2)),
            whs.AvgPrice,prc.Price,prc.Currency,isnull(whs.StockValue,0),hst.AvgQty,items.SalFactor2
        union
        select grp.ItmsGrpNam,itm.ItemCode,whs.WhsCode,itm.CardCode as DefaultVendor,
               itm.ItemName,whs.OnHand,itm.SalUnitMsr as SaleUnit,itm.BuyUnitMsr as PurchUnit,
               whs.IsCommited,
               (whs.OnHand - whs.IsCommited) as Available,whs.OnOrder,itm.PurFactor2,purprc.Price,
               isnull(purprc.Currency,'USD') as PurchCurrency,
               cast(whs.OnHand / (CASE WHEN itm.PurFactor2 = 0 THEN 1 ELSE itm.PurFactor2 END) as decimal(16,2)) as CS,
               whs.AvgPrice,prc.Price,isnull(prc.Currency,'USD') as Currency,isnull(whs.StockValue,0) as StockValue,0,
               isnull(hst.AvgQty,0) as AvgSales,itm.SalFactor2
        from OITM itm,
             OITB grp,
             OITW whs
                  left join(INV1 lines inner join OINV main
                    on lines.DocEntry = main.DocEntry and lines.LineTotal <> 0
                       and main.Canceled = 'N' and main.instance = 0
                       and Main.DocDate Between @StartDate and @EndDate)
                    on whs.ItemCode = lines.ItemCode and whs.WhsCode = lines.WhsCode
                  left outer join #tmpavg hst on hst.ItemCode = whs.ItemCode and hst.WhsCode = whs.WhsCode,
             ITM1 prc,
             ITM1 purprc
            where itm.ItemCode between @FromItem and @ToItem
              and itm.PrchseItem = 'Y'
              and (@ShowInactive = 'Y' or itm.frozenfor = 'N')
              and grp.ItmsGrpCod = itm.ItmsGrpCod
              and grp.ItmsGrpCod = isnull(@GroupCode,grp.ItmsGrpCod)
              and whs.ItemCode = itm.ItemCode
              and whs.WhsCode collate database_default in (select WhsCode from #tempwhs)
              and main.DocEntry is null
              and prc.ItemCode = itm.Itemcode
              and prc.PriceList = (CASE WHEN whs.whscode = '02' THEN 6 else 2 END)
              and purprc.ItemCode = itm.Itemcode
              and purprc.PriceList = (CASE WHEN whs.whscode = '02' THEN 10 else 1 END)
        group by grp.ItmsGrpNam,itm.ItemCode,whs.WhsCode,itm.CardCode,
           itm.ItemName,whs.OnHand,itm.SalUnitMsr,itm.BuyUnitMsr,whs.IsCommited,whs.OnOrder,itm.PurFactor2,itm.LastPurPrc,purprc.Price,purprc.Currency,
           cast(whs.OnHand / (CASE WHEN itm.PurFactor2 = 0 THEN 1 ELSE itm.PurFactor2 END) as decimal(16,2)),
           whs.AvgPrice,prc.Price,prc.Currency,isnull(whs.StockValue,0),hst.AvgQty,itm.SalFactor2
        select r.*,
               cast((CASE WHEN r.OnOrder = 0
                THEN 0
                ELSE (CASE WHEN r.AvgSales = 0
                           THEN (CASE WHEN r.MtdSales = 0 THEN 999 ELSE r.OnOrder / r.MtdSales END)
                           ELSE r.OnOrder / r.AvgSales
                      END)
                END) as decimal(9,1)) as MonthsOnOrder,
               cast((CASE WHEN r.Available <= 0 THEN 0
                     ELSE (CASE WHEN r.AvgSales <= 0 THEN 999
                     ELSE r.Available / r.AvgSales END) END) as decimal(9,1)) as MonthsInStock
          from #temprpt r
         order by 1,2,3
    end
    GO
    SET QUOTED_IDENTIFIER OFF
    GO
    SET ANSI_NULLS ON
    GO
    I hope that is not too overwhelming, it is for me so any help you have to offer is truly appreciated. I am not trained in SAP but they have no one else. Thanks alot everyone!

  • Purchasing Report: Plant, Purchasing group, material type, PO, GR No.

    All SAP Gurus,
    Is there any Purchasing report available which gives the information regarding:
    Plant, Purchasing group, material type, PO, GR No., vendor, amount (all in single report only).
    Regards,

    Hi,
    Refer following reports;
    ME2N - List of PO Documents (In selection Screen use Scope of List - ALLES)
    ME80FN - General Analysis (Here in Output, select option "PO History" by clicking on the button at extreme right)

  • Open PO not showing up on purchasing reports

    We have a customer whos PO's are not showing up on our purchasing reports. I am thinking it has something to do with needing to run some type of process to maybe sync up addresses or something. Anyone have an idea!
    Thanks in advance.

    Hi,
    There are various reports in Purchasing, can you please let us know the name of the report which you are trying to run?
    Thanks,
    Raghav

  • Change BI report links in Purchasing reports ?

    Hi,
    We are in SRM 7.0.
    I want to hide some of the links in portal under the buyer role.
    Purchasing reports : In this , i want to hide some links.
    There is change launch pad option is available , but i want to hide for all the users.
    Could you please let us know whether that is poassible or not.
    For better understanding : Link : [http://img1.uploadscreenshot.com/images/orig/1/500101326-orig.jpg]
    Regards
    Venkatesh P
    Edited by: Venkatesh Padarti on Jan 6, 2011 6:10 AM

    There is one transaction LPD_CUST.
    In that i have done the changes.
    Regards
    Venkatesh P

  • 0vtype in purchasing reports

    Hi ,
    0vtype is used to differentiate a keyfigure with respect to its value type like actual value and planned value.
    But what is the use of 0vtype as a filter in Purchasing Reports where there are no planned values and why is it always 10 - does it mean that its always actual value?
    Thanks,
    JB

    Hi JB,
    I think in case of Controlling module, we have to specify 0VTYPE in query level , as in r/3 we define budget, planning figures for a period/fiscal year.
    And for purchasing it should be actuals only.
    Hope that helps.
    Regards
    Kapadia
    ***Assigning points is the way to say thanks in SDN.***

  • Purchase Report Requirement from Auditors

    Dear All
    I have a query from audit department for Purchase Reprots as follows, They require reports in one consilidated format and not to do anything in EXCEL
    requirement as follows
    a) one material--having different rates
    b) different vendorssame materialdifferent rates
    They want this report at plant, company level.
    Please guide me ASAP
    Regards
    Manoj

    Hi,
    There is SAP Standard Report for PR - ME5A
    Just check in this.
    Here in the selection screen of the reports, enter Scope of List as "ALV". And then execute the report and download to excel.
    If Scope of List as "ALV" is not there in the list then you can create the same in SPRO > MM > Purchasing > Reporting > Maintain Purchase Requisition Lists > Define Scope of List > Here select "A" and copy to "ALV", for "ALV" activate indicator "ALV grid control"
    Then go to SPRO > MM > Purchasing > Reporting > Maintain Purchase Requisition Lists > Define Default Values for Transactions > Here enter Scope of List "ALV" as default for the above reports.

  • Purchase report for Supplier

    Hi Experts
    I would like to creat a report that shows all items purchased from a specific supplier
    amount and price sum per item
    I try using the default purchase report in the system but it doesnt show the frozen/non active items.
    could you help me with this issue?
    thanks & regards.
    d.Medalion.

    Hi........
    You need to use Union All function.......
    SELECT T0.DocEntry, T0.[DocNum] As 'PO No.', T0.[DocDate], T0.[DocDueDate],
    T5.DocEntry 'DownPayment No.', T0.[CardCode], T0.[CardName], T0.[NumAtCard],
    T1.[ItemCode], T1.[Dscription], T1.FreeTxt,T1.[Quantity], T1.Price as 'PO Price',
    T4.[PymntGroup] 'Payment terms', T3.DocNum As 'GRN No.', T2.Quantity  As 'Total Rcvd',
    T1.[OpenQty], T1.ShipDate FROM OPOR T0  INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry
    LEFT Join PDN1 t2 On T1.DocEntry=T2.BaseEntry and T1.LineNum=T2.BaseLine LEFT Join OPDN T3 On T2.DocEntry=T3.DocEntry Left Join OCTG T4 On T0.GroupNum = T4.GroupNum LEFT JOIN DPO1 T5 On T5.BaseEntry=T0.DocEntry LEFT JOIN ODPO T6 On T5.DocEntry=T6.DocEntry
    Where (T0.Docstatus='[%0]' or '[%0]'='') And (T1.LineStatus='[%1]' or '[%1]'='')
    And (T6.Canceled != 'Y' or T6.Canceled Is Null) And T0.CardName='[%2]'
    Group By T0.[DocNum], T0.[DocDate], T0.[DocDueDate], T0.[CardCode], T0.[CardName],
    T0.[NumAtCard], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T1.[OpenQty], T3.DocNum,
    T2.Quantity, T1.Price, T4.[PymntGroup], T1.FreeTxt, T0.DocEntry, T1.ShipDate, T5.DocEntry
    Union All
    SELECT Null, T0.DocNum, Null, Null,
    Null 'DownPayment No.', Null, '', '',
    Null, Null, '', Sum(T1.[Quantity]) , Sum(T1.LineTotal)/Sum(T1.[Quantity]) as 'PO Price',
    Null, Null, Sum(T2.Quantity)  As 'Total Rcvd',
    Sum(T1.[OpenQty]), Null FROM OPOR T0  INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry
    LEFT Join PDN1 t2 On T1.DocEntry=T2.BaseEntry and T1.LineNum=T2.BaseLine LEFT Join OPDN T3 On T2.DocEntry=T3.DocEntry Left Join OCTG T4 On T0.GroupNum = T4.GroupNum LEFT JOIN DPO1 T5 On T5.BaseEntry=T0.DocEntry LEFT JOIN ODPO T6 On T5.DocEntry=T6.DocEntry
    Where (T0.Docstatus='[%0]' or '[%0]'='') And (T1.LineStatus='[%1]' or '[%1]'='')
    And (T6.Canceled != 'Y' or T6.Canceled Is Null) And T0.CardName='[%2]'
    Group By T0.[DocNum]
    Order By T0.DocNum
    Regards,
    Rahul

Maybe you are looking for

  • Wrong Title Appearing in Vendor Master Record

    We have a situation where when a user goes in to change the vendor master, it appears to have a title selected in the "title" field, yet one is not maintained.  They are using MK02, but the same issue appears with transaction MK03.  The vendor is mai

  • Video Out not working on 2g

    Hey I am using an iPod touch 2g with 2.2.1 firmware. I just bought a video cable (i-tec) it says "made for iPod" on it, but when I try to use it watch movies on my tv it does not work.

  • Need to find the Difference between two table

    Hello , I have stucked in program as below scenario:- I have two tables of huge data of same structure in a same schema.I need to find the difference exact values in tables. By using MINUS we can find the difference between two table ,i need to find

  • Where I can get visio file of SAML claims-based authentication process

    Hello I saw SAML claims-based authentication process flow diagram  on http://msdn.microsoft.com/en-us/library/office/hh394901(v=office.14).aspx . Please let me know where I will get the visio of this file.   Regards Avian

  • Why are the animations so choppy?

    I just did an upgrade to Yosemite and the animations (like entering Mission Control) are quite choppy. I have a late 2013 rMBP with 16GB of RAM, 2.6GHz Quad Core i7, NVIDIA GeForce GT 750M, and 1TB SSD. Mavericks had no issues and was always smooth.