Skip to Content
Author's profile photo MA JAMIL

Redesigning of the MB51 Standard SAP report 3\3

It would take time to activate the database because it will recreate all the indices at system end. View and ignore the problems if it states the DB space problem.


Moving on to the SAP Note 1516684, we are now fully ready to execute the report. We have changed the MSEG table, added the fields in MSEG from MKPF successfully, created the Indices; Modified the MSEG Standard Index M by adding a field from MKPF activated the Indices, created the table. Now we are all set to go to run the report. Follow the instructions from the SAP Note 1516684.

Most importantly, carefully read the instructions to run the report from the SAP Note. The report would run in background mode and also we have to mention the Blocks of the data from the MSEG table and actual runs per block to cover the whole data from the MSEG table.


In order to identify the block size of the MSEG table i.e. the total number of entries that exists in the MSEG table, we used the transaction SE11 to identify how many blocks can be made to cover the entire data from MSEG. Access SE11 and Enter MSEG as the Table name, select display table, the below screen would be displayed and here you can identify the number of entries by selecting the Number of Entries pushbutton. Before this do blank Width of output list and Maximum No. of Hits option as highlighted in the snapshot below.


In our case the total existed entries are 16,569,028 within the MSEG table. If we divide this number to a single block of 10,000,000 than the runs per block would be 17 to cover the entire data from MSEG for conversion.


Select the path mention below from the Menu bar;

Program->Execute in Background


The System will ask for the print parameters. Give your print parameters.


Another popup asking for the starting mode to select. Select Immediate mode and press Save icon


From the job overview session, you can have the status of your report run in background mode.


This report would take enough time to convert all your documents within the MSEG table. You Can always monitor the progress via Job overview in SAP.


After the successful run of the report again run the report with ‘Show documents to be converted’ mode with ‘Update MSEG’ checked and block size and Number of runs per block size remained in their default values. This time you would not run it in background as it would not take much time to execute.


The result of the second mode would be that ‘All documents were converted’ as mentioned below.


Again run the report with the third Mode selected.


You can view the status of current report via SM50


Again the successful run message would be ‘All documents were converted’, which would mean that we are exactly going in the right direction.


This mode is of much importance as it will place a conversion complete check within the table that we have created earlier with the name MMIM_CONTROL_LOG, which would confirm that the conversion of MSEG has been successfully completed without any impediments.


Monitor the Status through SM37.


The second mode has been run successfully, now we are all set to go for the Regeneration of MB51 according to the new code and new data from MSEG.


Again schedule the background task for the last mode to Regenerate MB51.


We got an error as mentioned below. You won’t get it if you have already placed exactly the same name of the Z file in your SAP editor. We got it because we change the name of the file and this is causing an error.


For this to run without any obstacles, we changed the following code in ZMST_FILL_MSEG_FROM_MKPF_V3. Open the editor to change the code in change mode.


Search for the ‘reading’ keyword or the exact error ‘Error during reading source code’ within the source code of the file. You will easily see above the error they mentioned to read the file with the name hardcoded. Change it accordingly if you already change the name of the file during creation. If you do not change the file name, than you do not need to perform the step.



After the change, now again execute the report. And you will see the successful message stating that ‘Report RM07DOCS_GENERATED updated’ which would mean that the standard MB51 coding has now been updated to the new changes and new logic would be executed which would fetch the data from MSEG.


Now You can transport the created request.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Jamil,

      Nice document, thanks a lot......


      Shaiksha Vali.

      Author's profile photo Bärbel Winkler
      Bärbel Winkler

      Hi Jamil,

      very nice set of blog-posts about making MB51 more performant! Thanks for putting it together.

      I have a question about this process which was initiated about 2 years ago where I work:

      When the relevant OSS-Notes were applied, the focus was more on just getting the redundant MKPF-fields added to and filled in MSEG (apparently, MB51 wasn't too problematic then performance-wise). These activities were done and the fields are properly populated in our systems. After a recent system migration to another database we are now experiencing performance issues with MB51 and upon checking things out, I noticed that there's no entry in table MMIM_CONTROL_LOG. This seems to indicate that neither the steps "Set conversion complete" nor "Regenerate MB51" have been executed yet.

      Can these be safely executed now and what would we need to be on the look-out for (if anything)?

      Thanks much and Cheers


      Author's profile photo Bärbel Winkler
      Bärbel Winkler

      Just an update for whoever might be interested:

      Via OSS I was able to confirm that the missing steps could safely be executed even with a 2-year delay. So, we went ahead and processed the steps "Set conversion complete" and "Regenerate MB51" in our production environments. Since then, the transaction has been much improved performance-wise whenever it gets executed.