Skip to Content
author's profile photo Former Member
Former Member

FIFO method - Avg Price

Hi experts,

Just want to ask how SAP can determine the last avg price of the item if the method is FIFO. I'm creating a SQL query based from the quantity and price from the sales and get the avg price of the item.

Regards,

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Dec 15, 2014 at 08:50 AM

    Hi

    try with bellow Query and analyze Avg Price

    last 30 purchase item lists will display according to that you can calculate Average price

    SELECT TOP 30 T0.[DocNum],T0.[DocDate], T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[FreeTxt], T1.[Project], T1.[Quantity], T1.[Price] FROM OPCH T0 INNER JOIN PCH1 T1 ON T0.DocEntry = T1.DocEntry WHERE T1.[ItemCode] =[%0] and T1.[TargetType] !='19' order by T0.[DocDate] desc

    Thanks&regards

    Andakondaramudu

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 15, 2014 at 11:47 AM

    Hi Bryan,

    Are you trying to determine the average cost price, the average sales price, or the average profit ?

    Regards,

    Johan

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Bryan,

      Ok, the Base Price Origin should be set to Cost Price (anyway). After that the system registers the Cost Price of each item in the document row tables (GrossBuyPr) at the moment the document is created.

      So you can calculate the average GrossBuyPr based on all relevant documents.

      Regards,

      Johan

  • author's profile photo Former Member
    Former Member
    Posted on Dec 16, 2014 at 12:10 AM

    I am sorry i not am aware of sql coding but we can achieve the result by using control break events by the following program, just copy paste in se38

    DATA : it TYPE TABLE OF ekpo,

    wa TYPE ekpo.

    DATA : count TYPE ekpo-netwr VALUE 0,

    count1 TYPE ekpo-netwr VALUE 0,

    count2 TYPE ekpo-netwr VALUE 0.

    SELECT-OPTIONS : s_ebeln FOR wa-ebeln.

    SELECT * FROM ekpo INTO TABLE it

    WHERE ebeln IN s_ebeln.

    SORT it BY ebeln.

    LOOP AT it INTO wa.

    WRITE : / wa-ebeln, wa-ebelp, wa-netwr.

    count = count + wa-netwr.

    count1 = count1 + 1.

    AT END OF ebeln.

    IF sy-subrc = 0.

    WRITE :/ 'THE TOTAL OF NETWR',count.

    count2 = count / count1.

    WRITE :/ 'THE AVERAGE OF NETWR',count2.

    CLEAR count.

    CLEAR count1.

    CLEAR count2.

    ENDIF.

    ENDAT.

    ENDLOOP.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.