Skip to Content

My view to prepare a report for all completed PO numbers with or without open invoice

Business Requirement:

We know we can get all types of purchase report from ME2N/ME2M/ME2L etc. But these all reports are considering as per line item. These reports will show you result line item wise when you run with your criteria (like as Selection parameter).

When you want to get a report for completed POs with consider all line items. When you want a report only for these PO numbers, whose are having delivery complete for all line items. You will not consider these POs as complete if GR will be pending (or partial GR) for any line item.

In short, you want a report with the indicator as “Fully Delivered” in Header – Status tab.

As an example,

You have a PO with 2 line items, GR has fully completed for first line item but your second line item has the partial GR. So when you will consider this PO as incomplete PO as second line item has some GR pending.

You will find more information in this discussion List of completed POs with compare all line items. I had posted the query but didn’t find any standard solution. Experts says, I have to go with development. Somehow, I’ve prepared this report with the field delivery complete indicator (EKPO) and Ms Excel.

I want to share my experience so that it can be helpful for others.

Actually my boss had given the task to me. We have one vendor and we are doing invoice when the PO for this vendor will be totally completed. My boss asked me to give the all completed PO numbers with open invoices, so that he can calculate the quantity for open invoices.

But before doing this you might have to know some important notes:

You will need to make this report when you will agree to pay invoices only when all line items of a single PO number are totally completed.

As you can see the report will be made by some work which is outside from SAP (as MS excel), so if you are agreed with to do an extra work analysis outside SAP.

If your PO is containing multiple line items, since if your some data (like as material, plant etc) are not same for multiple line items, then you can’t combine these lines into one.

You can’t do this when your vendor will give you invoice as per line item and vendor says you will not get rest material until you pay his sent invoices for another line item (which has completed).

You can’t do this when your vendor says he will give you some discount if you pay him for another line item which has completed and you will not able to get this discount if you will wait for the whole PO complete (all line items). Then it is suggestible to make the invoice and payment as per line item.


PO number 4500013608 contains 3 line items.

PO number 4500013609 contains 2 line items.

GR pending only for 3rd line item for PO number 4500013608. Hence I just need the report which will contain only PO number 4500013609 because only this PO number get fully completed.


Create a selection parameter as delivery complete tick indicator and delivered = Ordered. So that we can get all these line items whose are having filly GR completed.

IMG path : SPRO-IMG-Materials Management-Purchasing-Reporting-Maintain Purchasing Lists-Selection Parameters-Define Selection Parameters.

It will be much better to create your own selection parameter. You can create by coping a standard, then you have to make the changes as below:


Save the selection parameter.

Then take the all completed PO numbers (completed as per line item) with from ME2N with selection parameter ZDEV and ALV layout. It brings 4 entries (2 line items for PO number 4500013608 and 2 line items for PO number 4500013609)


Export it to excel.

Then copy these PO numbers and take the DCI indicator from EKPO table (DCI will be flagged only for these line items which has GR completed and also be sure your system has the option set delivery indicator automatically activated).


Export it into another excel sheet and replace the blank with value A (You can use A to W – alphabetically below than X). Then sort the DCI field. You can see the A will be appeared first.


You can see my one PO number has two DCI indicator as A and X. I have sorted this because we know excel will take the first value for formula V-Lookup when source contain different value.

Now I have two excel sheets. First is exported from ME2N and second is exported from EKPO table. I’ve done V-Lookup and take the DCI indicator from second excel to first excel.

Now our first excel will look like as below:


Now here, delete the line item which will contain the value A in DCI field.

After delete the line items, you will get the line item which will contain only value X for the field DCI.

It is thereport for all PO numbers which has completed GR in header status.


It means I get the PO number which are having GR as fully cleared for all line item.

I can compare this PO in SAP system as Header – Status as “Fully Delivered”


Here, in your excel sheet, you’ve got these PO numbers which are having GR fully delivered.

Now if you want to check the Invoice has already done yet or not for these PO numbers, then just go to ME2N report and filter these PO numbers with selection parameter “RECHNUNG”. You will get the result for all PO numbers with header status as “Fully Delivered” and “Not yet invoice”.

You must be Logged on to comment or reply to a post.
  • Thanks for sharing. Makes one wonder though how easier this would be if POs also had the status tables like VBUK/VBUP for sales orders. Oh well, maybe in sERP on HANA? 😉

  • Hi Dev

    This is how we play with system for reporting purpose. As Jelena said it is very simple and easy to get this information in SD 🙂

    BTW did you try this doing in query reporting? May be we can make a report with some additional field and some coding in it for elimnating the MS Excel part. What do you think?


    • In this case Dev is using the results from a standard report, so to do the same in a query one might have to recreate the logic of that report (or at least part of it). That might not always be easy. There were many times when the users would come to me and point to their monitors and ask “why can’t we get this number from here and this number from here and add 10 more fields and have just one report?”. Well, that’s because this would require reverse engineering and re-creating “here” and “here” and we might end up waiting for the results forever. 🙂

      Also unfortunately the queries don’t have built-in “remove duplicates” functionality. Since the ‘complete delivery’ field is at the line level, you’d have to build the query using EKPO and then it would show the line items, not just the PO numbers. You could build it based on EKKO and then add ABAP code to check EKPO, but performance wise that would be very inefficient.

      Query is a great tool but not without limitations, alas.

      • Yes we do have some limitations in query reports. I always had believed that we can’t remove duplicates in query reports but a frind of mine told me that they have done something in coding to have single record from a table lets say VBRP. If we use batch split in SD, you know there is single line item for every batch in VBRP and system would show each item sperately in query report. But he told me that it is possile to show this in one line item by adding quantity. In short remove duplicate can be possible up to some extent. I still have to ask the technique from him.

        Since you are ABAPER and functional both so you must know this better than me 🙂


        • I know what you mean. Those are not really duplicate records because there is certain criteria that can be used for filtering. This can be easily done either with ABAP code or a layout filter. But in the cases where there is no such criteria available, e.g. multiple lines with the same status but all we need is just document number, like in this case, it is more challenging.

          By the way, there is a note that explains changes that can be made to have just one invoice line for batch split (there will be two lines in the delivery but one line in the invoice). We’ve done it in our system. Sorry for hijacking the comments for a side discussion! 🙂

          • Note 77414 – Billing during batch split. I believe I was also asked to do a VOFM routine but am not sure it was actually needed (we were in a hurry at that time, which is never a good thing).

    • Sridhar, I’m sure you meant no disrespect, but please be aware that in most English speaking countries “dude” is usually not considered an appropriate salutation in the professional setting (SCN is a professional site). You might want to take a look at this blog – simply liking/rating content is usually the most appropriate. Thank you.

  • Dear Dev sir,

    Very good document thanks for sharing. If we know well about selection parameter there no need of ABAP coding for these type reports. i also faced similar to this but my client need report only Pending POs report material group wise cumulatively. selection parameter will give this easily without any new report.


    B V