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: 

Block stock calculation from mseg table for any given date.

Former Member
0 Kudos
536

I am calculating stock from mseg table for any given date. Not just month end stock or current stock. It could be back date also. It is tallying also with MB5B stock report of that date. Now I have to bifurcate that stock into unrestricted stock, quality stock and block stock.

I have checked INSMK and ZUSTD field in mseg table, but could not concluded. Should I check movement type wise? Block/ Quality stock could be transferred into unrestricted stock also. That also I have to take care.

Can anyone clearly explain how the stock type posting takes place in mseg table when goods receipt as block / quality stock and when the same goods transferred in unrestricted stock, what are the reference indication.

2 REPLIES 2

Former Member
0 Kudos
123

DATA : LIST_TAB TYPE TABLE OF ABAPLIST.

DATA: BEGIN OF VLIST OCCURS 0,

FIELD1(5) TYPE C,

FIELD2(19) TYPE C,

FIELD3(16) TYPE C,

FIELD4(17) TYPE C,

FIELD5(25) TYPE C,

FIELD6(24) TYPE C,

FIELD7(25) TYPE C,

FIELD8(25) TYPE C,

END OF VLIST.

TYPES : BEGIN OF ITAB,

MATNR(18) TYPE C,

WERKS(5) TYPE C,

END_MENGE(20) TYPE C,

END OF ITAB.

DATA : ITAB TYPE STANDARD TABLE OF ITAB WITH HEADER LINE,

WA_TAB TYPE ITAB.

----


----


submit command to run mb5b in the background and -

----


push the data into an internal table -

----


" Calling MB5B for displaying the Closing Stock

SUBMIT RM07MLBD USING SELECTION-SCREEN '1000'

WITH DATUM BETWEEN S_DATE-LOW AND S_DATE-HIGH

WITH MATNR IN S_MATNR WITH WERKS IN S_WERKS

WITH BWART-LOW = '601' EXPORTING LIST TO MEMORY

AND RETURN.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

LISTOBJECT = LIST_TAB

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2.

CALL FUNCTION 'LIST_TO_ASCI'

EXPORTING

LIST_INDEX = -1

TABLES

LISTASCI = VLIST

LISTOBJECT = LIST_TAB

EXCEPTIONS

EMPTY_LIST = 1

LIST_INDEX_INVALID = 2

OTHERS = 3.

LOOP AT VLIST WHERE FIELD1 CS '|'.

CHECK SY-TABIX GE 4.

MOVE : VLIST-FIELD1+1(4) TO ITAB-WERKS,

VLIST-FIELD2+1(18) TO ITAB-MATNR,

VLIST-FIELD8 TO ITAB-END_MENGE.

APPEND ITAB.

ENDLOOP.

This is the program to call MB5B and the standard program and use the following settings for the closing stock opening stock and block stock

0 Kudos
123

Hi Sabyasachi,

Thanks for your reply. But my problem is not just to tally the stock with MB5B. It is tallying already. But block stock and quality stock qty. are included in MB5B closing stock. Which I need to bifurcate. Only MMBE give that sort of bifurcation for current stock qty. Not for back date. I want to know how to identify that records in mseg table. Because I need that for backdate also.

Got my problem?

Anyway you have not given your email id to me before leaving Kolkata. My id is ayan.banerjee.88@gmail.com