Skip to Content

All stock and valuation tables in SAP have as well history tables since release 45. All those tables have the same name as the standard tables, but with a H at the end.

Standard table History table Function module
Storage Location Data for Material MARD MARDH MARD_EXTEND
Project Stock Valuation QBEW QBEWH QBEW_EXTEND
Special Stocks with Customer MSKU MSKUH MSKU_EXTEND
Special Stocks with Vendor MSLB MSLBH MSLB_EXTEND
Sales Order Stock Valuation EBEW EBEWH EBEW_EXTEND
Special Stocks from Vendor MKOL MKOLH MKOL_EXTEND
Material Master Plant data MARC MARCH MARC_EXTEND
and some more

This was implemented to speed up the period closing.

But how these tables are updated is for many users cumbersome, they expect to see a record for each month in those history tables, but SAP does it differently. SAP explains the logic in Note 193554 – Stock/valuation data of previous periods still we can see in many discussions that this note was not fully understood.

SAP does not update the history table when you execute MMPV to close the MM period.

The History tables are updated with first movement after a period closure.

If there is no movement for several months, then you will not see any history record for all those months that have past.

SAP writes only a history record for the month preceding a change in stock or value.

All the periods between 2 records in a history table had the same stock/value all the time, hence you can take the value for those periods from the record following these missing periods.

Here we see 8 history records for the valuation data MBEW of one material in one plant, created over a time span of 5 years:

many would expect to see 60 records for 5 years, but we had only 8 months with changes in those 5 years, hence only 8 history records were created.


And as proof a screen shot from MB51 Material Document list for the same material and plant:


You can see that the first movement to this material happened on May 22, 2007. This event triggered the creation of the history record for period 004 2007.

The history record tells you that the stock and value for this material was zero at the end of April 2007

The next month with movements was December 2007, which caused a history record for November 2007

The movement from April 8, 2008 triggered the creation of 2 history records: for period 003 2008, and because there was a year change in between a record for period 12 2007

The  movement type 301K (marked yellow) did not trigger any update in MBEWH table, because consignment stock has no value, hence no change to valuation, which means MBEW table is not affected.

Finally we have movements in May 2011, and the first movement caused the creation of year end records of 2009 and 2010 and for the previous month 04 2011.

If you need to develop own ABAP reports with month end stock then you have to make use of function modules that understand this complex logic. The name of these function modules is starting with the table name followed by _EXTEND (see table)

To retrieve previous period data for all materials in valuation area ZRAG the coding should be like that

select * from mbew into table mbew_tab where bwkey = ‘ZRAG’.

call function ‘MBEW_EXTEND’


      xvper = ‘X’


      mbew_tab = mbew_tab.

