Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member183424
Active Contributor
19,018

I was having a requirement from my production department, They use ME2N report, now they want to see the user who has created the PO in output field.

I have checked the screen layout for the ME2N report (including the ME2L/ME2M), but didn't find the field User name which is containing the user ID who created the correspond PO.

In ME2N report, there are no field as "User name" in output field. This blog will describe how to add the field User Name in output section.
I've read a document Enhance purchasing reports with new fields written by joao.sousa2Here, he has used a BADI. Then I've read another document from a different website Modify Standard Purchasing Report Output of ME2N. It can fulfil my requirement. Here, he has used explicit enhancement as I have described in my blog Explicit Enhancement for "Personal Settings" for an User. But here he has implemented a particular value for a field, but I need the PO creator name in this extra field.

Then I thought I can change the value by doing some coding in this explicit enhancement without using BADI. I have tried it with the help of our ABAPer and I've done it successfully. I want to share it. Here is the all configurations and coding.

Before giving the steps, I would like to suggest to read the post Modify Standard Purchasing Report Output of ME2N. It almost every settings are same as per this document. You just need to add different field in structure and you need to add your own logic/coding in this explicit enhancement. A good explanation with screen shot has given in this post.

I have taken help from our ABAPer as the code is not known to me as a functional consultant, but if you know the coding part, then you do not need to take help from anyone. You can do it yourself with the help of my this blog.

Note: This screen layout is applicable for ALV layout. You need to run the report ME2N/ME2L/ME2M with ALV as scope of list.


As we know the structure of purchase report's screen layout is used from MEREP_OUTTAB_PURCHDOC. So we need to create a new structure under this structure as ZUSER (you can use it different as per your requirement). To create the structure, you need to go to SE11, then enter the structure name in Data Type and then press Display.

Then you will find an option as append structure. A brief detail explanation you can find it in this Document.

You just need to use a different component type (as you want to show it as User name) as SYUNAME.

Save your entry. You can save this into a TR, so that you can move it into another client if required.

Then you can see the field will be appeared in ME2N output screen layout. But it will come with blank value as we have just created the structure but didn't add any value or any coding for the newly created structure.

Now we need to create an explicit enhancement for this structure. When we run the report ME2N/ME3L/ME2M, system read the program LMEREPD02 (it is not the main program). In this program we can implement our enhancement and we need to do that under the methode build_base_list.

Go to SE38 and enter the program LMEREPD02, then click in the display, then find the method build_base_list in this program (you can find it in line item 76).

As this is a standard program, it will be same for every system (Note: I am not sure it can be different with different ECC/EHP release). Now double click on the method build_base_list.

Now click on the spiral symbol and follow the steps which I have already explained in this blog Explicit Enhancement for "Personal Settings" for an User.

Do these all steps from step 2 to step 5 in this blog. In step 6, you need to do some changes in coding.

Write the below code for this explicit enhancement. There are two way (code) you use for the same requirement.

SELECT SINGLE ernam

          FROM ekko

          INTO re_outtab_purchdoc-zuser

          WHERE ebeln = im_ekko-ebeln.

IF sy-subrc <> 0.

    clear: re_outtab_purchdoc-zuser.

ENDIF.


or


types : begin of ty_ekko,

         ebeln type ebeln,

         ernam type ernam,

         end of ty_ekko,

         ty_t_ekko type standard table of ty_ekko.

  data : wa_ekko type ty_ekko,

         it_ekko type ty_t_ekko.

  data : ename type ernam.

select ebeln ernam

   from ekko

    into table it_ekko

    where ebeln = im_ekko-ebeln.

   clear : wa_ekko , ename.

   LOOP AT it_ekko into wa_ekko.

   ename = wa_ekko-ernam.

   ENDLOOP.

   re_outtab_purchdoc-zuser = ename.


Remember, do not use both code in this enhancement, you can use only one of them.

(You can find attachment for both coding also with this blog)


If you will use a different Component for structure MEREP_OUTTAB_PURCHDOC, then you need to write the same component in the last line of this coding.

I have used the component as ZUSER, so that I have written the same component name in the last line as re_outtab_purchdoc-zuser = ename.

Now click on Enhancement as shown in this Blog.

Now our enhancement is ready to use. Now we need to test the same for reports ME2N/ME2L/ME2M. Go to ME2N and enter your selection data and press execute.

Here you can see the new field with field value with correspond POs. If you are not able to see the field, then you need to choose the field from Change Layout. Now we can compare it with EKKO table, where you can found the same User name for these POs.

You can see both are matched. You can also use this field in these below reports and t-codes :

ME28 - Release Purchase Order

ME2C - Purchase Orders by Material Group

ME2W - Purchase Orders for Supplying Plant

ME2N - Purchase Orders by PO Number

ME2L - Purchase Orders by Vendor

ME2M - Purchase Orders by Material

ME2K - Purch. Orders by Account Assignment

ME35 - Release Outline Agreement

ME35K - Release Contract

ME35L - Release Scheduling Agreement

ME45 - Release RFQ.

Try it in your system. It is quite simple and easy if you know the code of the enhancement. Even you do not need to take help from an ABAPer once you will get the code.

11 Comments
Labels in this area