Skip to Content
Author's profile photo Former Member

Automatic setting lock when creating the purchase requisition. BADI ME_PROCESS_REQ_CUST.

Task essence:

My task was to set Block ID and Text automatically while end-user created purchase requisition in ME51N.

Why do it? Because, it should be approved in another SAP module (PSM-FM) and only after this it can be converted to PO.



My solution:

First of all, look at SE11, structure MEREQ_ITEM_S_CUST_ALLOWED. There are no such fields (block id and text) there.

Create append structure.


Then, implement BADI ME_PROCESS_REQ_CUST, create 1 attribute and write code of 2 methods:

G_TRTYP Instance Attribute Private Type TRTYP

  METHOD if_ex_me_process_req_cust~open.
->g_trtyp = im_trtyp .

  METHOD if_ex_me_process_req_cust~process_item.
CHECK  me->g_trtyp  = ‘H’ . ” creatingmode
CHECK im_count = .

    DATA  reqdata   TYPE mereq_item .
CLEAR: reqdata .
= im_item->get_data( ) .

    reqdatablckd   = ‘1’ .
= ‘need to approve’ .
->set_data( reqdata ) .

    DATA: ls_datax TYPE mereq_itemx.
MOVE: ‘X’ TO ls_dataxblckd,
‘X’ TO ls_dataxblckt.

    im_item->set_datax( ls_datax ) .

That’s all. Have a nice day 🙂

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Christine Kühberger
      Christine Kühberger

      Thank you very much for this information. I successfully used this to change delivery address in the purchase requisition (Field adrn2) and it works fine!