VAT Statement XML Generation & Archiving
Automated extraction, formatting, XML generation, validation, and ERP document archiving for Swedish VAT (MomsDek) reporting, triggered by GL04 execution.
Key APIs used
GET /v1/objects/companies?select=companyId,companyName– Retrieve ERP companies to identify the legal entity for which the VAT automation must run.GET /v2/objects/document-types?companyId={companyId}&filter=documentType eq '{documentType}' and status eq 'N'&select=documentType,status&limit=1– Validate that the configured document type exists and is active.GET /v1/objects/report-variants?companyId={companyId}&filter=reportName eq 'GL04' and variant eq {variantId}– Validate that the GL04 report variant parameter is valid and configured in ERPx.GET /v1/objects/vat-statements?companyId={companyId}&filter=batchId eq '{batchId}'&select=amountType,batchId,companyId,repCurrency,repPeriod,statementInformation(*)&orderBy=statementInformation/groupNumber asc– Retrieve VAT statement transaction data for the specific GL04 batch.GET /v1/companies/{companyId}– Retrieve company-level master data used for file naming and XML context.POST /v1/documents– Store the generated Swedish VAT XML file into ERPx Document Archive together with all the required metadata.
Integration workflow
sequenceDiagram
participant ERP as ERPx APIs
participant EIT as Integration/Extension Toolkit
Note over ERP,EIT: Trigger: GL04 VAT Statement executed with "Execute Updating" enabled
ERP->>EIT: 1. GL04 execution event (companyId, batchId, variantId)
EIT->>ERP: 2. GET /v1/objects/companies
ERP-->>EIT: Company information
EIT->>ERP: 3. GET /v2/objects/document-types
ERP-->>EIT: Document type validation
EIT->>ERP: 4. GET /v1/objects/report-variants
ERP-->>EIT: Variant exists or is invalid
EIT->>ERP: 5. GET /v1/objects/vat-statements (filtered by batchId)
ERP-->>EIT: VAT transaction data set
EIT->>ERP: 6. GET /v1/companies/{companyId}
ERP-->>EIT: Company master data (used for XML + filename)
Note over EIT: Transform VAT statement data → XML format
EIT->>ERP: 7. POST /v1/documents (XML + metadata)
ERP-->>EIT: File stored successfully
Note over ERP,EIT: Result: XML file archived with traceable naming and metadataQuick links
For detailed API specifications, request/response formats, and authentication details, refer to:
- Documents, Object - report variant and Companies. - Complete API reference with request schemas.
- Events - Documentation on events that initiate processes during record creation in the ERPx.
- Authentication & Security - Setup and security configuration.
- Limits and quotas - All available settings and options.
- Error Handling - Troubleshooting common issues and error codes.