Purchase Price Variance Report

I am trying to write a query to understand whether we have a purchase price variation from the latest invoice to the second latest invoice. I am having a problem gaining the information for the second purchase invoice as SAP Query generator seems to state that The sub query for the second to last invoice is bringing through more than 1 value. Could someone give me some help on how to do this better.
SELECT DISTINCT T0.[ItemCode], T0.[Dscription],
(Select  Top 1 T2.[Price] FROM PCH1 T2 WHERE T2.[ItemCOde]=T0.[ItemCode] ORDER BY T2.DocDate) AS " LAST PURCHASE PRICE",
(Select  Top 1 T2.[DocDate] FROM PCH1 T2 WHERE T2.[ItemCode]=T0.[ItemCode] ORDER BY T2.DocDate) AS " LAST DATE PURCHASE PRICE",
(select Top 1(Select Top 2 T3.[Price] FROM PCH1 T3 WHERE T3.[ItemCode]=T0.[ItemCode] ORDER BY T3.DocDate) ) AS " 2nd LAST PURCHASE PRICE"
FROM PCH1 T0  INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode
WHERE T1.[PrcrmntMtd] ='b'
ORDER BY T0.[ItemCode]

SELECT DISTINCT T0.[ItemCode], T0.[Dscription],
(Select  Top 1 T2.[Price] FROM PCH1 T2 WHERE T2.[ItemCOde]=T0.[ItemCode] ORDER BY T2.DocDate DESC) AS " LAST PURCHASE PRICE",
(Select  Top 1 T2.[DocDate] FROM PCH1 T2 WHERE T2.[ItemCode]=T0.[ItemCode] ORDER BY T2.DocDate DESC ) AS " LAST DATE PURCHASE PRICE",
(select Top 1 TA.[PRICE] FROM (Select Top 2 T3.[Price] FROM PCH1 T3 WHERE T3.[ItemCode]=T0.[ItemCode] ORDER BY T3.DocDate DESC) TA ) AS " 2nd LAST PURCHASE PRICE",
(select Top 1 TA.[DocDate] FROM (Select Top 2 T3.[DocDate] FROM PCH1 T3 WHERE T3.[ItemCode]=T0.[ItemCode] ORDER BY  T3.DocDate DESC) TA ) AS " 2nd LAST PURCHASE PRICE DATE"
FROM PCH1 T0  INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode
WHERE T1.[PrcrmntMtd] ='b'
ORDER BY T0.[ItemCode]
I have ammended the sql to desc the order by. and this is now giving me the same results in both columns. I need to reverse the order by in 2nd last columns but cant seem to get this to work in SQL. Another option would be to take the bottom value of the Top 2. But i do not know how to do this could someone help me out?Either option is fine.

