Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Using BAPI_PO_CHANGE to flag Delivery Complete

Hi Experts,

I've successfully implemented code found on post Using BAPI_PO_CHANGE to update z-field.

I would now like to modify the code to update the "Outward Delivery Completed" Indicator on ME22N (EGLKZ). However, running the code results in message "No Data Changed". I am aware EGLKZ is only valid for internal stock transport orders, not purchase orders. I have successfully made the changes manually using ME22N, so it is not a data validation issue.

I am very new to ABAP, so perhaps I am missing something obvious. Any suggestions?

REPORT  Z_MASS_REMOVE_FDI_BAPI.

*head
PARAMETERS: p_ebeln LIKE bapimepoheader-po_number OBLIGATORY.

*Item
PARAMETERS :p_ebelp LIKE bapimepoitem-po_item DEFAULT 1.

DATA: s_header TYPE bapimepoheader,
      s_headerx TYPE bapimepoheaderx,
      s_item TYPE bapimepoitem,
      s_itemx TYPE bapimepoitemx,
      i_return TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
      i_extension TYPE bapiparex OCCURS 0 WITH HEADER LINE,
      s_bapimepoheader TYPE bapimepoheader,
      s_bapimepoheaderx TYPE bapimepoheaderx,
      s_bapimepoitem TYPE bapimepoitem,
      s_bapimepoitemX TYPE bapimepoitemX,
      wa_message TYPE c LENGTH 100.

s_bapimepoheaderx-po_number = p_ebeln.
s_bapimepoheader-po_number = p_ebeln.
s_bapimepoitemx-PO_ITEM = p_ebelp.
s_bapimepoitem-PO_ITEM = p_ebelp.
s_bapimepoitemx-DELIV_COMPL = 'X'.
s_bapimepoitem-DELIV_COMPL = 'X'.


s_header-po_number = p_ebeln.
S_item-PO_ITEM = p_ebelp.

CALL FUNCTION 'BAPI_PO_CHANGE'
  EXPORTING
    purchaseorder = p_ebeln
  TABLES
    return        = i_return.

COMMIT WORK.
LOOP AT i_return.
  MESSAGE ID   i_return-id
       TYPE    i_return-type
       NUMBER  i_return-number WITH
               i_return-message_v1
               i_return-message_v2
               i_return-message_v3
               i_return-message_v4.
ENDLOOP.

Tags:
Former Member
Former Member replied

Hi ,

s_bapimepoitem TYPE bapimepoitem occurs 0 with header line ,

s_bapimepoitemX TYPE bapimepoitemX occurs 0 with header line,

and in need to change u are code as well .

s_bapimepoitemx-DELIV_COMPL = 'X'.

s_bapimepoitem-DELIV_COMPL = 'X'.

append s_bapimepoitem.

clear s_bapimepoitem.

this is just a sample code only , for more details u need to check the documentation of this BAPI or search for sample code in ABAP forums.

regards

Prabhu

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question