Badi:Not allowing creating PO(specific document type) without PR
Recently I have implemeted Badi(ME_PROCESS_PO_CUST) for ‘Not allowing create PO(with dcoument type NBPJ and CRPJ) without PR.
If user tries to create PO(PO document type PJCR or NBPJ) with out PR,then system will throw error message.The Error message is “There is NO Purchase Requisition for this PO !”.
How to do this?
You can use transaction SE18 to Implement it.
1.Go to transaction SE18.
3.From the menu Implementation->Create
4.Give your implemenation name as below(starts with Z..) Here I have given as zme_process_po_cust.
5.Then give implementation short text as you like.
6. Then click ‘Interface ‘ tab and select method ‘PROCESS ITEM’ (BY DOUBLE CLICKING)
7.In this method,please add the following coding.
include mm_messages_mac . “useful macros for message handling
CALL FUNCTION ‘MEPO_DOC_HEADER_GET’
EX_EKKO = LS_MEPOHEADER.
IF ( LS_MEPOHEADER-BSART = ‘NBPJ’ OR LS_MEPOHEADER-BSART = ‘PJCR’ ) . “here I am checking my document type
CALL METHOD IM_ITEM->GET_DATA
RE_DATA = LS_MEPOITEM.
IF LS_MEPOITEM-BANFN IS INITIAL.
How to create error message?
Here my error message is E025 with message class ZQ.You can use transction code SE91,you can create your own message.
8.Finally ‘SAVE’ and ‘ACTIVATE’.
9.Now try to create PO with your own PO document type without PR,then you will get error message and without rcreating PR,you can not complete your PO..However you can ‘HOLD’ your PO.
I welcome your suggestion,please.Thank you.