Beruflich Dokumente
Kultur Dokumente
INTRODUCTION
SAP does not have inbuilt Tax calculation solution, hence external tax bolt on software
products are used for tax solution. Sabrix is one of the many external tax Software
products available as SAP bolt-on. The scope of this document is tax calculation in SAP
using SABRIX for North America and Canada regions. As Sabrix is a SAP bolt-on, required
information needs to be passed from SAP to Sabrix to calculate tax and receive the
results from Sabrix back in SAP.
There is a standard interface for passing predetermined fields between SAP and SABRIX. In most
cases, the fields available in the standard interface are not enough for effective and efficient tax
calculation. Hence some enhancements are required while sending and receiving data between SAP
and SABRIX. When the required fields with required information are sent to SABRIX, it returns the
Taxable amount and Tax Code which in turn gets posted in SAP. If this exchange of information
happens seamlessly, it results in accurate calculation of Tax (or the taxable amount) which is the
ultimate aim of using Tax software.
ARCHITECTURE
There must be communication established between ECC SAP & SABRIX. Communication between
these two is established using SAP RFC (Remote Function Calls).
There are two ways of communication between SAP and SABRIX:
OUTBOUND SAP sends required data to SABRIX to calculate Tax using RFC
(RFC_CALCULATE_TAXES_DOC).
INBOUND SABRIX returns Taxable amount and Tax Code to SAP through RFC.
CONFIGURATION
Below are the steps required in the configuration of Sabrix. To get the details of each step, please go through
the link given below along with the OSS notes.
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/047ab790-0201-0010-a9b1-e612f8b71dcd?
overridelayout=true
Below are the configuration steps which are provided for information only and this document will not cover the
config part.
1.
2.
3.
4.
5.
6.
7.
REQUIREMENT
While creating PO manually or by reference of PR/PO, the Taxable amount should be calculated by
SABRIX. The Tax Exemption code should be assigned for each PO line item based on the taxable
amount. This Tax Exemption
The above three fields were used as part of our requirement. The requirement could be different for other
projects and can use different fields as well.
OUTBOUND
The User exit EXIT_SAPLFYTX_USER_001 (mentioned below in document) is used to pass required
data to Sabrix for Tax calculation. The standard fields present in the user exit are not enough to
calculate the correct Tax amount for PO. In order to calculate the correct Tax amount, additional
fields needs to be passed to the above user exit which is explained in the document below.
To send additional fields to the SABRIX, one has to implement Enhancements, BADIs and
Classes. The details and sequence of each are mentioned below.
The User Exit can be searched during PO creation/change by using break points on call
customer-function and it will take you to the User Exit shown below.
It holds the coding block data of PO and can be used to get the current values of PO fields like Cost
Center, WBS and Order Number.
We can use the COBL structure to get the current values of Cost Center (KOSTL), Order (AUFNR)
and WBS (PS_PSP_PNR) and export the values.
In case they are not same then Sabrix should be called and changing parameter CH_X_LF_CALCTYPE will be
set which calls Sabrix. Details are mentioned below.
Method 1->ME_TAXCOM_MEPO
This method is used to get PO header, item and account assignment data. There are following importing
parameters IM_OEKKO, IM_EKKO, IM_OFEKPO, IM_EKPO and IM_ACCOUNTING
Parameter IM_ACCOUNTING is the Account Assignment Data for Item. It is a table which contains multiple
records. Following values can available in this table:
Cost center, order number, WBS, G/L Account Number and Project Number. These values can be exported
and used further in order to pass to SABRIX.
E.g. We can check the Account Assignment Category (IM_EKPO-KNTTP) with 3 cases:
1. 1. Account Assignment = K This is related to the Cost Center. We can use the Cost
Center in the IM_ACCOUNTING (KOSTL).
2. Account Assignment = P This is related to WBS Element. We can use WBS element
(PS_PSP_PNR) from IM_ACCOUNTING. Based on this value, actual WBS can be fetched
from PRPS table.
3. Account Assignment = F This is related to the Order number. We can use order
(AUFNR) from IM_ACCOUNTING. Based on this value, we can select Order master data
from table COAS table.
As per our scenario, we collected the Cost Center, Order and WBS data in the internal table and exported it
along with PO item details. We will need these values further in our logic.
Method 2->MM_DATA_FOR_TAX_SYSTEM
(Preparation and Sending of Additional Data for Tax):
D. Enhancement FYTX0002
(EXIT_SAPLFYTX_USER_001)
This User Exit is used for passing the additional data to Sabrix required for Tax Calculation.
Details are mentioned below.
This Enhancement has the component EXIT_SAPLFYTX_USER_001 and Include ZXFYTU03.
This Enhancement is used for Sales and Purchase Order transactions to pass the Field values to
the Sabrix for Tax Calculation.
Import Parameters are given in below snapshot.
I_T007A
I_TTXD
I_TAX_HEADER_INPUT Not Used in our scenario.
I_TAX_ITEM_INPUT Not Used in our scenario.
I_INPUT_USER - This parameter has the standard fields avaiable but does not contaitn the
additional fields to pass to Sabrix. In order to calculate the Tax properly, we will append this
structure with those additional fields, needed by Sabrix. For
eg. MATKL, KUNNR, AUART,
WERKS etc.
Using this Enhancement, the additional fields given below can be passed to the Sabrix for Tax
calculation:
Material Group, Plant Number, Cost Center, G/L Account Number, Internal Order, PO Line Type, (item
category), PO Account Assignment Indicator, Material Type, Cost Center Category, Invoice Header Reference,
Profit Center, Project No.
In order to pass the additional fields we need to enhance the structure
TAX_ALLOWED_FIELDS of the CHANGING Parameter CH_USER_CHANGED_FIELDS.
Below Struture is appended with the Attribute fields which will hold additional fields.
The additional fields like zzattribute16 (Cost Center), zzattribute18 (ORDER) and zzattribute21
(WBS) etc. were passed to Sabrix in our scenario. Similarly, all the fields described in the
structure above were passed to Sabrix.
This User Exit will run for multiple transactions such as ME21, ME21N, ME22, ME22N, ME23,
ME23N, MIRO, MRRL, MRIS, MRKO, FB60, FB65, and ML81N. Based on the requirement,
one can add the logic respectively to pass the fields to Changing structure.
In the above screenshot, we are passing Cost Center (KOSTL), Cost element (SAKTO), Order
Number (AUFNR), Item Category (PSTYP), Account Assignment Category (KNTTP), Material
Type (MTART) and Profit Center (PRCTR) in the ZZATTRIBUTE fields.
Once the structure is populated, the RFC will have the updated values in the input
table TAX_CAL_ITEM_INXX to send to Sabrix. The SABRIX is called through the RFC
RFC_CALCULATE_TAXES_DOC and returns the taxable amount. The input field values are
provided by table TAX_CAL_ITEM_INXX and the Taxable amount is returned in the table
TAX_CAL_ITEM_OUTXX.
We can read the RFC table TAX_CAL_ITEM_OUTXX and get the taxable amount in the field
TAXAMOV.
INBOUND
A. Transactions Used For Purchase Order
Generate the Purchase Order: ME21N and ME21.
Change Existing Purchase Order : ME22N and ME22
Display the Purchase Order: ME23N and ME23.
There are 5 tax Exemption codes associated with each PO line item. i.e. A1, A2, A3, A4, A5.
Each Tax Exemption Code has a description given in the table below and is used in Purchase Order
form output as per the tax Exemption code assigned to each line item of PO.
Tax Exemption codesRFC_CALCULATE_TAXES_DOC) and will be assigned to the PO line item and
displayed on the screen(Logic for tax Exemption code will be covered in enhancement below).
Tax Exemption Codes A4 and A5 will be added with custom logic as per or scenario
C. Enhancement Implementation
The Sabrix is called for each line item to calculate tax. In order to get the line item number, an Implicit
Enhancement ZMM_LINEITEM_GET was created in the inlcude LFYTX_TAXMF12. The line item
determined this way will help in placing the correct Tax Exemption Code on the PO screen.
This enhancement is called after SABRIX returns tax information so that the correct line item number
can be used to populate Tax Exemption Code.
The line item number is exported to the memory ID to use it further.
The line number exported above can be imported here so that the Tax Exemption Code can be
assigned for respective line item.
To get the tax Exemption code and taxable amount returned by SABRIX, Read the table
TAX_CAL_ITEM_OUTXX which is output of SABRIX RFC.
The tax amount will be in the field TAXAMOV of the table TAX_CAL_ITEM_OUTXX
The tax Exemption code Returned from SABRIX will be in the field EXT_EXREASON of the same
table.
The tax Exemption code A1, A2 and A3 will be returned from the SABRIX in the field
EXT_EXREASON and A4/A5 will be assigned by the logic in code depending on the taxable amount.
Logic To Calculate Tax Exemption Code A4 and A5
Tax Exemption code A1, A2 and A3 are standard and will be returned by Sabrix RFC. But as per
our requirement, we need A4 and A5 which explained below how to determine these Tax Exemption
codes.
Check the taxable amount (TAX_CAL_ITEM_OUTXX TAXAMOV) returned by the SABRIX.
When taxable amount = 0, for a particular line item and the tax ExemptionExemption code to
populate the PO Customer data Screen field(Sabrix tax Exemption code). In case the SABRIX do not
return the tax ExemptionExemption code, Then use tax Exemption code as A4. This mean TAX
EXEMPT.
If the taxable amount is NOT 0, for a particular line item and the Tax ExemptionExemption
codeExemption Code). In case the SABRIX doesn't return the tax Exemptiontax Exemption, Then
use tax Exemption code as A5. This mean TAXABLE amount.
(See the Code Snippet 1 as an attachment)
Collect the tax Exemption code for each item in the internal table and export the internal table.
This table will be used further in the inlcude ZXM06O03(Detail given below) to assign the Tax Exemption
Code to the PO Customer Data
Screen.
A custom include ZXM06ZZZ was created for all the subprograms and modules.
Inside this include, another custom include ZXM06O03 contains the code to get the Tax Exemption Code from
Sabrix and assign to the Screen Field Tax Exemption Code.
Code Snippet2:
The PO below has been assigned TaxCode as A1 for Line item 10. Simillarly, Line item
20 and 30 has been assigned TAXCODE as A5 because the Tax is calculated for each line
item. Please go through below screen shots.