GUÍA DE INTEGRACIÓN XML PARA PROVEEDORES – CONECTA EDI
Esta guía te permitirá integrar tu ERP con Conecta EDI en muy poco tiempo. Solo necesitas generar un archivo XML con esta estructura y subirlo a nuestra plataforma. El mismo formato XML sirve para cuatro tipos de documento:
- Facturas (
INVOIC), - Albaranes (
DESADV), - Pedidos (
ORDERS) - Recepciones de mercancía (
RECADV).
El campo Header.DocumentType identifica de qué tipo se trata en cada archivo.
Antes de empezar — dos diferencias clave entre la factura (INVOIC) y el albarán (DESADV):
- En la factura (INVOIC) las líneas de producto van en un bloque
<LineItems>plano en la raíz del documento, junto con sus precios, IVA, descuentos y los totales del documento. - En el albarán (DESADV) las líneas viven dentro del
<Pallet>que físicamente las transporta. No hay precios, ni IVA, ni totales — sólo datos físicos: SSCC, peso, cantidad de cajas, lote y caducidad. Es la realidad del proceso: el albarán describe qué hay en cada palet, no cuánto cuesta.
NOMENCLATURA DEL ARCHIVO
El nombre del archivo XML que generes debe contener un prefijo o palabra clave que indique el tipo de documento. Nuestra plataforma identifica el tipo a partir del nombre del archivo antes de procesarlo. Si el nombre no contiene ningún patrón reconocible, el archivo se procesará por defecto como factura (INVOIC).
Patrones admitidos (mayúsculas o minúsculas):
| Tipo de documento | Patrones reconocidos en el nombre | Ejemplos válidos |
|---|---|---|
| INVOIC (factura) | INVOIC_, _INVOIC, INVOIC-, FACTURA_, FAC_, CABFAC, FACCAB, LINFAC, FACLIN, o extensión.INV |
INVOIC_FA-2024-001.xmlFAC_2024-001.xml |
| DESADV (albarán) | DESADV_, _DESADV, ALBARAN_ ALB_, CABALB, ALBCAB, LINALB, ALBLIN, terminación .DES |
DESADV_DN-2026-00126.xmlALB_2026-00126.xml |
| ORDERS (pedido) | ORDERS_, _ORDERS, PED_, PEDIDO_, CABPED, PEDCAB, LINPED, PEDLIN, o extensión.ORD |
ORDERS_PO-2026-00128.xmlPED_2026-00128.xml |
| RECADV (recepción) | RECADV_, _RECADV, REC_, CABREC, RECCAB, LINREC, RECLIN, o extensión .ORD |
RECADV_RC-2026-00130.xmlREC_2026-00130.xml |
Importante: el campo
Header.DocumentType dentro del XML también debe coincidir con el tipo real del documento. Si el nombre del archivo dice DESADV_ pero el Header.DocumentType dice INVOIC (o viceversa), el documento se procesará con la ruta indicada por el nombre y la incoherencia provocará un error de validación. Por consistencia, asegúrate de que ambos coincidan.
ESTRUCTURA BÁSICA DEL XML
<?xml version="1.0" encoding="UTF-8"?>
<Document xmlns="conectaedi-invoice-1.0">
<Header>...</Header>
<Supplier>...</Supplier>
<Buyer>...</Buyer>
<ShipTo>...</ShipTo> <!-- Opcional -->
<Invoicee>...</Invoicee> <!-- Opcional -->
<DueDates>...</DueDates> <!-- Sólo en INVOIC -->
<References>...</References>
<Remarks>...</Remarks> <!-- Opcional -->
<LineItems>...</LineItems> <!-- En raíz para INVOIC y ORDERS -->
<Pallets>...</Pallets> <!-- Sólo en DESADV. Contiene los LineItems -->
<TaxSummary>...</TaxSummary> <!-- Sólo en INVOIC -->
<Totals>...</Totals> <!-- Sólo en INVOIC -->
</Document>
1. HEADER (Cabecera del documento)
Incluye toda la información clave a nivel de cabecera del documento.
Etiqueta <Header>. Contiene:
| Nombre | Tipo | Descripción | Mandatory |
|---|---|---|---|
| TransactionNumber | String | Número único del documento (ej: FA-2024-001 para factura, DN-2026-00126 para albarán, PO-2026-00126 para pedido) | YES |
| TransactionDate | Date (YYYY-MM-DD) | Fecha de emisión del documento | YES |
| DocumentType | String | Tipo de documento: «INVOIC» para facturas, «DESADV» para albarán «ORDERS» para pedidos, «RECADV» para recepciones de mercancía |
YES |
| Currency | String | Código de moneda: EUR, USD, GBP | YES |
<Header>
<TransactionNumber>FA-2024-001</TransactionNumber> <!-- Número de documento -->
<TransactionDate>2025-11-05</TransactionDate> <!-- Fecha factura (YYYY-MM-DD) -->
<DocumentType>INVOIC</DocumentType> <!-- INVOIC, DESADV, ORDERS, RECADV -->
<Currency>EUR</Currency> <!-- EUR, USD, GBP -->
</Header>
Nota: Solo 4 campos, todos obligatorios.
2. INTERLOCUTORES
Todas las funciones de interlocutor comparten los mismos campos. Es el nombre de la etiqueta el que define la función del interlocutor:
<Supplier>, <Buyer>, <ShipTo>, <Invoicee>
Todas las funciones contienen:
| Nombre | Tipo | Descripción | Mandatory |
|---|---|---|---|
| GLN | String (13 dígitos) | Código GLN de tu empresa | YES |
| Name | String | Nombre completo de tu empresa | YES |
| TaxID | String | NIF/CIF español (ej: B12345678) | YES |
| Street | String | Calle y número | YES |
| City | String | Ciudad | YES |
| Province | String | Provincia | NO |
| PostalCode | String | Código postal | YES |
| CountryCode | String (2 letras) | Código país ISO (ES, FR, DE, etc.) | YES |
Supplier (Proveedor)
<Supplier>
<GLN>84123456789</GLN> <!-- Obligatorio: tu código GLN -->
<Name>Empresa Proveedora S.L.</Name> <!-- OBLIGATORIO -->
<TaxID>B12345678</TaxID> <!-- OBLIGATORIO: NIF/CIF -->
<Street>Calle Mayor 123</Street> <!-- Recomendado -->
<City>Madrid</City> <!-- Recomendado -->
<Province>Madrid</Province> <!-- Recomendado -->
<PostalCode>28001</PostalCode> <!-- Recomendado -->
<CountryCode>ES</CountryCode> <!-- OBLIGATORIO: código país 2 letras -->
</Supplier>
Buyer (Comprador)
En general el BUYER siempre va a ser el destinatario de la factura, pero en ocaciones puntuales una empresa A puede ser el BUYER, pero la factura se envía a una empresa B.
<Buyer>
<GLN>4065054000006</GLN> <!-- OBLIGATORIO : GLN del cliente -->
<Name>ALDI SAN ISIDRO SUPERMERCADOS, S.L.</Name> <!-- OBLIGATORIO -->
<TaxID>B53948204</TaxID> <!-- OBLIGATORIO: NIF del cliente -->
<Street>POL.IND.LA GRANADINA, CALLE 3, PARC</Street>
<City>SAN ISIDRO- ALICANTE</City>
<PostalCode>03349</PostalCode>
<CountryCode>ES</CountryCode>
</Buyer>
ShipTo (Destino o punto de entrega de la mercancía )
A menudo los clientes Retail tienen distintos puntos de entrega, distintas plataformas y por ende distintos puntos operacionales asociados a la misma empresa. Por ejemplo, Alcampo Mataró y Alcampo Sant Boi, aunque se facturan al mismo Invoicee (mismo destinatario de la factura) la mercancía se entrega en 2 ubicaciones distintas.
<ShipTo>
<GLN>4065054000006</GLN> <!-- OBLIGATORIO : GLN del cliente -->
<Name>ALDI SAN ISIDRO SUPERMERCADOS, S.L.</Name> <!-- OBLIGATORIO -->
<TaxID>B53948204</TaxID> <!-- OBLIGATORIO: NIF del cliente -->
<Street>POL.IND.LA GRANADINA, CALLE 3, PARC</Street>
<City>SAN ISIDRO- ALICANTE</City>
<PostalCode>03349</PostalCode>
<CountryCode>ES</CountryCode>
</ShipTo>
Invoicee (Destinatario de la factura)
Es el destinatario de la factura a efectos fiscales, y por tanto, pagador.
<Invoicee>
<GLN>4065054000006</GLN> <!-- OBLIGATORIO : GLN del cliente -->
<Name>ALDI SAN ISIDRO SUPERMERCADOS, S.L.</Name> <!-- OBLIGATORIO -->
<TaxID>B53948204</TaxID> <!-- OBLIGATORIO: NIF del cliente -->
<Street>POL.IND.LA GRANADINA, CALLE 3, PARC</Street>
<City>SAN ISIDRO- ALICANTE</City>
<PostalCode>03349</PostalCode>
<CountryCode>ES</CountryCode>
</Invoicee>
3. CONDICIONES DE PAGO – Vencimientos (sólo INVOIC)
Etiqueta <DueDates>. Sólo se incluye en facturas (INVOIC). En albaranes (DESADV) y pedidos (ORDERS) se omite.
| Nombre | Tipo | Descripción | Mandatory |
|---|---|---|---|
| DueDate | Elemento repetible | Cada vencimiento de pago | YES (al menos 1) |
Dentro de cada DueDate:
| Nombre | Tipo | Descripción | Mandatory |
|---|---|---|---|
| Date | Date (YYYY-MM-DD) | Fecha de vencimiento | YES |
| PaymentMethod | String | Método: Transfer, CreditCard, Cash | YES |
| IBAN | String (IBAN formato) | Cuenta bancaria para transferencia | NO |
| Amount | Decimal | Importe a pagar en esta fecha | YES |
<DueDates>
<DueDate>
<Date>2025-11-05</Date> <!-- Fecha vencimiento -->
<PaymentMethod>Transfer</PaymentMethod> <!-- Transfer, CreditCard, Cash -->
<IBAN>ES9121000418450200051332</IBAN> <!-- Opcional: tu IBAN -->
<Amount>423.568</Amount> <!-- Importe a pagar esta fecha -->
</DueDate>
<!-- Puedes añadir más DueDate si hay varios vencimientos -->
</DueDates>
Tip: Si solo hay un vencimiento, solo un
<DueDate>.
4. REFERENCIAS A OTROS DOCUMENTOS
Etiqueta <References>.
| Nombre | Tipo | Descripción | Mandatory |
|---|---|---|---|
| PurchaseOrderNumber | String | Número del pedido del cliente | YES |
| PurchaseOrderDate | Date (YYYY-MM-DD) | Fecha del pedido | NO |
| DeliveryNoteNumber | String | Número de albarán | YES |
| DeliveryNoteDate | Date (YYYY-MM-DD) | Fecha de albarán | NO |
| OriginalInvoiceNumber | String | Nº factura original (para rectificativas). Obligatorio en rectificativas. |
NO |
| OriginalInvoiceDate | Date (YYYY-MM-DD) | Fecha factura original (para rectificativas) | NO |
<References>
<PurchaseOrderNumber>3800085665</PurchaseOrderNumber> <!-- Número de pedido -->
<PurchaseOrderDate>2025-10-29</PurchaseOrderDate> <!-- Fecha pedido -->
<DeliveryNoteNumber>3/23147</DeliveryNoteNumber> <!-- Número albarán -->
<DeliveryNoteDate>2025-10-29</DeliveryNoteDate> <!-- Fecha albarán -->
<OriginalInvoiceNumber>3/23147</OriginalInvoiceNumber> <!-- Número de factura original en caso de facturas rectificativas-->
<OriginalInvoiceDate>2025-10-29</OriginalInvoiceDate> <!-- Fecha de factura original en caso de facturas rectificativas -->
</References>
Regla simple: Si tienes el número, ponlo. Si no, omítelo. La mayoría de clientes retail los exigen.
5. OBSERVACIONES (Opcional)
Etiqueta <Remarks>
Sirven para incluir mensajes y observaciones en el documento.
| Nombre | Tipo | Descripción | Mandatory |
|---|---|---|---|
| Remark | String (repetible) | Texto libre para observaciones y comentarios | NO |
<Remarks>
<Remark>Entrega por la mañana antes de las 12:00</Remark>
<Remark>Factura con descuento por pronto pago</Remark>
</Remarks>
LÍNEAS DE PRODUCTO
Etiqueta <LineItems> que lleva anidado múltiples <Item>. Cada <Item> contiene:
| Nombre | Tipo | Descripción | Mandatory |
|---|---|---|---|
| GTIN | String (13-14 dígitos) | Código EAN/GTIN del producto | YES |
| SupplierSKU | String | Tu referencia interna del producto | NO |
| ClientSKU | String | Referencia del producto para el cliente. Obligatorio para algunos clientes como ALDI. | NO |
| Description | String | Descripción del producto | YES |
| Quantity | Decimal (>0) | Cantidad de unidades de venta | YES |
| UnitOfMeasure | String | Unidad de medida facturada (ver tabla CÓDIGOS DE UNIDAD DE MEDIDA MÁS USADOS) | YES |
| ConsumerUnitsPerTradeUnit | Decimal | Unidades de consumo por unidad de venta. Cantidad de UNIDADES/CAJA cuando se factura en cajas. | YES |
| ConsumerUnitOfMeasure | String | Unidad de medida de las unidades de consumo. Generalmente PCE para UNIDADES, y KGM para KILOS. Ver tabla CÓDIGOS DE UNIDAD DE MEDIDA MÁS USADOS. |
YES |
| Measurement | Decimal | Medida alternativa: peso total facturado en KGM o volumen total facturado en LTR. Obligatorio al facturar en KGM. | YES |
| MeasurementUnit | String | Unidad de medida de la medida alternativa: KGM o LTR | YES |
| NetUnitPrice | Decimal (>0) | Precio unitario (sólo en INVOIC y opcionalmente en ORDERS) | YES (en INVOIC) |
| GrossUnitPrice | Decimal (>0) | Precio unitario antes de descuentos | NO |
| PriceUnitOfMeasure | String | Unidad del precio unitario. Normalmente igual a ConsumerUnitOfMeasure (PCE o KGM) | YES (en INVOIC) |
| PriceBasis | Decimal | Base de precio: siempre 1. Aunque puede expresarse el precio de 10 UD, 100 UD, 1000 UD, etc. | NO |
| Subtotal | Decimal | Importe línea: Quantity × NetUnitPrice (sólo en INVOIC) | YES (en INVOIC) |
| BatchNumber | String | Número de lote del producto. Válido tanto en INVOIC como en DESADV. Útil para trazabilidad en facturas de alimentación, farmacia y perecederos. Obligatorio en DESADV de productos con trazabilidad. | NO |
| ExpirationDate | Date (YYYY-MM-DD) | Fecha de caducidad o consumo preferente. Válido tanto en INVOIC como en DESADV. | NO |
1. IDENTIFICACIÓN DEL ARTÍCULO
Campos para identificar los códigos de artículo.
<Item>
<GTIN>24099639</GTIN> <!-- EAN del producto -->
<SupplierSKU>PROD-LIMON-001</SupplierSKU> <!-- referencia -->
<ClientSKU>9963</ClientSKU> <!-- Referencia del cliente -->
<Description>LIMON 6 KGS</Description> <!-- Descripción -->
...
</Item>
2. CANTIDADES DEL ARTÍCULO
<Item>
...
<Quantity>28</Quantity> <!-- Cantidad de unidades de venta -->
<UnitOfMeasure>CT</UnitOfMeasure> <!-- Unidad de venta: CT=caja, PCE=pieza, KGM=kg -->
<ConsumerUnitsPerTradeUnit>10</ConsumerUnitsPerTradeUnit> <!-- Cantidad de unidades por caja -->
<ConsumerUnitOfMeasure>PCE</ConsumerUnitOfMeasure> <!-- Unidad de consumo (PCE, KGM, etc.) -->
...
</Item>
EJEMPLOS PRÁCTICOS DE CANTIDADES
Ejemplo 1: Vendes cajas de n unidades
<Item>
...
<Quantity>100</Quantity> <!-- 100 cajas -->
<UnitOfMeasure>CT</UnitOfMeasure> <!-- Cajas -->
<ConsumerUnitsPerTradeUnit>24</ConsumerUnitsPerTradeUnit> <!-- 24 unidades por caja -->
<ConsumerUnitOfMeasure>PCE</ConsumerUnitOfMeasure> <!-- Unidad de consumo unidades -->
...
</Item>
Ejemplo 2: Vendes cajas de m kilogramos, se factura por kilos y precio por KGM
En general este caso aplica tanto para artículo de peso fijo, como de peso variable. Si se factura en KGM se debe añadir la información de los Kilos facturados
<Item>
<Quantity>40</Quantity> <!-- 40 cajas -->
<UnitOfMeasure>CT</UnitOfMeasure> <!-- CT -->
<ConsumerUnitsPerTradeUnit>25</ConsumerUnitsPerTradeUnit> <!-- 25kg por caja -->
<ConsumerUnitOfMeasure>KGM</ConsumerUnitOfMeasure> <!-- Unidad de consumo kg -->
<Measurement>1000</Measurement> <!-- Peso total facturado: 40 × 25 = 1000kg -->
<MeasurementUnit>KGM</MeasurementUnit> <!-- Unidad de medida: kg -->
</Item>
Ejemplo 3: facturas unidades, independientemente de la cantidad de cajas y unidades/caja (lo más simple)
<Item>
...
<Quantity>150</Quantity> <!-- 150 unidades -->
<UnitOfMeasure>PCE</UnitOfMeasure> <!-- Piezas -->
<!-- No necesitas ConsumerUnitsPerTradeUnit si es 1:1 -->
...
</Item>
3. PRECIOS DE LÍNEA (sólo INVOIC)
<Item>
<!-- ... identificación y cantidades ... -->
<!-- PRECIOS -->
<NetUnitPrice>1.72</NetUnitPrice> <!-- Precio por unidad -->
<GrossUnitPrice>1.79</GrossUnitPrice> <!-- Precio por unidad antes de aplicar descuentos -->
<PriceUnitOfMeasure>PCE</PriceUnitOfMeasure> <!-- Unidad del precio -->
<PriceBasis>1</PriceBasis> <!-- Generalmente 1. Permite indicar precio de 10 UD, 100 UD, 1000 UD, etc. -->
<!-- IMPORTE LÍNEA -->
<Subtotal>288.96</Subtotal> <!-- Total de línea antes de impuestos: Cantidad × NetUnitPrice -->
</Item>
Consejo: Si
GrossUnitPrice (precio unitario bruto) no lo tienes, no lo indiques. También puedes indicar mismo precio que NetUnitPrice si no hay descuento. En albaranes (DESADV) este bloque se omite por completo.
4. IMPUESTOS POR LÍNEA (sólo INVOIC)
Etiqueta <Taxes>. Puede contener múltiples <Tax> anidados:
| Nombre | Tipo | Descripción | Mandatory |
|---|---|---|---|
| Tax | Elemento repetible | Cada impuesto aplicado a la línea | YES (al menos 1) |
Dentro de cada Tax:
| Nombre | Tipo | Descripción | Mandatory |
|---|---|---|---|
| TaxType | String | Tipo: «VAT» para IVA | YES |
| TaxRate | Decimal | Porcentaje: 4, 10, 21 | YES |
| TaxBase | Decimal | Base imponible = Subtotal de la línea | YES |
| TaxAmount | Decimal | Importe: TaxBase × (TaxRate/100) | YES |
<Item>
<!-- ... precios y subtotal ... -->
<Taxes>
<Tax>
<TaxType>VAT</TaxType> <!-- Siempre "VAT" para IVA -->
<TaxRate>4</TaxRate> <!-- % IVA: 4, 10, 21 -->
<TaxBase>288.96</TaxBase> <!-- = Subtotal -->
<TaxAmount>11.558</TaxAmount> <!-- TaxBase × (TaxRate/100) -->
</Tax>
</Taxes>
</Item>
Importante: Si un producto tiene varios impuestos (no aplica en España), añade más
<Tax>.
5. DESCUENTOS DE LÍNEA (Opcional, sólo INVOIC)
Etiqueta <Discounts>. Puede tener múltiples <Discount> anidados.
| Nombre | Tipo | Descripción | Mandatory |
|---|---|---|---|
| Discount | Elemento repetible | Cada descuento aplicado a la línea | NO |
Dentro de cada Discount:
| Nombre | Tipo | Descripción | Mandatory |
|---|---|---|---|
| DiscountType | String | Tipo: Promocional, Cantidad, Otro | NO |
| DiscountPercentage | Decimal | Porcentaje de descuento | NO |
| DiscountAmount | Decimal | Importe descontado | NO |
<Discounts>
<Discount>
<DiscountType>Promocional</DiscountType> <!-- Texto libre -->
<DiscountPercentage>5</DiscountPercentage><!-- % descuento -->
<DiscountAmount>14.45</DiscountAmount> <!-- Importe descontado -->
</Discount>
</Discounts>
6. TRAZABILIDAD: LOTE Y CADUCIDAD (Opcional en INVOIC, obligatorio en DESADV)
Los campos BatchNumber y ExpirationDate son opcionales y pueden aparecer dentro de cada <Item> tanto en facturas (INVOIC) como en albaranes (DESADV). Son fundamentales para la trazabilidad en sectores como alimentación, farmacia o cualquier producto perecedero. Algunos retailers exigen lote y caducidad en el albarán para productos con trazabilidad — en ese caso el campo deja de ser opcional.
<Item>
<!-- ... identificación, cantidades, precios ... -->
<BatchNumber>L20260514A</BatchNumber> <!-- Lote del producto -->
<ExpirationDate>2028-03-03</ExpirationDate><!-- Fecha de caducidad (YYYY-MM-DD) -->
</Item>
RESUMEN DE IMPORTES (sólo INVOIC)
Los bloques <TaxSummary> y <Totals> sólo aparecen en facturas. En albaranes (DESADV) y pedidos (ORDERS) se omiten por completo.
1. TaxSummary (Resumen de impuestos)
Etiqueta <TaxSummary>. Puede contener múltiples <Tax> anidados.
| Nombre | Tipo | Descripción | Mandatory |
|---|---|---|---|
| Tax | Elemento repetible | Resumen por cada tipo de impuesto | YES (al menos 1) |
Dentro de cada Tax:
| Nombre | Tipo | Descripción | Mandatory |
|---|---|---|---|
| TaxType | String | Tipo: «VAT» para IVA | YES |
| TaxPercentage | Decimal | Porcentaje: 4, 10, 21 | YES |
| TaxableBase | Decimal | Suma de Subtotal de productos con este % | YES |
| TaxAmount | Decimal | Importe: TaxableBase × (TaxPercentage/100) | YES |
<TaxSummary>
<!-- Un Tax por cada tipo de IVA en la factura -->
<Tax>
<TaxType>VAT</TaxType>
<TaxPercentage>4</TaxPercentage> <!-- % IVA -->
<TaxableBase>288.96</TaxableBase> <!-- Suma de Subtotal de productos al 4% -->
<TaxAmount>11.558</TaxAmount> <!-- TaxableBase × 4% -->
</Tax>
<Tax>
<TaxType>VAT</TaxType>
<TaxPercentage>10</TaxPercentage>
<TaxableBase>125.00</TaxableBase> <!-- Suma de Subtotal de productos al 10% -->
<TaxAmount>12.50</TaxAmount>
</Tax>
</TaxSummary>
2. Totals (Totales del documento)
Etiqueta <Totals>
| Nombre | Tipo | Descripción | Mandatory |
|---|---|---|---|
| Subtotal | Decimal | Suma de todos los Subtotal de líneas | YES |
| Discounts | Decimal | Suma de todos los descuentos | YES (puede ser 0) |
| Tax | Decimal | Suma de todos los TaxAmount del TaxSummary | YES |
| Total | Decimal | Total a pagar: Subtotal – Discounts + Tax | YES |
<Totals>
<Subtotal>413.96</Subtotal> <!-- Suma de todos los Subtotal -->
<Discounts>14.45</Discounts> <!-- Suma de todos los descuentos globales de la factura -->
<Tax>24.058</Tax> <!-- Suma de TaxSummary.TaxAmount -->
<Total>423.568</Total> <!-- Subtotal - Discounts + Tax -->
</Totals>
Fórmula de validación:
Total = Subtotal - Discounts + Tax
BLOQUES ESPECÍFICOS DEL ALBARÁN (DESADV)
Cuando Header.DocumentType es DESADV, el documento describe un envío físico de mercancía. La estructura cambia respecto a la factura: las líneas de producto se anidan dentro del palet que las contiene, igual que físicamente las cajas van dentro del palet. Los campos de precio, IVA, descuentos y totales del documento no aplican en DESADV y se omiten.
Resumen de diferencias entre INVOIC y DESADV:
| Aspecto | INVOIC (factura) | DESADV (albarán) |
|---|---|---|
Ubicación de <LineItems> |
En la raíz del <Document> |
Dentro de cada <Pallet> |
Bloque <Pallets> |
No aparece | Obligatorio en la raíz del documento |
BatchNumber y ExpirationDate en <Item> |
Sí (opcional) | Sí (recomendado / obligatorio en perecederos) |
Campos físicos en <Item> (PackageCount, PackageTypeCode, NetWeight, BoxSerial) |
No aparecen | Sí |
Precio, IVA, descuentos, Subtotal en <Item> |
Sí | No (se ignoran si se mandan) |
<TaxSummary> y <Totals> |
Sí | No |
<DueDates> |
Sí | No |
1. BLOQUE Pallets — Datos físicos de los palets
Etiqueta <Pallets>, contenedor que lleva uno o varios <Pallet>. Cada <Pallet> describe un palet físico del envío, identificado por su código SSCC (Serial Shipping Container Code) de 18 dígitos GS1.
Dentro de cada <Pallet> contiene:
| Nombre | Tipo | Descripción | Mandatory |
|---|---|---|---|
| SSCC | String (18 dígitos) | Identificador GS1 del palet. Es el número que se imprime en la etiqueta logística (GS1-128) del palet. Único en el documento. | YES |
| PackageTypeCode | String | Tipo de bulto según UN/ECE Rec 21. Para palets, habitualmente 201. |
YES |
| PalletTypeCode | String | Tipo de palet: EUR, EUR1, CHEP, LPR… |
NO |
| GrossWeight | Decimal | Peso bruto del palet (palet + mercancía + embalaje). | NO (recomendado) |
| NetWeight | Decimal | Peso neto del palet (sólo mercancía). | NO |
| GrossWeightUnit / NetWeightUnit | String | Unidad: KGM por defecto. |
NO |
| LineItems | Contenedor | Las líneas de producto que físicamente van en este palet. Ver bloque 2. | YES |
<Pallets>
<Pallet>
<SSCC>184354343160606725</SSCC> <!-- 18 dígitos GS1 -->
<PackageTypeCode>201</PackageTypeCode> <!-- 201 = palet (UN/ECE) -->
<PalletTypeCode>EUR</PalletTypeCode> <!-- EUR, CHEP, LPR... -->
<GrossWeight>148.5</GrossWeight> <!-- Peso bruto en KGM -->
<GrossWeightUnit>KGM</GrossWeightUnit>
<LineItems>
<!-- Aquí van los <Item> que hay en este palet (ver bloque 2) -->
</LineItems>
</Pallet>
<!-- Más <Pallet> si el envío lleva varios palets -->
</Pallets>
Cómo se genera desde el ERP: el flujo natural es un doble bucle. Por cada palet preparado para el envío, se escribe un bloque
<Pallet> con sus datos físicos. Dentro de cada palet, por cada caja/grupo de cajas iguales que contiene, se escribe un <Item> dentro de <LineItems>. Si un mismo SKU se reparte entre dos palets distintos, ese SKU aparece como <Item> en cada uno, con cantidades y lotes propios.
2. BLOQUE LineItems en DESADV — Líneas anidadas en el palet
En DESADV las líneas viven dentro del <LineItems> de su <Pallet>. Cada <Item> usa los mismos campos de identificación y cantidad que en la factura (GTIN, SupplierSKU, Description, Quantity, UnitOfMeasure, ConsumerUnitsPerTradeUnit, ConsumerUnitOfMeasure), añade los datos de trazabilidad por línea (BatchNumber, ExpirationDate — ya documentados arriba) y añade los campos físicos del bulto que se listan a continuación.
Datos físicos del bulto (sólo DESADV):
| Nombre | Tipo | Descripción | Mandatory |
|---|---|---|---|
| PackageCount | Integer | Número de cajas (bultos) de esta línea en este palet. | YES |
| PackageTypeCode | String | Tipo de bulto contenedor: CT (caja), BX (box), BG (saco), RO (rollo). |
YES |
| NetWeight | Decimal | Peso neto por unidad de bulto (kilos por caja, por ejemplo). | NO |
| NetWeightUnit | String | Unidad del peso neto: KGM por defecto. |
NO |
| BoxSerial | String | Serial interno de caja del proveedor. No es un SSCC GS1, es un identificador propio del ERP. | NO |
<Item>
<!-- Identificación del producto (igual que en INVOIC) -->
<LineNumber>1</LineNumber>
<GTIN>8435434354757</GTIN>
<SupplierSKU>067425</SupplierSKU>
<Description>Producto consumer unit</Description>
<!-- Cantidades (igual que en INVOIC) -->
<Quantity>108</Quantity> <!-- 108 unidades de consumo -->
<UnitOfMeasure>PCE</UnitOfMeasure>
<ConsumerUnitsPerTradeUnit>12</ConsumerUnitsPerTradeUnit>
<ConsumerUnitOfMeasure>PCE</ConsumerUnitOfMeasure>
<!-- Trazabilidad (también en INVOIC) -->
<BatchNumber>18435434354754</BatchNumber>
<ExpirationDate>2028-03-03</ExpirationDate>
<!-- Datos físicos (solo DESADV) -->
<PackageCount>36</PackageCount> <!-- 36 cajas de esta línea en este palet -->
<PackageTypeCode>CT</PackageTypeCode> <!-- En cajas (CT) -->
<NetWeight>3.6</NetWeight> <!-- 3.6 kg por caja -->
<NetWeightUnit>KGM</NetWeightUnit>
<BoxSerial>6030310801</BoxSerial> <!-- Serial interno opcional -->
</Item>
Importante: Si un mismo SKU se reparte físicamente entre varios palets, debes generar un
<Item> en cada uno de esos <Pallet>, repitiendo el mismo LineNumber en todos. Cada <Item> lleva la cantidad concreta que va en ese palet y su propio lote/caducidad si difieren entre palets.
VALIDACIONES AUTOMÁTICAS QUE HACEMOS
- NIF válido formato español (1 letra + 8 números)
- Fechas en formato YYYY-MM-DD
- Cálculos coherentes:
Subtotal = Quantity × NetUnitPrice - Totales cuadran:
Total = Subtotal - Discounts + Tax - SSCC válido en DESADV: 18 dígitos numéricos y check digit MOD-10 GS1 correcto, único por documento
- Coherencia DESADV ↔ ORDERS: cantidades enviadas en DESADV cuadran con cantidades pedidas en el ORDERS asociado (tolerancia configurable)
EJEMPLOS COMPLETOS DE XML
Ejemplo 1: FACTURA (INVOIC) completa
<?xml version="1.0" encoding="UTF-8"?>
<Document xmlns="conectaedi-invoice-1.0">
<!-- HEADER CON DATOS GENERALES -->
<Header>
<TransactionNumber>FA-2024-001</TransactionNumber>
<TransactionDate>2025-11-05</TransactionDate>
<DocumentType>INVOIC</DocumentType>
<Currency>EUR</Currency>
</Header>
<!-- INTERLOCUTORES-->
<!-- Proveedor-->
<Supplier>
<GLN>84123456789</GLN>
<Name>Mi Empresa Proveedora S.L.</Name>
<TaxID>B12345678</TaxID>
<Street>Dirección postal</Street>
<City>Barcelona</City>
<Province>Barcelona</Province>
<PostalCode>30506</PostalCode>
<CountryCode>ES</CountryCode>
</Supplier>
<!-- Comprador-->
<Buyer>
<GLN>4065054000006</GLN>
<Name>ALDI SAN ISIDRO SUPERMERCADOS, S.L.</Name>
<TaxID>B53948204</TaxID>
<Street>POL.IND.LA GRANADINA, CALLE 3, PARC</Street>
<City>SAN ISIDRO- ALICANTE</City>
<PostalCode>03349</PostalCode>
<CountryCode>ES</CountryCode>
</Buyer>
<!-- Punto de entrega-->
<ShipTo>
<GLN>4065054000006</GLN>
<Name>ALDI SAN ISIDRO SUPERMERCADOS, S.L.</Name>
<Street>POL.IND.LA GRANADINA, CALLE 3, PARC</Street>
<City>SAN ISIDRO- ALICANTE</City>
<PostalCode>03349</PostalCode>
<CountryCode>ES</CountryCode>
</ShipTo>
<!-- A quién se factura-->
<Invoicee>
<GLN>4065054000006</GLN>
<Name>ALDI SAN ISIDRO SUPERMERCADOS, S.L.</Name>
<Street>POL.IND.LA GRANADINA, CALLE 3, PARC</Street>
<City>SAN ISIDRO- ALICANTE</City>
<PostalCode>03349</PostalCode>
<CountryCode>ES</CountryCode>
</Invoicee>
<!-- CONDICIONES DE PAGO -->
<DueDates>
<DueDate>
<Date>2025-11-05</Date>
<PaymentMethod>Transfer</PaymentMethod>
<IBAN>ES9121000418450200051332</IBAN>
<Amount>626.518</Amount>
</DueDate>
</DueDates>
<!-- REFERENCIAS DEL DOCUMENTO -->
<References>
<PurchaseOrderNumber>3800085665</PurchaseOrderNumber>
<PurchaseOrderDate>2025-10-29</PurchaseOrderDate>
<DeliveryNoteNumber>3/23147</DeliveryNoteNumber>
<DeliveryNoteDate>2025-10-29</DeliveryNoteDate>
</References>
<!-- OBSERVACIONES / REMARKS -->
<Remarks>
<Remark>Factura correspondiente al pedido 3800085665</Remark>
</Remarks>
<!-- LÍNEAS DE PRODUCTOS (2 LÍNEAS) -->
<LineItems>
<!-- LÍNEA 1: Producto con IVA 4% -->
<Item>
<!-- IDENTIFICACIÓN DEL PRODUCTO-->
<GTIN>24099639</GTIN>
<SupplierSKU>PROD-LIMON-001</SupplierSKU>
<ClientSKU>9963</ClientSKU>
<Description>LIMON 6 KGS</Description>
<!-- CANTIDADES-->
<Quantity>28</Quantity>
<UnitOfMeasure>CT</UnitOfMeasure>
<ConsumerUnitsPerTradeUnit>10</ConsumerUnitsPerTradeUnit>
<ConsumerUnitOfMeasure>PCE</ConsumerUnitOfMeasure>
<!-- PRECIOS-->
<NetUnitPrice>1.72</NetUnitPrice>
<GrossUnitPrice>1.79</GrossUnitPrice>
<PriceUnitOfMeasure>PCE</PriceUnitOfMeasure>
<PriceBasis>1</PriceBasis>
<!-- IMPORTE LÍNEA -->
<Subtotal>288.96</Subtotal>
<!-- TRAZABILIDAD (opcional, recomendado en perecederos) -->
<BatchNumber>L20251029A</BatchNumber>
<ExpirationDate>2025-11-25</ExpirationDate>
<!-- IMPUESTOS DE LINEA -->
<Taxes>
<Tax>
<TaxType>VAT</TaxType>
<TaxRate>4</TaxRate>
<TaxBase>288.96</TaxBase>
<TaxAmount>11.558</TaxAmount>
</Tax>
</Taxes>
<!-- DESCUENTOS -->
<Discounts>
<Discount>
<DiscountType>Descuento</DiscountType>
<DiscountPercentage>5</DiscountPercentage>
<DiscountAmount>14.45</DiscountAmount>
</Discount>
</Discounts>
</Item>
<!-- LÍNEA 2: Producto con IVA 10% -->
<Item>
<!-- IDENTIFICACIÓN DEL PRODUCTO-->
<GTIN>24098588</GTIN>
<SupplierSKU>PROD-NARANJA-001</SupplierSKU>
<ClientSKU>9858</ClientSKU>
<Description>NARANJA MALLA 5KG</Description>
<!-- CANTIDADES-->
<Quantity>50</Quantity>
<UnitOfMeasure>CT</UnitOfMeasure>
<ConsumerUnitsPerTradeUnit>10</ConsumerUnitsPerTradeUnit>
<ConsumerUnitOfMeasure>KGM</ConsumerUnitOfMeasure>
<Measurement>500</Measurement>
<MeasurementUnit>KGM</MeasurementUnit>
<!-- PRECIOS-->
<NetUnitPrice>2.50</NetUnitPrice>
<GrossUnitPrice>2.75</GrossUnitPrice>
<PriceUnitOfMeasure>PCE</PriceUnitOfMeasure>
<PriceBasis>1</PriceBasis>
<!-- IMPORTE LÍNEA -->
<Subtotal>125.00</Subtotal>
<!-- IMPUESTOS DE LINEA -->
<Taxes>
<Tax>
<TaxType>VAT</TaxType>
<TaxRate>10</TaxRate>
<TaxBase>125.00</TaxBase>
<TaxAmount>12.50</TaxAmount>
</Tax>
</Taxes>
<!-- DESCUENTOS -->
<Discounts>
<!-- Sin descuentos -->
</Discounts>
</Item>
</LineItems>
<!-- RESUMEN DE IMPUESTOS (COHERENTE) -->
<TaxSummary>
<!-- IVA 4% sobre productos al 4% solamente -->
<Tax>
<TaxType>VAT</TaxType>
<TaxPercentage>4</TaxPercentage>
<TaxableBase>288.96</TaxableBase>
<TaxAmount>11.558</TaxAmount>
</Tax>
<!-- IVA 10% sobre productos al 10% solamente -->
<Tax>
<TaxType>VAT</TaxType>
<TaxPercentage>10</TaxPercentage>
<TaxableBase>125.00</TaxableBase>
<TaxAmount>12.50</TaxAmount>
</Tax>
</TaxSummary>
<!-- RESUMEN DE TOTALES (COHERENTE) -->
<Totals>
<Subtotal>413.96</Subtotal>
<Discounts>14.45</Discounts>
<Tax>24.058</Tax>
<Total>423.568</Total>
</Totals>
</Document>
Ejemplo 2: ALBARÁN (DESADV) completo
Albarán de un envío de 1 palet que contiene 3 SKUs distintos, cada uno en su propio grupo de cajas con su lote y caducidad. Observa que las líneas viven dentro del <Pallet>.
<?xml version="1.0" encoding="UTF-8"?>
<Document xmlns="conectaedi-invoice-1.0">
<!-- HEADER -->
<Header>
<TransactionNumber>DN-2026-00126</TransactionNumber>
<TransactionDate>2026-05-08</TransactionDate>
<DocumentType>DESADV</DocumentType>
<Currency>EUR</Currency>
</Header>
<!-- INTERLOCUTORES -->
<Supplier>
<GLN>84123456789</GLN>
<Name>Mi Empresa Proveedora S.L.</Name>
<TaxID>B12345678</TaxID>
<Street>Calle Mayor 123</Street>
<City>Madrid</City>
<PostalCode>28001</PostalCode>
<CountryCode>ES</CountryCode>
</Supplier>
<Buyer>
<GLN>4065054000006</GLN>
<Name>ALDI SAN ISIDRO SUPERMERCADOS, S.L.</Name>
<TaxID>B53948204</TaxID>
<Street>POL.IND.LA GRANADINA, CALLE 3, PARC</Street>
<City>SAN ISIDRO- ALICANTE</City>
<PostalCode>03349</PostalCode>
<CountryCode>ES</CountryCode>
</Buyer>
<ShipTo>
<GLN>4065054000006</GLN>
<Name>ALDI SAN ISIDRO SUPERMERCADOS, S.L.</Name>
<Street>POL.IND.LA GRANADINA, CALLE 3, PARC</Street>
<City>SAN ISIDRO- ALICANTE</City>
<PostalCode>03349</PostalCode>
<CountryCode>ES</CountryCode>
</ShipTo>
<!-- REFERENCIAS -->
<References>
<PurchaseOrderNumber>3800085665</PurchaseOrderNumber>
<PurchaseOrderDate>2026-05-07</PurchaseOrderDate>
<DeliveryNoteNumber>DN-2026-00126</DeliveryNoteNumber>
<DeliveryNoteDate>2026-05-08</DeliveryNoteDate>
</References>
<!-- PALETS CON LAS LÍNEAS ANIDADAS -->
<Pallets>
<Pallet>
<SSCC>184354343160606725</SSCC>
<PackageTypeCode>201</PackageTypeCode>
<PalletTypeCode>EUR</PalletTypeCode>
<GrossWeight>148.5</GrossWeight>
<GrossWeightUnit>KGM</GrossWeightUnit>
<LineItems>
<!-- LÍNEA 1 dentro del palet -->
<Item>
<LineNumber>1</LineNumber>
<GTIN>8435434354757</GTIN>
<SupplierSKU>067425</SupplierSKU>
<Description>Producto A</Description>
<Quantity>108</Quantity>
<UnitOfMeasure>PCE</UnitOfMeasure>
<ConsumerUnitsPerTradeUnit>12</ConsumerUnitsPerTradeUnit>
<ConsumerUnitOfMeasure>PCE</ConsumerUnitOfMeasure>
<BatchNumber>18435434354754</BatchNumber>
<ExpirationDate>2028-03-03</ExpirationDate>
<PackageCount>36</PackageCount>
<PackageTypeCode>CT</PackageTypeCode>
<NetWeight>3.6</NetWeight>
<NetWeightUnit>KGM</NetWeightUnit>
<BoxSerial>6030310801</BoxSerial>
</Item>
<!-- LÍNEA 2 dentro del mismo palet -->
<Item>
<LineNumber>2</LineNumber>
<GTIN>8435434367122</GTIN>
<SupplierSKU>066721</SupplierSKU>
<Description>Producto B</Description>
<Quantity>162</Quantity>
<UnitOfMeasure>PCE</UnitOfMeasure>
<ConsumerUnitsPerTradeUnit>9</ConsumerUnitsPerTradeUnit>
<ConsumerUnitOfMeasure>PCE</ConsumerUnitOfMeasure>
<BatchNumber>38435434367123</BatchNumber>
<ExpirationDate>2027-07-30</ExpirationDate>
<PackageCount>36</PackageCount>
<PackageTypeCode>CT</PackageTypeCode>
<NetWeight>4.05</NetWeight>
<NetWeightUnit>KGM</NetWeightUnit>
<BoxSerial>6013010901</BoxSerial>
</Item>
<!-- LÍNEA 3 dentro del mismo palet -->
<Item>
<LineNumber>3</LineNumber>
<GTIN>8435434354726</GTIN>
<SupplierSKU>034728</SupplierSKU>
<Description>Producto C</Description>
<Quantity>108</Quantity>
<UnitOfMeasure>PCE</UnitOfMeasure>
<ConsumerUnitsPerTradeUnit>12</ConsumerUnitsPerTradeUnit>
<ConsumerUnitOfMeasure>PCE</ConsumerUnitOfMeasure>
<BatchNumber>38435434354727</BatchNumber>
<ExpirationDate>2027-09-08</ExpirationDate>
<PackageCount>36</PackageCount>
<PackageTypeCode>CT</PackageTypeCode>
<NetWeight>4.8</NetWeight>
<NetWeightUnit>KGM</NetWeightUnit>
<BoxSerial>5090810801</BoxSerial>
</Item>
</LineItems>
</Pallet>
</Pallets>
</Document>
Ejemplo 3: PEDIDO (ORDERS) completo
Un pedido (ORDERS) lo emite el cliente (retailer) al proveedor. La estructura es muy similar a la factura, pero sin precios ni IVA — sólo cantidades pedidas. Aquí los roles cambian: el <Supplier> es a quién se hace el pedido y el <Buyer> es el cliente que lo emite.
<?xml version="1.0" encoding="UTF-8"?>
<Document xmlns="conectaedi-invoice-1.0">
<!-- HEADER -->
<Header>
<TransactionNumber>3800085665</TransactionNumber>
<TransactionDate>2025-10-29</TransactionDate>
<DocumentType>ORDERS</DocumentType>
<Currency>EUR</Currency>
</Header>
<!-- INTERLOCUTORES -->
<!-- Comprador (cliente que emite el pedido) -->
<Buyer>
<GLN>4065054000006</GLN>
<Name>ALDI SAN ISIDRO SUPERMERCADOS, S.L.</Name>
<TaxID>B53948204</TaxID>
<Street>POL.IND.LA GRANADINA, CALLE 3, PARC</Street>
<City>SAN ISIDRO- ALICANTE</City>
<PostalCode>03349</PostalCode>
<CountryCode>ES</CountryCode>
</Buyer>
<!-- Proveedor (a quién se hace el pedido) -->
<Supplier>
<GLN>84123456789</GLN>
<Name>Mi Empresa Proveedora S.L.</Name>
<TaxID>B12345678</TaxID>
<Street>Calle Mayor 123</Street>
<City>Madrid</City>
<PostalCode>28001</PostalCode>
<CountryCode>ES</CountryCode>
</Supplier>
<!-- Punto de entrega del pedido -->
<ShipTo>
<GLN>4065054000006</GLN>
<Name>ALDI SAN ISIDRO SUPERMERCADOS, S.L.</Name>
<Street>POL.IND.LA GRANADINA, CALLE 3, PARC</Street>
<City>SAN ISIDRO- ALICANTE</City>
<PostalCode>03349</PostalCode>
<CountryCode>ES</CountryCode>
</ShipTo>
<!-- REFERENCIAS -->
<References>
<PurchaseOrderNumber>3800085665</PurchaseOrderNumber>
<PurchaseOrderDate>2025-10-29</PurchaseOrderDate>
</References>
<!-- OBSERVACIONES -->
<Remarks>
<Remark>Fecha de entrega solicitada: 2025-11-03</Remark>
<Remark>Entrega antes de las 12:00</Remark>
</Remarks>
<!-- LÍNEAS PEDIDAS -->
<LineItems>
<Item>
<LineNumber>1</LineNumber>
<GTIN>24099639</GTIN>
<SupplierSKU>PROD-LIMON-001</SupplierSKU>
<ClientSKU>9963</ClientSKU>
<Description>LIMON 6 KGS</Description>
<Quantity>28</Quantity>
<UnitOfMeasure>CT</UnitOfMeasure>
<ConsumerUnitsPerTradeUnit>10</ConsumerUnitsPerTradeUnit>
<ConsumerUnitOfMeasure>PCE</ConsumerUnitOfMeasure>
</Item>
<Item>
<LineNumber>2</LineNumber>
<GTIN>24098588</GTIN>
<SupplierSKU>PROD-NARANJA-001</SupplierSKU>
<ClientSKU>9858</ClientSKU>
<Description>NARANJA MALLA 5KG</Description>
<Quantity>50</Quantity>
<UnitOfMeasure>CT</UnitOfMeasure>
<ConsumerUnitsPerTradeUnit>10</ConsumerUnitsPerTradeUnit>
<ConsumerUnitOfMeasure>KGM</ConsumerUnitOfMeasure>
</Item>
</LineItems>
</Document>
CÓDIGOS DE UNIDAD DE MEDIDA MÁS USADOS
| Código | Significado | Uso típico |
|---|---|---|
PCE |
Pieza | Unidades sueltas |
CT |
Caja | Cajas, packs |
KGM |
Kilogramo | Productos a granel |
LTR |
Litro | Líquidos |
MTR |
Metro | Telas, cables |
BX |
Box | Caja (sinónimo de CT en contexto logístico) |
BG |
Bag | Saco / bolsa |
RO |
Roll | Rollo |
201 |
Pallet (UN/ECE Rec 21) | Tipo de bulto palet en DESADV |