Sending LS Retail Transactions as PEPPOL Sales Invoices
This feature allows LS Central point-of-sale transactions to be sent as outbound PEPPOL documents — either a Sales Invoice (UBL type 380) or a Credit Note (UBL type 381) — through the Centara eMessaging network.
Prerequisites and configuration
Before the feature can operate, the following must be in place:
| Setting | Location | Purpose |
|---|---|---|
| Send Transactions to Centara = enabled | Sales & Receivables Setup → Centara eMessaging for LS Central section | Activates the automatic flow |
| Web Service URL | Centara Wise Courier Setup | Endpoint for submitting the PEPPOL document |
Document Sending Profile = COURIERPEPPOL | Customer Card | Tells the system this customer should receive PEPPOL documents automatically |
| Post as Shipment = false | LSC Transaction Header | Transactions posted as shipments cannot be invoiced via this flow |
Document number format
The LS Retail transaction key is used directly as the Cust. Ledger Entry Document No. and must follow this exact format:
<StoreNo,10>-<PosTerminal,10>-<TransactionNo>
Example: S001-POS01-12345
The system parses this to look up the matching LSC Transaction Header record. If the format is incorrect, an explicit error is raised.
Two ways to trigger sending
1. Automatic — via Customer Ledger Entry insert
An event subscriber (CustLedgerEntry_OnAfterInsertEvent) fires every time a new Customer Ledger Entry is created. The entry will be automatically queued for PEPPOL sending if all of the following conditions are met:
- Send Transactions to Centara is enabled in Sales & Receivables Setup
- The entry is document type Invoice or Credit Memo
- The entry is not temporary
- The customer’s Document Sending Profile resolves to
COURIERPEPPOL(the system checks the customer’s own profile first, then falls back to the default profile)
When the conditions are met, a Job Queue entry is scheduled immediately using the CTALSC Send Transaction codeunit (category CTALSC). This makes the sending asynchronous — the user is not blocked while the PEPPOL document is generated and submitted.
2. Manual — via the Customer Ledger Entries page
The Send to Centara Message action appears in the processing ribbon of the Customer Ledger Entries page. Users can select one or more entries and trigger sending on demand.
Behaviour:
- The action button is disabled unless the focused record is an Invoice or Credit Memo
- The selection is additionally filtered to Invoice and Credit Memo types before processing, so mixed selections are handled gracefully
- After processing, the user receives a confirmation: “Sent N transactions to Centara Message.”
- If any entry fails validation (bad Document No. format, missing setup, etc.), a descriptive error is raised immediately for that entry
Core sending logic
The AddTransactionToCentaraMessage procedure (in CTALSC Subscribers) handles both paths and performs the following steps:
- Guard: document type — exits immediately for anything other than Invoice or Credit Memo
- Validate Document No. — raises an error if blank
- Validate Centara setup — reads and validates the Web Service URL; raises an error if not configured
- Parse Document No. — splits on
-to extract Store No., POS Terminal, and Transaction No. - Look up the Transaction —
LSC Transaction Header.Get(StoreNo, PosTerminal, TransActionNo) - Validate Post as Shipment = false — prevents invoicing of shipment-posted transactions
- Create the outbound message record — calls
RSMSTADataGenerationLogic.InsertDocumentMessagewith direction Outbound and typePeppolOutboundDocument, using the Transaction Header’s RecordId, Receipt No., and Date - Set the receiver — uses the Customer No. from the Cust. Ledger Entry; if the customer has Use GLN in Electronic Document enabled, the GLN is included
- Generate the PEPPOL XML via XMLport:
- Invoice:
CTALSC Transaction Invoice— exports against the LSC Transaction Header, setsInvoiceTypeCode = 380, uses the Due Date from the Cust. Ledger Entry (falls back to transaction date if not set) - Credit Memo:
CTALSC Transaction Credit Memo— exports against the LSC Transaction Header, setsCreditNoteTypeCode = 381 - Both XMLports produce valid UBL 2.x XML (namespaces for Invoice-2 and CreditNote-2 respectively)
- Invoice:
- Encode and attach — converts the XML stream to Base64 and attaches it to the message via
RSMSTADataGenerationLogic.AddMessageAttachment - Submit to Centara — calls
AddDataToWiseCourierto write the message, attachment, and receiver records into the Centara message tables - Update Transaction Header — sets
CTALSC E-Document Status→ Waiting to be sent
Status tracking
Three fields are added to LSC Transaction Header and shown on the Transaction Card:
| Field | Description |
|---|---|
| E-Document Status | Current state in the PEPPOL lifecycle (Waiting to be sent → Sent to receiver). Clicking it opens the document in the Centara service portal. |
| Identifier in Centara | The unique document ID assigned by the Centara/WiseCourier platform after submission |
| Sent to Centara On | Timestamp of when the document was successfully sent |
When the Centara platform confirms successful delivery, an event subscriber (OnAfterMessageSendSuccessfulEvent) updates all three fields automatically.
Flow summary
flowchart TD
A["Cust. Ledger Entry inserted\n(Invoice / Credit Memo)"] --> B{"Automatic?"}
B -- "Auto: Send to Centara enabled\n+ Profile = COURIERPEPPOL" --> C["Schedule Job Queue\nCTALSC Send Transaction"]
B -- "Manual: Send to Centara\nMessage action" --> D["AddTransactionTo\nCentaraMessage()"]
C --> D
D --> E["Parse Document No.\nStoreNo / POS / TransNo"]
E --> F["Get LSC Transaction Header"]
F --> G["Create outbound\nPEPPOL message record"]
G --> H["Set receiver\n(Customer No. / GLN)"]
H --> I["Generate UBL XML\n(Invoice 380 or CreditNote 381)"]
I --> J["Attach Base64 XML\nSubmit to Centara"]
J --> K["E-Document Status:\nWaiting to be sent"]
L["Centara delivery\nconfirmation"] --> M["E-Document Status:\nSent to receiver"]
Relationship to eMessaging auto-processing
This pipeline is separate from the eMessaging auto-processing system, which handles inbound purchase documents. The LS Central transaction sending is a thin orchestration layer that sits on top of the existing PEPPOL XML generation helpers shared with the core eMessaging extension.