Application Development and Automation 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: 
Read only

Stock on posting date

Former Member
0 Likes
1,594

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
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,304

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!

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
Read only

ThomasZloch
Active Contributor
0 Likes
1,304

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

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,305

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!

Read only

Former Member
0 Likes
1,304

Hi,

Can u pls provide your code snippet ?

Regards

HM

Read only

Former Member
0 Likes
1,304

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 ???

Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
1,304

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

Read only

0 Likes
1,304

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.