问题
I am trying to modify the values of field WEORA and BSTAE in ME21n upon saving. I've written my codes in ME_PROCESS_PO_CUST BADI, in method CHECK. Below is my code.
DATA: lt_data TYPE PURCHASE_ORDER_ITEMS,
lo_header TYPE REF TO CL_PO_HEADER_HANDLE_MM,
lt_item TYPE REF TO IF_PURCHASE_ORDER_ITEM_MM,
ls_get_item TYPE MEPOITEM,
ls_set_item TYPE MEPOITEM,
lv_firewall TYPE abap_bool.
FIELD-SYMBOLS: <fs_data> TYPE PURCHASE_ORDER_ITEM.
lt_data = im_header->get_items( ).
READ TABLE lt_data ASSIGNING <fs_data> INDEX 1.
IF <fs_data> IS ASSIGNED.
lt_item = <fs_data>-item.
ENDIF.
ls_get_item = lt_item->get_data( ).
ls_get_item-bstae = '0004'.
ls_get_item-weora = abap_true.
CALL METHOD lt_item->set_data
EXPORTING
im_data = ls_get_item.
I tried debugging it, but inside the method set_data there is a condition:
CHECK l_parent->my_ibs_firewall_on EQ mmpur_yes OR l_parent->my_cust_firewall_on EQ mmpur_yes.
The value of bot is initial so it doesn't go through the whole set_data code. But I also tried forcing one of them to abap_true (for it to go through the rest of the code) but updating the fields also doesn't work.
It seems like this BADI isn't working but I made my research and most of them uses this BADI to update EKPO fields in ME21n. Is there any problem with my code? And is there other exit I can use to update fields WEORA and BSTAE in transaction code ME21N upon saving?
回答1:
You have to call method SET_DATAX and then SET_DATA. SET_DATAX , you will mark X to field you want to update values.
Regards, Umar Abdullah
来源:https://stackoverflow.com/questions/52877382/modifying-ekpo-fields-in-me21n-me-process-po-cust-badi