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: 
knutheusermann
Product and Topic Expert
Product and Topic Expert
1,470
Changing product tax classifications may become a mass change topic if tax laws of a country change. For example forced the recent change of Indian tax laws (GST) many companies to adopt their product tax classifications.

Using SAP Business ByDesign you can easily run mass updates of product tax classifications using web service APIs. In the following I explain the same for materials, but the same works similarly for service products as well.

 

Change tax rate type and tax exemption reason:


Step 1: Query/read product tax data using web service API "Query Materials"

The following web service request reads the material with ID "KHM01" and requests to return tax data only:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:glob="http://sap.com/xi/SAPGlobal20/Global">
<soapenv:Header/>
<soapenv:Body>
<glob:MaterialByElementsQuery_sync>
<MaterialSelectionByElements>
<SelectionByInternalID>
<InclusionExclusionCode>I</InclusionExclusionCode>
<IntervalBoundaryTypeCode>1</IntervalBoundaryTypeCode>
<LowerBoundaryInternalID>KHM01</LowerBoundaryInternalID>
</SelectionByInternalID>
</MaterialSelectionByElements>
<ProcessingConditions>
<QueryHitsMaximumNumberValue>200</QueryHitsMaximumNumberValue>
<QueryHitsUnlimitedIndicator>false</QueryHitsUnlimitedIndicator>
<LastReturnedObjectID></LastReturnedObjectID>
</ProcessingConditions>
<RequestedElements materialTransmissionRequestCode="2">
<Material deviantTaxClassificationTransmissionRequestCode="1" withholdingTaxClassificationTransmissionRequestCode="1"></Material>
</RequestedElements>
</glob:MaterialByElementsQuery_sync>
</soapenv:Body>
</soapenv:Envelope>

As result I get the product key information and tax data:
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header/>
<soap-env:Body>
<n0:MaterialByElementsResponse_sync xmlns:n0="http://sap.com/xi/SAPGlobal20/Global">
<Material>
<ChangeStateID>20171122142945.3455900</ChangeStateID>
<InternalID>KHM01</InternalID>
<UUID>00163e06-58b8-1ee7-b3f1-f2ea392b9bb0</UUID>
<SystemAdministrativeData>
<CreationDateTime>2017-11-22T14:19:01.749192Z</CreationDateTime>
<CreationIdentityUUID>00300571-ce9b-1ded-8dc7-301872e1069a</CreationIdentityUUID>
<LastChangeDateTime>2017-11-22T14:29:45.34559Z</LastChangeDateTime>
<LastChangeIdentityUUID>00163e01-0774-02de-84bf-1b2093f5412a</LastChangeIdentityUUID>
</SystemAdministrativeData>
<ProductCategoryID>80</ProductCategoryID>
<BaseMeasureUnitCode>EA</BaseMeasureUnitCode>
<DeviantTaxClassification>
<CountryCode>BE</CountryCode>
<RegionCode listID="BE"/>
<TaxTypeCode listID="BE">1</TaxTypeCode>
<TaxRateTypeCode listID="BE1||2|1">2</TaxRateTypeCode>
<TaxExemptionReasonCode listID="BE1||2|1">1</TaxExemptionReasonCode>
</DeviantTaxClassification>
<WithholdingTaxClassification>
<CountryCode>BE</CountryCode>
<TaxTypeCode listID="BE">2</TaxTypeCode>
<WithholdingTaxIncomeTypeCode listID="BE2||2|1">4</WithholdingTaxIncomeTypeCode>
</WithholdingTaxClassification>
</Material>
<ProcessingConditions>
<ReturnedQueryHitsNumberValue>1</ReturnedQueryHitsNumberValue>
<MoreHitsAvailableIndicator>false</MoreHitsAvailableIndicator>
<LastReturnedObjectID>00163E0658B81EE7B3F1F2EA392B9BB0</LastReturnedObjectID>
</ProcessingConditions>
</n0:MaterialByElementsResponse_sync>
</soap-env:Body>
</soap-env:Envelope>

 

Step 2: Update product tax exemption reason and tax rate type using web service API "Manage Materials"

The following web service request changes the TaxRateTypeCode and TaxExemptionReasonCode (please note: changing the tax rate type is possible with release 1802). Using action 06 (no action) on header level ensures, that no changes are done on header level. Action code 02 (update) on deviant tax classification level executes the update of the tax classification record.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:glob="http://sap.com/xi/SAPGlobal20/Global" xmlns:glob1="http://sap.com/xi/AP/Globalization">
<soap:Header/>
<soap:Body>
<glob:MaterialBundleMaintainRequest_sync_V1>
<BasicMessageHeader>
</BasicMessageHeader>
<Material actionCode="06" deviantTaxClassificationListCompleteTransmissionIndicator="false" withholdingTaxClassificationListCompleteTransmissionIndicator="false">
<InternalID>KHM01</InternalID>
<DeviantTaxClassification actionCode="02">
<CountryCode>BE</CountryCode>
<RegionCode></RegionCode>
<TaxTypeCode listID="">1</TaxTypeCode>
<TaxRateTypeCode listID="">3</TaxRateTypeCode>
<TaxExemptionReasonCode listID="">9</TaxExemptionReasonCode>
</DeviantTaxClassification>
</Material>
</glob:MaterialBundleMaintainRequest_sync_V1>
</soap:Body>
</soap:Envelope>


Add, delete or replace a product tax classification:


Step 1: Query/read product tax data using web service API "Query Materials"

Read the product tax data as described above.

Step 2: Replace product tax classification using web service API "Manage Materials"

The following web service request deletes the existing tax classification for a specific country and tax type (action code 03: delete), and creates a new tax classification for the same country and tax type (action code 01: create). The web service API ensures that deletion and creation are processed in the right sequence. The attribute deviantTaxClassificationListCompleteTransmissionIndicator="false" ensures that the tax classification of other countries and tax types are not changed.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:glob="http://sap.com/xi/SAPGlobal20/Global" xmlns:glob1="http://sap.com/xi/AP/Globalization">
<soap:Header/>
<soap:Body>
<glob:MaterialBundleMaintainRequest_sync_V1>
<BasicMessageHeader>
</BasicMessageHeader>
<Material actionCode="06" deviantTaxClassificationListCompleteTransmissionIndicator="false" withholdingTaxClassificationListCompleteTransmissionIndicator="false">
<InternalID>KHM01</InternalID>
<DeviantTaxClassification actionCode="03">
<CountryCode>BE</CountryCode>
<RegionCode></RegionCode>
<TaxTypeCode listID="">1</TaxTypeCode>
<TaxRateTypeCode listID="">3</TaxRateTypeCode>
<TaxExemptionReasonCode listID="">9</TaxExemptionReasonCode>
</DeviantTaxClassification>
<DeviantTaxClassification actionCode="01">
<CountryCode>BE</CountryCode>
<RegionCode></RegionCode>
<TaxTypeCode listID="">1</TaxTypeCode>
<TaxRateTypeCode listID="">2</TaxRateTypeCode>
<TaxExemptionReasonCode listID="">1</TaxExemptionReasonCode>
</DeviantTaxClassification>
</Material>
</glob:MaterialBundleMaintainRequest_sync_V1>
</soap:Body>
</soap:Envelope>

 

You can retrieve ByD code lists using web service API QueryCodeListIn. For details see blog post How to get ByDesign Code Lists via Web Service QueryCodeListIn.

You find more details about ByD web service APIs on SAP Help, link "Web Services APIs".

 

 

 
3 Comments