Technical Articles
Creating Custom Fields in Sales Contract form for Poland
This blog post explains how to extend the custom fields in the output form of the Sales Contract in Poland country solution of the SAP S/4HANA Cloud system.
The sample business scenario describes how to add three custom fields, i.e. Tax Amount, PKWiU Code and PKWiU Description for Poland in extensibility of SAP S/4HANA Cloud.
- Tax Amount: This specifies the total amount of tax to be paid per item.
- PKWiU Code: This is used for tax purposes to categorize goods and services sold per item in Poland.
- PKWiU Description: This is used to specify the description of PKWiU Code.
These three custom fields are not available in SD_SLS_CONTRACT form. However, this is achieved by using extensibility concept based on business requirements.
Prerequisites
You have access to Adobe LiveCycle Designer Tool and have experience in using it. Coding experience on CDS View is also necessary, since this extensibility solution requires
Business Add-In (BAdI) implementation.
Authorizations
Business Roles | Business Catalogs | Catalog Description | Applications Used |
---|---|---|---|
SAP_BC_CORE_EXT | SAP_BC_CORE_EXT | Extensibility | Custom Fields and Logic |
Implementation
In this section, the steps are given to implement the custom fields in the Sales Contract form for Poland.
1. Create Custom Fields
Create the following custom fields under the Custom Fields & Logic app:
Custom field | Custom Field Name | Business Context | Type |
Tax_Description | YY1_tax_rate_desc | Sales: Sales Document Item | Text – char(50) |
Sales_PKWiU_code | YY1_sales_pkwiu_code | Sales: Sales Document Item | Text – char(30) |
PKWiU_Description | YY1_sales_pkwiu_desc | Sales: Sales Document Item | Text – char(50) |
2. Implementation of BAdI
Create BAdI implementation under BAdI Description: Sales Item Modification and Business Context: Sales: Sales Document Item and implement it using the following points:
- Moving the Data: Do not forget to move the data from input parameter data to output parameter.
i.e. salesdocumentitem_extension_o = salesdocumentitem_extension_i - Tax Amount: In salescontractitem node, the field Tax Amount is available. It can be directly mapped in the layout.
- PKWiU Code: You can use CDS View I_ProductPlant to fetch PKWiU Code and assign it to temporary field(i.e. lv_pkwiu) based on salesdocumentitem-MATERIAL and salesdocumentitem-productionplant.
- PKWiU Description: You can use CDS View I_AE_CnsmpnTaxCtrlCodeTxt to fetch PKWiU Description and assign it temporary field(ie. la_tab2) based on the LANGUAGE , CountryCode and the PKWiU Code selected above.
Note: Do not forget to map the fields to the corresponding change parameter fields.
Sample Code:
3. Download the Form and add Fields
- Go to the Maintain Form Templates app under the tile Output Management.
- Go to Predelivered Templates.
- Search for SD_SLS_CONTRACT form and download it.
- Modify the layout with the custom fields in the Adobe LiveCycle Designer Tool.
Add the custom fields in the line item level as per the screen short below:
4. Update Form Template
- Go to the Maintain Form Templates app under the tile Output Management.
- Click Custom Templates.
- Add or modify the template.
5. Test the Implementation
Print the forms by using the Change Contract app or Display Contract app. This will download the form with all three custom fields Tax Amount, PKWiU Code and PKWiU Description.
Conclusion
By following the steps mentioned above, you can extend three custom fields i.e. Tax Amount, PKWiU Code and PKWiU Description in the output form of the Sales Contract in Poland country solution of the SAP S/4HANA Cloud system.
For more information, refer SAP Note: 2955050 – Poland CE 2011 : Adding Custom Fields for Purchase Order and Sales Contract.