# CALCULATE_TAX_FROM_NET_AMOUNT — Calculate Tax from Net Amount

> Calculates the tax amounts (total, deductible and non-deductible input tax) for a net amount with a given company code, tax code and currency, according to the company's tax calculation procedure. Developers use it in invoice uploads, in reports that calculate prices or quotations and in interfaces that send gross amounts to other systems. Details per tax condition come back in T_MWDAT; always handle exceptions such as MWSKZ_NOT_DEFINED.

- Modules: FI
- Type: Function module
- Function group: TAX1
- Remote-enabled (RFC): No
- S/4HANA status: Used the same way in S/4HANA
- URL: https://nekuhub.com/en/functions/calculate-tax-from-net-amount/

## Importing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| I_BUKRS | BKPF-BUKRS | Company code | Yes |
| I_MWSKZ | BSEG-MWSKZ | Tax code | Yes |
| I_WAERS | BKPF-WAERS | Currency key | Yes |
| I_WRBTR | BSEG-WRBTR | Net amount | Yes |
| I_TXJCD | BSEG-TXJCD | Tax jurisdiction code | - |
| I_ZBD1P | BSEG-ZBD1P | Cash discount percentage | - |
| I_PRSDT | KOMK-PRSDT | Pricing date | - |
| I_ACCDATA | BSEG | Accounting document segment | - |

## Exporting parameters

| Parameter | Type | Description |
|---|---|---|
| E_FWSTE | BSET-FWSTE | Tax calculated (total) |
| E_FWAST | BSET-FWSTE | Calculated deductible tax |
| E_FWNAV | BSET-FWSTE | Non-deductible tax calculated (total) |
| E_FWNVV | BSET-FWSTE | Non-deductible tax allocated |

## Tables parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| T_MWDAT | RTAX1U15 | Tax amounts and percentage rates | Yes |

## Exceptions

- BUKRS_NOT_FOUND: Company code not found
- COUNTRY_NOT_FOUND: Country of company code not found
- MWSKZ_NOT_DEFINED: Tax code not defined in calculation procedure
- MWSKZ_NOT_VALID: Tax code not allowed in calculation procedure
- ACCOUNT_NOT_FOUND: Error in account determination
- KALSM_NOT_FOUND: Calculation procedure not found
- KNUMH_NOT_FOUND: Condition record not found
- KSCHL_NOT_FOUND: Condition type not found
- KTOSL_NOT_FOUND: Transaction key not found
- PARAMETER_ERROR: Parameter error
- TXJCD_NOT_VALID: Tax jurisdiction code not valid
- UNKNOWN_ERROR: Unknown error

## Call template (ABAP)

```abap
CALL FUNCTION 'CALCULATE_TAX_FROM_NET_AMOUNT'
  EXPORTING
    i_bukrs = lv_i_bukrs
    i_mwskz = lv_i_mwskz
    i_waers = lv_i_waers
    i_wrbtr = lv_i_wrbtr
  IMPORTING
    e_fwste = lv_e_fwste
    e_fwast = lv_e_fwast
    e_fwnav = lv_e_fwnav
    e_fwnvv = lv_e_fwnvv
  TABLES
    t_mwdat = lt_t_mwdat
  EXCEPTIONS
    bukrs_not_found = 1
    country_not_found = 2
    mwskz_not_defined = 3
    mwskz_not_valid = 4
    account_not_found = 5
    kalsm_not_found = 6
    knumh_not_found = 7
    kschl_not_found = 8
    OTHERS = 9.
```

## Related tables

T001, T007A

