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: 

Purchase order item - avoid delete

Former Member
0 Kudos

Hi Expert,

I have to make a control to avoid the deletion of an item of purchase order.

In other word, when the user press the delete button in the item of purchase order, I have to check variable A.

If A = 'X' --> avoid delete item, and pop for info

else.

delete item

endif.

How I can make it ? There's a BADI, or an user exit ?

Tks a lot.

4 REPLIES 4

GauthamV
Active Contributor
0 Kudos

hi,

use this badi.

ME_PROCESS_PO_CUST.

Former Member
0 Kudos

Tks Gautham,

I've implemented the BADI ME_PROCESS_PO_CUST-PROCESS_ITEM

And, now how to avoid the deletion ? How to write inside to avoid the deletion ?

tks

0 Kudos

Hello,

Please implement the Badi "ME_PROCESS_PO" in that go to

if_ex_me_process_po_cust~process_item.

Write the code

DATA : re_data TYPE mepoitem.

DATA : mmmfd_preq_no TYPE mmpur_metafield VALUE 003. "Banfnummer

INCLUDE mm_messages_mac. "useful macros for message handling

CALL METHOD im_item->get_data

RECEIVING

re_data = re_data.

IF re_data-lokez ne space.

CALL METHOD im_item->invalidate( ).

mmpur_metafield mmmfd_preq_no.

mmpur_message_forced 'E' 'ME' '083' text-003 'Deletion not allowed' '' ''. ENDIF.

Former Member
0 Kudos

Hello Suresh,

Tks for your reply, You solved my question !

Anyway there's a little problem:

If the user delete the item, my BADI avoid this operation, but after

the user is blocked, I mean that the error message is always present.

There's a way to restore the situation ?

tks a lot,