This document would give in formation on how to access or change the PO item data before save using different methods.

 

Create implementation for BADI ME_PROCESS_PO_CUST

 

go to Method PROCESS_ITEM(This method can be used to change the Item)

 

DATA:

  Flg_pers type c,

  ref_pohdr TYPE REF TO if_purchase_order_mm,

  wa_pohdr  TYPE mepoheader,

  wa_item   TYPE mepoitem,

  wa_pitem   TYPE mepoitem.

* This method can be used to get referance(Pointer) for header data

  ref_pohdr = im_item->get_header( ).

* Read header data from above referance

  wa_pohdr = ref_pohdr->get_data( ).

* im_item of PROCESS_ITEM can be used as a referance to get item data

  wa_item = im_item->get_data( ).

* IS_PERSISTENT can be used to check whether item is already created or it is nw entry

  flg_pers = im_item->is_persistent( ).

* We can apply logic for only new items

IF flg_pers IS NOT INITIAL.

      EXIT.

ENDIF.

* in this example I am modifying GR indicator for few conditions

IF wa_pohdr-ekorg EQ ‘1001’ AND wa_item-knttp = ‘F’.

      wa_item-wepos = space.

      im_item->set_data( EXPORTING im_data = wa_item ).

ENDIF.

New NetWeaver Information at SAP.com

Very Helpfull

User Rating: Be the first one !