09-30-2008 12:57 PM
Hi All,
I need to validate some item level data with the header data, So i wrote the code in User Exit. Its validating well, but if i press save button its simple asking a dialog and the PO is getting saved.
i have tried EXIT_SAPMM06E_007, EXIT_SAPMM06E_006 and EXIT_SAPMM06E_012 also. In call cases, its validating properly with throwing a message. But i am able to save...
can you please let me know your views on this.
Thnks,
Raghu Posani.
09-30-2008 1:05 PM
Raghu
Try to put the code in BADI ME_PURCHDOC_POSTED..
Create the Implementation and put the checks in method POSTED..
Thanks
Amol Lohade
09-30-2008 1:09 PM
you can use the BADI ME_PROCESS_PO_CUST , try with Check method or post method
09-30-2008 1:26 PM
Hi Vijay,
I have tries that BAPI as well, but iam unable to suceed to get the item level data. Thats why i have moved to user exit. As am not aware how to write the code in BAPI i approached the User Exit...
Thnks,
Raghu Posani.
09-30-2008 1:34 PM
Hi use badi me_process_po_cust
this is sample code which i had used for similar requirement
u manipulate as per ur requirement
IF SY-TCODE = 'ME22N'.
RF_MEPOHEADER = IM_ITEM->GET_HEADER( ).
IT_MEPOHEADER = RF_MEPOHEADER->GET_DATA( ).
IF IT_MEPOHEADER-BSART = 'ZLNB' OR IT_MEPOHEADER-BSART = 'ZLUB' OR IT_MEPOHEADER-BSART = 'ZLS'
OR IT_MEPOHEADER-BSART = 'ZLC' OR IT_MEPOHEADER-BSART = 'ZLFO' OR IT_MEPOHEADER-BSART = 'ZLLN'
OR IT_MEPOHEADER-BSART = 'ZLDB'.
IF SY-SUBRC = 0.
IF SY-UNAME = 'ABAP05' OR SY-UNAME = 'FUNC65' OR SY-UNAME = 'MKHPE485' OR SY-UNAME = 'MKHPH9546'
OR SY-UNAME = 'MKHPH9554' OR SY-UNAME = 'MKHPH9553' OR SY-UNAME = 'MKHP163'
OR SY-UNAME = 'MKHPE517' OR SY-UNAME = 'MKHPE540' OR SY-UNAME = 'MKHPE422'
OR SY-UNAME = 'MKHPH9559' OR SY-UNAME = 'MKHPE426' .
IF SY-SUBRC = 0.
SELECT SINGLE * FROM EKPO INTO WA_EKPO
WHERE EBELN = IT_MEPOITEM-EBELN
AND EBELP = IT_MEPOITEM-EBELP.
SELECT SINGLE * FROM EKKO INTO WA_EKKO
WHERE EBELN = IT_MEPOITEM-EBELN.
IF WA_EKKO-FRGKE = 'R'.
IF WA_EKPO-MENGE NE IT_MEPOITEM-MENGE OR WA_EKPO-NETPR NE IT_MEPOITEM-NETPR.
Message 'You are not authorized to change the given data' type 'E'.
ENDIF.
IF WA_EKKO-ZTERM NE IT_MEPOHEADER-ZTERM .
Message 'You are not authorized to change the given data' type 'E'.
ENDIF.
ENDIF.
ENDIF.
CLEAR: WA_EKPO ,WA_EKKO.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
Ronak
09-30-2008 3:13 PM
It's not a BAPI it's BADI
but iam unable to suceed to get the item level data
for sample code :
DATA : im_data TYPE mepoitem,
*get the item data
CALL METHOD im_item->get_data
RECEIVING
im_data = im_data.