0

I'm trying to change field WEORA and BSTAE in ME21n through BADI me_process_po_cust, method PROCESS_ITEM. I have successfully changed the value in the screen, BUT when I saved the PO, table EKPO is not updated with the new value. Am I missing something? Do I need to commit?

DATA: ls_mepoitem_set TYPE mepoitem.
DATA: cl_po TYPE REF TO cl_po_header_handle_mm.
DATA: ls_mepoitem TYPE mepoitem.
FIELD-SYMBOLS: <fs_item> TYPE mepoitem.

ls_mepoitem = im_item->get_data( ).
    
ls_mepoitem_set = ls_mepoitem.
ls_mepoitem_set-bstae = '0004'.
ls_mepoitem_set-weora = abap_true.
ASSIGN ls_mepoitem_set TO <fs_item>.
CALL METHOD im_item->set_data( EXPORTING im_data = <fs_item> ).
    
cl_po ?= lm_poheader.
IF NOT cl_po->my_recheck_queue IS INITIAL.
   CLEAR cl_po->my_recheck_queue.
ENDIF.
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Yuri
  • 11
  • 2
  • 5
  • I add a reference to your first post about [updating the screen field](https://stackoverflow.com/questions/52877382/modifying-ekpo-fields-in-me21n-me-process-po-cust-badi), as it might be useful for understanding the context. – Sandra Rossi Oct 22 '18 at 08:28
  • Please don't commit in this BADi. According to BADi documentation: `Under no circumstances make any changes to the database within this method. On no account use Commits.` – Nelson Miranda Oct 22 '18 at 14:40
  • Is it possible that you didn't activated the BADi implementation? – Nelson Miranda Oct 22 '18 at 15:02
  • The BADI implementation is activated because I'm debugging my code there. @NelsonMiranda – Yuri Oct 23 '18 at 09:07
  • Your code works for me, check if you have conflicts with other BAdi implementations or other custom code – Suncatcher Nov 13 '20 at 15:35

2 Answers2

0

Please check if there is project enhancement implentation for PO which might be updating field values.

regards, Umar Abdullha

Umar Abdullah
  • 1,282
  • 1
  • 19
  • 37
  • But there is no set_datax method in class IF_PURCHASE_ORDER_ITEM_MM. – Yuri Nov 08 '18 at 07:52
  • Yes. There is no method set_datax in PO. set_datax is in PR BAdi. I am updating answer. – Umar Abdullah Nov 08 '18 at 08:23
  • I am using the BADI implementation of ME_PROCESS_PO_CUST. In the method PROCESS_ITEM. it updates the screen but when I click the save button, the value changed is not reflected in EKPO table – Yuri Nov 09 '18 at 05:59
0

I had the same mistake and I was able to resolve it by using the same code shown before in IF_EX_ME_PROCESS_PO_CUST->PROCESS_ITEM.

I had to call im_item->get_data( ) to get the data from the position and the set method work perfectly.

Watercayman
  • 7,970
  • 10
  • 31
  • 49