ml-connector
SAP ECCAvalara

SAP ECC and Avalara integration

SAP ECC manages procurement, sales, and finance across company codes and plant locations. Avalara calculates sales and use tax for every transaction across jurisdictions in real-time. Connecting them ensures every purchase order and sales transaction in SAP ECC is validated for tax compliance as soon as it is posted, and tax amounts determined by Avalara flow back into SAP ECC's general ledger without manual re-entry. Sales tax reporting becomes automated, and tax determinations are auditable across both systems.

How SAP ECC works

SAP ECC exposes vendors, customers, purchase orders, sales orders, general ledger accounts, and cost centers through RFC BAPI function modules (such as BAPI_VENDOR_GETLIST, BAPI_PO_CREATE1, BAPI_ACC_DOCUMENT_POST), OData v2 REST via SAP Gateway (at http://<host>:<port>/sap/opu/odata/<namespace>/<service>/), and IDoc XML. Authentication is HTTP Basic Auth (username and password) for OData and IDoc delivery, or RFC Basic Auth for BAPI calls via the SAP .NET Connector or Java Connector running on a customer-managed on-premises agent. Because SAP ECC is on-premises, RFC and BAPI calls cannot originate directly from the cloud and require the agent to run on the customer network. OData services must be manually activated by the SAP Basis team via transaction SICF and are not active by default. Write operations require an explicit BAPI_TRANSACTION_COMMIT call or the document remains locked. IDoc HTTP delivery has no webhook signature verification. SAP ECC polling uses RFC_READ_TABLE on demand or a scheduled interval, and IDoc push is available if the customer configures WE21/WE20 ports in SAP Basis.

How Avalara works

Avalara exposes transactions, companies, customers, tax codes, certificates, and addresses through REST at https://rest.avatax.com/api/v2 (or sandbox at https://sandbox-rest.avatax.com/api/v2). Authentication is HTTP Basic Auth with a base64-encoded Account ID and License Key (recommended for connectors and does not expire on password change) or Username and Password (user-specific and breaks on password reset). Avalara operates pull-only with no push webhooks or outbound callbacks. The CreateTransaction endpoint accepts a transaction for tax calculation and returns the calculated tax amount inline in the response. The document code acts as an idempotency key, and reusing a committed transaction code returns a DocumentCodeConflict error. Committed transactions are irreversible; they must be voided and recreated or adjusted with refund operations. Rate limits are enforced with HTTP 429 responses; exact thresholds are not publicly disclosed and Retry-After headers are not documented. Invalid addresses cause tax calculation to fail and must be pre-validated with the /addresses/resolve endpoint.

What moves between them

Purchase orders and sales transactions flow from SAP ECC into Avalara. When a PO is created in SAP ECC, ml-connector extracts the line items, ship-to and bill-to addresses, vendor or customer reference, and posts them as a transaction to Avalara for tax determination. Avalara calculates the applicable sales or use tax across all relevant jurisdictions and returns the total tax amount. ml-connector then posts the tax impact into SAP ECC's general ledger via BAPI_ACC_DOCUMENT_POST, allocating the tax debit or credit to the cost center and GL account derived from the PO. Monthly or on-demand, ml-connector also polls Avalara's transaction list to detect any adjustments or voids made in Avalara itself and reconciles them back into SAP ECC as correcting entries. Reference data such as SAP company codes, plant locations, and cost centers are mapped to Avalara company IDs upfront so tax postings land on the correct GL dimensions.

How ml-connector handles it

ml-connector maintains an RFC connection pool to the on-premises SAP agent with retry logic for COMMUNICATION_FAILURE and SYSTEM_FAILURE exceptions. It caches Avalara credentials as Account ID and License Key in encrypted storage and presents them as HTTP Basic Auth on every REST call. When a PO is created in SAP ECC, ml-connector pulls the full document via BAPI_PO_GETDETAIL1, extracts line-item tax category codes, and validates the ship-to address with Avalara's /addresses/resolve endpoint before submitting to CreateTransaction. Avalara responds with calculated tax by jurisdiction, and ml-connector detects duplicate POs using SAP ECC's REF_DOC_NO field to prevent double-posting on retry. The tax total is then posted into SAP ECC's general ledger as a compound line-item journal via BAPI_ACC_DOCUMENT_POST, followed by an explicit BAPI_TRANSACTION_COMMIT to lock the entry. Because Avalara has no push webhooks, ml-connector polls Avalara's transaction list on a weekly or monthly schedule tied to the customer's close calendar. If Avalara shows a void or adjustment not yet reflected in SAP ECC (detected by comparing document codes and amounts), ml-connector posts a correcting entry into SAP ECC's GL. Rate-limit 429 responses trigger exponential backoff with jitter, and the request is retried up to three times. Address pre-validation failures are logged and do not block the flow; the operator is alerted to fix the address in SAP ECC and resubmit the PO. Every transaction carries a full audit trail in ml-connector including the PO number, Avalara transaction ID, tax calculation timestamp, and GL document number.

A real-world example

A multi-national manufacturing company with operations in seven U.S. states uses SAP ECC for procurement and order-to-cash. Before integration, the tax team manually reviewed purchase orders for applicability to each state, pulled tax rates from tax software, and re-entered the calculated tax into SAP ECC's GL after each month's close. Results were inconsistent; some POs were missed, rates drifted out of sync when state rules changed mid-month, and reconciliation took weeks. With SAP ECC and Avalara connected, every PO is automatically evaluated by Avalara's real-time tax engine at the moment it is posted in SAP ECC. Tax calculations are logged instantly into the GL by plant and cost center, and the monthly reconciliation report matches Avalara's transaction log directly. The tax team now focuses on exception handling and reporting, not data re-entry.

What you can do

  • Post purchase orders from SAP ECC to Avalara for real-time sales and use tax calculation across all jurisdictions.
  • Write calculated tax amounts back into SAP ECC's general ledger allocated to the correct cost center and GL account per PO.
  • Validate ship-to and bill-to addresses with Avalara before tax calculation to prevent failures and ensure accuracy.
  • Detect duplicate transactions using SAP ECC's REF_DOC_NO field and retry without double-posting into Avalara or the GL.
  • Reconcile Avalara adjustments and voids back into SAP ECC on a schedule and maintain a complete audit trail of every transaction.

Questions

How does ml-connector handle the on-premises requirement of SAP ECC?
ml-connector connects to SAP ECC through the customer-managed RFC agent (SAP .NET Connector or Java Connector) running on the on-premises network. It pools RFC connections with retry logic for transport failures and refreshes OData bearer tokens on 401 errors. The agent must have network access to both SAP ECC and the internet so ml-connector can reach Avalara's REST endpoint.
What happens if an address in a SAP ECC PO fails Avalara's validation?
ml-connector pre-validates the ship-to and bill-to address with Avalara's /addresses/resolve endpoint before submitting the transaction for tax calculation. If validation fails, the error is logged and the operator is alerted to correct the address in SAP ECC and resubmit the PO. Address validation failures do not block other transactions in the flow.
How does ml-connector prevent duplicate tax posts in Avalara and SAP ECC?
ml-connector uses SAP ECC's REF_DOC_NO field to detect duplicate POs on retry. Before posting to Avalara, it checks if the transaction has already been submitted and committed; if so, it retrieves the prior Avalara response instead of resubmitting. Avalara's document code acts as a second idempotency key; reusing a committed code returns DocumentCodeConflict, which ml-connector catches and treats as success on retry.

Related integrations

Connect SAP ECC and Avalara

Free to use. Add your credentials, ping your real systems, and see if we fit.

Get started