SAP Purchasing report : GR Quantity values

Hi All,
  We have a purchase variance report in which the GR Quantity value is not matching the Production server data can someone tell me how the actual GR Qty is calculated because on a posting date for a PO And for Material i see a GR Qty has +ve value and -ve values and i also find that the transactions are repeating....
Can someone help me with this , if any additional information is needed ill send you that...
Thanks a lot.

HI ,
Actually in the update rules of the cube , the qunatity is being converted from PO Units to Base units , you should consider that while validating the data
And the Actual GR quantity is derived based on the below condition
     COMM_STRUCTURE-PROCESSKEY = '002' or
     COMM_STRUCTURE-PROCESSKEY = '012' or
     COMM_STRUCTURE-PROCESSKEY = '022'
     AND COMM_STRUCTURE-BWAPPLNM EQ 'MM'
     AND COMM_STRUCTURE-CPQUAOU <> 0.
BWMNG    --> 0CPQUAOU    (Gross purchase order value )
BWVORG   --> 0PROCESSKEY ( you can find the below info in help.sap )
BWVORG u2013 Transaction Key SAP BW
This field identifies the event that is based on the information in the DataSource. The contents of this field determines the importance and the behavior of other fields in the DataSource. The field ALIEF (Number of Deliveries) is, for example, only filled if the event is a goods receipt.
For more information, see SAP Note 684465: BWVORG for Purchasing Data
Hope this is usefull ,
Sathya

