Skip to Content

Badi:Not allowing creating PO(specific document type) without PR

JAHEER HUSSAIN,CRISTAL.

______________________________________________________________________________________________________________________________
Hi,

Objective:

    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.

/wp-content/uploads/2015/06/1_727289.jpg

2.Press ‘Display’.

3.From the menu Implementation->Create

/wp-content/uploads/2015/06/1_727289.jpg

4.Give your implemenation name as below(starts with Z..) Here I have given as  zme_process_po_cust.

/wp-content/uploads/2015/06/1_727289.jpg

5.Then give implementation  short text as you like.

6. Then click ‘Interface ‘ tab and select   method ‘PROCESS ITEM’ (BY DOUBLE CLICKING)

/wp-content/uploads/2015/06/1_727289.jpg

7.In this method,please add the following coding.

method if_ex_me_process_po_cust~process_item.


  include mm_messages_mac . “useful macros for message handling


  CALL FUNCTION ‘MEPO_DOC_HEADER_GET’


    IMPORTING


      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


      RECEIVING


        RE_DATA = LS_MEPOITEM.

    IF LS_MEPOITEM-BANFN IS INITIAL.


     MESSAGE E025(ZQ).

   

    ENDIF.

  ENDIF.

endmethod.

————————————————————————–

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.

/wp-content/uploads/2015/06/1_727289.jpg

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.

4 Comments
You must be Logged on to comment or reply to a post.