Similar Messages

  • Purchase Price Variance Report completes with error status

    Dear Members,
    I am using R12.1.3 Vision Instance.
    When I ran the report Purchase Price Variance Report, it completed with an error.
    The error message is :-
    Enter Password:
    REP-1212: Object 'F_h_report_date' is not fully enclosed by its enclosing object 'Body'.
    REP-0069: Internal error
    REP-57054: In-process job terminated:Terminated with error:
    REP-1212: Object 'F_h_report_date' is not fully enclosed by its enclosing object 'Body'.
    Can any one please guide me in resolving this issue?
    Many thanks in advance.
    Regards.

    HI,
    Check the below references, it would address your issue
    Purchase Price Variance (Xml) Post Process Failed [ID 1341213.1]
    Report Error Rep-1212: Object 'F_report_date' [ID 567886.1]
    Regards,
    Ivruksha

  • Purchasing price variance report

    dear all,
    I have to generate the purchasing price variance report...
    Report to analyze and compare the following data elements from the invoice and standard cost:Period Actual average price per unit.YTD actual average price per unit o current year.YTD actual average price per unit o previous year.Current (actual) standard cost per unit.
    The tables to be used Ekko/ Ekpo/Ekbe.
    Best regards

            Setting of Chartrange and Labelrange (1)
    .ChartRange  = .Range(start, end)
    .ChartRange  = .Range(.Cells(row#,column#), .Cells(.Rows.Count row#, column#))
    .ChartRange  = .Range(.Cells(1,1), .Cells(.Rows.Count-1, 5))
    0
    1
    2
    3
    4
    5
    0
    Label Range
    ** Header names not to be exported to chart **
    1
    4
    3
    -8
    2
    4
    3
    -7
    3
    5
    2
    -6
    4
    7
    21
    -5
    5
    18
    35
    -4
    6
    15
    25
    -3
    7
    20
    16
    -2
    8
    0
    0
    32
    2.5
    5
    -1
    .ChartRange  = .Range(.Cells(2,1), .Cells(.Rows.Count-1, 5))
    0
    1
    2
    3
    4
    5
    0
    Label Range
    ** Header names not to be exported to chart **
    1
    ** data not to be exported to chart **
    -8
    2
    4
    3
    -7
    3
    5
    2
    -6
    4
    7
    21
    -5
    5
    18
    35
    -4
    6
    15
    25
    -3
    7
    20
    16
    -2
    8
    0
    0
    32
    2.5
    5
    -1

  • Purchase Price Variance Report - incorrect calculation

    Good afternoon all,
    As a relative new comer to Oracle I'm after some help/advice.
    When running a PPV report I'm not convinced the report is returning the correct answer. The report seems to be calculating the PPV as Qty x PO Price. It should be Qty x (PO price - Standard Cost).
    How can I find out if this is a bug / determining whether there is already a solution to the issue? Version R12.
    Thanks
    Jon

    You should log a service request with Oracle Support on this. Oracle documentation says that the PPV calculation should be just like you say it should be. So if the report is not doing that calculation, sounds like a program problem that needs to be identified and fixed. If there is a fix already, support will tell you what it is.
    John Dickey
    Edited by: John Dickey, McCarthy on May 11, 2010 2:57 PM

  • Purchase Price Variance (Standard Costing) with Intercompany

    We are missing Intercompany transactions in Purchase price variance report. Is there a setup which let's us include these transactions to be captured by PPV report
    We do have standard costing in all Organizations

    Finally got this answered from Oracle Support below is what they said. Does not make sense but atleast we have an answer
    In principle the internal requisition hits the interorg variance account which is defined at the shipping network and is different from purchase price variance(PPV) account of the organization. So this is not included in PPV report. PPV report is only meant for purchase orders.
    Best practice would be to define different account for PPV and interorg variance. Use PPV report to match PPV account with GL and use material distribution account detail report for Interorg variance.
    If the customer defines PPV and Interorg variance account as the same then the workarounds would be :
    1) Use material distribution account detail report.
    Or
    2) In R12 use SLA account balance reports

  • Report for Purchase Price Variance

    Hi,
    Is there any standard report for finding Purchase Price Variance between Purchase Order and Material master
    regards,
    Mallik

    Hi Mallik,
    There is no std report for Purchase price variance .
    But you can check KSB1 , where you can find the Price difference which is going to your PRD account .
    You can find out your PRD G/L account .
    Now go to KSB1 . In the cost element field give the PRD G/L account .
    After executing change the layout as per your requirement .
    Now you can see the Pur Price variance for the particulat material for the PO .
    Otherwise you need to develop a customised report .
    Hope this helps .
    regards

  • Standard SAP report for purchase price variance

    Hi All,
    I need to know if there is a standard SAP report that shows the purchase price variance.
    Thanks,
    Regards

    Hi Ritika,
    There is no standard report available to compare purchase order price cost and standard cost of a material.
    You can check if FBL3N helps to resolve your purpose or not. Or else you have to make a customized report with the help of ABAP'er on the informations based on the following tables.
      MBEW
            EKKO
            EKPO
            EKBE
           MKPF       
            MSEG                  
            KEKO
            KEPH,                        
            BKPF                                            
            BSEG                                          
            LFA1         
    Thanks,
    Vasanthan

  • Report to view Manufacturing variances - Purchase Price Variance

    Report to view Manufacturing variances - Purchase Price Variance, Materials Usage variance, Labor Usage variance.
      for above reports if standard tcodes are available in SAP please provide them or else explain how to develop these reports in SAP
    Spandana

    Hi
    You can use KKO0 reports...
    For that, assign your Cost Comp Str in OKN0 and choose Product Group = material group.. This is one time config
    Execute KKRV monthly after all period end setttlements are over... Then you can view KKO0 reports
    br, Ajay M

  • Purchase Price comparicion Report

    Hi,
    If any standard Sap Purchase Price comparicion Report are there in Sap. plz give me t Code

    Hi,
    You can find the prices for various POs in T_code ME1P with variance.Also in T_code ME81.
    Hope this will help you.
    Regards,
    Goraksh.

  • Formulation in a Price Variance Report

    Hi everyone,
    I had a quick question. Im currently working on a price variance report and and using cube 0BBP_C01 Global Spend Point to Point connection.
    The client wants the Unit of Measure on the PO to be consistent with the Unit of Measure on the Invoice.
    However the Standard price in the Master data is based on the USAGE unit of measure. (Not the Purchase unit of measure)
    I need to convert the USAGE unit of measure (master data) to the PURCHASE unit of measure so that the PO unit of measure is consistent with the INVOICE unit of measure.
    How can I do that? Is there an InfoObject that does that?
    Cheers

    BI 7.0, in transformation in the rule, you can select or define the conversion for the UNIT of measure quantity.
    refer:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/27/b65c42b4e05542e10000000a1550b0/content.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/1b/325d4217139041e10000000a1550b0/content.htm

  • Material purchase price variance and different cuurrency in IR

    we have a requirement to split  price variance and freight purchase price variance in goods receipt stage, but the problem is condition type can not be assigned COPC original group. so what are the tables I can use to split the two ppvariance using customized report?
    also in GR, accrued freight now is using month end rate, but we want it to be planned rate(another exchange rate type), is it possible to configure?
    during invoice recept, standard can't maintain different currency from PO currency, is it possible to reconfigure the system to use another currency for invoice recept?

    This is the answer from OSS
    Dear Customer,
    the system works as designed.
    When Material Ledger is activated, price differences are always
    generated under the circumstances you have described. The reason is
    that when material ledger is activated, price differences must not be
    included into the stock changes value, otherwise the system would
    not be able to calculate an actual price.
    When Material Ledger is activated, the customizing setting
    for handling price differences in the subcontracting process has no
    effect.
    Best regards,
    Santiago Lorite
    AGS Primary Support, Business Suite & Technology u2013 Logistics

  • Pipeline Materials: Purchase Price Variances

    Hi,
    Can anybody please guide me on how to handle Purchase Price Variances of Pipeline Materials. As pipeline materials doesn't have any POs and invoices, how is it possible to post the PPV so that the variances are recorded in material ledger.
    Best Regards,
    Ganesh Perumalla

    Hi,
    I could see from SAP Notes and Help the following:
    If the consignment prices have changed since the original goods receipt, post the credit memo in Financial Accounting. Clear the invoice and the credit memo in Financial Accounting.
    But the above Credit memo doesn't update the Material Ledger.
    SAP Notes advices to use the function modules FU EXIT_RMVKON00_001, FU EXIT_RMVKON00_002 and FU EXIT_RMVKON00_003.
    If somebody already worked on this scenario, could you please provide any details.
    Best Regards,
    Ganesh Perumalla
    <u><b>FU EXIT_RMVKON00_001</b></u>
    Text
    Customer Exit: Consignment Settlement - Change Invoice Data
    Functionality
    Report RMVKON00 (Settle Consignment/Pipeline Liabilities) calls this customer-specific function module.
    Report RMVKON00 calculates the invoice data from the withdrawals to be settled and calls the interface to Financial Accounting (function module AC_DOCUMENT_CREATE). Before calling the function module, you can change the following data:
    Document header (internal table T_BKPF), contains only one line
    Document items (internal table T_BSEG), the first line contains the vendor line item, the following lines contain the invoice items
    The following information is available:
    The company code (I_BUKRS) and the vendor (I_LIFNR), for which you are creating the document.
    Parameters
    I_BUKRS
    I_LIFNR
    T_BKPF
    T_BSEG
    T_BSET
    T_RKWA
    Exceptions
    ERROR
    Function Group
    XM08
    <u><b>FU EXIT_RMVKON00_002</b>____________________________________________________</u>
    Text
    Customer Exit: Consignment Settlement - Fill RKWA at Goods Withdrawal
    Functionality
    Report RMVKON00 (Settle Consignment/Pipeline Liabilities) calls this customer-specific function module and fills structure CI_RKWA.
    In report RMVKON00, database table RKWA is changed at settlement. In table RKWA, structure CI_RKWA exists as an include that can incorporate customer-specific fields. The system can fill structure CI_RKWA at goods withdrawal or at settlement. The system uses this function module to fill structure CI_RKWA at the time of settlement.
    The RKWA entry for the withdrawal (parameter I_RKWA) is available for filling structure CI_RKWA.
    For technical reasons, it is not possible to return structure CI_RKWA, instead, the whole of table RKWA is returned using the parameter E_RKWA. However,changes to table RKWA that are not part of structure CI_RKWA, are ignored by report RMVKON00.
    Notes
    The system only adopts structure CI_RKWA if the value 'X' is passed on at parameter E_CHECK.
    Parameters
    I_RKWA
    E_RKWA
    E_CHECK
    Exceptions
    ERROR
    Function Group
    XM08

  • CST amount is debit in the purchase price variance

    Hi
    We are maintaining std in the materials master
    and price procedure as taxinj
    While doing migo, the CST amount is debit in the purchase price variance and credit in the GR/IR RM,
    We need to debit the CST amount in the in the Raw material account
    what are the settings i need to carry out Plz give suitable suggestions.
    in tax code we are not maintining any G/L account for the CST
    Edited by: K. Raghuram on May 19, 2009 12:48 PM
    Edited by: K. Raghuram on May 19, 2009 1:02 PM

    Hi Raghuram,
    I think,the only possiblity for this to happen is due to the standard Price in the Mterial Mater you are using.
    Means in the Material Master ,the Price key is a standard pricing.
    So ,when ever you do a GRN ,the PO value will go and hit the Material account upto to the Standard price maintained in the material Master.
    if the amount is more than it ,then amount difference will hit the Price variance account.
    so in your case ,the CST is inventorised one ,i believe.. so that is the reason it is behaving so.
    if there is somethig else required.provide a clear insight of the Problem.
    Regards
    Anjanna

  • Purchase price variance in subcontracting order

    Our customer has the following scenario:
         Purchase account is posted with the value of stock subsequently purchase price variance is a legal account
         Material ledger is active
         Inventories are managed with standard price for each material code
         Latin method management of inventories post stock values on managerial account
    In good receipt with a subcontracting order, in case of purchase price variance, legal account of purchase price variance is posted generating a wrong reconciliation between managerial and legal posting.
    Example
    The subcontractor is a co packer that assembles material A to produce material B
    Material  A has a standard price of   3
    Material B has a standard price of     5
    If Co packer fees have a value     of     2 no purchase price variance occurs during good receipt, as a matter of fact :
    (Co packing fees) 2 + (Material A)  3 = (Material B) 5
    Else if co packer fees have a value of 3 a purchase price variance of 1 occurs and itu2019s posted using transaction key u201CPRDu201D. On FI the following document is posted:
    Legenda  : L stands for legal account , M stands for managerial account
    (L) Co packing Fees                                         3
    (L) Invoice to receive                                     3
    (L)Purchase price variance                            1
    (M) Consumption Material A                           3
    (M) Stock  Material              A                            3
    (M) Stock Material               B                            5
    (M) Production Confirmation  Material B       6
    In this scenario Purchase price variance should be a managerial account, but  transaction key is PRD  and  changing the account would affect every posting.

    This is the answer from OSS
    Dear Customer,
    the system works as designed.
    When Material Ledger is activated, price differences are always
    generated under the circumstances you have described. The reason is
    that when material ledger is activated, price differences must not be
    included into the stock changes value, otherwise the system would
    not be able to calculate an actual price.
    When Material Ledger is activated, the customizing setting
    for handling price differences in the subcontracting process has no
    effect.
    Best regards,
    Santiago Lorite
    AGS Primary Support, Business Suite & Technology u2013 Logistics

  • Purchase Price Variances

    Hi,
    I am new to SAP.  What is the best way to look at all the purchase price variances for a whole month?
    Thanks

    HI,
    Use transaction FBL3N and enter the Purchase Price variance GL Account with period for month and execute....
    Regards,
    Chintan Joshi

Maybe you are looking for