Quantcast
Viewing all articles
Browse latest Browse all 10425

Fill WERK and LGORT depending on BSART with BAdI ME_PROCESS_PO_CUST

Dear,



I have the following requirement:


If the Purchasing document type (BSART) in ME21N is 'NB', the Plant (WERKS) and Storage location (LGORT) should always be set to '8999' and '8999' respectively.


(kind of like the USEREXIT_MOVE_FIELD_TO_VBAK in SD).



Now for that purpose I have found Methods PROCESS_HEADER and PROCESS_ITEM within BAdI ME_PROCESS_PO_CUST,


Based on the (many, many and varying) samples on this forum, I have ultimately coded both Methods as follows:


PROCESS_HEADER:


method IF_EX_ME_PROCESS_PO_CUST~PROCESS_HEADER.



DATA : l_items TYPE purchase_order_items.


DATA : l_single TYPE purchase_order_item.


DATA : l_item_cond TYPE mmpur_tkomv.



CALL METHOD im_header->get_items


RECEIVING


re_items = l_items.



LOOP AT l_items INTO l_single.


CALL METHOD l_single-item->get_conditions


IMPORTING


ex_conditions = l_item_cond.



ENDLOOP.



endmethod.



PROCESS_ITEM:


method IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM.



DATA : LS_MEPOITEM TYPE MEPOITEM.


DATA:  LS_MEPOHEADER TYPE MEPOHEADER.



IF LS_MEPOHEADER = 'NB'.


LS_MEPOITEM-WERKS = '8999'.


LS_MEPOITEM-LGORT = '8999'.


ENDIF.



endmethod.



This code shows no syntax errors, but Plant and Storage location are not set as '8999'.


I put a breakpoint in both Methods but I don't get into debugger mode..



What do I need to change in my code to have the system behave as I explained?


Thanks in advance, correct answers will definitely be rewarded.


Please don't be too hard on me since I am fairly new to BAdI's.:)



Kind regards,
Bart


Viewing all articles
Browse latest Browse all 10425

Trending Articles



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