Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
abdul_hakim
Active Contributor
3,126

Due to the complexities of U.S tax rules and regulations which seem to vary based on industry or business practice, SAP has provided a Function Module exit within the tax interface programming logic to allow customers and partners to handle customer and partner specific functionality.

SAP enhancement FYTX0002 consist of the following components which can be viewed in transaction SMOD.

  1. Function Module exit EXIT_SAPLFYTX_USER_001
  2. Customizing Include CI_TAX_INPUT_USER

Function Module exit EXIT_SAPLFYTX_USER_001 has the following important interface parameters.

The fields of the changing parameter CH_USER_CHANGED_FIELDS can be modified within the Function Module exit EXIT_SAPLFYTX_USER_001.

Customizing include CI_TAX_INPUT_USER can be used to add additional fields from structures KOMP, KOMK and XKOMV.

If you want to pass additional fields from pricing that are not in KOMP and KOMK to the tax Function Module exit EXIT_SAPLFYTX_USER_001 then you can add those fields to the pricing includes INCLUDE KOMKAZ in KOMK (header data) and INCLUDE KOMPAZ in KOMP (item data).

You can populate these fields as well as existing fields in KOMP and KOMK in USEREXIT_PRICING_PREPARE_TKOMK and

USEREXIT_PRICING_PREPARE_TKOMP in programs MV45AFZZ (order processing) and RV60AFZZ (billing).

In addition to the Function Module exit mentioned above the badi EXTENSION_US_TAXES also needs to be implemented to handle specific business scenarios such as Purchase orders, Incoming invoice (MIRO).

Purchase order

In order to process account assignment data for Purchase order line items in the Function Module exit EXIT_SAPLFYTX_USER_001 implement the method ME_TAXCOM_MEPO of the badi EXTENSION_US_TAXES as follows.


Sample code


*Read account assignment data for item
READ TABLE im_accounting INDEX 1 INTO wa_im_accounting.
*G/L account number
EXPORT wa_im_accounting-sakto FROM wa_im_accounting-sakto TO MEMORY ID 'GL_ACCOUNT'.
*Cost center
EXPORT wa_im_accounting-kostl FROM wa_im_accounting-kostl TO MEMORY ID 'COST_CNTR'.
*WBS Element
EXPORT wa_im_accounting-ps_psp_pnr FROM wa_im_accounting-ps_psp_pnr TO MEMORY ID 'WBS'.
*Internal Order
EXPORT wa_im_accounting-aufnr FROM wa_im_accounting-aufnr TO MEMORY ID 'IO'.





Process this data in the Function Module exit EXIT_SAPLFYTX_USER_001 as follows.

Sample code


*G/L account number
IMPORT wa_im_accounting-sakto TO wa_im_accounting-sakto FROM MEMORY ID 'GL_ACCOUNT'.
*Cost center
IMPORT wa_im_accounting-kostl TO wa_im_accounting-kostl FROM MEMORY ID 'COST_CNTR'.
*WBS Element
IMPORT wa_im_accounting-ps_psp_pnr TO wa_im_accounting-ps_psp_pnr FROM MEMORY ID 'WBS'.
*Internal Order
IMPORT wa_im_accounting-aufnr TO wa_im_accounting-aufnr FROM MEMORY ID 'IO'.





Incoming invoice (MIRO)

In order to send additional data for tax system implement the method MM_DATA_FOR_TAX_SYSTEM of the badi EXTENSION_US_TAXES as follows.


Sample code


*Item Data from FI Document
EXPORT it_bseg FROM ti_bseg TO MEMORY ID 'TI_BSEG'.
EXPORT it_bseg_mat FROM ti_bseg_mat TO MEMORY ID 'TI_BSEG_MAT'.
*Item Data from MM Document
EXPORT it_drseg FROM ti_drseg TO MEMORY ID 'TI_DRSEG'.
*Link Table BSEG-DRSEG
EXPORT it_matkl FROM ti_bseg_mat TO MEMORY ID 'TI_MATKL'.



Process this data in the Function Module exit EXIT_SAPLFYTX_USER_001 as follows.

Sample code


*Item Data from FI Document
IMPORT it_bseg TO it_bseg FROM MEMORY ID 'TI_BSEG'.
IMPORT it_bseg_mat TO it_bseg_mat FROM MEMORY ID 'TI_BSEG_MAT'.
*Item Data from MM Document
IMPORT it_drseg TO it_drseg FROM MEMORY ID 'TI_DRSEG'.
*Link Table BSEG-DRSEG
IMPORT it_matkl TO it_matkl FROM MEMORY ID 'TI_MATKL'.



Vendor invoice (FB60)

The data required for vendor invoice processing can be imported in the Function Module exit EXIT_SAPLFYTX_USER_001 from the memory id as follows.


Sample code


IMPORT xbkpf xbseg FROM MEMORY ID '%BKPF%'.


Sales order

If you want to process Customer details within the Function Module exit EXIT_SAPLFYTX_USER_001 for instance customer number, customer name and pricing subtotal then add these fields to customizing include CI_TAX_INPUT_USER and process as follows.

Sample code


if i_input_user-kunnr is not initial.
  select single name1 from kna1 into lv_name where kunnr eq i_input_user-kunnr.
endif.
*Pricing subtotal
ch_user_changed_fields-freight_am = i_input_user-zzwi20.


For all the business scenarios, once we import the data in Function Module exit EXIT_SAPLFYTX_USER_001 the data can be processed based on the specific business requirement and then assigned to changing parameter CH_USER_CHANGED_FIELDS as needed.

Important SAP Notes for tax interface exit implementation

302998, 1692637, 1730413, 1790294

7 Comments
Labels in this area