Being compliant to taxation laws on country and regional level is essential for all companies. However this may become a challenge if taxation laws are changed frequently or if a large number of products are affected. A recent example of a major change has been the Goods and Service Tax for India (GST). For this purpose
SAP Business ByDesign (
ByD) provides user interfaces, mass maintenance capabilities, web service APIs and OData APIs to efficiently review and update product tax classifications.
On the
SAP Business ByDesign UI you can change product tax classifications of materials, service products and entitlement using work center
Product Data: Open for example the material that you intend to change, switch to sheet
Taxes and change the
Product Tax Classification:
However, to enable companies to change product tax classifications of large numbers of materials
SAP Business ByDesign provides 3 possibilities to
mass update product tax classifications:
- Mass Data Maintenance:
Work center Mass Data Maintenance provides a possibility to export product tax classifications, change the data offline and import the changes back to ByD.
- Product Web Service APIs used in Excel:
Product web service APIs (Soap) enable you to query, read and update product tax classifications. Below you find an Excel example to read and update product tax classifications using web service APIs.
- Product OData Services:
The work center Application and User Management - OData Services can be used to expose product tax classification data via the ByD OData API. As result you can query, read, update, delete and create product tax classification via OData.
The following chapters explain the 3 options in detail with some examples.
Please note: Option 1 and 2 are planned for release 1802 (in release 1711 the tax rate type cannot be changed as described below, but requires to delete and re-create the product tax classification record).
Mass Data Maintenance
The ByD work center
Mass Data Maintenance provides the possibility to download and upload product tax classifications of materials:
Step 1: Export product tax classification
Open work center view
Mass Data Maintenance and click on the link to export materials:
On screen "
Export of Materials": select materials, switch to sheet "
Taxes" and download the tax classification data using button "
Export Data to CSV File":
Step 2: Change tax classifications offline
Edit the product tax classifications in the CSV file, for example using Excel. Since ByD release 1802 you can upload changed tax rate types and the tax exemption reasons.
Step 3: Import changed tax classifications
Open work center view
Mass Data Maintenance again and click on the link to import materials. Switch to sheet "
Taxes", click on "
Upload Data from Text File" and choose the source file and file settings.
Execute the data import of the data on sheet "
Taxes" after the system completed the validation.
Product Web Service APIs used in Excel
Using ByD web service APIs (synchronous Soap APIs) for materials, service products and entitlements you can query, read, change, create and delete product tax classifications. The blog post
Change Product Tax Classifications using Web Service APIs provides you with a detailed description how to use product web services including request- and response xml examples.
Using web service APIs
- Query Materials and
- Manage Materials,
and Excel VBA you can build Excel templates that enable you to change product tax classifications in three steps:
- Extracts product tax classification data from ByD into Excel using ByD web service APIs.
- Change product tax rate types and tax exemption reasons offline in Excel.
- Update the changed product tax classifications in ByD using ByD web service APIs.
Example:
In blog post
Mass Changes of ByD Data using Excel and ByD Web Services you find further details about the possibility using Excel and ByD web service APIs for mass data changes.
This blog post provides you as well with a link to download some sample Excel templates incl. the example to change product tax classifications mentioned above.
In blog post
How to get ByDesign Code Lists via Web Service QueryCodeListIn you find details how to retrieve code lists incl. an example for tax rate type codes.
Product OData Services
If you prefer REST/OData you use as well the ByD OData API to build or connect some application to read and update product tax classifications in ByD.
Here is an example how to expose ByD product tax classifications of materials via OData, and how to consume the ByD OData API:
Step 1: Create Custom OData Service
Open work center view
Application and User Management - OData Services and create a
Custom OData Service for business object
Material.
Make sure you expose material properties that enable you to filter relevant materials and all properties of node
DeviantTaxClassification. In my example I included the following elements to my OData service "
khmaterial":
- InternalID
- UUID
- Description (incl. content and languageCode)
- DeviantTaxClassification (created as separate collection MaterialDeviantTaxClassification with all elements)
Please note the
Service URL from the OData Editor. In my example the service URL is
https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/khemployee.
Step 2: Get material data using OData
If need you can retrieve the metadata using the URL
https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/khemployee/$metadata
Using the entity set
MaterialCollection you can filter and read ByD materials including product tax classifications:
https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/khmaterial/MaterialCollection?$filter=Interna... eq 'KHM1'&$expand=MaterialDeviantTaxClassification&$format=json
In my example I'm using the parameter
- $filter=InternalID eq 'KHM1' (to filter the materials by the internal ID),
- $expand=MaterialDeviantTaxClassification (to include the product tax classifications in the OData response) and
- $format=json (to use JSON as body format of the response; default is xml).
Furthermore I set the header parameter
- x-csrf-token=fetch to get the CSRF-token to update the material in the next step.
In Postman the OData request looks as follows
Step 3: Update the product tax classification using OData
Using http-method POST and the information provided by GET-response you can now update the product tax classification:
In my example I'm using the URL
https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/khmaterial/MaterialDeviantTaxClassificationCo...')
with the header parameters
- Content-Type = application/json
- x-http-method = MERGE
- x-csrf-token = <as provided by the response header in step 2>
and the body
{
"ObjectID":"00163E2A132B1ED7B59C302C7EDBD1C1",
"ParentObjectID": "00163E2A132B1ED7B59C302C7EDB91C1",
"CountryCode": "US",
"RegionCode": "AK",
"TaxTypeCode": "1",
"TaxRateTypeCode": "2",
"TaxExemptionReasonCode": "M"
}
Step 4: Delete and create product tax classifications using OData
If you would like to replace a product tax classification, you can delete a tax classification and create a new tax classification.
Delete product tax classification:
Using http-method POST and the object ID provided by GET-response you can delete the product tax classification:
Example URL:
https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/khmaterial/MaterialDeviantTaxClassificationCo...')
with the header parameters
- Content-Type = application/json
- x-http-method = DELETE
- x-csrf-token = <as provided by the response header in step 2>
Create new product tax classification:
Using http-method POST and the parent object ID provided by GET-response you can create a new product tax classification:
Example URL:
https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/khmaterial/MaterialDeviantTaxClassificationCo...
with the header parameters
- Content-Type = application/json
- x-csrf-token = <as provided by the response header in step 2>
and body
{
"ParentObjectID": "00163E2A132B1ED7B59C302C7EDB91C1",
"CountryCode": "DE",
"RegionCode": "11",
"TaxTypeCode": "1",
"TaxRateTypeCode": "1",
"TaxExemptionReasonCode": ""
}