SAP CALCULATE_TAX_DOCUMENT Function Module for









CALCULATE_TAX_DOCUMENT is a standard calculate tax document SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used to perform a specific ABAP function and below is the pattern details, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.


See here to view full function module documentation and code listing for calculate tax document FM, simply by entering the name CALCULATE_TAX_DOCUMENT into the relevant SAP transaction such as SE37 or SE38.

Function Group: TAX1
Program Name: SAPLTAX1
Main Program: SAPLTAX1
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function CALCULATE_TAX_DOCUMENT pattern details

In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.
CALL FUNCTION 'CALCULATE_TAX_DOCUMENT'"
EXPORTING
I_BUKRS = "Company code to which taxes are posted
* I_NOERR = ' ' "X - no error message for incorrect tax amount
* I_XSIMU = ' ' "X - simulation mode
* I_XHWBT = ' ' "X - LC amounts ready for input
* I_XNOMS = ' ' "X - no warning for tax code in open item
* I_GENER = 0 "

IMPORTING
E_ITXDAT = "Total of all taxes in FC
E_XSTVR = "Tax amounts were changed
E_PRSDT = "

TABLES
T_BKPF = "Document headers
T_BSEG = "Line items
* T_DBSEG = "Detail line items
* T_FICCO = "Values to be corrected in external company code
* T_FICTX = "Tax data fr.external company codes

EXCEPTIONS
ERROR_CALCULATE_DISCOUNTB = 1 MWSKZ_NOT_DEFINED = 2 USER_EXIT = 3 MWSKZ_EINHEITLICH_VORGEBEN = 4 STEUERBETRAG_FALSCH = 5
.



IMPORTING Parameters details for CALCULATE_TAX_DOCUMENT

I_BUKRS - Company code to which taxes are posted

Data type: BKPF-BUKRS
Optional: No
Call by Reference: No ( called with pass by value option)

I_NOERR - X - no error message for incorrect tax amount

Data type: BSEZ-XMWST
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_XSIMU - X - simulation mode

Data type: BSEZ-XMWST
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_XHWBT - X - LC amounts ready for input

Data type: RFOPT-XNOHW
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_XNOMS - X - no warning for tax code in open item

Data type: BSEZ-XMWST
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_GENER -

Data type: T020-GENER
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for CALCULATE_TAX_DOCUMENT

E_ITXDAT - Total of all taxes in FC

Data type: ITXDAT
Optional: No
Call by Reference: No ( called with pass by value option)

E_XSTVR - Tax amounts were changed

Data type: BKPF-XMWST
Optional: No
Call by Reference: No ( called with pass by value option)

E_PRSDT -

Data type: BKPF-BUDAT
Optional: No
Call by Reference: No ( called with pass by value option)

TABLES Parameters details for CALCULATE_TAX_DOCUMENT

T_BKPF - Document headers

Data type: BKPF
Optional: No
Call by Reference: No ( called with pass by value option)

T_BSEG - Line items

Data type: BSEG
Optional: No
Call by Reference: No ( called with pass by value option)

T_DBSEG - Detail line items

Data type: DBSEG
Optional: Yes
Call by Reference: No ( called with pass by value option)

T_FICCO - Values to be corrected in external company code

Data type: FICCO
Optional: Yes
Call by Reference: No ( called with pass by value option)

T_FICTX - Tax data fr.external company codes

Data type: FICTX
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXCEPTIONS details

ERROR_CALCULATE_DISCOUNTB - Error in cash discount base calculation

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

MWSKZ_NOT_DEFINED - Tax code not defined

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

USER_EXIT - Tax check ended with cancellation

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

MWSKZ_EINHEITLICH_VORGEBEN - Use only '**' or an explicit indicator

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

STEUERBETRAG_FALSCH -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

Copy and paste ABAP code example for CALCULATE_TAX_DOCUMENT Function Module

The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.

DATA:
lt_t_bkpf  TYPE STANDARD TABLE OF BKPF, "   
lv_i_bukrs  TYPE BKPF-BUKRS, "   
lv_e_itxdat  TYPE ITXDAT, "   
lv_error_calculate_discountb  TYPE ITXDAT, "   
lt_t_bseg  TYPE STANDARD TABLE OF BSEG, "   
lv_e_xstvr  TYPE BKPF-XMWST, "   
lv_i_noerr  TYPE BSEZ-XMWST, "   SPACE
lv_mwskz_not_defined  TYPE BSEZ, "   
lv_e_prsdt  TYPE BKPF-BUDAT, "   
lv_i_xsimu  TYPE BSEZ-XMWST, "   SPACE
lt_t_dbseg  TYPE STANDARD TABLE OF DBSEG, "   
lv_user_exit  TYPE DBSEG, "   
lv_i_xhwbt  TYPE RFOPT-XNOHW, "   SPACE
lt_t_ficco  TYPE STANDARD TABLE OF FICCO, "   
lv_mwskz_einheitlich_vorgeben  TYPE FICCO, "   
lv_i_xnoms  TYPE BSEZ-XMWST, "   SPACE
lt_t_fictx  TYPE STANDARD TABLE OF FICTX, "   
lv_steuerbetrag_falsch  TYPE FICTX, "   
lv_i_gener  TYPE T020-GENER. "   0

  CALL FUNCTION 'CALCULATE_TAX_DOCUMENT'  "
    EXPORTING
         I_BUKRS = lv_i_bukrs
         I_NOERR = lv_i_noerr
         I_XSIMU = lv_i_xsimu
         I_XHWBT = lv_i_xhwbt
         I_XNOMS = lv_i_xnoms
         I_GENER = lv_i_gener
    IMPORTING
         E_ITXDAT = lv_e_itxdat
         E_XSTVR = lv_e_xstvr
         E_PRSDT = lv_e_prsdt
    TABLES
         T_BKPF = lt_t_bkpf
         T_BSEG = lt_t_bseg
         T_DBSEG = lt_t_dbseg
         T_FICCO = lt_t_ficco
         T_FICTX = lt_t_fictx
    EXCEPTIONS
        ERROR_CALCULATE_DISCOUNTB = 1
        MWSKZ_NOT_DEFINED = 2
        USER_EXIT = 3
        MWSKZ_EINHEITLICH_VORGEBEN = 4
        STEUERBETRAG_FALSCH = 5
. " CALCULATE_TAX_DOCUMENT




ABAP code using 7.40 inline data declarations to call FM CALCULATE_TAX_DOCUMENT

The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.

 
"SELECT single BUKRS FROM BKPF INTO @DATA(ld_i_bukrs).
 
 
 
 
"SELECT single XMWST FROM BKPF INTO @DATA(ld_e_xstvr).
 
"SELECT single XMWST FROM BSEZ INTO @DATA(ld_i_noerr).
DATA(ld_i_noerr) = ' '.
 
 
"SELECT single BUDAT FROM BKPF INTO @DATA(ld_e_prsdt).
 
"SELECT single XMWST FROM BSEZ INTO @DATA(ld_i_xsimu).
DATA(ld_i_xsimu) = ' '.
 
 
 
"SELECT single XNOHW FROM RFOPT INTO @DATA(ld_i_xhwbt).
DATA(ld_i_xhwbt) = ' '.
 
 
 
"SELECT single XMWST FROM BSEZ INTO @DATA(ld_i_xnoms).
DATA(ld_i_xnoms) = ' '.
 
 
 
"SELECT single GENER FROM T020 INTO @DATA(ld_i_gener).
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!