You are using API_PURCHASECONTRACT_PROCESS_SRV to create contracts in the S/4Hana Public Cloud. In the payload, you are transferring a user ID in the 'CreatedByUser' field but when the Contract is created it shows the communication user of the API and not the 'CreatedByUser' passed in the payload.
SAP S/4HANA Cloud All Versions
Reproducing the Issue
- Call API_PURCHASECONTRACT_PROCESS_SRV
- In the payload transfer a user ID via field "CreatedByUser": "CB9980000000"
- Open APP 'Manage Purchase Contracts' note the 'Created By' field shows the Communication User and not the 'CreatedByUser' from the payload.
The 'CreatedByUser' field of a Contract is technical administration data, which may be relevant for audit purposes. It therefore has to reflect the actual user that created the document. For this reason the system user is taken ahead of any user passed in the payload.
Standard system behaviour
EKKO-ERNAM, ERNAM, is_header-CREATEDBYUSER, sy-uname, CL_MM_PUR_CON_PROCESS_API, MAP_PAYLOAD_TO_API_HEADER, CreatedByUser. , KBA , MM-FIO-PUR-SQ-CON , Fiori UI for Manage Purchase Contracts , MM-PUR-OA-CON , Contract , Problem