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: 

Appending customer field for BAPI_CONTRACT_CREATE

Former Member
0 Kudos

Hello.

I'm trying to append customer field to the table EKPO using BAPI called "BAPI_CONTRACT_CREATE ".

I have created a structure and included it into append structure of EKPO.

Can anyone tell me what I should do next?

Regards,

Tomoko Sakamoto

1 ACCEPTED SOLUTION

uwe_schieferstein
Active Contributor
0 Kudos

Hello Tomoko

The BAPI has a TABLES parameter EXTENSIONIN having the following documentation:




 FU BAPI_CONTRACT_CREATE          EXTENSIONIN

 ____________________________________________________

 Short Text

     ExtensionIn

 Description

     With the parameters ExtensionIn and ExtensionOut, it is possible to
     enhance the interface of a BAPI without modification to achieve the
     automatic processing of customer-specific data.

     The data is passed on in a table. The format of the individual data
     records of this table is determined via the structure BAPIPAREX. This
     structure contains several data record fields (VALUEPART1, VALUEPART2
     etc.) and a field for the name of an auxiliary structure (STRUCTURE).
     Because per data record the data is written piecewise consecutively to
     the data record fields available for the purpose, an auxiliary structure
     is needed for the interpretation of the data.

     In the event that an SAP database table is to be enhanced by additional
     fields, BAPI table extensions are especially suitable as auxiliary
     structures. A BAPI table extension can either be already predefined by
     SAP or created by the customer. Examples of auxiliary structures and
     BAPI table extensions can be found at the following points:

     o   Description of the various customer enhancement options

     o   Enhancement of BAPI based on existing SAP database tables

     o   Enhancement of BAPI through incorporation of additional customers'
         own database tables

     o   Enhancement of BAPI by import data that does not show up the
         database level

     Note that only fields of the data type CHAR and similar data types may
     be used in the BAPI parameter ExtensionIn/ExtensionOut.

     If the customer Include contains deviating parameters, the configurable
     message ME 887 is invoked. However, the data is not adopted in the
     target structure from the container.



 Default

     The auxiliary structures have been defined as follows:

     o   Header data:

         -   BAPI_TE_MEOUTHEADER

         -   BAPI_TE_MEOUTHEADERX

     o   Item data:

         -   BAPI_TE_MEOUTITEM

         -   BAPI_TE_MEOUTITEMX

     o   Account assignment data:

         -   BAPI_TE_MEOUTACCOUNT

         -   BAPI_TE_MEOUTACCOUNTX

 Function Module

     BAPI_CONTRACT_CREATE

You need to define and structure the values passed by this EXTENSIONIN parameter in a specific way in order to achieve your goal. For more details please refer to:

