cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate Opening Stock for a particular date.

Former Member
0 Kudos

Hi Experts,

I have a sitution to calculate Opening stock for a particular date.

please help me with the necessary Fields & Tables required.

Appriciate If any Sample coding available.

Thanks & regards,

Venkat.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Venkat,

To Calculate Opening Stock & Closing stock there are different procedures.

It just depends of\n the client requirements & usage of the material.

For example, we have different types of stocks, like, Through Pipeline, Special, Unristricted, quality, safety,

and many types of stocks.... so all these types are indicated in MSEG tabe in SOBTZ field,...

Now Comimg to your Query, You need to calculate OPENING & CLOSING STOCK.

We have a similiar standard report in MB5B Tcode..

to get the same results in your report do like this...

For valuated stock go to the MARDH, MBEWH, MCHBH tables But I Prefer MBEWH.

here in MBEWH give the month & year and you get the result in LBKUM field...

For Special stock, You need to go to another table like MKOLH,,(I forgot still 2 more) and

give the month & year inputs and you will get the result in SLABS field.

and remaining MB5B refers to its deetails lists with different Movement types,

whcih you can get clearly from MSEG Table...

Hope you can write the select Queries accordingly.

Thanks & Regards,

Dileep .C

Former Member
0 Kudos

Hi Dileep,

In MBEWH table

i have MATNR (material)

          BWKEY(Valuation Area)

         LFGJA(Financial year)

          LFMON(month)

          LBKUM(total stock)

here how to calculate...

Current month opening stock

please give me syntaxxxx

Answers (9)

Answers (9)

Former Member
0 Kudos

Hi ,

Its tricky requirement and the prog will have Optimization issue in later stage as well.

Anyways .

Tables are

MSEG , MKPF ... use Debit / Credit indicator ( Do not go woth any static Movement types ) and u have to consider all stock related table

MBEW , EBEW etc..., to get the stcok on particular date .

Please refer to Std. Tcode FBL5N for reference.

Br, Parthi

Former Member
0 Kudos

Hi Venkat,

If you want to find the Stock for a particluar date, It is not available in any table as I know,

Rather you need to do calculations like this.

Select the stock (Menge) till date from MSEG and add all with different movement types,

Its a logic need to ask to your functional consultant,

like 101 added to stock, 601 sales, 102 rejeted, 602 added back to stock,... transfers, 261,,, like this.

But take a little time, get all these by using MKPF & MSEG tables... thats it.

Thanks & regards,

Dileep .C

SuhaSaha
Advisor
Advisor
0 Kudos

Hello,

AFAIK there are no tables which can directly give you stock on a particular date. MARD/MARDH, MCHB, MCHBH etc. provide you with period stocks & not daily stocks.

I think you can use the std. SAP report MB5B for this purpose as suggested in some post. But i am not sure whether it can help.

BR,

Suhas

Former Member
0 Kudos

other wise

You could try calling transaction MB5B from within your Z.. program. MB5B

will give you the stock on a specific date

Former Member
0 Kudos

Hi,

It may help both of you to look at MARDH (Stock History). Bearing in mind

that this table is only updated if the stock position is different at month

end when the material posting period is closed (as I understand it).

Regards,

Anki Reddy

former_member228751
Contributor
0 Kudos

-> S031

-> S032 tables

Former Member
0 Kudos

HI

[Calculation of opening stock based on date|]

Thanks!

Former Member
0 Kudos

HI,

Check this link..this might help you.

[Calculate Opening and Closing Stock |]

former_member222860
Active Contributor
0 Kudos

Table: MARD