2009 Mar 20 8:55 AM
We have a requirement to make the Delivery Address a mandatory field for Purchase Requistions raised via ME51N.
Can anyone please suggest a Badi or User Exit that we can use to check that the field has been populated when saving?
Thanks in advance
Jan
2009 Mar 20 9:38 AM
Hi Jan,
I think this can be achieved by doing some configuration change through SPRO. Follow this path in SPRO and look whether you can set devlivery address field mandatory:
SPRO-> Materials Management-> Purchasing->Purchase Requisition->Define Screen Layout at document Level or OMF2 transaction. In the table control select ME51 and press details icon. From the resulting screen select Field Selection Group and for each group you can find fields which can be set mandatory, optional, display only.
You can take help of functional consultant for above settings.
Hope this helps.
Ramesh.
2009 Mar 20 12:24 PM
Hi Ramesh,
Thanks for your reply. According to our Business Analyst, the delivery field is one of two fields that cannot be made mandatory in this way.
However, I have managed to solve the problem myself using method Check in Badi ME_PROCESS_REQ_CUST, thanks to another post in this forum. The code is as follows, in case it helps anyone else:
data: it_items type mmpur_requisition_items,
wa_item type mmpur_requisition_item,
v_items type ref to if_purchase_requisition_item,
w_item_data type mereq_item.
call method im_header->get_items
receiving
re_items = it_items.
loop at it_items into wa_item.
v_items = wa_item-item.
call method v_items->get_data
receiving
re_data = w_item_data.
if w_item_data-adrn2 = ''.
message e083(zmm) with 'Item '
w_item_data-bnfpo
'Delivery Address is Mandatory'.
endif.
endloop.
Jan
2020 Jan 29 10:54 AM
hi ,
I tried your way for making it mandatory but I am always getting w_item_data-adrn2 or w_item_data-adrnr as initial even if the address is filled . This adrnr is generated after the posting doc is generated.
Can you help with this.
Thanks.