Skip to Content
Product Information
Author's profile photo Krishna Ramadesikan

Custom Tax File Generation in SAP Business ByDesign

Keeping pace with the ever-changing regulatory environment is a challenge; tax return file is a good use case of such legal format changes in many countries. Keeping them updated as per latest regulations from standard delivery is a challenge.

In this blog, we will explain the new feature of possibility to generate custom tax return files in SAP Business ByDesign. This would enable the partners to adapt tax return files to relevant format according to specific country regulations. This feature has been made available to be consumed even for pre-localized and non-localized country tax return(by using the generic tax return).

Partners/Customers would now have 2 approaches to amend a given tax return file format and content.

Approach 1: Edit values in SAP generated tax return files

To do this, the partners would need to implement the enhancement option

PDI AE Multiple Usage Tax File Generation BAdI for VAT return files (OR)

PDI AE Multiple Usage Withholding Tax File Generation BAdI for withholding tax return files(Available with release 2108)

in the SAP Cloud Applications Studio with relevant filter conditions. The implementation can be done for a combination of tax country and tax return type. Please refer example snapshot below.

Enhancement%20Implementation%20Filter

Enhancement Implementation Filter

In the implementation, partners would have the option to edit SAP generated file content. We would recommend partner to edit this content judiciously. Please refer example implementation in below snapshot.

Sample%20Implementation

Sample Implementation

 

Approach 2: Generate a new custom tax return file

Please note that knowledge of XSL Transformation would be a pre-requisite to generate these valid custom tax return files.

The brief steps to be followed for the partners/customers to achieve this would be as below

Step 1: Check Electronic Submission Indicator in relevant tax return arrangement.

Electronic Submission indicator is used to determine if an electronic file should be generated when releasing a tax return. If the indicator is unchecked, no file is created.

To do so, follow the path Tax Management  Company Tax Arrangements. Search for required company. Click Edit. Under Tax Return Arrangements, check the Electronic Submission checkbox.

If the electronic submission indicator is unchecked and non-editable, you need to first maintain a dummy XSL transformation.

Step 2: Create XSL Transformation

In case the partner wants to see the exact content of the SAP generated tax return file, then they can refer the input parameter to the enhancement option PDI AE Multiple Usage Tax File Generation BAdI  for VAT or PDI AE Multiple Usage Withholding Tax File Generation BAdI for withholding tax.

However, if the partner just wants the input structure format, then they could refer the datatype ‘ProductTaxDeclaration’ for VAT return and ‘WithholdingTaxDeclaration’ for Withholding tax return in Repository Explorer of SAP Cloud Applications Studio.

Datatype%20Reference

 

Step 3: Maintain XSL Transformation in XSLT Repository

Once the XSL transformation is created, you need to maintain it in the XSL transformation repository. You can maintain the configuration in the Common Master Data Configuration using configuration type code Transformation Repository. This feature allows you to store a single or multiple customer-specific XSLT files in the repository from which dedicated transformations can be created as per your business requirements.

Ensure to maintain the Transformation Type as TXRT – XSL Transformation Tax Return while adding XSL transformation.

XSLT%20Maintenance

For steps on how to add an XSL transformation, please see XSL Transformation.

The steps to generate tax returns itself remain unchanged. However kindly note that for a given tax return, the custom XSL transformation file(if maintained properly) takes precedence over the standard file delivered by SAP.

Since this feature enables customization of tax return file content, if this is consumed, then SAP does not validate the modified content, the customer/partner would need to modify/validate the content themselves judiciously.

