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: 

The best way to check the stock of one entire plant?

Former Member
0 Kudos

We use MB52 to display the stock of one whole plant,which means we don't use the material number as the input Arguments.The Performance is so poor that most of the cases lead to runtime error 'TIME_OUT'.Some experts suggested copy the RM07MLBS to a Z_XXX in which replace the table MARD with MARA in line 1127,which the ABAP  code is as below:

* END INSERT n_759412

ENHANCEMENT-SECTION EHP604_RM07MLBS_09 SPOTS ES_RM07MLBS .

     SELECT mara~matnr werks xchar mtart matkl meins trame umlmc

            bwesb glgmg                          "AC0K020254 "912093

          mara~lvorm AS lvorm_mara

          marc~lvorm AS lvorm_marc

          INTO CORRESPONDING FIELDS OF TABLE t_mat

          FROM mara INNER JOIN marc

          ON mara~matnr = marc~matnr

          WHERE mara~matnr IN matnr

            AND werks IN werks

            AND mtart IN matart

            AND matkl IN matkla

            AND ekgrp IN ekgrup.

END-ENHANCEMENT-SECTION.


There  would be some difficulty with this solution:

1,The 'ENHANCEMENT-SECTION'  can't be copied.

2,there are some fields not included in MARD which is included in MARA,like MTART KATKL.

3,We had  discussed it with our PM,who suggested not use the tables MARD,MSPR &etc since we don't know the detailed logic in MB52 and may be there would be some dirty records in those tables.

So I wonder if there are any other solutions?My MB52 selection screen see my attachment.Thanks in advance.

10 REPLIES 10

Former Member
0 Kudos

Hi Yunze,

Well MB52 is a standard report to fetch the stock plantwise however you can try,

1. MD04.

2. MMBE (material wise stock)

3. MC.1,MC.9

Regards,

Sagnik.

0 Kudos

Hi Sagnik,

What I wanna is that I just only enter the 'plant' to select the whole stock of the plant,what you gave to me can't fit my demand with which there is no data found or the material is the required input.

JL23
Active Contributor
0 Kudos

Talk with your basis admins, they can create a performance trace and they should be able  to create a new index that better suits your requirement.

If you get time-outs then you should run the report in background anyway.

Former Member
0 Kudos

Hi Jürgen,

There is a index in MARC within field 'WERKS'  since it's the third filed of the Primary key.So this Isn't  the correct solution,thanks Anyway.

JL23
Active Contributor
0 Kudos

In my opinion you would need an index that is like

WERKS, MATNR to have a fast selection when you only enter the plant.

if the index is MATNR, WERKS, then SAP has to read all materials and to select only those which fits to the correct plants. So it is reading many more data than it is needed.

Former Member
0 Kudos

Anyway there is a SAP standard index 'WRK'(MANDT+WERKS),I may suppose this is suitable for my situation.However,it's slow anyway.

JL23
Active Contributor
0 Kudos

To summarize  your query: you are looking for a way to get a stock report without even accessing the stock tables.

"Z_XXX in which replace the table MARD with MARA"

" our PM,who suggested not use the tables MARD,MSPR"

Former Member
0 Kudos

Sorry,it was replacing MARC with MARD,my mistake.

Former Member
0 Kudos

Replacing MARC with MARD.

JL23
Active Contributor
0 Kudos

The first thing to do if you have timeouts, is to run the report in background instead in foreground.

(Unfortunately you did not even tell how much materials you have in your system)

Further you should analyse if your selection suits really the requirement.

E.g. you are including special stock (e.g. consignment, sales order stock, project stock, subcontractor stock). All these stock types are held in different tables. So you know your situation best, if you do not have such special stocks then you should not include it into the selection. If you have for example only subcontractor stock then you should restrict the special stock selection to this stock type.

Then you should check SAP marketplace if there are performance notes for this report,

you may even open a message yourself and let SAP analyze if it is dramatically poor.

In-transit stocks are stored in MARC, excluding MARC from the program would exclude this stock type too.  I am not sure if you can even imagine how many stock tables SAP has and has to check if you run the report almost unrestricted. See Stock Tables and Stock Types - ERP SCM - SCN Wiki