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_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. 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:
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 of