Skip to Content
1
Jun 15, 2021 at 12:55 PM

Data not set by IF_PURCHASE_ORDER_ITEM_MM~SET_DATA

610 Views

Hello,

I have a requirement to change amount values of PO items in BAdI ME_PROCESS_PO_CUST. Because of some reasons I use method IF_EX_ME_PROCESS_PO_CUST~POST of this BAdI instead of IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM. So IF_PURCHASE_ORDER_MM~GET_ITEMS() gives me all that items and IF_PURCHASE_ORDER_ITEM_MM~SET_DATA() should change the affected attributes, but does not.

Here is a simple version of the code I use:

DATA:
  lt_poi         TYPE        purchase_order_items,
  ls_poi_data    TYPE        mepoitem,
  lr_po_header   TYPE REF TO cl_po_header_handle_mm,
  lf_firewall_on TYPE        mmpur_bool

FIELD-SYMBOLS:
  <ls_poi> LIKE LINE OF lt_poi,
.

IF im_header->is_changeable( ) NE mmpur_yes. RETURN. ENDIF.

lr_po_header  ?= im_header.
lf_firewall_on = lr_po_header->my_ibs_firewall_on.
IF lr_po_header->my_ibs_firewall_on  NE mmpur_yes AND
   lr_po_header->my_cust_firewall_on NE mmpur_yes.
  lr_po_header->my_ibs_firewall_on = mmpur_yes.
ENDIF.

CALL METHOD im_header->get_items
  RECEIVING
    re_items = lt_poi.

LOOP AT lt_poi ASSIGNING <ls_poi>.
  ls_poi_data = <ls_poi>-item->get_data( ).
  ls_poi_data-menge = 1. " nonsense, but simple example
  <ls_poi>-item->set_data( ls_poi_data ).
ENDLOOP.

lr_po_header->my_ibs_firewall_on = lf_firewall_on.

Testing my implementation by transforming a purchase requisition into a purchase order works fine and in debugger I can see, that IF_PURCHASE_ORDER_ITEM_MM~SET_DATA( ) is executed well.

Never the less, when the purchase order is checked with ME22N or ME23N, amount-value of purchase order items are unchanged.

Please tell me your ideas why the values are not changed.

Thanks and regards,

Hubert