Skip to Content

PO line item delete while saving ( based on custom selection)

Hi ,

We are trying to implement PO line item auto delete while saving the PO ( based on auto conversion or though me21n manual ) and this should work based custom selection / custom table . We had tried to implement through exit and BADI but it’s not working .

Let me know if anyone having idea on this or implemented same scenario in past .

Thanks ,


Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Jun 03, 2014 at 10:40 AM

    You can well use the badi ME_PROCESS_PO_CUST for your requirement..

    For more details consult with your ABAP team.

    Also you should post the query to ABAP forum.. An ABAP consultant can give you more information about why the badi is not working.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Raghavendra Balegar


      Tell your ABPAER to use the below badi.


      Method: PROCESS_ITEM

      If Goto SE18 check the documentation you can very well see as below.

      Processing of Item Data


      The PROCESS_ITEM method enables you to change the item data and check it for correctness.


      The following parameters are available:

      • IM_ITEM - Document item
        The interface reference is of the category IF_PURCHASE_ORDER_ITEM_MM. You can use all methods defined there.


          Please note the general hints on

        Error Handling


          • If you wish to mark the document item as invalid, use the INVALIDATE() method of the IF_PURCHASE_ORDER_ITEM_MM interface.


          Under no circumstances make any changes to the database within this method. On no account use Commits.

          Documentation for Business Add-In ME_PROCESS_PO_CUST

      • author's profile photo Former Member
        Former Member
        Posted on Jun 03, 2014 at 12:11 PM

        Can you explain whats the business process in brief why 'PO line item auto delete while saving' is required.


        Add a comment
        10|10000 characters needed characters exceeded

        • Hi Raghavendra,

          I understand that you are facing problems due to non-availibility of Header data in PROCESS_ITEM. But the same can be pulled live from the program. Sample pseudo code and reference link provided below. Hope it helps your ABAPer gain an insight.

          REF: Getting Header Data in ITEM_PROCESS

          DATA: ls_item TYPE mepoitem,

          ls_header TYPE mepoheader,

          ls_header_obj TYPE REF TO if_purchase_order_mm.

          *Get PO Header data

          CALL METHOD im_item->get_header


          re_header = ls_header_obj.

          CALL METHOD ls_header_obj->get_data


          re_data = ls_header.

      • author's profile photo Former Member
        Former Member
        Posted on Jun 03, 2014 at 11:52 AM

        Hi RB,

        You can explore your options by triggering the BAPI function module "BAPI_PO_CHANGE" after the event save at the purchase order. Here you can pic-up the criteria for deletion from your custom table and pass them so as to delete the entries at item level.

        Hope it helps,


        Hardik Sharma

        Add a comment
        10|10000 characters needed characters exceeded

        • Former Member Nishant Nayak

          Hi Nishant,

          Not that it is in context to the question, but I would like to mention another perspective. Not always is the prevention better than cure. Prevention is not economically viable because you have to be alert and do stuff so as to prevent and statistically there is a chance at 'failing at preventing'. If the cure is available, take it and forget about preventing.

          One may buy an extended warranty for ones cell phone, another may not. We have different perspectives on risk avoidance.

          Coming back to the question: I guess the BAPI Function module will take the header data ("Vendor/P.Org/Document type") into account as well. If you delete the items before the save itself the user might not know about what items were deleted. But in case of post save changes, you do have record of what items have the custom enhancement deleted. I know it will have performance impact, but Its just my understanding / perspective of the problem.


          Hardik Sharma

      Before answering

      You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
      You must be Logged in to submit an answer.

      Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.