Please read the SAP Note 415349 – Usage of modules XXXX_EXTEND for previous period values for detailed information because the function modules are not released.

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Former Member

    hi Jurgan,

    Thank you very much for giving conceptual clarification..

    As per my understanding/study, the stock and value updated in history table for one perticular material is same as of closing stock and value which we can see in MB5B for that material at month end date.



    1. Jürgen L Post author

      Thanks, that is my aim: to explain complex things in a way that it can be understood by everyone.

      I do not like the doctor language of explaining things extra complicated to preserve the status of a special breed

  2. Former Member

    Excellent collection of tables, Good information thanks! Also you may wish to use MB5B Report (RM07MLBD) to inventory report beyond current and past period.

    Sunil Wawdhane

  3. Jürgen L Post author

    50 is the correct quantity.

    Remember, the table is MBEWH which means valuated stock

    the receipt of 2 is not to stock, there is no storage location, it is a receipt to a PO with account assignment.

  4. Former Member

    Hi Jurgen,

    Thanks for sharing this document, It helps a lot to understand this complex picture.

    I have one thing to ask what yo mean by receipt of 2 is not to stock , it is receipt to a PO with Account assignment. What is the difference between them.



    1. Former Member

      A little bit late but; when making a Goods Receipt that comes from a PO with acount assignment the “destination” of the material being received is not the Warehouse (or what you called “not to stock”).

      The destination of that material is what the user indicated in the account assignment field in the PO, some of those account assignment “objects” are (as configured in my system):

      A    Asset

      B    MTS prod./sales ord.

      C    Sales order

      D    Indiv.cust./project

      E    Ind. cust. w. KD-CO

      F    Order

      G    MTS prod./project

      H    Third-party GR mand.

      K    Cost center

      M    Ind. cust. w/o KD-CO

      N    Network

      P    Project

      Q    Proj. make-to-order

      R    Services 2 Way match

      T    All new aux.acc.***.

      U    Unknown

      V    All aux. w/ GR mand.

      W    Vendor Consignment

      X    All aux.acct.assgts.

      Y    Third-party Order

      Z    MTO valuated with RA

      One good example is a purchase directed to a Cost Center (K); the value of the purchase will affect directly the Cost Center indicated in the PO, and you won´t see quantity being received at any storage location as those “goods” where delivered directly to the responsible of that Cost Center (business area).



  5. Former Member


    Not sure if I missed the point above, but is it possible to read historical stocks (say, 2 years ago) directly through the FM MBEW_EXTEND or MARD_EXTEND? Is there any option programmatically to read these stocks?

    SAP standard has reports like MB5B / MC.9 etc that can help out; however, often we need to fetch these values in a report; is there an API available that could help us here?



    1. Jürgen L Post author

      Do you not consider function modules as programs? MBEW_EXTEND can read 2 year old stock, MARD_EXTEND cannot.

      From OSS note 415349: Not all function modules can calculate these periods. Correspondingly not all function modules have all four parameters.

      1. Former Member

        Hello Juergen

        Thanks for your note. I meant if these FMs can’t do it, is there any other option programmatically?

        Coming back to your point on the FM MBEW_EXTEND, could you tell me how we could read old stocks thru this FM. I tried using this FM with all different parameters and passing the current row from MBEW in MBEW_TAB as advised in the Note 415349, but it kept returning me the same line item. Do we need to go back period by period? Let’s take an example, the MBEW record I have is for 03/2014, and the last record in MBEWH is for 02/2014. Can I read 02/2012 stock through this FM directly?



        1. Former Member

          hi arijit,

          i got the same issue. get sales order stock quantity to a given date in the past ( period ).

          if you need the coding just answer. i know, its a little bit time past 😉



  6. Jürgen L Post author

    The first March posting should create this February entry, if it was posted in the March period and not backdated to post in February period.

    First search for OSS notes, if there is no suitable then open a call yourself

    1. Juwin Pallipat Thomas

      Sorry Jurgen, I thought my question was in an inappropriate place and hence had deleted my comment before you could reply.

      For the readers,

      Jurgen was replying to my following query:

      We had some materials + batches, where we found that the history table entries were missing eventhough the 1st transaction in the new period has happened. I was asking him why this would have happened and if I should log a call to SAP for fixing this.

      I logged an incident with SAP and they confirmed my finding that the history table entries were in fact missing. They created the missing entries manually.


  7. Former Member

    Dear Jurgen Sir,

    Really appreciated article and very informative…not only for functional it also very useful from technical perspective too.



  8. Jürgen L Post author

    No, not directly as this is just about month end stocks and how the records in the historic tables work.
    You were looking for a transaction, you can just copy your subject line into Google to find what you asked for.

  9. Dammah Sebiyam

    Hi Jurgen,

    Guten Tag,

    I need a pointer here. I got my developer write a code in HANA to generate inventory (Valuated stock) from MBEW, MBEWH, EBEW, EBEWH, CKMLCR etc. Basically to generate period end inventory values. When this report is run for current period for a plant the values tie with GL.  The difficulty is running it for previous periods like behavior in MB5L or S_P99_41000062 or any other inventory report.

    What are key fields SAP is using to look up or loop back for values in these tables for previous periods.  We triedMBEWH-LFMON, MBEWH-LFGJA.  Any pointer as to how my developer can code into HANA so when a report is run for say, previous period, logic is able to determine last value for each stock in each plant and return the same?

    Thank you


Leave a Reply