Mexico’s Digital Invoice CFDI
This SAP Note aims to clarify questions about the implementation and use of the solution that support the Mexican legal requirements CFDI Digital Invoice solution (Factura Electrónica) required by Mexico’s tax authority SAT. We intend to maintain this SAP KBA updated with new SAP Notes and other future changes regarding this solution. We also invite you to check out the SAP Note 2525257, in order to keep updated on overall Localization Latin America topics and solutions.
Last update: 20/OCT/2017 (New topic D7).
SAP Library Documentation
Application help for Mexico is published on SAP Help Portal at help.sap.com. To find it, search for the product page “SAP ERP” and select the version as required. Under Application Help, choose SAP Library. Choose SAP ERP Central Component -> Financials or Logistics-> Country Versions -> Americas -> Mexico and navigate using one of the paths below.
– Financial Accounting (FI) -> Accounts Receivable (FI-AR) -> Business Transactions -> Processing of Digital Invoices
– Sales and Distribution (SD) -> Processing of Digital Billing Documents
The attachments MX_FI_DIGITAL_INVOICES_SAPLIBRARY_JUNE2017.PDF and MX_SD_DIGITAL_BILLINGDOCS_SAPLIBRARY_JUNE2017.PDF contain the application help in PDF format. Note that the attached documentation is subject to adjustment if changes in the software require that the documentation is updated.
All SAP Notes for ERP system are only valid for SAP_APPL versions from 600 to 618 releases and some specific S4CORE or SAP_FIN versions. In case the transaction SNOTE informs you that a specific SAP Note is obsolete for your system version, disregard the SAP Note but review its textual content and attachments. Check if you followed all the instructions and implemented the last version of SAP Notes. Notice that some SAP Notes have manual pre and post implementation steps in the description content or in their attachments. The list below is divided in the main SAP Notes to be used in the installation of Digital Invoice solution and SAP Notes with correction issues. Notice that some SAP Notes are just valid for specific versions.
A1 – Main SAP Notes to install Digital Invoice solution
1869512 – Announcement of Mexico’s Digital Invoice
1890586 – IDOC basic type INVOIC02 extension
1914863 – Digital Invoice solution for SD area
1933263 – Digital Invoice solution for FI area
1939037 – PI configuration guide 1
1943607 – IDOC types and prerequisites of SAP Note 1933263
1952287 – Missing upport and downport
1956876 – Local time and cancellation digest value
1963866 – Alignment of SD message structure with FI
1966264 – Tax adjustment FI documents
1966538 – BADI method to change material code in Original Input Message
1976684 – Reorganization of code in function RV_INVOICE_DOCUMENT_ADD
1976737 – Additional correct status of outbound IDOCs in CFDI_MONITOR
1982281 – Enhancement of monitor tool for CFDI_MONITOR
1995039 – Increasing of means of payment description length
2003735 – PI configuration guide 2
2008414 – Reverse FI document rejected by SAT
2029035 – Approval Request IDOCs without importing a PSE certificate file 1
2031362 – Approval Request IDOCs without importing a PSE certificate file 2
2069713 – Include header supplement in Original Input Message
2075584 – UUID field for vendor invoice verification
2086655 – Get XML version from customizing table IDMX_DI_VBASIC
2090292 – BADI method to change item description in Original Input Message
2129698 – Rejection code and description not showing in status log in monitor
2137261 – Additional authorization checks in monitor
2145609 – New invoice header text to display RFC data and pass to Electronic Accounting
2201909 – Activating IDOC segments
2299830 – Consistency for higher releases in enhancement of Monitor Tool
2316220 – BADI method to change address codes for Foreign Trade Complemento
2320328 – Authorization check for CFDI MONITOR actions
2323636 – Adding One-Time Customer for BADI method in Foreign Trade Complemento
2358725 – Correct decimal places for amount values in IDOC segments based on currency
2362265 – New means of payment codes Formas de pago
2333641 – Customizing invoice line amount calculation
2394873 – Cancellation Request failing for PSE file with PKCS7 SSF format
2424502 – Tax Regime should have 3 digit code for Foreign Trade Complemento
2441240 – Authorization fields for CFDI_MONITOR
2441984 – Customizing Invoice line amount error message
2406126 – CFDI 3.3 (new SAP Note)
2479630 – CFDI 3.3 prerequisite for SAP Note 2406126 (new SAP Note)
2519732 – FM to fetch catalog information (new SAP Note)
2526843 – Changes to UUID retrieval in FI module (new SAP Note)
2532740 – Certificate Number in OIM (new SAP Note)
2544513 – CFDI 3.3: Incorrect Timestamp while creating FI docs (new SAP Note)
A2 – SAP KBAs and SAP Notes with corrections
SAP KBAs are not implementable via SNOTE. Some SAP Notes only have instructions and also cannot be implemented via SNOTE. All SAP Notes for ERP system are only valid for SAP_APPL versions from 600 to 618 releases and some specific S4CORE or SAP_FIN versions. In case you have other version, disregard the SAP Note.
1376355 – PSE file test
1633779 – IDMX_CHECK_SIGNING does not generate expected result
1687545 – Error IDMX305 when creating a Digital Invoice
1689614 – Company Codes with less than 4 digits in FI area
1891213 – Subject-ID not exceeding 255 characters
1896038 – Certificate import
1901485 – Error IDMX219 ‘Access to pse file XXX.pse denied’
1955870 – Documentation corrections
1970787 – Revenue Recognition documents must not be digitally signed
1988385 – Increasing of texts length
1990053 – System fields in method GET_LOCAL_TIME
1991578 – Timestamps are empty after activating Daylight Saving Time
2003715 – Deactivate error message IDMX 417 for FI documents
2017749 – Import Invoice Number Pedimento
2025907 – Wrong data elements in segments E1EDMXCFDIK04 and E1EDMXCFD
2036767 – Change of position of minus sign of item values in Original Input Message
2044004 – No IDOCs are created when SD document is posted
2141437 – IDOC is not generated for FI posting from BAPI_ACC_DOCUMENT_POST
2183794 – Allow triggering of even when Document Type BLART is initial
2298217 – S_TCODE authorization check to display SD documents in monitor
2525710 – Settings for iDoc Filling with CFDI Catalog Data missing at SPRO (new SAP Note)
2520856 – Missing SPRO menu entries mentioned in SAP Note 2327391 (new SAP Note)
The support of the legal requirement Foreign Trade Complemento require some changes in the Mexico’s CFDI Digital Invoice solution. This complemento applies to export invoices and it is handled via two BADIs. For SD side is the BADI IDMX_DI_SDDATA_DET and for FI side is the BADI IDMX_DI_FIDATA_DET. The methods to be used in SD and FI are described in the topics below.
B1 – Get Supplement Data of Document Header (GET_HEADER_COMPLEMENTO)
It is used to include complemento’s data required in the Original Input Method (Cadena Original). And it is used in the signing generated within SAP system.
B2 – Get Supplement Data of Document Header for XML only (GET_HEADER_COMPLEMENTO_XML)
It is used to build complemento’s structure and data required in the XML file. This structure plus the data is stored in one of the IDOCs fields and it will require to be mapped when the XML file is generated in the middleware system. In the new version of CFDI, SAT defined catalogs for the different address fields (sub district, city, district, state and postal code). For this specific Foreign Trade Complemento, SAT requires those codes in the fields of the different addresses: company’s, sales area’s, customer’s and ship to. In order to include in the XML file the codes for the addresses, a new BADI was released in SAP Note 2316220. You have to create z tables to store the catalogs, and via BADI, replace the addresses texts by the corresponding codes.
B3 – Position of the data in the OIM
The GET_LINE_ITEM_COMPLEMENTO has to be used when the complement data has to be inserted after each line item of the invoice (Complemento Concepto). The list of the complements, and at which level they are, is in the link (https://goo.gl/sGxIhX). The only Complementos that are at line item level (Concepto) are Instituiciones educativas privadas; venta de vehículos; terceros; acreditamiento del IEPS. The complement of Foreign Trade (Comercio Exterior) is at header level therefore. The method that has to be used is the GET_HEADER_COMPLEMENTO, not the LINE_ITEM one. In case it is easier to use GET_LINE_ITEM_COMPLEMENTO_XML to determine the data for the XML file, it is ok, as it does not really affects anything. But for the OIM, it is necessary to use the method GET_HEADER_COMPLEMENTO, otherwise the data will not be in the right place to generate the OIM and signing.
In order to enter the new codes for the means of payment, customers will have to use method DET_MEANS_OF_PAYMENT for SD documents or method IDMX_DI_FIDATA_DET for FI documents, from BADI IDMX_DI_SDDATA_DET. The codes and descriptions of Catalog of Payment Methods (Catálogo de Métodos de Pago) are listed below.
01 – Efectivo
02 – Cheque
03 – Transferencia
04 – Tarjetas de crédito
05 – Monederos electrónicos
06 – Dinero electrónico
07 – Tarjetas digitales
08 – Vales de despensa
09 – Bienes
10 – Servicio
11 – Por cuenta de tercero
12 – Dación en pago
13 – Pago por subrogación
14 – Pago por consignación
15 – Condonación
16 – Cancelación
17 – Compensación
98 – “NA”
99 – Otros
C1 – Length of ‘Transferencia Electrónica’ or ‘Transferencia Electrónica de Fondos’
After you refer to SAP Notes 1734373, 1963866 and 1995039, you will be able to indicate your own descriptions in the method DET_MEANS_OF_PAYMENT of the BADI. You have to indicate your own descriptions in the field MEANS_OF_PAYMENT of the exporting internal table CT_ACCOUNT_DATA. You have to add one entry to this internal table for each description that you would like to use. The length of these single descriptions could be longer than 30 characters, however since all the descriptions indicated in the BADI are concatenated later in the function IDMX_DI_ADJUST_ACCOUNT_DATA into the field LS_DATA_EXTRACT-DOCUMENT_DATA-PAYM_MEANS, then the max lenght of the concatenation is 158 characters, because the lenght of field LS_DATA_EXTRACT-DOCUMENT_DATA-PAYM_MEANS is 158. For example, if you use only one description in the BADI, one entry in the exporting internal table CT_ACCOUNT_DATA, then you have the 158 characters available for that description. If you use two descriptions in the BADI, two entries in the exporting internal table CT_ACCOUNT_DATA, then the concatenation of both of them should not exceed 158 characters. In other words, after implementing the SAP Notes, you will be able to use descriptions longer than 30 characters in the BADI, but the max length of the concatenation of them is limited to 158.
D1 – Mexico City legal name
Log in ERP system using Spanish language (ES), change the Description of the entry MX-DF (sometimes MX-DIF) in the table T005S from ‘Distrito Federal to Ciudad de México’ or ‘Distrito Federal’ to ‘Ciudad de México’. There is no need to change the entry ‘DF’ or ‘DIF’ to other abbreviation. Similar instructions are informed in the SAP Note 1164216, but notice that this SAP Note is not updated with this change in Mexico yet and there are no plans to update it.
D2 – CFDI 3.3
The Mexico’s tax authority SAT provided the formats for the new CFDI version 3.3. The current version of CFDI 3.2 can be issued until 30/NOV/2017. The version of CFDI 3.3 will be required only on 01/DEC/2017. The SAP Notes of CFDI 3.3 are listed in the topic A1 of this documentation. For more details about this legal change, check the Mexican government website: https://goo.gl/opOad4
D3 – e-Payment
Check SAP KBA 2523263.
D4 – Error IDMX200
There are several scenarios not supported that could generate the error IDMX 200:
– Account payables not supported;
– Multiple customers not supported;
– Multiple payment means not supported;
– Multiple CPD customers not supported;
– Adjustments of multiple invoices not supported;
– Error in SSF configuration;
– Error in the numbering customizing.
D5 – Error IDMX425
The error IDMX 425 is shown when the parameter type IDMX01 in table T001Z is not maintained with the fiscal regime of the company. Once you maintain it correctly, the error probably will not happen anymore. If the issue remains, check if the SAP Notes 2441984, 2424502, 2358725 and 2333641 are correctly applied in your system.
D6 – Dump CALL_FUNCTION_CONFLICT_TYPE CX_SY_DYN_CALL_ILLEGAL_TYPE
D7 – PI in CFDI 3.3
SAP did not delivery PI content for CFDI 3.3. Customer have to perform the adjusts based in the XSD defined by SAT (Mexico’s tax authority) and you may find it in the link:
payment method, método de pago, factura electrónica, sat, catálogo de formas de pago, cumplimiento de requisitos en la expedición de comprobantes fiscales, facturas electrónicas, cfd, comprobantes fiscales digitales por internet, cfdi sat, catálogo de métodos de pago, efectivo, cheque, transferencia, tarjetas de crédito, monederos electrónicos, dinero electrónico, tarjetas digitales, vales de despensa, bienes, servicio, por cuenta de tercero, dación en pago, pago por subrogación, pago por consignación, condonación, cancelación, compensación, “na”, na, n/a, otros, peso, pesos, moneda, mxn, currency, currencies, complement de comercio exterior, complemento de comercio exterior, means of payment, mean of payment, medios de pago, media, medio, abono, recompensa, entero, servicio de administracón tributaria, méxico, mexico, mejico, shcp, secretaría de hacienda y crédito público, régimen general, agency, fiscal authority, bapi, badi, method, mexican localization, localisation, billing, invoice, factura, faturas, facturas, invoic02, mxcfdireq00, mxcfdiresp001, mxcfdiinv001, cfdi_monitor, anexo 20 de la resolución miscelánea fiscal para 2012, anexo 20, annex 20, cfdi schema, pi/xi, pi, xi, cfd, zssf_test_pse, pse, certificate, certificado, wrong password, no credentials in system, pse denied, vf02, vf01, vf03, release to accounting, no credentials available, sapgenpse, strust, lssfzu07, idmx 219, dmx219, idmx-219, idmx, message class, vf22, bancomer, banco de mexico, banxico, sat, secudir, mexico, dir_instance, oim, error message, seclogin, digital certificate, xml, sapmxdi, mxdi, kernel update, after kernel update, al11, pin, pse pin, facturación, billing, billing process, digital billing, renewal, mexiko, idmx212, expired certificate, mejico, expirado, ssf kernel error, méxico, invalid parameter, authorities of mexico, mexico authorities, fiscal authorities, autoridades fiscales, idmx_di_check_ssf_config, e219(idmx), sapcryptolib, ssfc_getowncertificate, idmx_di_pseprof, vf04, fb01, vfx3, electronic invoice, electronic billing, idmx_di_vpseprof, no valid pse, cfdi, cfd, cfd 2.2, annex 3.3, 3.30, cfd 3.3, complemento de pagos, pagos recibidos, pago, pagos. Complemento de Pagos, Pagos Recibidos,e-Payment, ePayment, ePago.