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: 

opening stock for meterial monthwise

Former Member
0 Kudos

Hi all,

Plz tell me logic how to calculate Opening Stock and Closing Stock of material of any particular date of month...........

Thanks in Advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

see the logic for transaction MB5B which gives stocks on a particular date. For opening stock you should know at what value the stock ended for previous day. then on that particular date find the stocks issued or received

Today's stock = Opening stock + stocks received - stock issued.

i would suggest copy MB5B transaction program RM07MLBD. pass your program variables to this program using submit command. Get the values where there is

1st part.

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS: bukrs FOR t001-bukrs OBLIGATORY .

SELECT-OPTIONS: matnr FOR mbewh-matnr OBLIGATORY.

PARAMETERS : werks LIKE mbewh-bwkey OBLIGATORY.

PARAMETERS: datum LIKE mkpf-budat OBLIGATORY.

SELECTION-SCREEN: END OF BLOCK b1.

START-OF-SELECTION.

CLEAR rspar_line.

rspar_line-selname = 'MATNR'.

rspar_line-kind = 'S'.

rspar_line-sign = 'I'.

rspar_line-option = 'BT'.

rspar_line-low = matnr-low.

rspar_line-high = matnr-high.

APPEND rspar_line TO rspar_tab.

CLEAR rspar_line.

rspar_line-selname = 'BUKRS'.

rspar_line-kind = 'S'.

rspar_line-sign = 'I'.

rspar_line-option = 'BT'.

rspar_line-low = bukrs-low.

rspar_line-high = bukrs-high.

APPEND rspar_line TO rspar_tab.

CLEAR rspar_line.

rspar_line-selname = 'WERKS'.

rspar_line-kind = 'P'.

rspar_line-sign = 'I'.

rspar_line-option = 'EQ'.

rspar_line-low = werks.

*rspar_line-high = BUKRS-HIGH.

APPEND rspar_line TO rspar_tab.

CLEAR rspar_line.

rspar_line-selname = 'DATUM'.

rspar_line-kind = 'S'.

rspar_line-sign = 'I'.

rspar_line-option = 'BT'.

rspar_line-high = datum.

*rspar_line-high = BUKRS-HIGH.

APPEND rspar_line TO rspar_tab.

CLEAR rspar_line.

SUBMIT zrm07mlbd_zexad USING SELECTION-SCREEN '1000'

WITH SELECTION-TABLE rspar_tab

AND RETURN EXPORTING LIST TO MEMORY.

in copy of MB5b program.

in zrm07mlbd where perform listumfang ends put perform fill_ztable.

in form ZRM07MLBD_FORM_02 where function listumfang ends.

Insert code.

FORM FILL_ZTABLE.

DATA: BEGIN OF ITABU OCCURS 0,

MANDT TYPE MANDT,

WERKS LIKE ZSTK_HIT1-WERKS,

MATNR LIKE ZSTK_HIT1-MATNR,

CALDAY LIKE ZSTK_HIT1-CALDAY,

QTY LIKE ZSTK_HIT1-QTY,

UNIT LIKE ZSTK_HIT1-UNIT,

END OF ITABU.

ITABU-MANDT = SY-MANDT.

ITABU-WERKS = werks-low.

itabu-matnr = matnr-low.

itabu-calday = datum-low.

  • break-point.

itabu-qty = bestand-endmenge.

itabu-unit = bestand-meins.

append itabu.

modify zstk_hit1 from table itabu.

clear itabu.

ENDFORM.

make a ztable zstk_hit1 containing the important parameters and date as the key which keeps track of the stock as on date. Then after submit statement fetch data from this table.

Regards,

mallick

4 REPLIES 4

Former Member
0 Kudos

see the logic for transaction MB5B which gives stocks on a particular date. For opening stock you should know at what value the stock ended for previous day. then on that particular date find the stocks issued or received

Today's stock = Opening stock + stocks received - stock issued.

i would suggest copy MB5B transaction program RM07MLBD. pass your program variables to this program using submit command. Get the values where there is

1st part.

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS: bukrs FOR t001-bukrs OBLIGATORY .

SELECT-OPTIONS: matnr FOR mbewh-matnr OBLIGATORY.

PARAMETERS : werks LIKE mbewh-bwkey OBLIGATORY.

PARAMETERS: datum LIKE mkpf-budat OBLIGATORY.

SELECTION-SCREEN: END OF BLOCK b1.

START-OF-SELECTION.

CLEAR rspar_line.

rspar_line-selname = 'MATNR'.

rspar_line-kind = 'S'.

rspar_line-sign = 'I'.

rspar_line-option = 'BT'.

rspar_line-low = matnr-low.

rspar_line-high = matnr-high.

APPEND rspar_line TO rspar_tab.

CLEAR rspar_line.

rspar_line-selname = 'BUKRS'.

rspar_line-kind = 'S'.

rspar_line-sign = 'I'.

rspar_line-option = 'BT'.

rspar_line-low = bukrs-low.

rspar_line-high = bukrs-high.

APPEND rspar_line TO rspar_tab.

CLEAR rspar_line.

rspar_line-selname = 'WERKS'.

rspar_line-kind = 'P'.

rspar_line-sign = 'I'.

rspar_line-option = 'EQ'.

rspar_line-low = werks.

*rspar_line-high = BUKRS-HIGH.

APPEND rspar_line TO rspar_tab.

CLEAR rspar_line.

rspar_line-selname = 'DATUM'.

rspar_line-kind = 'S'.

rspar_line-sign = 'I'.

rspar_line-option = 'BT'.

rspar_line-high = datum.

*rspar_line-high = BUKRS-HIGH.

APPEND rspar_line TO rspar_tab.

CLEAR rspar_line.

SUBMIT zrm07mlbd_zexad USING SELECTION-SCREEN '1000'

WITH SELECTION-TABLE rspar_tab

AND RETURN EXPORTING LIST TO MEMORY.

in copy of MB5b program.

in zrm07mlbd where perform listumfang ends put perform fill_ztable.

in form ZRM07MLBD_FORM_02 where function listumfang ends.

Insert code.

FORM FILL_ZTABLE.

DATA: BEGIN OF ITABU OCCURS 0,

MANDT TYPE MANDT,

WERKS LIKE ZSTK_HIT1-WERKS,

MATNR LIKE ZSTK_HIT1-MATNR,

CALDAY LIKE ZSTK_HIT1-CALDAY,

QTY LIKE ZSTK_HIT1-QTY,

UNIT LIKE ZSTK_HIT1-UNIT,

END OF ITABU.

ITABU-MANDT = SY-MANDT.

ITABU-WERKS = werks-low.

itabu-matnr = matnr-low.

itabu-calday = datum-low.

  • break-point.

itabu-qty = bestand-endmenge.

itabu-unit = bestand-meins.

append itabu.

modify zstk_hit1 from table itabu.

clear itabu.

ENDFORM.

make a ztable zstk_hit1 containing the important parameters and date as the key which keeps track of the stock as on date. Then after submit statement fetch data from this table.

Regards,

mallick

Former Member
0 Kudos

Hi ankita,

Give me your mail id i wil send you Program...

Regards,

Bohra

0 Kudos

hi,

Can you please send me the program also. My email id is dpitguru@gmail.com. I had done it for another program but it is quite lengty.

Thanks in advance,

Mallick

0 Kudos

Hi naveen,

patelankita_2195@yahoo.co.in is my mail id.

can u help me? plz