Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Display Message while creating / changing PO .

Former Member
0 Likes
685

Hi All ,

Whenever a New PO is created against a WBS . I have to check if the value of this PO exceeds the total budet available for WBS .

Is there any BADI / BAPI / user exit where I can write my code and display my messages accordingly .

Thanks in advance ,

Regards ,

Ambar .

4 REPLIES 4
Read only

GauthamV
Active Contributor
0 Likes
631

Use this badi.

ME_PROCESS_PO_CUST

Read only

Former Member
0 Likes
631

Hey

Thanks a lot for such a quick response . However , i couldnt make out much .

Can you please elaborate a little bit .

Read only

0 Likes
631

You can try something like this .



METHOD if_ex_me_process_po_cust~process_item .

  DATA:l_if_header TYPE REF TO if_purchase_order_mm,
        ls_header TYPE mepoheader,
        lt_accounts TYPE purchase_order_accountings,
        st_account TYPE purchase_order_accounting,
        l_accounting TYPE REF TO if_purchase_order_account_mm,
        ls_mepoaccounting TYPE mepoaccounting,
        v_stufe  TYPE ps_stufe,
        l_text(100) TYPE c,
       doctype     TYPE bsart,
       Compcode type bukrs,
       docdate type ekko-bedat.

  INCLUDE mm_messages_mac.

  l_if_header = im_item->get_header( ).
  ls_header   = l_if_header->get_data( ).
  doctype     = ls_header-bsart .  "NB
  Compcode   = ls_header-bukrs.
  DOCDATE    = LS_HEADER-BEDAT.

      CHECK doctype NE 'UB'. "stock transport purchase order no restriction

      lt_accounts = im_item->get_accountings( ).
      LOOP AT lt_accounts INTO st_account.
        l_accounting = st_account-accounting.
        ls_mepoaccounting = l_accounting->get_data( ).
        CHECK ls_mepoaccounting-ps_psp_pnr NE space.
        SELECT SINGLE stufe FROM prps INTO v_stufe
        WHERE pspnr = ls_mepoaccounting-ps_psp_pnr.
        IF sy-subrc EQ 0.
          CHECK v_stufe LE 3.
          CONCATENATE 'WBS Element of Level greater than 3:'
          'IN Item:' ls_mepoaccounting-ebelp INTO l_text.
          mmpur_message_forced 'E' 'ME' '083' l_text ' '  ' '  ' '.
          CALL METHOD im_item->invalidate( ).
        ENDIF.
      ENDLOOP.

  
ENDMETHOD.

Read only

kanishakgupta1
Contributor
0 Likes
631

hi,

badi me_process_po_cust contains the method process_item and process_header where u can put the validations whichever u want...

n in method check,u can provide appropriate messages.

regards

kanishak