Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
CE6
Product and Topic Expert
Product and Topic Expert
1,424

You might want more fields from master data available in your sales documents, for example, to display in a sales order app or to print in the sales order confirmation. You can do this with key user extensibility.

You can find detailed information about how to use key user extensibility in SAP S/4HANA Cloud Sales to adjust the sales document processing of your system in another blog post.

In this blog post, I will focus on the process how to get master data into a sales document. As an example, I use the Customer Classification field from customer master data which is available in the I_Customer CDS view.

To add the field to your sales documents, take the following two steps in your system:

1. Create a custom field in the Custom Fields app

First, you must create a custom field in the sales document (business context: Sales: Sales Document) that will contain the value of the customer master data field. Choose the same data type that the customer master field has. In our example, it is a text field of length 2.


2. Implement the Sales Header Modification BAdI in the Custom Logic app

To copy the value of the field, we use the Sales Header Modification Business Add-In (BAdI). Here is some example code:

*First of all assign existing extension field values to output parameter:

salesdocument_extension_out = salesdocument_extension_in.



SELECT single customerclassification

 FROM i_customer with privileged access

  into @salesdocument_extension_out-yy1_customerclassifica_sdh

   where customer = @salesdocument-soldtoparty.


The Customer Classification field is now available in your sales documents. After enabling its usage, you can use the field like any other custom field.

If you want to use the description of the customer classification instead of the key, you can get it from the I_CustomerClassificationText CDS view.

Additional information:

If you want to add a field on item level, you need to use business context Sales: Sales Document Item for your custom field and Cloud BAdI Sales Item Modification to implement the logic.

There are some more interesting released CDS Views to get master data into the sales document:

Released CDS ViewDescription
I_CustomerSalesArea (KNVV)Customer Sales Area
I_Product (MARA)Product Master Data
I_ProductPlantSales (MARC)Product Plant


You can find all released CDS Views in the app View Browser: documentation

4 Comments