09-12-2008 5:17 AM
Hi All,
I want validate at SAP Transaction level (ME21N). When I am going to create PO i need to validate the EKGRP maintained at PO level and maintained at Info record level. if both are different i need to throw an error??
So can you please tell me the procedure to go ahead? if i need to write the code in the exit, please let me know the procedure where to write.
Thnks,
Raghu.
09-12-2008 6:22 AM
Hello Raghu
Having BAdI ME_PROCESS_PO_CUST available on your system you can use its method CHECK to do final validations which allow you to cancel saving of the PO (in case of failed validations set CH_FAILED = 'X' ).
IMPORTING parameter IM_HEADER (IF_PURCHASE_ORDER_MM) has a method GET_DATA which returns the header data (structure MEPOHEADER). Here you can find EKGRP at header level.
If I am correct then info records are found at item level. Thus, call IM_HEADER->GET_ITEMS to retrieve them.
Items are TYPE REF TO IF_PURCHASE_ORDER_ITEM_MM -> implementing class CL_PURCHASE_ORDER_ITEM_MM).
Loop over the item instances and call method lo_item->GET_DATA in order to retrieve the item data (structure MEPOITEM) which contain field INFNR ( Number of Purchasing Info Record ).
Well, from here on it should be possible to find the way on your own.
Regards
Uwe