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: 

Purchase Requisition - BADI - PROCESS_ITEM - change other items as well

Jeansy
Active Contributor
0 Kudos

Dear all, 

I implement currently the BAdI ME_PROCESS_REQ_CUST to update the PR-items. In my scenario it is necessary that in case of a specific change to the current item, I need to update an append-field in all other items of the PR as well.

I am not sure if this is supported by the mentioned BAdI because it is not working in the moment.

This is my coding which I call in the menthod PROCESS_ITEM.

  ls_data      = io_item->get_data( ).
  ls_data_prev = io_item->get_previous_data( ).
  lo_header    = io_item->get_requisition( ).
  
  " Check if the Material Group has been changed
  CHECK ls_data-matkl NE ls_data_prev-matkl.

  " Get PR-items
  lt_item_obj = lo_header->get_items( ).

  " Process each PR-item
  LOOP AT lt_item_obj ASSIGNING <ls_item_obj>.

    " Get Item-Details
    ls_item = <ls_item_obj>-item->get_data( ).

    " Update ZZ-Field
    ls_item-zzxxx = 'ABC'.
    ls_item->set_data( ls_item ).

ENDLOOP.

I get all the other items using the header-object which leads me then to the list of items and their corresponding object which I use to update the item data.

Did you already try to implement a similar requirement using this BAdI?

I tried as well using method CHECK but I guess here it is not allowed to change the items details anymore. I tried it but w/o success as well.

Thank you very much for every hint/advice

Kind regards
Jens

 

 

2 REPLIES 2

raga1234
Discoverer
0 Kudos

Hi Jeansy,

Please pass " SET_DATAX" method values.

raymond_giuseppi
Active Contributor
0 Kudos

Suggestions

  • Add a call of get_datax / set_datax
  • Prevent infinite loop, only call set_data[x] when actually changing a value