This blog contains the guidelines to populate field values in the ModifyXMLData BAdI implementation. In this blog you will learn how to modify legally allowed fields in the SII XML before sending it to the tax authority.
Prerequisites
- You have installed the latest version of SAP Cloud Applications Studio
- The ModifyXMLData BAdI should be implemented with the filters
Getting Started
We have opened the SII XML for partners/customers to add custom logic to change field values in the SII incoming and SII outgoing XML.
Let us take an example of outgoing scenario where we need to report a customer invoice with Regime 12. When Regime 12 needs to be reported, the mandatory table also needs to be updated.
- First, we will see how to change the Regime value. The XML field name for Regime is ‘ClaveRegimenEspecialOTrascendencia’. Now to update this field the below parameters should be passed:
Structure Field |
Value |
Type |
S |
FieldName |
FACTURA_EXPEDIDA-BASE-CLAVE_REGIMEN_ESPECIAL_OTRASCE |
Value |
Value derived from custom logic |
Please find below a sample code to update the Regime field:
2. Next, we will populate the mandatory fields 'SituaciónInmueble' and 'ReferenciaCatastral' of table DatosInmueble. This will be updated in 2 steps as follows:
i. First, create a table with type ValueStructforSIIbadi.NestedFldValues and populate the desired values for the fields SituaciónInmueble and ReferenciaCatastral.
Structure Field |
Value |
Operation |
None |
RecordNumber |
Record Number |
FieldName |
SITUACION_INMUEBLE
REFERENCIA_CATASTRAL |
Value |
Value derived from custom logic |
To populate multiple records in the table, increment the record number and pass the FieldName and Value.
ii. Then pass the above created table to DatosInmueble field.
Structure Field |
Value |
Type |
T |
FieldName |
FACTURA_EXPEDIDA-DATOS_INMUEBLE-DETALLE_INMUEBLE |
NestedFldValues |
Table filled in step 2.i. |
Value |
None |
Please find below a sample code to update the DatosInmueble table:
Similarly, we can pass custom value to other legally allowed fields of the SII XML as per the mapping provided below:
Outgoing scenario :
Incoming scenario :
Part 2 :
Let us take another example to cover Adjustment Document “AJ” scenario for travel agencies. The scenario here is, for special VAT schema for travel agencies, at the end of the travel or event an adjustment of the profit margin must be done. For this adjustment, the travel agency should create a new invoice type called “AJ” which should be an adjustment to the tax amount and report it to the tax authority. We will use ‘ModifyXMLData’ BAdI to achieve this scenario.
The prerequisite is to create a manual tax entry transaction which will be sent as an ‘AJ’ document along with other details using PDI BAdI. An identification (Document Description) in the manual tax entry also has to be added in order to classify it as document type “AJ”.
Below are the fields along with the technical details which need to be modified to report to the tax agencies the adjustment scenario:
XML Field |
Type |
FIELDNAME |
VALUE |
FechaOperación |
S |
FACTURA_RECIBIDA-BASE-FECHA_OPERACION |
Blank Value |
TipoFactura |
S |
FACTURA_EXPEDIDA-BASE-TIPO_FACTURA |
AJ |
NombreRazón |
S |
FACTURA_EXPEDIDA-CONTRAPARTE-NOMBRE_RAZON |
Blank Value |
NIFREPRESENTANTE |
S |
FACTURA_EXPEDIDA-CONTRAPARTE-NIFREPRESENTANTE |
Blank Value |
Selection |
S |
FACTURA_EXPEDIDA-CONTRAPARTE-CHOICE-SELECTION |
Blank Value |
NIF |
S |
FACTURA_EXPEDIDA-CONTRAPARTE-CHOICE-NIF |
Blank Value |
IDType |
S |
FACTURA_EXPEDIDA-CONTRAPARTE-CHOICE-IDOTRO-IDTYPE |
Blank Value |
ID |
S |
FACTURA_EXPEDIDA-CONTRAPARTE-CHOICE-IDOTRO-ID |
Blank Value |
TipoNoExenta |
S |
FACTURA_EXPEDIDA-TIPO_DESGLOSE-CHOICE-DESGLOSE_FACTURA-SUJETA-NO_EXENTA-TIPO_NO_EXENTA |
S1 |
TipoNoExenta |
S |
FACTURA_EXPEDIDA-TIPO_DESGLOSE-CHOICE-DESGLOSE_TIPO_OPERACION-PRESTACION_SERVICIOS-SUJETA-NO_EXENTA-TIPO_NO_EXENTA |
S1 |
Please find below sample code :
Summary
We have now learnt how to modify legally allowed fields in the SII XML before submitting to the tax authority. Customers would not only be able to add custom logic to fill fields 'ReferenciaCatastral' and 'SituaciónInmueble' in the SII XML, but also in general, be able to change other legally allowed fields in the XML file.