Archive

Archive for March, 2009

Material beginning stock

March 19th, 2009

If you go through MB5B, you can see beginning stock, receiving / issuing, and ending stock of a specified material in specified plant / storage location. Now, if you need to get that beginning stock of a specified date, sometimes it becomes quite tricky.  I don’t know if SAP provides any function module to read that beginning stock.. I made several trials but never got a correct result that runs correctly for every material.  So, what I did was turning ST05 and run MB5B to see what it really does in the program. It turned out that the program actually “traceback” the stock from the current condition! It doesn’t read any history table (MARDH or MBEWH). I thought that method will take me forever to get the result, but I was wrong! It turned out to be the fastest way compared with all the other methods I tried by reading the history tables!

Here’s my code to get that beginning stock of a material:

Read more…

vera ABAP

Selecting MKPF-MSEG

March 11th, 2009

Selecting data from MKPF and MSEG can be quite tricky.. It will take forever to get just a few rows if you make the wrong selection.

Before you select anything from the table, you need to make sure your selections are in the table’s indexes and make as many conditions possible to restrict an exhaustive selection from the database.

I tried using select in select, get the mkpf in an internal table and then getting the mseg using for all entries, all took a long time… it just didn’t work the way I wanted to be.

And here’s my latest code as an example, and I’m satisfied with it.

Read more…

vera ABAP