cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate Opening & Closing Balance Material Stock

kabil_g
Active Participant
0 Kudos

Dear Frds,


I found the below formula from different threads,


Fetching from s031,s032 Tables ..... I want the fields for below formula pls help me out......



opening stock = quantity total stock + issue total stock - receipt total stock.

=  0totalstck +  0isstotstck - 0rectotstck.

closing stock = opening stock + receipt total stock - issue total stock.(0totalstck).

(but in BW it is calculated in extractors there is no need for calculation simply rename it 0totalstck as closing stock.    


Kabil.

Accepted Solutions (1)

Accepted Solutions (1)

former_member183241
Active Participant
0 Kudos

Hi Kabil,

Please refer below formula to calculate Closing and opening stock

Yesterday's Closing Stock = 0RECTOTSTCK till yesterday - 0ISSTOTSTCK till yesterday

Today's Opening Stock = Yesterday Closing is the opening stock for today.

If you calculate today's closing stock then it will be opening stock for next day.

Thanks,

Kashif Ali Khan

kabil_g
Active Participant
0 Kudos

Hi Kashif,

My requirement is Month wise total stock for month , for current month i will take stock value in MBEW,

If i run 3 months back i want to show in Runned last two months stock for material.

S_P00_07000139 - Reporting  My report has to match these stock card transaction................

former_member183241
Active Participant
0 Kudos

Hi,

Not getting your requirement, can u explain in brief or share report format.

Thanks,

Kashif

kabil_g
Active Participant
0 Kudos

Hi Kashif,

I will run 201503 as input

it has to give 201503 month total stock & 201502 month total stock for materials available on that month  .....

Last month Stock (Feb)Closing stock (March)
Qty Qty
           300               56
rajkumarnarasimman
Active Contributor
0 Kudos

Hi Kabil,

If you want to match the same stock value which is showing in standard report S_P00_07000139, it is better to get the value from standard report itself from Custom one. Because there are more number of logic returned in standard report, either we are suppose have same logic in custom program or we have to call the standard program using SUBMIT Command.

Do the enhancement in standard report and export the value and call the standard report using SUBMIT command from custom report.

Please find the document below.

Regards

Rajkumar Narasimman

former_member183241
Active Participant
0 Kudos

Hi,

Please try this

Last Month Stock(Closing) = 0RETOTSTCK Till (Input month - 1) - 0RETOTSTCK Till (Input month - 1)

Current Month stock = 0RETOTSTCK Till (Input month) - 0RETOTSTCK Till (Input month)

Thanks,

Kashif

kabil_g
Active Participant
0 Kudos

Hi Rajkumar,

S_P00_07000139

I need to look into enhancements options only bcoz my company is telling these report only having correct stock............

kabil_g
Active Participant
0 Kudos

Hi Rajkumar,

Is there any way run these transaction S_P00_07000139 in background and update the values to ZTABLE ....

rajkumarnarasimman
Active Contributor
0 Kudos

Hi Kabil,

Without enhancement in standard program, it is possible to receive the value in custom program using FM LIST_FROM_MEMORY.

Population of data based on Submit report List Object - Code Gallery - SCN Wiki

Regards

Rajkumar Narasimman

rajkumarnarasimman
Active Contributor
0 Kudos

Hi Kabil,

It is possible. We can create our custom program and schedule the report in background and get the values using LIST_FROM_MEMORY and we can save the values in Z-table too, but it is not recommendable one.

We need only the current updated stock value which is already system fetches using some standard report. It is better to follow the standards, using the above said(z-table) we can minimize the performance but standards need to be considered .

Regards

Rajkumar Narasimman

kabil_g
Active Participant
0 Kudos

Hi Rajkumar,

I tried tat also in that transaction they have defaulted date 01.03.2015 to 31.03.2015 example last month from & end date unable to change the values while exporting our criteria.

rajkumarnarasimman
Active Contributor
0 Kudos

Hi Kabil,

Yes, since the code is written in Initialization event, we can overwrite the same by creating the Variant for the particular screen, Call the Submit report like SUBMIT USING SELECTION-SET like shown below, here I have created the variant 'TEST2'.

Call the selection screen as follows.


SUBMIT J_1HSTCD

   VIA SELECTION-SCREEN

   EXPORTING LIST TO MEMORY

   AND RETURN

   USING SELECTION-SET 'TEST2'.

To change the variant value using FM FASU_RS_CHANGE_CREATED_VARIANT. Please find the document below.

Mass Change of Variants - Code Gallery - SCN Wiki

If you found more difficult, you can another method using  BDC too and there are more number of implicit enhancements available for the program J_1HSTCD as shown below. write the export statement inside implicit enhancement and get the value in the custom program.

Regards

Rajkumar Narasimman

kabil_g
Active Participant
0 Kudos

Hi Rajkumar,

I have copied a ZPROGRAM and export & imported values not getting values in internal table

EXPORT flag TO MEMORY ID 'ZSTOCK_CONSUM'.

   SUBMIT zj_1hstcd_v1 WITH SELECTION-TABLE rspar_tab EXPORTING LIST TO MEMORY AND RETURN.

   IMPORT gt_stock FROM MEMORY ID 'ZSTOCK_CONSUM'.

Sijin_Chandran
Active Contributor
0 Kudos

You should use the same structure ( name should also be same ) for EXPORT and thereafter IMPORT while using a memory id say 'ZSTOCK_CONSUM' in this case.

So, for "EXPORT flag TO MEMORY ID 'ZSTOCK_CONSUM'. "

corresponing IMPORT should be

" IMPORT flag FROM MEMORY ID 'ZSTOCK_CONSUM'. "

rajkumarnarasimman
Active Contributor
0 Kudos

Hi Kabil,


Method 1:

Can you try EXPORT TO DATABASE statement, please find the below thread. 

Import/Export statement not working..


Method 2:

Here we are using the SUBMIT command in custom program, we can retrieve the ALV report values using FM LIST_FROM_MEMORY itself.

Regards

Rajkumar Narasimman

Answers (0)