Skip to Content
Author's profile photo Dibyendu Patra

Add the field User Name in various Purchasing report’s output ALV list

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. Here, 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.

/wp-content/uploads/2014/12/dev_607099.jpg

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.

/wp-content/uploads/2014/12/dev_607099.jpg

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.

/wp-content/uploads/2014/12/dev_607099.jpg

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.

Assigned Tags

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

      Hello Dybiendu,

      Nice one !

      Alexandre

      Author's profile photo Mehmet Ozgur Unal
      Mehmet Ozgur Unal

      Hi All ;

      Helpful document to develop standard program, thanks for sharing.

      @dev : Is there any oss note to refer ?

      Regards.

      M.Ozgur Unal

      Author's profile photo Dibyendu Patra
      Dibyendu Patra
      Blog Post Author

      No. I am not able to find any oss note.

      Author's profile photo Narendra Konnipati
      Narendra Konnipati

      Hi DP,

      Good article.I will share it with my management to implement this.

      Thanks for sharing this to us DP 🙂 .

      BR's

      KNR

      Author's profile photo Florian Henninger
      Florian Henninger

      Hi Dypiendu,

      maybe you should ask your ABAPer to correct your coding snippet...

      As you just pass one ebeln there is no need for the table...

      A SELECT SINGLE STATEMENT is pretty enough and you even do not need a type-declaration for it 😉

      Additional to that, I do not got my sytem available, but I'm pretty sure there might be a better spot for it.

      ~Florian

      Author's profile photo Dibyendu Patra
      Dibyendu Patra
      Blog Post Author

      Can you give an example of the coding.

      I am looping our ABAPer in this comment portion.

      cc avishek saha

      Author's profile photo Florian Henninger
      Florian Henninger

      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.

      I did not prove the current enhancement, if it is at a position, which is good.

      Anyway, this coding is doing exact the same with just half of the lines.

      Additonal to that, I'm pretty sure, that there is everywhere a name-convention active and so something like

      DATA: ename type ername

      will be never ok to code anywhere in the system. This is not just because the customername-space begins with Y or Z

      ~Florian

      Author's profile photo Dibyendu Patra
      Dibyendu Patra
      Blog Post Author

      GreatJ.. This is also working same.

      I am adding both code in my this blog so that one can understand easily and use one of them.

      Thank you for your support and help.

      Author's profile photo ' MoazzaM '
      ' MoazzaM '

      Hi DEV

      This is nice document and the good thing is that you have shared all relevant blogs/threads in it. A comprehensive document and easy to understand explanation is always good to see. Good work my friend 🙂

      Thank$

      Author's profile photo Sanjeet Kumar Yadav
      Sanjeet Kumar Yadav

      Nice Dev. Thanks for posting such type of Block to save our time for future requirement.

      Author's profile photo Bhumika dodia
      Bhumika dodia

      Hello Sir,

      Very helpful post, helped me in to fulfill requirement.