Skip to Content
Technical Articles
Author's profile photo Prashant C P

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.


  • 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.

  1. 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
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



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
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 :




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.





Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Jose Luis Perez de viñaspre
      Jose Luis Perez de viñaspre

      Hello Prashant,


      Thanks a great blog. I have a question, If we need recovery data to inform for example

      REFERENCIA_CATASTRAL the UUID from InputData  what object does it correspond to?



      Jose Luis

      Author's profile photo Prashant C P
      Prashant C P
      Blog Post Author

      Hi Jose Luis,

      Please find the answer below:

      The UUID which is being passed in communication structure corresponds to the Tax Return Items meaning every item in Tax Return.

        Technical Name ESName Description
      BO Name FOPXD_PTXD ProductTaxDeclaration Product Tax Declaration
      BO Node TAXDECLIM Item Item
      Field UUID UUID UUID


       If invoice data needs to be extracted from this UUID, pass the UUID-content to the TAXDECLIM -NodeID” i.e. “Item -NodeID”

      The node will then return the result containing invoice contents. Please refer to the field  “BASE_BTD_REF-ID-CONTENT” i.e. “BaseBusinessTransactionDocumentReference-content”


      This invoice number can then be used to extract invoice details which are required by customer/partner to fill other fields.


      Hope this helps.


      Thanks and regards,