Skip to Content
0
Former Member
Mar 02, 2009 at 05:04 PM

Change fields in PO - ME21N

275 Views

Hello everyone,

I'm having some problems in changing a field from all items of a Purchase Order being created in transaction ME21N.

The logic is, when matkl between 1000 and 8999 and matnr is initial, then field uebto must be 10.

I created an implementation in BADI ME_PROCESS_PO_CUST, and then add the following code to

method POST (IF_EX_ME_PROCESS_PO_CUST~POST):

  DATA : l_header TYPE mepoheader,
         l_item TYPE purchase_order_items,
         wa_item TYPE mepoitem ,
         r_item LIKE LINE OF l_item.

  l_header = im_header->get_data( ).
  l_item = im_header->get_items( ).

  LOOP AT l_item INTO r_item.
    wa_item = r_item-item->get_data( ).
    IF wa_item-matkl GE '1000' AND wa_item-matkl LE '8999'
    AND wa_item-matnr IS INITIAL.

      wa_item-uebto = '10'.
      r_item-item->set_data( wa_item ).

    ENDIF.

  ENDLOOP.

I debugged and the conditions are correctly validated, and the "wa_item-uebto = '10' " is passed by. But when i go check the newly created PO document, the field remains 0.0.

Can anyone help me?

thank you in advance.

Added code tags

Edited by: Rob Burbank on Mar 2, 2009 12:15 PM