2007 May 04 2:20 PM
I want to update a Z field (customer include) in table EKKO. I want to use BAPI_PO_CHANGE with parameter extensionin.
Can anyone show an working example code.
Thanx in advance.
2007 May 14 9:54 PM
I just did a test today, seems to be working. We have a custom field EKKO-ZZDELIVERYDATE. To work with BAPI, this field must be included in two structures:
1) BAPI_TE_MEPOHEADER, there is an include CI_EKKODB. Add the Z field there with the same type as on EKKO. (I actually didn't have to do this - either somebody has already done this or it happened automatically when the fiel was added, not sure).
2) BAPI_TE_MEPOHEADERX, include CI_EKKODBX. Add the field with the same name but type BAPIUPDATE (!).
PARAMETERS: p_ebeln TYPE ebeln,
p_date LIKE sy-datum.
DATA: s_header TYPE bapimepoheader,
s_headerx TYPE bapimepoheaderx,
i_return TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
i_extension TYPE bapiparex OCCURS 0 WITH HEADER LINE,
s_bapi_te_mepoheader TYPE bapi_te_mepoheader,
s_bapi_te_mepoheaderx TYPE bapi_te_mepoheaderx,
wa_date TYPE ekko-zzdeliverydate,
wa_message TYPE c LENGTH 100.
s_bapi_te_mepoheaderx-po_number = p_ebeln.
s_bapi_te_mepoheaderx-zzdeliverydate = 'X'.
s_bapi_te_mepoheader-po_number = p_ebeln.
s_bapi_te_mepoheader-zzdeliverydate = p_date.
i_extension-structure = 'BAPI_TE_MEPOHEADER'.
i_extension-valuepart1 = s_bapi_te_mepoheader.
APPEND i_extension.
i_extension-structure = 'BAPI_TE_MEPOHEADERX'.
i_extension-valuepart1 = s_bapi_te_mepoheaderx.
APPEND i_extension.
s_header-po_number = p_ebeln.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = p_ebeln
TABLES
return = i_return
extensionin = i_extension.
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.