Top Banner
MSEG Extension - Redesign MB51/MB5B Performance optimization Matthias Stegmueller, SAP AG Developer Materials Management Inventory Management Installed Base Maintenance & Support SCM1 July 21 st , 2011
20

MB51 & MB5B Redesign Q3 2011

Nov 01, 2014

Download

Documents

Sachin Arora


Change of logic and code.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: MB51 & MB5B Redesign Q3 2011

MSEG Extension - Redesign MB51/MB5B

Performance optimization

Matthias Stegmueller, SAP AG

Developer

Materials Management – Inventory Management

Installed Base Maintenance & Support SCM1

July 21st, 2011

Page 2: MB51 & MB5B Redesign Q3 2011

© 2011 SAP AG. All rights reserved. MSEG Extension - Redesign MB51/MB5B Performance optimization SAP contact: Matthias Stegmüller 2

Agenda

The Issue and its Business Impact

Goal of the implementation

Redesign

Action Plan

Page 3: MB51 & MB5B Redesign Q3 2011

© 2011 SAP AG. All rights reserved. MSEG Extension - Redesign MB51/MB5B Performance optimization SAP contact: Matthias Stegmüller 3

The Issue and its Business Impact

Issue: Long runtime of transaction MB51 / MB5B

Example: Transaction MB51 runs for a long time and sometimes terminates with the runtime error "TIME_OUT".

Reason and Prerequisites:

There is an extremely large number of MM documents in your system.

The SELECT JOIN statement on the header and item table is very demanding

on system performance due to large volumes of data.

Business Impact:

It takes a long time to get the list of material documents. Sometimes the

transaction gets aborted.

Page 4: MB51 & MB5B Redesign Q3 2011

© 2011 SAP AG. All rights reserved. MSEG Extension - Redesign MB51/MB5B Performance optimization SAP contact: Matthias Stegmüller 4

Goal of the implementation

Goal:

- Increase performance

- Decrease runtime of the report

- Avoid short dumps

- Increase user satisfaction

Page 5: MB51 & MB5B Redesign Q3 2011

© 2011 SAP AG. All rights reserved. MSEG Extension - Redesign MB51/MB5B Performance optimization SAP contact: Matthias Stegmüller 5

Redesign - Overview

- Fields from MKPF (like posting date, user name, etc.) are added to table MSEG

- The fields from MKPF are held redundantly in the table MSEG

- This technique enables large gains for the performance of all applications that read material documents

- Note correction ensures that the new fields of the table MSEG are updated in the same way as the fields in the table MKPF by each goods movement

A conversion tool is provided to fill the existing document items in the MSEG table

with the fields from MKPF.

- Notes for MB51 & MB5B are being provided

- FAQ Note available

Page 6: MB51 & MB5B Redesign Q3 2011

© 2011 SAP AG. All rights reserved. MSEG Extension - Redesign MB51/MB5B Performance optimization SAP contact: Matthias Stegmüller 6

Redesign - Overview

Relevant notes:

1516684 MKPF fields added to MSEG - Performance optimization

1550000 MB51: Redesign of selection for performance optimization

1558298 MB5B: Redesign of selection to optimize performance

1567602 DB dependent steps to support the redesign of MB51

1598760 FAQ: MSEG Enhancement & Redesign MB51/MB5B

Page 7: MB51 & MB5B Redesign Q3 2011

© 2011 SAP AG. All rights reserved. MSEG Extension - Redesign MB51/MB5B Performance optimization SAP contact: Matthias Stegmüller 7

Action plan

1. • Enhance the table MSEG by fields from table MKPF

2. • Implement correction instruction of note 1516684 to ensure update of new fields of table MSEG

3. • Implement report ZMST_FILL_MSEG_FROM_MKPF from note 1516684

4. • Perform data conversion using report ZMST_FILL_MSEG_FROM_MKPF to update existing

MSEG records according to the values in MKPF as explained in longtext of note 1516684

5. • Apply note 1550000 for coding change in MB51, Note 1558298 for MB5B

6. • Apply manual steps of note 1550000 including creation of new DB indexes -> see note 1567602

for details about the indexes to be created

NOTE: The process steps are very detailed explained in the long text of

notes 1516684 and 1550000 – See FAQ Note 1598760 for questions