Similar Messages

  • How to take Purchase order Pending quantity value from Table. ?

    Hai SAP Gurus,
                             Now Using ME2N, I am taking Pending Purchase Order Value against Plant wise & Material Type wise. Its takes lomg time to see this report.. Kindly guide me  how to takes those value from table..?
    ex:  Material Type     Plant 1
           RM                     1716294228
           HIBE                         63586533
           ERSA         27143712
           VERP      7551982745
           Components      7375781142
           Total                    Rs. 16734788360

    Hi
    It is possible through ME2N plantwise pend PO report.
    Put plant and WE101 in selection parameters

  • SAP Query Report gives Repeated Values

    Hi Gurus,
    I run a fixed asset report in Quickview in SAP Query but the output shows repeated results. Example I created a report in Quickview for all assets captalized in a period. When I run the report, I see all the assets repeated several times in the report. Is there something I am missing?

    If you just need cap date, then use ANLA only in the query and it should work fine. if you are defining a join with any other table check the join.

  • No Quantity/ value update at Movement type

    Hello All,
    At Material type level with valuation area SAP controls check / uncheck Quantity/ Value updating (OMS2)
    In our specific business scaenraios, we use material type (HALB) with valuation area combination with / without Quanity & Value updating. Hnece, above setting will not work in our scenario.
    is it possible to have control of Quantity/ Value updating by using a custom movement (ex: copy of 101 to 1Z1)?
    Really appreciate your thoughts!
    Thanks
    Siva

    Hii shiva, lots of threads are available regarding this .
    have u gone thru.plz search sdn, u will get good reply.
    quantity and value update
    Quantity update and value update in case of account assignment category
    Material Type that updates Value but no Quantity
    Quantity and value updates for stock.
    quantity/value updation query
    hope u will get sm idea.
    Note : Do not use SMS Speak.Avoid links while answering,try to give your own suggestions.
    Edited by: Jeyakanthan A on Jul 22, 2011 10:25 AM

  • Display all quantity values, buy sales want highest value in same report

    Hi
    I have slares do num , and item and qty and sales cal month
    if i execute based on month i need get top sales value ( i mean higherst values for that report) and quantity need show all values?
    if i apply condition top 1 for sales its effecting qty also?
    ple let me know what is solution for this, ?

    Hi Suneel,
                     Try with this.....
    Keyfigure  -
    > properties----->calculate single value as---> maximum.
    check here....
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/1f/25883ce5bd7b1de10000000a114084/content.htm
    Hope this will help you.
    Thanks,
    Vijay.

  • Passing 'ALL' value into Two Parameters in SAP Crystal Reports

    Hi,
    I have one report made it from sql command in that there is 2 parameters one is C_Type and other is C_Type_HV both shows the records like 01,02,03,05 both the parameters are used in command where clause and also that report contain one sub report for showing summary made it from sql command in that command both the parameters are passing through where clause of command now i want to add 'ALL' as a value in both the parameters how i can do this in sap crystal report.
    for referance I give u both the query of report
    With Regards,
    Ganesh

    Hi Ganesh,
    Please have a look at this thread on how to add 'ALL' as a value for the prompt.
    All values in parameter
    -Abhilash

  • Profit Center wise value of material consumption & purchases report

    Dear Frinz,
    Can anybody revert with t-code/table from which I could be able to see purchase & consumption of material / material group Profit Center wise, from the first day of mat procurement to till date.
    Profit Center wise value of material consumption & purchases report
    =-=
    Pradip Gawande

    Hi,
    You can use T.Code: KSB1 (Display Actual cost line items) in which you can restrict the report by providing the material consumption cost elements and don't give any cost center, which displays all the cost center for the given cost element.
    Regards

  • Value questions for SAP HR Reporting

    I am working as a "SAP HR Functional consultant".
    I am preparing Value Questions that can benefit End users with respect to SAP HR Reporting.
    Could you kindly help me by sending some questions [If you have any ] & Also tell me how to prepare them?
    <b>For Exp</b>: This below example is for sales, need the same for HR scenarios ( Time management,Org Management, Budget monitoring, Leave management)
    <b>Q</b>
    1. Actor - Sales Rep                                  
    2. Question - Are there new Leads/Opportunities that need my attention?
    3.Action to take - follow-up with Oppty's contact & update Oppty Record with actions taken
    <b>Q</b>
    1. Actor - Sales Rep                                  
    2. Question - What are my territory’s/geography's monthly Sales trends?
    3.Action to take - contact customers whose sales are below expectations
    Waiting for your early reply.
    Thanks.
    Nimisha

    Hi Nisha
    We generally categorise the reports in a matrix structure based on the following criteria -
    1. Usage of the report, eg. monthly, weekly and so on
    2. Data to be processed per usage, eg. no of records
    3. Criticality of the report, eg, must have, useful, important, nice to have and so on
    4. Intended users of the report, eg, management, top management, support satff and so on
    Based on the matrix and the estimated effort required for each report, we make a decision of which reports to be created and the ranking of the reports, that is, which reports to be created on an urgent basis and which ones can be taken up later.
    Also, the same matrix can be used for determining the authorizations for the reports.
    Pls feel free to contact me in case of any further queries/clarifications.
    Regards
    Lincoln

  • Need SAP Crystal Report formula for Blance Quantity

    Hi,
         i really need a formula for SAP Crytal report my requirement is
        i have group 2 Groups  one on sale order and another one on Invoice
       Example:
            ================================================================
              Order No:100001 
             Order Quantity:1000
          =================================================================
          Detail Area invoice group
          INV#        INVQty   CreditNoQty        Balance
         10002       100               0                       900
         10003        500             100                    500   
           i need formula for balance quantity . the balance quantity subtract from order quantity and plus with credit note quantity.

    Try this:
    1) Modify the code above to:
    Whileprintingrecords;
    Numbervar x := x +1;
    If x = 1 then
    Numbervar t := ({Order qty} - Invqty) + {Credit};
    Else
    t := ({Order qty} - t) + {credit}
    2) Create a reset formula and place this on the group header 1:
    Whileprintingrecords;
    Numbervar x := 0;
    Numbervar t := 0;
    -Abhilash

  • 1099 Misc reporting for US in SAP Standard report not containing any value

    HI All,
    In my current clients requirement is to get the SAP Standard reprort for 1099 Misc reporting for US
    1) Accordingly i have done configuration for Withholding tax for US with tax type FE
    2) There are 14 WHT Tax codes under FE , like 01 = Rent , 02 = royalty, 03 = other income etc.
    3) Assigned Tax type  with Co. Code
    4) Activated WHT tax at Co. code
    5) Created WHT country US
    And also assign WHT tax type FE and respective tax code to vendors in Accounting info in Vendor Master
    Posted couple of vendor invoices and made payment for those also
    Then after this when i run the SAP Standard report for 1099 Misc reporting for US , then the output contains with no data..  but only contains vedor names and WHT tax code which i have assigned..
    I think i have missed some configuration may be . Can any one let me know the detail step by step config and process how to get proper out put in 1099 Misc reporting for US in Standard reporting..
    Regards,
    Sandip

    Hello auroar,
    I followed the path that you provided and that lead me to this part of the tree: Define File Format for Withholding Tax Reporting...This is where I found the information that I needed.
    Thank you very much.
    -Patrick
    Edited by: Patrick Smith on Oct 22, 2009 8:41 PM

  • Extracting Purchase doucument Item condition value (Urgent)

    Hi Gurus,
    Currently, I am extracting purchase order item level data using 2lis_02_itm DS in which the extract structure is modified with fields which are fetching data from Condition Type (KSCHL), Condition Value (KWERT), etc., field at run time for which code is written in CMOD.
    Now, user requirement is some what like this: they maintain KWERT for one of the condition type after a week/a month or 2 months (not fixed) of PO creation date.
    Problem: In current extraction the data is comming for all the values changed or records added at item level (like material number, quantity, value, net value, etc.) but its not extracting the change in Condition Value (KWERT).
    <b>Please explain why?</b>
    Also, I tried to create a view based on the tables EKKO, EKPO and KONV but since KONV is pool table it's not allowing to create one.
    Tried to create function module by changing standard function module RSAX_BIW_GET_DATA_SIMPLE_1 and passing an custom extract structure created with only few (required) fields. The problem with this one is that in OPEN CURSOR ..... area when I am trying to write select statement which contains INTO clause, its giving error while checking where as query is working when tested as a report output.
    <b>Also, pls. let me know weather any provision is available on extraction of Condition data for each item in a PO is available in SAP's standard DS or BC. The one like they have condition level DS for application area SD.</b>
    for any further details pls. let me know.
    Thank You in advance.
    Points will be awarded to satisfying answer.
    Regards,<b></b><b></b>

    Good afternoon Joshi,
    It is unfortunnatelly very normal that the changes of the conditions are not loaded into BI... When you enhanced a DS, all the fields you add are simply calculated for each line that are in the delta queue. Here the change of a condition is not recognize as a change for BI, so no record is created in the delta queue so you extra fields are not calculated...
    The simplest way to check on which field a change is triggering a record in the delta queue is to check the fields in the extract structure in transaction LBWE for your datasource.
    One solution might be to assign one of the sub-totals to that condition (if you already use the 6 available sub-totals I remember that there was a way to create some extra ones...)
    If this does not work, to extract data from a pool table, you can always create in infoset query in transaction SQ01. To my knowledge there is no BC datasource  for PO condition.
    hope it helps,
    Rodolphe
    I do not think

  • 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

  • Open Sales Order quantity & value

    Hi,
    We have a requirement here of report to show open sales order quantity & value for any month (monthend). There is a datasource 2LIS_11_V_ITM which gives Open order quantity. I have created an ODS with 2LIS_11_VAITM & 2LIS_11_V_ITM which can give me desired qty & value, but only for date of last data upload and not for date in the past.(and to get that, I have to sumup all open orders quantity without using any date filter)
    I am thinking of creating a Infocube over this ODS to update the Open Order qty & value at the monthend (Snapshot scenario). But to update this, I am not able to get the logic for date to be used in time dimension.
    If anyone can think of the solution or any alternate way to develop this kind of report, your help/suggestions are most welcome.
    Thanks,
    Vikram.

    Hi Vikram,
    Find the link, which solves u r requirement
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/bi/arobustdesignofopensalesorderdataflow
    Thanks & Regards
    Ramakrishna Kamurthy

  • MC$4 report shows PO value in wrong currency

    MC$4 report shows PO value in wrong currency EUR (EURO) eventhough PO
    was created with SEK (swiss) currency. Report picks data from info
    table S012 that also reflects wrong currency.
    Please check attached example....
    Currency is getting picked up in table S012 info-structure from company
    code table T001 (PO belongs to) not from purchase order.
    This is certainly bug in standard SAP LIS report. This is inbuilt LIS feature given by SAP & we cannot do any fixing.
    Can you provide solution how we can correct this error. How to display correct currency in report & info-structure S012.

    hi
    in the report the system might be taking the co code currency
    what u have to do is go to  MC$4  press ctrl+F7
    u will get the currency change option change it to what u want
    regrads
    kunal
    awrad if helpful

  • 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!