Please free to provide your queries and feedback here. Happy to help!

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Olivia Johansson
      Olivia Johansson

      Hi,

       

      Thanks for this blog! We have a question about step 2 Create XSL Transformation.

      Is there any exemple file we can look at? So we can understand how we should start build this XLS file.

       

      /Olivia Johansson

       

      Author's profile photo Ihan Capell
      Ihan Capell

      Hi Olivia,

      Regarding your question about step 2 (Create XSL Transformation), please check the link below for steps on how to add an XSL transformation:

      https://help.sap.com/viewer/0635ec3491974ad988be05d6b1dcf734/2111/en-US/82421168ccf24e9d8d7101079e3f174c.html

       

      Best Regards,

      Ihan

      Author's profile photo Olivia Johansson
      Olivia Johansson

      Hi,

       

      We have checked this, but it´s not helping us. Because we dont know how the file should be created and how we should build it.

      We have tried create a XSL file, but ByD dont accept the file.

      Do you have any example file that we can look at?

      /Olivia

       

      Author's profile photo Krishna Ramadesikan
      Krishna Ramadesikan
      Blog Post Author

      Hi Olivia,

      As mentioned in the blog, knowledge of XSL Transformation would be a pre-requisite to generate your custom tax return file. I would suggest you to get this knowledge from online resources. For example, https://www.w3schools.com/xml/xsl_transformation.asp. There are other online resources too to learn.

      In brief, the flow would be as below

      Input XML Structure => Uses XSL Transformation Data => To transform into target file

      Hence, for deriving at the XSL transformation file structure, it is required to know both, 'Input format'(mentioned below) and 'Output format'(Depends on country's desired tax file format).

      The schema of the input XML structure for this use case can be found by referring to the datatype ‘ProductTaxDeclaration’ for VAT return and ‘WithholdingTaxDeclaration’ for Withholding tax return in Repository Explorer of SAP Cloud Applications Studio.

      For your reference, attaching a XSL file created by my colleague for a part of Spain 303 tax return file.

      <xsl:transform xmlns:xhtml="http://www.w3.org/1999/xhtml"
        xmlns="http://www.w3.org/1999/xhtml"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        version="1.0">
      
        <xsl:preserve-space elements="*" />
        <xsl:output method="text" omit-xml-declaration="yes" />
      
        <xsl:template match="/">
          <!-- formatting for DP30300 -->
          <xsl:value-of disable-output-escaping="yes" select="string('&lt;T3030')"/>
          <xsl:value-of select="substring(//*[local-name() = 'ProductTaxDeclarationNotification']/ProductTaxDeclaration/ReportingPeriod/EndDate,1,4)" />
          <xsl:value-of select="substring(//*[local-name() = 'ProductTaxDeclarationNotification']/ProductTaxDeclaration/ReportingPeriod/EndDate,6,2)" />
          <xsl:value-of disable-output-escaping="yes" select="string('0000&gt;&lt;AUX&gt;')"/>
          <xsl:call-template name="spaces">
            <xsl:with-param name="x" select="300"/>
            <xsl:with-param name="something" select="string(' ')"/>
          </xsl:call-template>
          <!-- formatting for DP30301 -->
          <xsl:value-of disable-output-escaping="yes" select="string('&lt;/AUX&gt;&lt;T30301000> I')"/>
          <xsl:value-of select="substring(//*[local-name() = 'ProductTaxDeclarationNotification']/ProductTaxDeclaration/ReportingPeriod/EndDate,1,4)" />
          <xsl:value-of select="substring(//*[local-name() = 'ProductTaxDeclarationNotification']/ProductTaxDeclaration/ReportingPeriod/EndDate,6,2)" />
          <xsl:value-of disable-output-escaping="yes" select="string('213221222')"/> <!-- fields 11-19 -->
          <xsl:call-template name="spaces">   <!-- fields 20-21 -->
            <xsl:with-param name="x" select="9"/>
            <xsl:with-param name="something" select="string(' ')"/>
          </xsl:call-template>
          <xsl:value-of select="string('200')"/> <!-- fields 22-24 -->
      
          <!-- Product Tax Event Type Codes -->
          <xsl:variable name="base_event_type_code" select="310" />    
          
          <!-- fill fields 25-27 -->
          <xsl:for-each select="//*[local-name() = 'ProductTaxDeclarationNotification']/ProductTaxDeclaration/Item[ProductTax/EventTypeCode = $base_event_type_code]">
          </xsl:for-each>
          
          <xsl:call-template name="spaces">   <!-- field 71, 72 -->
              <xsl:with-param name="x" select="613"/>
              <xsl:with-param name="something" select="string(' ')"/>
          </xsl:call-template>
          <xsl:value-of disable-output-escaping="yes" select="string('&lt;/T30301000>')"/>
          <!-- formatting for DP30303 -->
          <xsl:value-of disable-output-escaping="yes" select="string('&lt;T30303000>')"/>
      
          <xsl:call-template name="spaces">   <!-- fields 29-35 -->
              <xsl:with-param name="x" select="660"/>
              <xsl:with-param name="something" select="string(' ')"/>
          </xsl:call-template>
          <xsl:value-of disable-output-escaping="yes" select="string('&lt;/T30303000>')"/>
          <xsl:value-of disable-output-escaping="yes" select="string('&lt;/T3030')"/>
          <xsl:value-of select="substring(//*[local-name() = 'ProductTaxDeclarationNotification']/ProductTaxDeclaration/ReportingPeriod/EndDate,1,4)" />
          <xsl:value-of select="substring(//*[local-name() = 'ProductTaxDeclarationNotification']/ProductTaxDeclaration/ReportingPeriod/EndDate,6,2)" />
          <xsl:value-of disable-output-escaping="yes" select="string('0000>')" />
        </xsl:template> <!-- root -->
      
        <!-- "subroutines" -->
        <xsl:template name="spaces"> <!-- print x <something> -->
          <xsl:param name="x" select="1" />
          <xsl:param name="something" />
          <xsl:if test="$x > 0">
              <xsl:value-of disable-output-escaping="yes" select="string($something)" />
              <xsl:call-template name="spaces">
                 <xsl:with-param name="x" select="$x - 1" />
                 <xsl:with-param name="something" select="$something" />
              </xsl:call-template>
          </xsl:if>
        </xsl:template>
      
      </xsl:transform>

       

      Best Regards,

      Krishna