[Customer Enhancement and Modification of BAPIs (CA-BFA)|http://help.sap.com/saphelp_nw70/helpdata/EN/6b/3f6d016d0711d396a50004ac96334b/content.htm]

Regards

Uwe

3 REPLIES 3

uwe_schieferstein
Active Contributor
0 Kudos

Hello Tomoko

The BAPI has a TABLES parameter EXTENSIONIN having the following documentation:




 FU BAPI_CONTRACT_CREATE          EXTENSIONIN

 ____________________________________________________

 Short Text

     ExtensionIn

 Description

     With the parameters ExtensionIn and ExtensionOut, it is possible to
     enhance the interface of a BAPI without modification to achieve the
     automatic processing of customer-specific data.

     The data is passed on in a table. The format of the individual data
     records of this table is determined via the structure BAPIPAREX. This
     structure contains several data record fields (VALUEPART1, VALUEPART2
     etc.) and a field for the name of an auxiliary structure (STRUCTURE).
     Because per data record the data is written piecewise consecutively to
     the data record fields available for the purpose, an auxiliary structure
     is needed for the interpretation of the data.

     In the event that an SAP database table is to be enhanced by additional
     fields, BAPI table extensions are especially suitable as auxiliary
     structures. A BAPI table extension can either be already predefined by
     SAP or created by the customer. Examples of auxiliary structures and
     BAPI table extensions can be found at the following points:

     o   Description of the various customer enhancement options

     o   Enhancement of BAPI based on existing SAP database tables

     o   Enhancement of BAPI through incorporation of additional customers'
         own database tables

     o   Enhancement of BAPI by import data that does not show up the
         database level

     Note that only fields of the data type CHAR and similar data types may
     be used in the BAPI parameter ExtensionIn/ExtensionOut.

     If the customer Include contains deviating parameters, the configurable
     message ME 887 is invoked. However, the data is not adopted in the
     target structure from the container.



 Default

     The auxiliary structures have been defined as follows:

     o   Header data:

         -   BAPI_TE_MEOUTHEADER

         -   BAPI_TE_MEOUTHEADERX

     o   Item data:

         -   BAPI_TE_MEOUTITEM

         -   BAPI_TE_MEOUTITEMX

     o   Account assignment data:

         -   BAPI_TE_MEOUTACCOUNT

         -   BAPI_TE_MEOUTACCOUNTX

 Function Module

     BAPI_CONTRACT_CREATE

You need to define and structure the values passed by this EXTENSIONIN parameter in a specific way in order to achieve your goal. For more details please refer to:

[Customer Enhancement and Modification of BAPIs (CA-BFA)|http://help.sap.com/saphelp_nw70/helpdata/EN/6b/3f6d016d0711d396a50004ac96334b/content.htm]

Regards

Uwe

Former Member
0 Kudos

Thank you, Uwe.

I've read the document of ExtensionsIn and the SAP online help aswell.

I don't do developing very often and this might be very biginner's question.

Would you please tell me the following?

I have created structure called ZEKPO01 and included it in EKPO as append structure.

ZEKPO01 contains only one parameter called ZUSERID.

What I need to do is put value into ZUSERID through BAPI_CONTRACT_CREATE.

And to do this, I believe I need to put value accordingly into the followings.

BAPIPAREX-STRUCTURE

BAPIPAREX-VALUEPART1

I'm now testing with ABAP program that calls BAPI_CONTRACT_CREATE.

How can I find out the value to put into BAPIPAREX-STRUCTURE?

I tried with EKPO-ZUSERID but it did not work.

0 Kudos

Here's example for purchase order,  change the type to


for items,

BAPI_TE_MEOUTITEM

BAPI_TE_MEOUTITEMX

and call the bapi_contract_create instead of PO.

Data: wa_bapi_poheader  type BAPIMEPOHEADER,
wa_bapi_poheaderx type BAPIMEPOHEADERX.
Data: it1_bapi_poheader like BAPI_TE_MEPOHEADER,
it1_bapi_poheaderx like BAPI_TE_MEPOHEADERX.
it1_bapi_poheader-PO_NUMBER = wa_data-ebeln.
it1_bapi_poheader-ZZXMLSENT = 'X'.
it1_bapi_poheaderx-PO_NUMBER = wa_data-ebeln.
it1_bapi_poheaderx-ZZXMLSENT = 'X'.
it_extensionin-structure = 'BAPI_TE_MEPOHEADER'.
it_extensionin-valuepart1 = it1_bapi_poheader.
append it_extensionin.
Clear  it_extensionin.
it_extensionin-structure = 'BAPI_TE_MEPOHEADERX'.
it_extensionin-valuepart1 = it1_bapi_poheaderx.
append it_extensionin.
Clear  it_extensionin.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
PURCHASEORDER = wa_data-ebeln
* POHEADER = wa_bapi_poheader
* POHEADERX = wa_bapi_poheaderx
* EXPHEADER =
* EXPPOEXPIMPHEADER =
TABLES
RETURN = it_bapireturn
* POITEM =
* POITEMX =
* POADDRDELIVERY =
* POSCHEDULE =
* POSCHEDULEX =
* POACCOUNT =
* POACCOUNTPROFITSEGMENT       =
* POACCOUNTX =
* POCONDHEADER =
* POCONDHEADERX =
* POCOND =
* POCONDX =
* POLIMITS =
* POCONTRACTLIMITS =
* POSERVICES =
* POSRVACCESSVALUES =
* POSERVICESTEXT =
EXTENSIONIN = it_extensionin
.
call function 'BAPI_TRANSACTION_COMMIT'.