Maybe you are looking for

  • ITunes 10.6 issues, artwork, etc.

    Issues I'm having with the past couple iTunes updates: I can't cycle through artwork on songs that have more than 1 image embedded in metadata.  I used to be able to click arrows to cycle through the images. I can't click the scroll bar to change my

  • AR invoice with payment can replace AR downpayment invoice

    We issue Proforma Invoice (Quote), then issue AR downpayment to collect all payments before we generate legitimate Drop Ship invoice to avoid any non-collect payment. Not sure "AR invoice with payment" need generate invoice first or in the same time

  • Why does Firefox seize control of my PC "for updates" as soon as it is turned on? Leave me alone, for cryin' out loud!

    All I want to do is connect with MSNBC via Mozilla. But each time I click on the Mozilla icon, up comes Firefox with "updates." How can Firefox believe that it can force its way into my home, seize my computer, and then force me to sit here while wai

  • AE CS6 Crashes after Photoshop Update

    AE was working okay for the week that I'd had it installed, but a couple hours ago, the Adobe Update downloaded and installed an update for Photoshop. The very next time I launched AE, it crashed with the following information: Problem signature:   P

  • Audio/ sequencing

    I've found myself with a bit of a burden. I couldn't capture clips onto sequence 12.6.06 (I date my sequences to stay sane). But I found that I could capture them onto yesterday's sequence 12.5.06. How this happened I have yet to figure out. After ho