How to use BAPI
I have a BAPI 'BAPI_CTRACCONTRACTACCOUNT_CH1'. This BAPI will be used to change the contract account. But my reaquirement is I have added some custom fields to contract account screen and we can see these fields in CAA1, CAA2, and CAA3 transactions. Now my question is how can I update custome fields through BAPI? Someone told me to use extension parameters and infact this BAPI has EXTENSIONIN parameter. But I am unable to map how to update custom fields through this BAPI using extension parameters.
Thanks in advance
Go through the FM documentation of BAPI_CTRACCONTRACTACCOUNT_CH1, this gives some information how to populate the custom fields.
You need to extend the structures mentioned in it.
then you have to pass the structure name into the bapi extension parameter when calling the BAPI along with the concatenated values of the custom fields.
data : w_extensionin type BAPIPAREX.
data : i_extensionin type table of BAPIPAREX.
w_extensionin-structure = one of the structures mentioned in bapi documention for EXtensionIN parameter (there are two structure mentioned as BAPI_TE_FKKVKI, and BAPI_TE_FKKVKPI, use the relevant one among this two).
w_extensionin-valuepart1 = concatenated values of the custom fields. (not required to use valuepart2, valuepart3 and valuepart4 fields).
append w_extensionin to i_extensionin.
Pass i_extensionin to the BAPI when you are making a call.
I think you need to extend the relevant tables and the BAPI structures mentioned above before calling this BAPI with Extension parameters.