Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Purchase Requisition BADI/User Exit

I am looking for an enhancement where I can change an item level field when a purchase requisition is saved. This should work for Me51/Me52/Me51n/Me52n transactions.

This should trigger upon 'SAVE' of purchase requisition.

Thanks in advance,

Shareen

Tags:
Former Member replied

Shareen,

The BADI exit allows modification of most PR fields.

A number of the parameters to each method are defined as "TYPE REF TO" ABAP objects, and if you drill down to these objects you see that they then have methods such as "GET_DATA" and "SET_DATA" to retrieve details and change them.

As an example, the following code for an implementation of method PROCESS_ITEM of ME_PROCESS_REQ_CUST changes the AFNAM field:

METHOD if_ex_me_process_req_cust~process_item.

  DATA: l_preq TYPE mereq_item.

  CALL METHOD IM_ITEM->get_data
    RECEIVING
      re_data = l_preq.

* Convert Requisitioner name to upper case
  TRANSLATE l_preq-afnam TO UPPER CASE.

  CALL METHOD IM_ITEM->set_data
    EXPORTING
      im_data = l_preq.

ENDMETHOD.

Thus, even though the original BADI has only importing parameters, it actually allows changes to the data.

The SAP example implementation CL_EXM_IM_ME_PROCESS_REQ_CUST appears to have very little example code - there is some information on how to present error messages in the OPEN method, but not much else.

The corresponding BADI (ME_PROCESS_PO_CUST) for Purchase Order transactions ME21N / ME22N is similar and has example code in method PROCESS_ITEM of CL_EXM_IM_ME_PROCESS_PO_CUST. This might help you.

You could also search SDN for previous posts on how this BADI works.

To create an implementation for the BADI use transaction SE19.

Andrew

1 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question