Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Bapi_contract_create extensionIn

former_member773939
Discoverer
0 Kudos
836

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

Sandra_Rossi
Active Contributor
0 Kudos
368

You must indicate the item number in bapi_te_item-item_no.

raymond_giuseppi
Active Contributor
0 Kudos
368

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.

0 Kudos
368

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.

0 Kudos
368

Could you elaborate on 'BAPI does not work correctly' which error do you get (You MUST pass the item value to update item records.)

former_member773939
Discoverer
0 Kudos
368

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.