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: 

Process_item not updating EKPO ME21N : S4hana

former_member444070
Discoverer
0 Kudos

Dear all

I have added custom fields using CMOD at item level in me21n , Based on custom fields value i have to change field weunb value to X in ekpo , i have used BADI method PROCESS_ITEM , it is transferring X to weunb , but it is triggering when user press enter at item level .

in a case if user press SAVE button directly , it is not getting triggered if it is a custom tab.

for other tab at item level , it is getting triggered .

I have tried methods CHECK and POST ,it is not working ...

This is the coding block i have used in all three methods

IF im_item IS BOUND.
 ls_po_item_data = im_item->get_data( ). IF ls_po_item_data-zval = 'CCV'.
 ls_po_item_data-weunb = 'X'.
 im_item->set_data( im_data = ls_po_item_data ).
 ENDIF.
 ENDIF.

How to rectify this

Thanks in advance

4 REPLIES 4

raymond_giuseppi
Active Contributor
0 Kudos

How did you manage the custom fields, e.g. in ME_GUI_PO_CUST, did you manage the RE_CHANGED parameter in TRANSPORT_FROM_DYNP.

Also did you actually implement a LOOP on every item in the CHECK method of ME_PROCESS_PO_CUST.

0 Kudos

Hi Raymond ,

Thanks for your reply

Yes , i did tried passing X to re_changed but not triggering process_item also i tried with E_CI_UPDATE in exit

Note : i have not used ME_GUI_PO_CUST for custom screen enhancement .

The coding i shown is inside process_item , for check i put this logic inside loop but debugging i have checked method set_data is failed but in process_item set_Data is doing purpose.

0 Kudos

A correct solution should be correction of your dynpro to trigger the event changed of item when data is input, so it depends on how you implemented it, could you elaborate?

Nevertheless, the CHECK method should have same success than PROCESS_ITEM (the SAVE method is executed too late, but not the CHECK one) could you post your exact code in the LOOP?

METHOD if_ex_me_process_po_cust~check.
  INCLUDE mm_messages_mac.
  DATA: ls_header TYPE mepoheader,
        lt_items  TYPE purchase_order_items,
        ls_items  TYPE purchase_order_item. " etc.
  CHECK me->trtyp NE 'A'. 
  mmpur_context mmcnt_context_badi.
  ls_header = im_header->get_data( ).
  lt_items  = im_header->get_items( ).
  " Loop at items
  LOOP AT lt_items INTO ls_items.
    ls_item = ls_items-item->get_data( ).
    CHECK ls_item-loekz IS INITIAL.
    " your code here?
    " if some field actually changed
    im_item->set_data( ls_item ).    
  ENDLOOP.
  " etc.
ENDMETHOD.<br>

0 Kudos

I have done screen enhancement through MM06E005

These are the function exits i have used

EXIT_SAPMM06E_012 --->here i have done validation

EXIT_SAPMM06E_016 --->pushing data into subscreen0111

EXIT_SAPMM06E_018 --->pushing out data from subscreen0111 here i am passing e_ci_update = 'X'.

Screen exit

SAPMM06E 0111

Here is coding block under method check

DATA  lt_po_item TYPE purchase_order_items.
    DATA ls_po_item TYPE purchase_order_item. DATA  ls_po_item_data TYPE       mepoitem. 
IF im_header IS BOUND. lt_po_item = im_header->get_items( ). ENDIF.
LOOP AT lt_po_item INTO ls_po_item. IF ls_po_item-item IS BOUND. ls_po_item_data = ls_po_item-item->get_data( ).
IF ls_po_item_data-val = 'CCC'. ls_po_item_data-weunb = 'X'. ls_po_item-item->set_data( im_data = ls_po_item_data ).
ENDIF.