Você está na página 1de 3

Who Moved my Stock?

Better Visibility into your Stock Segments Below is a snippet from one of hundreds of articles available to ERPtips subscribers. If you would like a complimentary copy of the full article, please email Mark.Downs@ERPtips.com (include the title of the article in your email) To subscribe to ERPtips, go to www.ERPtips.com/Subscribe.asp. ERPtips Journal is published by Klee Associates, Inc. ERPtips University provides both public and onsite training for SAP clients. For more about ERPtips University, including the current schedule, click here: www.ERPtips.com/WorkshopSchedule.asp

Who Moved my Stock? Better Visibility into your Stock Segments The concept for this article is the direct result of the author`s recent interaction with his stockroom manager. This manager wanted to analyze the details behind cumulation of his unrestricted-use stock and other stock segments. Sutrisno saw this as an opportunity to explain the unrestricted-use stock feature to his client and to our readers. This article shows a simple way to generate the list of material documents that match the stock-segment totals (not provided in any out-of-the-box SAP reports). The end result is a query that provides immediate feedback, as well as a solid framework upon which you can build other solutions for your stock analysis requirements.

Click here to read this Snippet

SAPtips Journal
Page 3

April/May 2005 Volume III Issue 2

transaction, but there is no easy way to drill-down into the details for each total. One can, of course, download the goods movements into Excel and sort them out based on movement types. There has got to be a better way! Indeed there is. Through the understanding of movement types and the intelligence they carry, I wrote a simple ABAP query to give the details that my stockroom manager was looking for. Figures 5, 6, and 7 show the results of my query. The query results are totaled by Plant (Plnt), Special Stock Indicator (S), Storage Location (SLoc), and Segment elds. Segment is a twodigit code that represents the stock segment as follows: 01 Unrestricted-use stock 02 QI stock 03 Returns stock 04 Stock transfer at storage location level 05 Stock transfer at plant level 06 Stock in transit Figure 6: Query Results Showing Totals of Stock Segments 02 (QI Stock) and 03 (Return Stock) Figure 5: Query Results Showing Totals of Stock Segment 01 (Unrestricted-Use Stock)

SAPtips Journal

07 Blocked stock 08 Restricted stock 09 Tied empties stock GR Goods receipt blocked stock The query provides line item details of the stock segments that are generated by goods movements. Line item details of the stock segments that are not generated by goods movements, such as Reserved and Open Ordered Quantity, are not reported by the query. There are standard transactions available to list the line item details for those.

Figure 7: Query Results Showing Totals of Stock Segments 04, 05, 07, and GR

SAPtips.com

SAPtips 2005 Klee Associates, Inc.

SAPtips Journal
Page 4

April/May 2005 Volume III Issue 2

To reconcile the query results against the MMBE results, proceed in the following manner. 1. Start with your stock segment, for example, 01 (UnrestrictedUse Stock). 2. Note the subtotals (see Figure 5). In this case, a. Storage Location 0001: 906. b. Storage Location 0002: 311. c. Vendor Consignment at Storage Location 0001: 496. d. Vendor Consignment at Storage Location 0002: 5. 3. Compare the subtotals against those reported by MMBE (see Figure 1). Similarly, you can reconcile subtotals for the other stock segments, such as: QI, Returns, etc. The query also has a drill-down capability to the material document. If you double-click on a line item, the query will call transaction MB03 to display the material document (see Figure 8). Figure 8: Drill Down to the Material Document unrestricted use, QI, or blocked). Unfortunately, it is not lled in for all movement types (refer to OSS note 368259). Otherwise, life would have been too easy. However, if it is lled in the material document, then it clearly indicates the stock segment that was updated. MSEG-BUSTM is a four-character code that points to table T156M. Table T156M identies the stock segment/s to be updated through the T156M-LBBSA eld. MSEG-BWART is the movement type that points to table T156. Table T156 contains a debit/credit indicator (T156-SHKZG) that needs to be used in conjunction with the sequence number (T156M-CNT02) in T156M to identify the stock segment to be debited and/or the one to be credited. Here is the step-by-step instruction on how to re-create this query in your system.

1) Create the InfoSet.

Execute transaction SQ02. The system will bring up the InfoSet: Initial Screen screen. Select [Environment -> Query areas]. Select Standard Area (Clientspecic). In the InfoSet eld, enter: MDOC Press the Create button. The system will bring up the InfoSet: Title and Database window (see Figure 9).

SAPtips Journal

OK. You are now interested in nding out how this query was created, right? Well, the query exploits the fact that each material document carries elds that indicate which stock segments were updated. These elds are: MSEG-INSMK (Stock Type) MSEG-BUSTM String) MSEG-BWART Type) (Quantity (Movement

MSEG-INSMK identies the stock segment that was updated (i.e.,

Figure 9: InfoSet: Title and Database Screen

SAPtips.com

SAPtips 2005 Klee Associates, Inc.

Você também pode gostar