Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Determining if a Purchase Order is complete or not

Former Member
0 Kudos

I'm working on a report that given a certain Purchase Order number, I must determine if it is complete or not. I thought that I might need to find all the material document numbers and check each of those to make sure all the line items have been received via MIGO or not. However, I'm not sure how to do that. Is this the easiest way or is there an easier way? Any information would be greatly appreciated.

Thanks,

Curtis

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

I don't think you can actually really "close" a purchase order, however I did code a program recently to make EKPO-EREKZ and EKPO-ELIKZ = 'X' if the user selected to do so based on an ALV I developed.

If there is a G/R, then I made sure beforehand that the G/R and I/R amount were equal, if not they are not allowed to close.

You can run FM ME_READ_HISTORY to view line item history.

IF EKBET-BETWP = 'E' then its a Goods Receipt

IF EKBET_BETWP = 'Q' then its a IR

Just make sure the quantities equal out.

Hope this helps.

Mark

4 REPLIES 4

Former Member
0 Kudos

Hi,

The more easier way would be to check the table field EKPO-ELIKZ. Using this you can get the status of the purchase order.

Regards,

Vikranth

Former Member
0 Kudos

In addition to checking the status, I think you should check to see if all the items are fully invoiced (taking returns into account as well).

rob

Former Member
0 Kudos

You need to make sure all the line items are Fully Invoiced and Fully delivered. That makes a PO is completed. In this process you need to consider the reversal postings also.

If You have funds management associated to your MM(Purchase orders), make sure the incumbarance amounts there is equal to 0. You can verify this by going into any PO menu path ENVIRONMENT>AC COMMITMENT DOCUMENTS>FUNDS MANAGEMENT DOCS-->LOOK AT THE AMOUNTS HERE.

Follow the below steps to determine a FULLY INVOICED & FUNDS MANAGEMENT Amounts = 0:

1. Fetch the PO header & Items for the given selection criteria. Do not consider a PO, if all the lines are deleted on it.

2. Fetch all the PO history for all the POs from step 1.

3. For a given PO,

3a. Check if the field EKPO-EREKZ (Final Invoice Indicator) = u2018Xu2019 at item level. If this is set, they are FULLY INVOICED and sometimes you donu2019t find their IRs in the PO history.If EKPO-EREKZ = u2018Xu2019 and also has a PO history, perform step 3b.

3b. Check if an IR exists and calculate the IR quantities by taking the reversal postings also into consideration. If the final quantities of the IR postings match with the PO quantity, then itu2019s FULLY INVOICED item.

3c. If the calculated quantity is 0, itu2019s NOT INVOICED and if GT 0 and less than PO quantity, it will be a PARTIALLY INVOICED item.

4. Summarize all the line items for each and every PO as described above.

5. For a given PO, if different line items are part of 3b & 3c (PARTIALLY INVOICED & NOT INVOICED), then the total status of that PO will be PARTIALLY INVOICED. Hence, we donu2019t need that PO in this scenario and delete all those Pos and consider Pos which are part of only 3b (FULLY INVOICED).

Once you filter your POs and hold only FULLY INVOICED, then check their FM Documnets amounts:

Similarly you need to write a logic for FULLY DELIVERED Also.

Hope this helps.

Thanks,

Kiran

Former Member
0 Kudos

Hi,

I don't think you can actually really "close" a purchase order, however I did code a program recently to make EKPO-EREKZ and EKPO-ELIKZ = 'X' if the user selected to do so based on an ALV I developed.

If there is a G/R, then I made sure beforehand that the G/R and I/R amount were equal, if not they are not allowed to close.

You can run FM ME_READ_HISTORY to view line item history.

IF EKBET-BETWP = 'E' then its a Goods Receipt

IF EKBET_BETWP = 'Q' then its a IR

Just make sure the quantities equal out.

Hope this helps.

Mark