Quantcast
Channel: SCN : Blog List - ABAP Development
Viewing all articles
Browse latest Browse all 943

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

$
0
0

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.

1.jpg

                             

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.

1.jpg

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.
     me
->g_trtyp= im_trtyp.
 
ENDMETHOD.

 

  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.
    reqdata
= im_item->get_data( ) .

    reqdata-blckd  
= '1' .
    reqdata-blckt  
= 'need to approve' .
    im_item
->set_data(reqdata) .

   
DATA: ls_dataxTYPE mereq_itemx.
   
MOVE: 'X' TO ls_datax-blckd,
         
'X' TO ls_datax-blckt.

   
im_item->set_datax( ls_datax) .
ENDMETHOD.

 

That's all. Have a nice day

 

 

 


Viewing all articles
Browse latest Browse all 943

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>