Modification AEAT Mapping Classes
The mappings that have been created for the Canary Islands reuse the existing mapping classes for the AEAT. Most of the fields can be reused, and the mapping established for them in the AEAT will be the mapping established for the Canary Islands. This reuse has been carried out through inheritance of the mapping classes. There are certain fields that could not be reused and their mapping had to be generated in the corresponding mapping class of the Canary Islands. Others have been reused, but the existing BAdI and code have been adapted, in order to be able to extend the mapping in case a different AEAT VS CANARIAS mapping is needed.
If Z mapping classes are used, it will be necessary to adjust the existing Z classes for their correct operation with the help of the modifications mentioned in this guide.
In the parent class /edge/sii_edoc_map a new optional input parameter is added to the methods: GET_SII, GET_SII_CABECERA, GET_ESTRUCTURA_XML. This parameter is a Boolean that will be marked with the value X when calling from a Canarian mapping.
In addition, the GET_SII_CABECERA method is modified to adjust the header mapping to the Canarian mapping.
Issued Invoices
Class /EDGE/CL_EDOC_SII_MAP_FE_L_11
- GET_ESTRUCTURA_XML method: Call to the super->get_estructura_xml and me->get_estructura_xml_1_1 methods with the new parameter iv_canarias = iv_canarias.
- Method GET_ESTRUCTURA_XML_1_1:
1. Parameter iv_canarias is added in the signature of the method.
2. The call to the method get_detalle_exenta is made with the new parameter importing iv_canarias.
Class /EDGE/CL_EDOC_SII_MAP_FE_L
- Method GET_ESTRUCTURA_XML:
1. When the non-exempt breakdown for Delivery, Service and Invoice Breakdown occurs, the following code is entered:
gv_no_exenta = abap_true.
IF iv_canarias EQ abap_true.
CONTINUE.
ENDIF.
With this, when iv_canarias comes informed with X, the non-exempt breakdown will not be made. Thus we reduce the mapping of the AEAT since the labels of this block change with respect to the XML of the Canary Islands and this part of code cannot be reused. With the global variable gv_not_exempt = X we know during the execution that the breakdown is not exempt.
2. In the call to the method get_type_invoice the optional parameter iv_canarias is added.
3. In the call to the get_special_regime method the optional parameter iv_canarias is added.
4. The call to the get_impositive_period_method is made with the new parameter iv_canarias.
5. The accesses to the table of VAT indicators /EDGE/SII_MP_013, are grouped in several methods in the utilities class, /edge/cl_sii_utilities, where according to the value of parameter iv_canarias, the table /EDGE/SII_MP_013 is read for mappings of the AEAT or /edge/sii_ca_003 for mappings of the Canary Islands.
6. When the general BAdI is called to determine whether an invoice is for self-consumption, a division is made. If the mapping comes from a class in the Canary Islands, the badi of the Canary Islands is called to determine if the invoice is for self-consumption, if the mapping is AEAT, the BAdI /edge/badi_sii_mapeos_gen is still called, get_auto_consumption method.
7. For the Real Estate Data mapping, the condition is set that this block is only mapped if the mapping does not come from the Canary Islands. Since in the mapping class of the Canary Islands this block will be mapped with possible values different from those of the AEAT.
8. In the call to the BAdI /edge/badi_sii_mape_tercero_fe method determina_contraparte the parameter iv_canarias is passed to it.
9. The ranges lr_mwskz_not_subject, lr_mwskz and the table lt_mwskz_inv_s_pas become global objects defined in the mapping class /EDGE/CL_EDOC_SII_MAP as attributes to be reused in the classes they inherit from it.
10. Access to the /edge/sii_mp_013 indicator table to retrieve the indicator type is grouped into three different methods in the /edge/cl_sii_utilities class to retrieve them from the AEAT indicator table (/edge/sii_mp_013) or the Canary Islands indicator table (/edge/sii_ca_003).
11. The call to the method get_type_not_subject of the BAdI /edge/badi_sii_mapeos_emi is made with the new importing parameter iv_canarias.
12. In the call to the get_cause_exemption method of the BAdI /edge/badi_sii_mapeos_emi, a new optional importing parameter iv_canarias is added. This parameter is a boolean that will be informed with X when its call is being executed from a Canarian mapping class. When this happens, the exemption cause to be determined by the VAT/IGIC indicator will be taken from the /edge/sii_ca_003 table instead of /edge/sii_mp_013 as is done for the AEAT.
13. In order to determine whether an invoice is for self-consumption, a new BAdI of the Canary Islands is called if the mapping is Canarian. If it is still a peninsular mapping, the call to the BAdI to determine if it is self-consumption does not vary:
14. In the call to get_facturas_rectificadas of BAdI /edge/badi_sii_mapeos_gen, the new parameter iv_canarias is added.
Class /EDGE/CL_EDOC_SII_MAP_FE_BL
- Method get_id_invoice: In the call to the method /edge/cl_sii_utilities=>get_id_invoice the new parameter iv_canarias is added.
Class /EDGE/CL_EDOC_SII_MAP_FE_IL
- Get_id_invoice method: The call to the get_id_invoice method is made with the new parameter iv_canarias. (Not applicable because the method is not used)
Self-consumption
In the BAdI /EDGE/BADI_SII_MAPEOS_EMI method GET_DESGLOSE_AUTO_CONS, a new export parameter is added to indicate that the mapping goes by exempt breakdown. Within this method, this new parameter will be marked as X if the breakdown is non-exempt. In this way in the breakdown of Canary Islands for self-consumption (/EDGE/CL_SII_MAP_FE_CA_L_11) it will be possible to know that the breakdown is not exempt.
In the mapping class of the Canary Islands, the mapping will be carried out for the breakdown of self-consumption when this is not exempt. The rest of the breakdown is reused from the AEAT mapping.
Adjustments already mapped fields in AEAT for the Canary Islands:
It may be that the client wants to define a different mapping for the AEAT than for the Canary Islands. The mapping of the Canary Islands reuses the mapping defined for the AEAT using inheritance in its methods. In this way, initially, the XML fields of the Canary Islands that exist in the XML of the AEAT take exactly the same mapping as in the AEAT.
If it is the case that the mapping for the Canary Islands is different, new BAdIs (BAdIs for the Canary Islands) have been created to overwrite the AEAT mapping and define a specific one for the Canary Islands. For outgoing invoices, the fields whose mappings can be modified for the Canary Islands are the following:
- Issuer Invoice Serial Number
- Description
- External Ref
- 2_7.3
- Previous Rule GGEE or REDEME or Competition
- Real Estate Data
- Amount Transmission Real Estate
- Issued By Third Parties Or Recipient
- Third and Sixth Additional Disp Billing and Organized Gas Market
- InvoiceWithoutIdentityRecipientArticle6.1.d
- Entity Succeeded
ISU/FICA Issued
Class /EDGE/CL_SII_MAP_FICA_L_11
- GET_ESTRUCTURA_XML method: Call to the super->get_estructura_xml and me->get_estructura_xml_1_1 methods with the new parameter iv_canarias = iv_canarias.
- Method GET_ESTRUCTURA_XML_1_1:
1. Parameter iv_canarias is added in the signature of the method.
2. The call to the method get_detalle_exenta is made with the new parameter importing iv_canarias.
Class /EDGE/CL_EDOC_SII_MAP_FICA_L
- Method GET_ESTRUCTURA_XML:
1. When the non-exempt breakdown for Delivery, Service and Invoice Breakdown occurs, the following code is entered:
gv_not_exempt = abap_true.
IF iv_canarias EQ abap_true.
CONTINUE.
ENDIF.
With this, when iv_canarias comes informed with X, the non-exempt breakdown will not be made. Thus we reduce the mapping of the AEAT since the labels of this block change with respect to the XML of the Canary Islands and this part of code cannot be reused. With the global variable gv_not_exempt = X we know during the execution that the breakdown is not exempt.
2. In the call to the method get_type_invoice the optional parameter iv_canarias is added.
3. In the call to the get_special_regime method the optional parameter iv_canarias is added.
4. For the Real Estate Data mapping, the condition is set that this block is only mapped if the mapping does not come from the Canary Islands.
5. In the call to the BAdI /edge/badi_sii_mapeos_fe_sd method get_datos_contraparte the parameter iv_canarias is passed.
6. The call to the get_cause_exemption method is made with the new parameter iv_canarias reported. (3 calls)
7. For the Real Estate Data mapping, the condition is set that this block is only mapped if the mapping does not come from the Canary Islands. Since in the class of mappings of the Canary Islands this block will be mapped with possible values different from those of the AEAT.
8. In the call to the method es_no_subject of the BAdI /edge/badi_sii_mapeos_fe_sd_cl parameter iv_canarias is added.
Additional properties
Class /EDGE/CL_EDOC_SII_MAP_RC_BL_11
- GET_SII method: The call to the get_id_invoice method is made with the new parameter iv_canarias.
Class /EDGE/CL_EDOC_SII_MAP_RC_L_11
- GET_ESTRUCTURA_XML method: In the get_estructura_xml method call, the new importing parameter iv_canarias is added.
Additional ISU/FICA properties
Class /EDGE/CL_SII_MAP_FICA_RC_11
- GET_ESTRUCTURA_XML method: The parameter iv_canarias is added in the call to the get_estructura_xml method.
Invoices Received
Breakdown and self-consumption
The breakdown of invoices received is done again in the mapping classes of the Canary Islands so the breakdown of the AEAT classes is not affected.
Field Adjustments for the Canary Islands
It may be that the client wants to define a different mapping for the AEAT than for the Canary Islands. The mapping of the Canary Islands reuses the mapping defined for the AEAT using inheritance in its methods. In this way, initially and the XML fields of the Canary Islands that exist in the XML of the AEAT take exactly the same mapping as in the AEAT.
If it is the case that the mapping for the Canary Islands is different, new BAdIs have been created without implementation to overwrite the AEAT mapping and define a specific one for the Canary Islands. For outgoing invoices, the fields whose mappings can be modified for the Canary Islands are the following:
- Issuer Invoice Series
- Amount Rectification (ChargeImplicitaImplicitaRect)
- Description
- External
- Simplified Invoice Articles 7.2, 7.3
- Previous Regio GGEE or REDEME or Competition
- Entity Succeeded
Class /EDGE/CL_EDOC_SII_MAP_FR_L
- Method GET_ID_INVOICE:
1. In the call to the method get_type_invoice the optional parameter iv_canarias is added.
2. In the call to the BAdI /edge/badi_sii_mapping_rec method get_id_emitter_invoice parameter iv_canarias is added.
3. Invoice type conditions 24 and 25 are added so that this block matches the holder's data.
- Method GET_ESTRUCTURA_XML:
1. In the call to the method get_type_invoice the optional parameter iv_canarias is added.
2. In the call to the get_special_regime_method, the optional parameter iv_canarias is added.
3. The access to the VAT indicators table /EDGE/SII_MP_013, is grouped in a method in the utilities class, /edge/cl_sii_utilities, where according to the value of parameter iv_canarias, the table /EDGE/SII_MP_013 is read for maps of the AEAT or /edge/sii_ca_003 for maps of the Canary Islands.
4. In the method call determines_counterpart of the BAdI /edge/badi_sii_mape_tercero_fr the new importing parameter iv_canarias is added.
5. In the call to the method get_id_emitter_invoice of the BAdI /edge/badi_sii_mapping_rec the parameter iv_canarias is added.
6. In the call to the get_id_invoice method, the importing parameter iv_canarias is added.
7. To determine if an invoice is for self-consumption, a new BAdI of the Canary Islands is called in case the mapping is Canarian. If it is still a peninsular mapping, the call to the BAdI to determine if it is self-consumption does not vary:
8. Invoice type conditions 24 and 25 are added so that the Invoice ID matches the holder data.
9. Invoice type conditions 24 and 25 are added so that the counterparty matches the holder data.
10. In the call to get_facturas_rectificadas of BAdI /edge/badi_sii_mapeos_gen, the new parameter iv_canarias is added.
Class /EDGE/CL_EDOC_SII_MAP_FR_L_11
- Method GET_ESTRUCTURA_XML: In the calls to the methods get_estructura_xml and get_estructura_xml_1_1_1 the parameter importing iv_canarias is added.
Class /EDGE/CL_EDOC_SII_MAP_FR_BL
- GET_SII method: The call to the get_id_invoice method is made with the new parameter iv_canarias.
- Method GET_ID_INVOICE:
1. In the call to the method /edge/cl_sii_utilities=>get_id_invoice the new parameter iv_canarias is added.
2. In the call to the method get_type_invoice the new optional parameter iv_canarias is added.
3. Invoice type 24 and 25 conditions are added so that this block coincides with the holder's data.
Class /EDGE/CL_EDOC_SII_MAP_FR_BL_11
- GET_SII method: The call to the get_id_invoice method is made with the new parameter iv_canarias.
Class /EDGE/CL_EDOC_SII_MAP_FR_IL
- Method GET_ID_INVOICE:
1. The call to the get_id_invoice method is made with the new parameter iv_canarias.
2. In the call to the method get_type_invoice the optional parameter iv_canarias is added.
3. Invoice type 24 and 25 conditions are added so that this block coincides with the holder's data.
Investment Goods
Class /EDGE/CL_EDOC_SII_MAP_BI_BL
- Method GET_ID_INVOICE: The call to the method get_id_invoice is done with the new parameter iv_canarias.
- GET_SII method: The call to the get_id_invoice method is made with the new parameter iv_canarias.
Class /EDGE/CL_EDOC_SII_MAP_BI_L_11
- GET_ESTRUCTURA_XML method: Calls to the get_estructura_xml method are made with the new parameter iv_canarias.
Class /EDGE/CL_EDOC_SII_MAP_BI_L
- Method GET_ESTRUCTURA_XML: The call to the method get_id_invoice is done with the parameter iv_canarias.
- Method GET_ID_INVOICE: The call to the method get_nif_creditor of the BAdI /edge/badi_sii_cons_razon_gen is made with the new parameter iv_canarias.
Class /EDGE/CL_EDOC_SII_MAP_BI_IL
- Method GET_ID_INVOICE: The call to the method get_id_invoice is made with the new parameter iv_canarias.
Debits Issued
100% of the AEAT mapping of the class: /EDGE/CL_EDOC_SII_MAP_CE_L_11 (class inheritance) is reused. In addition, it is possible to extend the value of the field Issuer Invoice Serial Number. To do this, the GET_SII method of the class /EDGE/CL_EDOC_SII_MAP_CE_L_11 is edited and the call is added to the BAdI /edge/badi_sii_map_ca_gen_cli METHOD get_num_serie_factura_emi. In this way we give the possibility to change the mapping of this field for the XML of the Canary Islands.
From the new Canary Islands mapping class, the AEAT get_sii (1.1) is called to reuse this mapping with the Canary Islands parameter informed (inheritance).
In this class, /EDGE/CL_EDOC_SII_MAP_CE_L_11, the get_sii method is also modified. In the selects to the edocument where the GUID is retrieved, the condition is added in the where canarias = iv_canarias.
In the mapping class of AEAT version 1.0, /EDGE/CL_EDOC_SII_MAP_CE_L, some modifications are also made. In the get_sii method, in the selects to the edocument where the GUID is retrieved, the condition is added in the where canarias = iv_canarias. But this class is obsolete due to version 1.1 of the AEAT.
Payments Received
The AEAT mapping of the class: /EDGE/CL_EDOC_SII_MAP_PR_L_11 (class inheritance) is reused. In addition, it is possible to extend the value of the field Issuer Invoice Serial Number. To do this, the GET_SII method of the class /EDGE/CL_EDOC_SII_MAP_PR_L_11 is edited and the call is added to the BAdI /edge/badi_sii_map_ca_gen_cli METHOD get_num_serie_factura_emi. In this way we give the possibility to change the mapping of this field for the XML of the Canary Islands.
From the new Canary Islands mapping class, the AEAT get_sii (1.1) is called to reuse this mapping with the Canary Islands parameter informed (inheritance).
In this class, /EDGE/CL_EDOC_SII_MAP_PR_L_11, the get_sii method is also modified. In the selects to the edocument where the GUID is retrieved, the condition is added in the where canarias = iv_canarias.
Also the call to the get_nif_creditor methods of the BAdI /edge/badi_sii_sii_cons_razon_gen is modified by adding the new parameter id_canarias.
In the mapping class of AEAT version 1.0, /EDGE/CL_EDOC_SII_SII_MAP_PR_L, some modifications are also made. In the get_sii method, in the selects to the edocument where the GUID is retrieved, the condition is added in the where canarias = iv_canarias. But this class is obsolete due to version 1.1 of the AEAT.
Related content
Avvale 2024