Skip to Content
0
Oct 27, 2021 at 10:27 AM

Bapi_contract_create extensionIn

183 Views Last edit Oct 27, 2021 at 10:28 AM 2 rev

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'.