Application Development 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: 

BADI for partner function

Former Member
0 Kudos

Hi all,

I'm looking for a badi for partner function in trx ME21N, ME22N.

In the tab Partners of the header of PO there is a table with partner function.

Any ideas?

thanks

enzo

1 ACCEPTED SOLUTION

uwe_schieferstein
Active Contributor
0 Kudos

Hello Enzo

The BAdI you are looking for is (most likely) <b>ME_PROCESS_PO_CUST</b>.

If you want to check data then the method of choice <b>IF_EX_ME_PROCESS_PO_CUST~CHECK</b> (<i>closing check</i>).

The CHECK method provides you with IM_HEADER (IF_PURCHASE_ORDER_MM). If you look at the implementing class CL_PO_HEADER_HANDLE_MM you have a method IF_PURCHASING_DOCUMENT~GET_PARTNERS available.

Please search the SDN forums for postings related to <b>ME_PROCESS_PO_CUST</b>. I have posted several answers to this topic.

Briefly, here is the way to go:

method IF_EX_ME_PROCESS_PO_CUST~CHECK.
  
  DATA:
    ls_header      TYPE MEPOHEADER,
    lt_partners     TYPE MMPUR_PARTNER_ALL_TAB,
    ls_partner      LIKE LINE OF lt_partners,
    lo_po_doc     TYPE REF TO IF_PURCHASING_DOCUMENT.

  
  ls_header = im_header->get_data( ).  " header details

  lo_po_doc ?= im_header.  " casting to purchase document

  lt_partners = lo_po_doc->get_partners( ).

  LOOP AT lt_partners INTO ls_partner
                                 WHERE ( parvw = '..' 
                                 AND         parno = ls_header-lifnr.  " vendor
    EXIT.
  ENDLOOP.
  IF ( syst-subrc = 0 ).
   " partner = vendor -> do something, e.g.
  
    ch_failed = 'X'.
  ENDIF.

endmethod.

Regards

Uwe

4 REPLIES 4

Former Member
0 Kudos

Hi

what for you need a BADI

you can straight away fetch the Partners data from <b>EKPA</b> table using the PO number

Regards

Anji

0 Kudos

The require is to make unable the user to put as partner the vendor of the PO.

So I need to check the partner and validate it.

I work on ECC 6.0 and I found some enhancement point that, may be, can help me.

thanks

enzo

uwe_schieferstein
Active Contributor
0 Kudos

Hello Enzo

The BAdI you are looking for is (most likely) <b>ME_PROCESS_PO_CUST</b>.

If you want to check data then the method of choice <b>IF_EX_ME_PROCESS_PO_CUST~CHECK</b> (<i>closing check</i>).

The CHECK method provides you with IM_HEADER (IF_PURCHASE_ORDER_MM). If you look at the implementing class CL_PO_HEADER_HANDLE_MM you have a method IF_PURCHASING_DOCUMENT~GET_PARTNERS available.

Please search the SDN forums for postings related to <b>ME_PROCESS_PO_CUST</b>. I have posted several answers to this topic.

Briefly, here is the way to go:

method IF_EX_ME_PROCESS_PO_CUST~CHECK.
  
  DATA:
    ls_header      TYPE MEPOHEADER,
    lt_partners     TYPE MMPUR_PARTNER_ALL_TAB,
    ls_partner      LIKE LINE OF lt_partners,
    lo_po_doc     TYPE REF TO IF_PURCHASING_DOCUMENT.

  
  ls_header = im_header->get_data( ).  " header details

  lo_po_doc ?= im_header.  " casting to purchase document

  lt_partners = lo_po_doc->get_partners( ).

  LOOP AT lt_partners INTO ls_partner
                                 WHERE ( parvw = '..' 
                                 AND         parno = ls_header-lifnr.  " vendor
    EXIT.
  ENDLOOP.
  IF ( syst-subrc = 0 ).
   " partner = vendor -> do something, e.g.
  
    ch_failed = 'X'.
  ENDIF.

endmethod.

Regards

Uwe

Former Member
0 Kudos

BAPI-step by step procedure

http://www.sapgenie.com/abap/bapi/example.htm

list of all BAPI's

http://www.planetsap.com/LIST_ALL_BAPIs.htm

Rewards if useful......

Minal