2023 Oct 26 11:18 AM
I need to update the IKEY field on the DFKKOP table, and I can't find FMs to change this value,
I've checked the following FMs and didn't work correctly:
1. FKK_CHANGE_DOC_DB
2. BAPI_CTRACDOCUMENT_CHANGE
Is there any way to change it instead of physical changing (Update the value directly).
2023 Oct 26 12:57 PM
2023 Oct 26 1:06 PM
Did you try to use the EXTENSIONIN parameter of BAPI_CTRACDOCUMENT_CHANGE?
(Add required field in structures BAPI_TE_DFKKOPCH and -X)
2023 Oct 29 12:33 PM
thamer_doulat See official SAP documentation + all answers about EXTENSIONIN. It's the same for any BAPI. It's a basic concept of BAPI.
2023 Oct 30 8:37 AM
This the code that i used to change the value of IKEY using EXTENSIONIN
FORM UPDATE_DB.
SELECT * FROM DFKKOP
WHERE OPBEL IN @SO_OPBEL AND IKEY <> 'Z1'
INTO TABLE @DATA(GT_ALV).
LOOP AT GT_ALV ASSIGNING FIELD-SYMBOL(<FS_ALV>) .
DATA: LT_PARTNERPOSITIONS TYPE STANDARD TABLE OF BAPIDFKKOPCH,
LS_PARTNERPOSITIONS TYPE BAPIDFKKOPCH.
LS_PARTNERPOSITIONS-LINE_NUMBER = <FS_ALV>-OPUPK.
APPEND LS_PARTNERPOSITIONS TO LT_PARTNERPOSITIONS.
DATA: IT_EXTENSIONIN TYPE TABLE OF BAPIPAREX,
WA_EXTENSIONIN TYPE BAPIPAREX,
WA_RETURN TYPE BAPIRET2.
DATA: WA_IKEY TYPE BAPI_TE_DFKKOPCH,
WA_IKEYX TYPE BAPI_TE_DFKKOPCHX.
WA_IKEY-LINE_NUMBER = <FS_ALV>-OPUPK.
WA_IKEY-IKEY = 'Z1'.
* Populate the ExtensionIn structure with the additional fields
WA_EXTENSIONIN-STRUCTURE = 'BAPI_TE_DFKKOPCH'.
WA_EXTENSIONIN-VALUEPART1 = WA_IKEY.
APPEND WA_EXTENSIONIN TO IT_EXTENSIONIN.
WA_IKEYX-LINE_NUMBER = <FS_ALV>-OPUPK.
WA_IKEYX-IKEY = 'X'.
* Populate the ExtensionIn structure with the additional fields
WA_EXTENSIONIN-STRUCTURE = 'BAPI_TE_DFKKOPCHX'.
WA_EXTENSIONIN-VALUEPART1 = WA_IKEYX.
* Append the structure to a table
APPEND WA_EXTENSIONIN TO IT_EXTENSIONIN.
CALL FUNCTION 'BAPI_CTRACDOCUMENT_CHANGE'
EXPORTING
DOCUMENTNUMBER = <FS_ALV>-OPBEL
* DOCUMENTHEADER =
* DOCUMENTHEADERX =
IMPORTING
RETURN = WA_RETURN
TABLES
PARTNERPOSITIONS = LT_PARTNERPOSITIONS
* PARTNERPOSITIONSX =
* REPETITIONPOSITIONS =
* REPETITIONPOSITIONSX =
* POSITIONLOCKS = LT_POSITIONLOCKS
EXTENSIONIN = IT_EXTENSIONIN
* POSITIONLOCKS_WITH_COMMENT =
.
IF SY-SUBRC = 0.
* Commit the changes
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
ENDIF.
ENDLOOP.
ENDFORM.
WA_RETURN always get this error : Different line in change parameter
Can anyone check the code??
2023 Oct 30 9:15 AM
I've created new fields in the structures BAPI_TE_DFKKOPCH and BAPI_TE_DFKKOPCHX as the following:
@Raymond Giuseppi