2021 Oct 27 11:27 AM
Hi,
I have a bapi "BAPI_CONTRACT_CREATE". It is required to store some data in custom fields in EKPO table. Therefore, I used extensionIn. However, after creating a document, the custom fields in EKPO table is empty.
DATA: ext_container TYPE TABLE OF bapiparex WITH HEADER LINE,
bapi_te_item TYPE BAPI_TE_MEOUTITEM,
bapi_te_itemx TYPE BAPI_TE_MEOUTITEMX .
bapi_te_item-item_no = ''.
bapi_te_item-ZZRESALE = 'X'.
bapi_te_item-ZEQUIPMENT = 'X'.
bapi_te_item-ZREFUBSHMENT = 'X'.
bapi_te_itemx-item_no = ''.
bapi_te_itemx-ZZRESALE = 'X'.
bapi_te_itemx-ZEQUIPMENT = 'X'.
bapi_te_itemx-ZREFUBSHMENT = 'X'.
ext_container-structure = 'BAPI_TE_MEOUTITEM'.
ext_container-valuepart1 = bapi_te_item.
APPEND ext_container.
CLEAR: ext_container.
ext_container-structure = 'BAPI_TE_MEOUTITEMX'.
ext_container-valuepart1 = bapi_te_itemx.
APPEND ext_container.
CALL FUNCTION 'BAPI_CONTRACT_CREATE'
EXPORTING
header = wa_header
headerx = wa_headerx
IMPORTING
purchasingdocument = gv_ebeln
TABLES
return = it_return
extensionin = ext_container[]
item = it_item
itemx = it_itemx.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
2021 Oct 27 12:41 PM
2021 Oct 27 12:44 PM
For items, BAPI_TE_MEOUTITEM, you must fill field bapi_te_item-item with the item number with the same value as in the item table parameter records. Only when creating/updating an item will BAPI look for those extension values.
2021 Oct 28 6:34 AM
I have tried to fill bapi_te_item-item. But in this case, the BAPI does not work correctly, and document is not been created.
2021 Oct 28 1:44 PM
Could you elaborate on 'BAPI does not work correctly' which error do you get (You MUST pass the item value to update item records.)
2021 Oct 28 8:50 AM
Sandra Rossi, thanks for comment,
But I have tried to fill bapi_te_item-item. But in this case, the BAPI does not work correctly, and document is not been created.