‎2024 Oct 17 7:17 AM - edited ‎2024 Oct 17 7:26 AM
Hello,
I have a small issue by implementing BAPI_CONTRACT_CHANGE to modify my custom fields in the ekko table. My three custom fields locate on the header level in me32k transaction. ZM04_E206_MASS_CHG is my transfer structure consisting of ebeln and my 3 zz1 fields. The reason why I created a transfer structure is, the BAPI_TE_MEOUTHEADER does not include my zz1 fields. I also tried to implement the method "IF_EX_MEOUT_BAPI_MAP2I_EXT_IN~MAP2I_EXTENSIONIN" However, I could not use the ch_header and ch_headerx in the method. Because MMPUR_OUTLINE_BAPI_TE_MEOUTHDR does not include my zz1 fields. I also tried to extend CI_EKKODB, but the extension caused dumps in the system.
I would be very thankful, if someone could give me a hint regarding my problem. Here are the steps I followed.
SELECT ebeln
FROM ekko
INTO CORRESPONDING FIELDS OF TABLE lt_contracts
WHERE ebeln IN s_ebeln.
LOOP AT lt_contracts ASSIGNING FIELD-SYMBOL(<ls_contracts>).
CLEAR: ls_ctrheader_ext,lt_extensionin, gs_ekko.
MOVE-CORRESPONDING ls_ekko_incl_eew_ps TO ls_ctrheader_ext.
ls_ctrheader_ext-ebeln = <ls_contracts>-ebeln.
ls_ctrheader_ext-zz1_ab = so_ab-low.
ls_ctrheader_ext-zz1_cd = so_cd-low.
ls_ctrheader_ext-zz1_ef = p_ef.
IF ls_ctrheader_ext IS NOT INITIAL.
APPEND INITIAL LINE TO lt_extensionin ASSIGNING FIELD-SYMBOL(<ls_ext>).
<ls_ext>-structure = 'ZM04_E206_MASS_CHG'. "BAPI_TE_MEOUTHEADER
cl_abap_container_utilities=>fill_container_c(
EXPORTING
im_value = ls_ctrheader_ext " Daten zum Füllen des Containers
IMPORTING
ex_container = <ls_ext>+30 " Container
EXCEPTIONS
illegal_parameter_type = 1 " Unzulässiger Typ für den Parameter IM_VALUE
OTHERS = 2 ).
ENDIF.
<ls_ext>-valuepart1 = ls_ctrheader_ext-zz1_ab.
<ls_ext>-valuepart1 = abap_true.
CALL FUNCTION 'BAPI_CONTRACT_CHANGE' "DESTINATION 'NONE'
EXPORTING
purchasingdocument = <ls_contracts>-ebeln
header = ls_header
headerx = ls_headerx
* IMPORTING
* EXP_HEADER = ls_header_exp
TABLES
extensionin = lt_extensionin
* EXTENSIONOUT =
return = lt_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
Request clarification before answering.
This is old but adding information here because we went through the same.
The answer is in function module documentation for EXTENSIONIN parameter.
The fields added by Fiori Custom fields app are added to a different structure.
Example, to populate item customer fields
DATA:
lt_extensionin TYPE bapiparex_tab,
lt_ctitem_custfields TYPE STANDARD TABLE OF mmpur_oa_bapi_item_ext,
lwa_ctitem_custfields TYPE mmpur_oa_bapi_item_ext.
* After filling LT_CTITEMCUSTFIELDS
*Set data of item custom fields in extensionin
TRY.
cl_cfd_bapi_mapping=>get_instance( )->map_to_bapiparex_multi(
EXPORTING ir_source_table = REF #( lt_poitem_custfields )
CHANGING ct_bapiparex = lt_extensionin ).
CATCH cx_cfd_bapi_mapping.
CLEAR lt_extensionin[].
ENDTRY.Pass LT_EXTENSIONIN to the BAPI
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Fabio,
We did this change for BAPI_PO_CHANGE
We did not implement any other BADIs or Exits, but, an existing user exit was posing a problem. EXIT_SAPMM06E_016
It was not a problem in ECC but in S4 it was. Had to add this as first block in user exit.
IF i_no_screen EQ abap_true "Called by Function ( BAPI )
OR i_aktyp EQ 'A'.
" This is being called by a Function module ( BAPI ) or Called in Dialog in Display mode
" During display, data derivation should not happen
ekpo_ci = CORRESPONDING ekpo_ci( i_ekpo ).
RETURN.
ENDIF.
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.