Page 8: MB51 & MB5B Redesign Q3 2011

© 2011 SAP AG. All rights reserved. MSEG Extension - Redesign MB51/MB5B Performance optimization SAP contact: Matthias Stegmüller 8

Action plan – detailled steps

1. Enhance the table MSEG by fields from table MKPF

MBLNR MJAHR …. VGART_MKPF BUDAT_MKPF CPUDT_MKPF CPUTM_MKPF USNAM_MKPF XBLNR_MKPF TCODE2_MKPF

Page 9: MB51 & MB5B Redesign Q3 2011

© 2011 SAP AG. All rights reserved. MSEG Extension - Redesign MB51/MB5B Performance optimization SAP contact: Matthias Stegmüller 9

Action plan – detailled steps

2. Implement correction instruction of note 1516684 to ensure update of new fields of table MSEG

The following code change ensures that the new fields

in MSEG will be updated by each goods movement:

Include MM07MFM0_M_SEGMENTE_ERGAENZEN

FORM M-SEGMENTE_ERGAENZEN

Page 10: MB51 & MB5B Redesign Q3 2011

© 2011 SAP AG. All rights reserved. MSEG Extension - Redesign MB51/MB5B Performance optimization SAP contact: Matthias Stegmüller 10

Action plan – detailled steps

3. Implement report ZMST_FILL_MSEG_FROM_MKPF from note 1516684

The conversion report ZMST_FILL_MSEG_FROM_MKPF is attached to

note 1516684. You can find it under attachments. Please apply it in your

system landscape.

Page 11: MB51 & MB5B Redesign Q3 2011

© 2011 SAP AG. All rights reserved. MSEG Extension - Redesign MB51/MB5B Performance optimization SAP contact: Matthias Stegmüller 11

Action plan – detailled steps

MKPF

VGART

BUDAT

CPUDT

CPUTM

USNAM

XBLNR

TCODE2

MSEG

VGART_MKPF

BUDAT_MKPF

CPUDT_MKPF

CPUTM_MKPF

USNAM_MKPF

XBLNR_MKPF

TCODE2_MKPF

4.

Execute report ZMST_FILL_MSEG_FROM_MKPF to perform the data conversion. This will

update existing MSEG records according to the values in MKPF as explained in the longtext of

note 1516684

DATA

COPY

A temporary index can be created in order to increase the runtime of the conversion report:

MSEG~TMP: MANDT, BUDAT_MKPF, MJAHR, MBLNR Once the conversion is done, the index can be deleted.

Page 12: MB51 & MB5B Redesign Q3 2011

© 2011 SAP AG. All rights reserved. MSEG Extension - Redesign MB51/MB5B Performance optimization SAP contact: Matthias Stegmüller 12

Report: ZMST_FILL_MSEG_FROM_MKPF

Process material documents:

This will update the new fields of the material document items

(MSEG) with the values in the material document header (MKPF)

Recommendation: Choose block size ‚1.000.000‘. As Number of

runs per block size you may choose the amount of millions MSEG

entries you have in the system. For instance if you have 49.334.233

MSEG entries you choose 50. You could also schedule the tool per

material document year (Year) for instance.

If you have many MM documents in table MSEG, it makes

sense to plan several parallel background jobs, e.g. for

different set of plants, movement type and document years.

Please run this in background task. This can also be executed

during your usual runtime.

Show documents to be converted and Show number of

converted documents:

This function can be used in case you want to check how many

documents are already processed and how the status of the overall

conversion is.

Set conversion complete:

This sets a client depended status that the conversion was

completed. The reports will later on check whether the conversion

was done completely before reading from the new fields of MSEG.

Till this status was not set, the reports will work with the old logic!

Regenerate MB51:

This is necessary to activate the redesign in MB51. This will

regenerate the generated include RM07DOCS and switches to the

new selection logic.

The conversion report is used only once, per each client in your system. Its

execution will fill in the newly created fields of all existing MSEG records.

Afterwards, new goods movements will be posted properly with the new

MSEG structure as explained in step 2.

Page 13: MB51 & MB5B Redesign Q3 2011

© 2011 SAP AG. All rights reserved. MSEG Extension - Redesign MB51/MB5B Performance optimization SAP contact: Matthias Stegmüller 13

