SAP BLOG Add Custom Field in Output of Standard Report of ME2N

SAP Blog

Kayıtlı Üye
Katılım
22 Ara 2017
Mesajlar
1,925
Tepki puanı
7
Puanları
6
Author: Vedarth Desai

A very common requirement from customer is to modify the outputs of standard reports.

Here I have tried to explain how to modify the standard report ME2N output.

Requirement

Purchase Documents per Document Number: T-code: ME2N is a standard report that retrieves a purchase order details via a document number and other user-defined parameters.

Minimum parameters in selection-screen we need to pass are valid Scope of list and Either of remaining fields.

Scope of List defines the format in which report will get display.

Capture-7.jpg


In general, Report output looks like below.

Capture-8.jpg




Here in this output we need to add one additional column which will display some information as per the requirement. Here let’s add an extra field/column and display ‘Net Order Value Incl. Tax’.

There are mainly 2 steps to do the modification.

  1. Add desired field in Output structure.
  2. Write code to populate the value in the field in Appropriate BADI/Enhancement.



Step 1: Add Desired Field in output structure

  1. To add desired field in output structure, you first need to find output structure.

– To find the same, you can press F1 on any of the output field and Click on technical information to find the structure. You will find the strucure name for ME2N as below.

Capture-9.jpg


2. After Getting Structure MEREP_OUTTAB_PURCHDOC, add desired field in strucure.

— Go to SE11.

— Data Element: MEREP_OUTTAB_PURCHDOC. Display.

— Click on Append Structure and Check if any Custom structure is available or not. If not, Create new Custom structure and add desired field with relevant data element.

Note: Field name should start from ‘ZZ’ as it is defined in customer namespace.

Capture-10.jpg


Capture-11.jpg


Set Relevant Currency field(if applicable) and enhancement category. (Can be Enhanced(Deep)).

Capture-12.jpg


Capture-13.jpg




— Activate the structure. and check structure MEREP_OUTTAB_PURCHDOC now.

Capture-14.jpg


— Now we are done with enhancement of underlying structure. Let’s execute the report ME2N and see our newly added field. You need to choose the field from Layout Option.
Index.9.jpg




Capture-15.jpg




So here Step 1 is finished as we got desired field in output.



Step 2: Write code to populate the value in the field in Appropriate BADI/Enhancement.

Appropriate BADI/Enhancement needs to be used for populating value to the newly added field in the structure.

For this requirement,BADI/Enhancement are there which varies from R3 system release to release.

In release ECC 6.0, BADI ME_CHANGE_OUTTAB is there but it’s only for SAP’s internal use. It can not be used by customer, so in this version of R3, one needs to search for some other alternatives or enhancement spot for this.

However in SAP ECC release with EHP4 FOR SAP ERP 6.0 / NW7.01, Same BADI with a different name which is available for customer usage. which is ME_CHANGE_OUTTAB_CUS.

This example is in system ECC 6.0, So one enhancement spot is required to populate value to the newly added field to the report.

Note:There is no specific way where you can find the appropriate enhancement spot/point/section.

When we run the report ME2N, main program SAPLMEREP will run and the include LMEREPI02 in it. We can find different enhancement point in the include which can be analyzed.

Capture-17.jpg


Note: I have chosen this specific include because there is already one standard enhancement available in this include. Which u can find through Enhancement spots as shown below.

Capture-18.jpg


Creating an enhancement spot and including custom logic in it inside the method BUILD_BASE_LIST will solve the purpose.

Double click on above method, click on ENHANCE button and then scroll down to the enhancement point which is present immediate before ENDMETHOD statement of above method.

Capture-19.jpg


Capture-20.jpg


Create an Enhancement here and include custom logic. This place/enhancement will trigger for each PO and its Line Items.

Right Click on Line before ENDMETHOD –> Enhancement Operations –> Create Implementation.

Capture-21.jpg


Add your custom logic.

Here, to Create Net order value with Tax I have created custom FM. which returns Value as per Line Item.

Capture-22.jpg


In this enhancement point, structure RE_OUTTAB_PURCHDOC will have all the report output fields including our new additional field. Code can be written here to manipulate values for other report fields. Write code as above Activate the enhancement .Then run the report to see the result.

Capture-23.jpg




Note: For this requirement I have not followed any specific methodology or procedure to find the program name, enhacement point name or structure name that needs to be modified. Debugging and searching in different sites helped me to reach to the conclusion.



I hope you find this post informative.

Okumaya devam et...
 
Üst