Declarations > Tax management > Spain > Spanish tax inquiry 

This inquiry must make it easy to view all Tax information in queries and/or reports. These reports will be only for internal use in order to prepare the legal declarations (from this point of view, these reports are only control reports).

The way to obtain all the information will consist in a process that will extract the tax information from all the objects of Sage X3 that have relation with Tax:

  • Journal Entry
  • Sales and Purchasing Invoices
  • Customer and Supplier BP Invoices

The information will be stored in several working tables in the most useful format in order to obtain the appropriate queries and reports.

The inquiry will have different selection criteria to filter the data:

  • VAT or Retention (in the same inquiry we will obtain both information)
  • Accounting date
  • Type of VAT
  • Tax from a BP or from BP tax rule
  • Tax range
  • Invoices and payments created into the special cash VAT regime

The user will be able to print the reports from the previous inquiry. Six reports will be available.
See below

In addition, these working tables facilitate the connection with external applications that are used to complete legal requirements. For example, theses working tables will be used for the connection with the "Sage Impresos Oficales X3" application. "Impresos Oficiales X3" is used to generate all Spanish legal declarations.


SEEREFERTTO Refer to documentation Implementation

Screen management



The following fields are present on this tab :


It is possible to select only companies with the SPAVAT – VAT Spain general parameter (LOC chapter, SPA group) active.


Tax type

  • Tax type (field TAXTYP)

Select the VAT type to filter the registers (Collected, deductible or all).

Record range

  • Processing flag (field PROCESS)

This field is used to filter the registers to be displayed in this inquiry.

Start - end range

  • Start date (field ACCDATDEB)


  • End date (field ACCDATFIN)






  • Withholdings (field RETENCION)

This flag is used to switch between registers with VAT or registers with Retention. If this flag is active, only the registers with Retention will be displayed.

Cash VAT

  • Invoices (field CSHVAT)


  • Payments (field PAYCSH)




Tab Spanish tax inquiry


The following fields are present on this tab :


  • Process (field PROFLG)

If this flag is active, the line will be taken into account in the reports and Declarations forms.

If the record comes from an account document without any original document (invoice), it will appear without this flag marked. If you want this record to be inclued in reports and Declarations forms, you must mark it.

This field is controlled with the type of operations to complete the 340 declaration.

If the value is "R", other action is available in the line (right-click) for the entry of Building data (Building location and Cadastre reference).

  • Tax type (field STAXTYP)


  • Accounting date (field ACCDAT)


  • Entry number (field NUM)


  • Site tax ID no. (field CRN)




  • Type (field SREGTYP)


  • Taxable base (field AMTNOTL)


  • Rate (field VATRAT)


  • Tax amount (field AMTTAXL)


  • Deductible amount (field DEDAMTL)


  • Cash VAT (field CSHVAT)


  • Enforceability date (field ENFDAT)


  • Paid (field TOTALPAY)


  • Paid amount (field PAYCUR)


  • Declared tax (field DECCUR)


Total selection

  • No. of records - Deductible (field SREGSOP)


  • Total base - Deductible (field SBASESOP)


  • Total tax - Deductible (field SQUOTASOP)


  • No. of records - Collected (field SREGREP)


  • Total base - Collected (field SBASEREP)


  • Total tax - Collected (field SQUOTAREP)




Action icon

Journal entry
Building location

The O.C. (Operation Code) field contains the type of operations to complete the 340 declaration form. If the value is "R", it is necessary to enter the Building data, Building location and Reference. These data are stored in a working table in order to maintain the data if the letter is changed. It is possible to modify the value of the Building data by right clicking on the line with the Building location button.

Payment method (cash VAT)

This screen is used to indicate the payment method used by the payments of invoices subject to the special cash VAT regime.

  • C: The payment was made in a bank account. A bank account must be indicated in the BIDNUM field.
  • T: The payment was made by check. A check number must be indicated in the BIDNUM field.
  • O: The payment was made by others means. Free description is allowed in this case. (Others as default)

If the date of enforceability is earlier than the process date, an additional record is generated with the remaining amount. In this case the PAM and BIDNUM fields are fed as:

PAM="0" and  BIDNUM="Devengo al 31/12"

Source document





By default, the following reports are associated with this function :

 S-LIBROREP : Collected VAT book

 S-LIBROREPCAJA : Collected VAT book (Cash VAT)

 S-LIBROSOP : Deductible VAT book

 S-LIBROSOPCAJA : Deductible VAT book (Cash VAT)

 S-RESIVA : VAT summary

 S-RETENCION : List of withholdings

This can be changed using a different setup.

These four reports are not legal reports, these are only control reports for internal use in order to prepare the legal declarations.

  • S-LIBROREP: Collected VAT book:
    This report displays the tax collected of sales invoices.
  • S-LIBROSOP: Deductible VAT book:
    This report displays the Tax deductible of purchasing invoices. EU Tax invoices will be printed depending on the value of "Tax auto balance" report parameter. Two possibilities:
      • Yes : Only show the EU invoices
      • No :  Do not display EU invoices
  • S-RESIVA: VAT Summary.
    This report can be requested by company, BP and date range.
  • S-RETENCION: List of Retentions:
    This report displays the records for this retention tax.
  • S-LIBROREPCAJA: Collected VAT book (cash VAT):
    This report displays the tax collected of sales invoices done into the special cash VAT regime.
  • S-LIBROSOPCAJA: Deductible VAT book (cash VAT):
    This report displays the Tax deductible of purchasing invoices done into the special cash VAT regime.

These reports can be obtained directly from the inquiry screen (using the menu File/Print/List).

Error messages

The only error messages are the generic ones.

Tables used

SEEREFERTTO Refer to documentation Implementation