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:

SettingLocationPurpose
Send Transactions to Centara = enabledSales & Receivables Setup → Centara eMessaging for LS Central sectionActivates the automatic flow
Web Service URLCentara Wise Courier SetupEndpoint for submitting the PEPPOL document
Document Sending Profile = COURIERPEPPOLCustomer CardTells the system this customer should receive PEPPOL documents automatically
Post as Shipment = falseLSC Transaction HeaderTransactions 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:

  1. Guard: document type — exits immediately for anything other than Invoice or Credit Memo
  2. Validate Document No. — raises an error if blank
  3. Validate Centara setup — reads and validates the Web Service URL; raises an error if not configured
  4. Parse Document No. — splits on - to extract Store No., POS Terminal, and Transaction No.
  5. Look up the TransactionLSC Transaction Header.Get(StoreNo, PosTerminal, TransActionNo)
  6. Validate Post as Shipment = false — prevents invoicing of shipment-posted transactions
  7. Create the outbound message record — calls RSMSTADataGenerationLogic.InsertDocumentMessage with direction Outbound and type PeppolOutboundDocument, using the Transaction Header’s RecordId, Receipt No., and Date
  8. 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
  9. Generate the PEPPOL XML via XMLport:
    • Invoice: CTALSC Transaction Invoice — exports against the LSC Transaction Header, sets InvoiceTypeCode = 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, sets CreditNoteTypeCode = 381
    • Both XMLports produce valid UBL 2.x XML (namespaces for Invoice-2 and CreditNote-2 respectively)
  10. Encode and attach — converts the XML stream to Base64 and attaches it to the message via RSMSTADataGenerationLogic.AddMessageAttachment
  11. Submit to Centara — calls AddDataToWiseCourier to write the message, attachment, and receiver records into the Centara message tables
  12. Update Transaction Header — sets CTALSC E-Document StatusWaiting to be sent

Status tracking

Three fields are added to LSC Transaction Header and shown on the Transaction Card:

FieldDescription
E-Document StatusCurrent state in the PEPPOL lifecycle (Waiting to be sent → Sent to receiver). Clicking it opens the document in the Centara service portal.
Identifier in CentaraThe unique document ID assigned by the Centara/WiseCourier platform after submission
Sent to Centara OnTimestamp 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.