Skip to Content

ME21N Line Item deletion

Hi,

I have a requirement on ME21n or ME22n, I need to delete line item based on some validation.I am using BADI: ME_PROCESS_PO_CUST (Method: PROCESS_ITEM).

I have used class method CL_PO_ITEM_HANDLE_MM - get data for reading data. and i am trying to use method REMOVE_ITEM for deleting line item. but it is incompatible.

Please suggest where i can delete line item.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Oct 25, 2018 at 03:39 AM

    Hi Michelle,
    Thanks for the reply.

    Below is the code where i am trying to remove line item.

    **Get Header and line items
    CALL METHOD im_item->get_header
    RECEIVING
    re_header = lo_header.

    **Get Items
    CALL METHOD lo_header->get_items
    RECEIVING
    re_items = lt_items.

    * DATA : ls_items TYPE MMPUR_MODEL_TYPE-model.
    DATA : ls_items TYPE purchase_order_item.
    ***********************temp code*******************
    * lcl_item_remove ?= im_item.
    *
    READ TABLE lt_items INTO ls_items WITH KEY item = im_item.

    ls_items_model ?= ls_items-item.
    DATA: LO_ROOT TYPE REF TO cx_root.
    create OBJECT lcl_item_remove.
    LOOP AT lt_items INTO ls_items.
    ls_items_model ?= ls_items-item.
    LS_MODEL-MODEL = ls_items_model.
    * try.
    ** lcl_item_remove->add_item( ls_model-model ). [Here i am getting ALREADY_SET dump]
    * CATCH SYSTEM-EXCEPTIONS. " ALREADY_SET.
    * ENDTRY.
    APPEND ls_model to lt_items_models.
    CLEAR LS_MODEL.
    ENDLOOP.

    mmpur_dynamic_cast lcl_item_remove_1 ls_items_model.
    lv_item = lcl_item_remove_1.

    CALL METHOD lcl_item_remove->remove_item
    EXPORTING
    im_item = lv_item.

    Please Suggest.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 26, 2018 at 11:30 AM

    Hi, i have use REMOVE_ITEMS but it is giving exception failure in class CL_HANDLE_MANAGER_MM, method: GET.

    Please suggest if any alternative is there.

    I have also check some exits and deleted the line item but object is created for each line item and internal table is populated again through object created.

    Add a comment
    10|10000 characters needed characters exceeded

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.