SAP Knowledge Base Article - Public

2944626 - Custom fields are not getting copied when creating a new credit memo request with reference to a billing document - SAP S/4HANA Cloud

Symptom

The "Credit Memo Request (A2X)" API is used to create a credit memo request with reference to a billing document. Several custom fields are in header of the billing document that need to be copied to the credit memo request. Within the payload of the API service request, the property "ReferenceSDDocument" is inserted while the custom fields are not. However, the custom fields are not copied from the preceding billing document.

Environment

SAP S/4HANA Cloud

Reproducing the Issue

  1. Several custom fields are enabled in both the "Sales: Sales Document" business context and the "Sales: Billing Document" business context and also available for the OData API "Credit Memo Request (A2X)" in the "Custom Fields and Logic" app.
  2. Prepare a billing document where all the desired custom fields are filled in with values.
  3. Prepare the request URL and the payload with property "ReferenceSDDocument" inserted without those for custom fields.
  4. When posting this API request to create a credit memo request with reference to this billing document, the credit memo request is generated without those custom fields.

Cause

At present, not restricted to this kind of scenario, none of the carry-overs of extensibility fields from reference documents to sales documents are supported through APIs.

Resolution

The following two workarounds are proposed. You can use any of them to create a sales document with reference to another sales document or billing document, including custom fields.

  • Perform a GET request of the billing document (or the preceding document) with the corresponding API to fetch the extensibility fields of the header. Copy and paste the required extensibility fields in the subsequent POST body of the credit memo request header as well as the property "ReferenceSDDocument". Since those custom fields are activated for tab OData APIs - "Credit Memo Request (A2X)", this CMR API request will recognize those custom fields.

  • Disable the tab OData APIs - "Credit Memo Request (A2X)" for those custom fields whose business context is "Sales: Sales Document" and enable tab Business Scenarios - "Billing Document to Sales Document on Header Level". On the other hand, remove the custom fields in the payload but only insert the property "ReferenceSDDocument". And then perform a CREATE credit memo request with the "Credit Memo Request (A2X)" API service request.

See Also

Keywords

Credit Memo Request (A2X), API_CREDIT_MEMO_REQUEST_SRV, Custom Field, Sales Document, Billing Document, Custom Fields and Logic, Extensibility, Credit Memo Request, API, OData API , KBA , SD-SLS-API , API , SD-SLS , Sales , SD-SLS-API-2CL , API (Public Cloud) , SD-SLS-EXT , Extensibility , Problem

Product

SAP S/4HANA Cloud Public Edition all versions ; SAP S/4HANA Cloud all versions