Action plan – detailled steps

5. Apply note 1550000 for coding change in MB51 & note 1558298 for MB5B

ATTENTION:

In case you only apply the notes, nothing will happen!

The reports check, whether the conversion of MSEG was done. Report

ZMST_FILL_MSEG_FROM_MKPF can set this status (see point 4.) The reports will work with the old logic (i.e. reading data from MKPF)

until the new status is set and the conversion done.

Page 14: MB51 & MB5B Redesign Q3 2011

© 2011 SAP AG. All rights reserved. MSEG Extension - Redesign MB51/MB5B Performance optimization SAP contact: Matthias Stegmüller 14

Action plan – detailled steps

6. Apply manual steps of note 1550000 including creation of new DB indexes -> see note 1567602

for details about the indexes to be created

1. The following new indexes must be created:

MSEG~BUD: MANDT, BUDAT_MKPF, MATNR, WERKS, LGORT, BWART, SOBKZ

MSEG~M1: MANDT, WERKS, BUDAT_MKPF, MATNR, LGORT, BWART, SOBKZ

MSEG~M2: MANDT, MATNR, BUDAT_MKPF, WERKS, LGORT, BWART, SOBKZ You may add your customer-specific indexes as needed to increase the performance individually

2. Customizing for MB51 should be adjusted to get the optimum benefit

-> see next slide

Page 15: MB51 & MB5B Redesign Q3 2011

© 2011 SAP AG. All rights reserved. MSEG Extension - Redesign MB51/MB5B Performance optimization SAP contact: Matthias Stegmüller 15

Action plan – detailled steps

Customizing for optimal performance increasement for transaction MB51

We recommend including only the following fields from MKPF in the Customizing table

MMIM_REP_CUST: (SPRO -> Materials Management -> Inventory Management and Physical Inventory -> Reporting -> Define Field Selection for Material Document List):

MBLNR, MJAHR, VGART, BUDAT, CPUDT, CPUTM, USNAM, XBLNR and TCODE2

The inclusion of other fields from MKPF may actually decrease the performance. Gains

are not as good as when you restrict your selection to the MKPF fields listed above.

You cannot include the new MSEG fields (such as BUDAT_MKPF) in Customizing. As

before, these are mapped using the standard fields MKPF-BUDAT. Therefore, leave

MKPF-BUDAT within the Customizing table MMIM_REP_CUST.

There is no restriction on the MSEG fields. They can be chosen as SELECT and OUTPUT

fields without negative impact on performance.

Page 16: MB51 & MB5B Redesign Q3 2011

© 2011 SAP AG. All rights reserved. MSEG Extension - Redesign MB51/MB5B Performance optimization SAP contact: Matthias Stegmüller 16

Example: Customizing without benefit

Here, the field MKPF-BKTXT is chosen as SELECT parameter. Since BKTXT

was not duplicated into MSEG, the old MSEG/MKPF Join logic must be used

and there is no benefit from the redesign.

Page 17: MB51 & MB5B Redesign Q3 2011

© 2011 SAP AG. All rights reserved. MSEG Extension - Redesign MB51/MB5B Performance optimization SAP contact: Matthias Stegmüller 17

Example: Customizing with improvement potential

Here, the fields MKPF-BKTXT and MKPF-XABLN are both chosen as OUTPUT

parameters. Since BKTXT and XABLN were not duplicated into MSEG, the

old MSEG/MKPF Join logic is used. However in this case, there is a benefit

from the redesign as the WHERE Condition (SELECT fields) is only being

done on MSEG fields.

Page 18: MB51 & MB5B Redesign Q3 2011

© 2011 SAP AG. All rights reserved. MSEG Extension - Redesign MB51/MB5B Performance optimization SAP contact: Matthias Stegmüller 18

Example: Optimal Customizing

The optimal customizing includes only the copied fields from MKPF in output

and selection of report MB51!

Page 19: MB51 & MB5B Redesign Q3 2011

© 2011 SAP AG. All rights reserved. MSEG Extension - Redesign MB51/MB5B Performance optimization SAP contact: Matthias Stegmüller 19

Any further questions?

Please refer to the FAQ Note 1598760 !

Page 20: MB51 & MB5B Redesign Q3 2011

Thank You!