Technical Articles
How to populate field values in SII XML using ModifyXMLData BAdI in SAP Business ByDesign
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 :
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.