cancel
Showing results for 
Search instead for 
Did you mean: 

Would you know a function or a bapi that can give me the stock for a material in a specific day?

Former Member
0 Kudos

Would you know a function or a bapi that can give me the stock for a

material in a specific day?
i founded a bapi called bapi_material_availability but it doesn't give the
stock in a past day.

i need for storag location with batch

Accepted Solutions (0)

Answers (5)

Answers (5)

JL23
Active Contributor

There is no such BAPI or function, there is a transaction with a huge program: MB5B. The stock of a certain day in the past is not stored in a table, the program starts with todays stock and calculates backwards based on the movements.

JL23
Active Contributor

If you could share the business background for this information then we might have alternative ideas.

I am doing SAP for 20 years and did other systems before, but to know how much stock I had on the second Thursday in March was never a figure to drive our business.

If such information is extremely important for your business and you are concerned about performance then it might be worth to copy the stock information every day at midnight into a Z-table. So you can quickly access the needed information with a single select.

Or you run MB52 report daily and store the list in an archive. Just depends on the requirements, like how often needs someone to know this info, for what reason and if it is enough to read it from a list or if you need to compute it further

Former Member
0 Kudos

i have create my own function calculation based on table MSEG working fine but very very very slow bad performance

after grows of data now always getting run time error , so i'm locking for alternative solution

Former Member
0 Kudos

most of time we have pending sales order we need to enter and completed to invoices in Previous Month before closing the month

without know the availability of material batch it took much time to determine which batch available.

for example : if today is : 05/06/2017 i need to make invoices in 31/05/2017 before closing month 05 /2017

Sijin_Chandran
Active Contributor
0 Kudos

Hello Ahmed,

Check with the below document.

https://blogs.sap.com/2012/11/30/getting-opening-and-closing-quantities-of-stock-with-accuracy-of-mb...

MB5B is a very well tuned program so it should not raise performance concerns.

Thanks,

Sijin

JL23
Active Contributor
0 Kudos

yes performance seems not to be problem as there are "only" 26 OSS notes for performance and MB5B 😉

Sijin_Chandran
Active Contributor
0 Kudos

Not able to guess even whether u actually "agreed" with my point or "disagreed".

But with my first employer we were easily able to leverage MB5B like this without any performance overhead.

JL23
Active Contributor

I disagreed. MB5B is the performance killer number 1.

But of course it depends on the volume that needs to be read. On the size of your machine, on the number of users working at the same time in a system , etc etc etc.

It is just a fact that MB5B starts with the current stock and reads the material documents backwards to calculate a stock in the past. If I do it for a single material and not looking far into the past then it can be used for analysis, but doing the same thing for a plant with some 10 thousand materials which might have several million material documents can be quite challenging

Sijin_Chandran
Active Contributor
0 Kudos

Yes exactly.

With my first employer the amount of material transactions was moderate ( not that high and not that low ).

And the report which we created based on MB5B used to be run in background jobs like many other FICO related reports. And the report was mainly run on month end times. So we never faced any issues instead we got a perfect Stock report 🙂 and of course with Opening and Closing as accurate as MB5B's 😉

raghug
Active Contributor
0 Kudos

Looks like they are having business process issues in trying to get users to actually acknowledge picking or PGI when the delivery gets sent out. There are a lot of better ways to solve this issue. For one you can tie the printing of required outputs such as a packing list or bill of lading to the PGI. No PGI -> no documents -> can't ship. You can also change your ATP check control to consider existing deliveries. That way the new deliveries can not be created if there is not enough material to satisfy the old deliveries plus the new ones.

JL23
Active Contributor
0 Kudos

Think again - is your business really that different to any business at any SAP customer world wide? If all customers would need such BAPI to invoices then it was probably available.

From your text it is unfortunately not explained with a reason, just with a wish. Also the logical flow of the business case is not really explained in a way strangers could understand it.

Why is it needed to know the availability of a batch if you want to post an invoice?

Why can't you use GR based Invoice verification?

Former Member
0 Kudos

what i mean is in time of create delivery and PGI (VL01N) in Previous day for any reason like pending data entry as i explain before the batch determine will not give accurate ATP so need manual calculate to know which bath are available to Post Good Issue

JL23
Active Contributor
0 Kudos

Sorry this is even more confusing. Now you even turned from a simple stock quantity into availability check. If you want to post a goods issue then you should actually know what you have put onto a van and not just theoretically determine something.