Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Stock on posting date

Former Member
0 Kudos

Hello sdn,

I am opening this thread, because although the search, i didn't find a clear answer.

My problem is that, i want to correct a query we have developed, which is calculate the z-field TOTAL stock on posting date in a wrong way.

So the input should be :

material number

plant

posting date

and the output the TOTAL stock

The functionality is like the MB5B tcode..

Is there any SAP function to do this or i have to develop one ?

Thanks in advance

1 ACCEPTED SOLUTION

SuhaSaha
Advisor
Advisor
0 Kudos

The functionality is like the MB5B tcode.. Is there any SAP function to do this or i have to develop one ?

If you want to find the opening & closing stock on a particular date, unfortunately SAP doesn't provide any FMs to cater to this requirement.

Run a SQL trace to check the DB tables which are involved in MB5B, then debug the trxn & figure out a logic.

BR,

Suhas

PS: In one of my previous projects we had developed a custom FM for similar kind of requirement. In that we had made use of combination of LIS structure & standard SAP "stock" tables viz., MARD/MARDH, MCHB/MCHBH etc. to calculate the stock for a particular date!

6 REPLIES 6

ThomasZloch
Active Contributor
0 Kudos

I can't help it, this sounds like a masked "spec dumping" attempt. Maybe you can "clear my doubts". Please describe what you have researched so far. Also post the query that gives the wrong result for better analysis.

Since you know that MB5B has the desired functionality, did you try analyzing/debugging how this transaction does it? If not, why not?

Thomas

SuhaSaha
Advisor
Advisor
0 Kudos

The functionality is like the MB5B tcode.. Is there any SAP function to do this or i have to develop one ?

If you want to find the opening & closing stock on a particular date, unfortunately SAP doesn't provide any FMs to cater to this requirement.

Run a SQL trace to check the DB tables which are involved in MB5B, then debug the trxn & figure out a logic.

BR,

Suhas

PS: In one of my previous projects we had developed a custom FM for similar kind of requirement. In that we had made use of combination of LIS structure & standard SAP "stock" tables viz., MARD/MARDH, MCHB/MCHBH etc. to calculate the stock for a particular date!

Former Member
0 Kudos

Hi,

Can u pls provide your code snippet ?

Regards

HM

Former Member
0 Kudos

Thank you all for your answers,

The problem is that the MARDH table (which the program reads) doesn't seem to be right.

The total quantity of 168,900 at the end of 3rd period is correctly added to MBEWH table, but the MARDH table shows this quantity at the end of 4th !

see link for details..

[https://export.writer.zoho.com/public/stratos.ts/mbewh-vs-mardh|https://export.writer.zoho.com/public/stratos.ts/mbewh-vs-mardh]

How is this possible ???

Jelena
Active Contributor
0 Kudos

Perhaps this is better asked in the MM forum. It's not really an ABAP issue.

Former Member
0 Kudos

I posted to MM, so this thread can be locked.

the link is the follow.

[|]

but i think that this issue has to do with ABAPers because The logic how tables are updating concerns us too, and not only MM consultaning

thanks in advance.