Pay clinical trial sites without the spreadsheet reconciliation — pull approved payment requests from Veeva Vault CTMS, create journal entries in SAP S/4HANA, and write payout status back as lifecycle transitions. Built on the published accelerator assets; use the clinical analytics plan when the goal is reporting rather than payment.
Tags: life-sciences, pharma, site-payments, clinical-trials, veeva, sap, payments
Site Payment Modernization: Veeva CTMS to SAP S/4HANA
Objective: Automate paying sites for the services they deliver during a trial, turning approved payment requests in Veeva Vault CTMS into journal entries in SAP S/4HANA and reflecting the payout back in Vault. Sites that get paid predictably stay engaged, and sponsors stop reconciling payment status by hand. This is use case 2 of the MuleSoft Accelerator for Life Sciences.
What's Getting Built
- Site Payments (Process API) — orchestrates approved Veeva CTMS payment requests into SAP journal entries and writes payout status back to Vault ·
ORCHESTRATE extract and post journal entry, ORCHESTRATE reconcile cleared payout to Vault lifecycle
- Veeva CTMS (System API) — retrieves Ready for Payment requests via VQL and advances Vault lifecycle state with payment details via REST ·
VQL GET payment requests where state=Ready for Payment, PATCH /payment-requests/{id}/lifecycle
- SAP Accounts Payable (System API) — posts journal entries and reads clearing status from S/4HANA Cloud ·
POST /journalEntries, GET /operationalJournalEntryItems?clearedSince={watermark}
- Payment extraction and posting (Scheduler) — polls for requests in Ready for Payment and posts one idempotent journal entry each ·
SCHEDULER poll Ready for Payment
- Payout reconciliation (Scheduler) — polls cleared entries and completes the Vault request with payment date and reference ·
SCHEDULER poll cleared payouts
- cleared-since watermark (Object Store) — persists the last cleared-since timestamp so the payout poller resumes without gaps ·
STORE cleared-since watermark, RETRIEVE cleared-since watermark
Value chain phase
Phase 02 — Clinical Development. Phases I–III testing on human subjects to ensure safety and efficacy.
- Scope of this plan: The financial half of clinical operations — payable items and payment requests moving from CTMS to the finance ledger and back.
- Data in this phase: Electronic Data Capture (EDC), Clinical Trial Management Systems (CTMS), and EHR.
- Receives from: Phase 01 — Research & Discovery.
- Hands off to: Phase 03 — Regulatory & Compliance.
Prerequisites
- Anypoint Platform org with API Manager and a non-production deployment target.
- Secrets Manager or secure properties configured for every regulated system credential.
- Named validation owner — GxP flows need a change-control path agreed before the first deployment.
- MuleSoft Accelerator for Life Sciences assets imported from Exchange for this use case.
- Veeva Vault CTMS with the Vault Payments application configured — fee schedules, payable items, and payment requests.
- SAP S/4HANA Cloud with the Journal Entry and Operational Journal Entry Item APIs enabled and a service user provisioned.
- Agreement from finance on company code, cost center, and account determination for site payments.
Source system notes
Veeva Vault CTMS
- Vault Connector VQL capabilities retrieve payment requests; REST capabilities write lifecycle state and payment details back.
- The payment request ID (
payment__v.id) must be 16 characters or fewer — SAP limits the external DocumentReferenceId it maps to.
- Lifecycle states drive the whole flow:
Ready for Payment in, Extracted for Payment after posting, Payment Completed after clearing.
SAP S/4HANA Cloud
- Post with the Journal Entry API and read clearing status with the Operational Journal Entry Item API.
- Confirm account determination with finance before go-live — a posting that lands in the wrong account is harder to unwind than one that fails.
Architecture
1. Business requirements
- Pay sites for delivered services without manual tracking or spreadsheet reconciliation.
- Keep trial operations and finance working from the same payment status.
- Make payment timeliness a competitive advantage when contracting with top sites.
- Leave an audit trail linking every payout to the payable items that justified it.
2. Payment request extraction
- Poll on a schedule for payment requests in
Ready for Payment, driven by VQL rather than a full object scan.
- Validate that each request carries the site, study, currency, and amount finance needs before posting.
- Reject requests whose ID exceeds the 16-character SAP external reference limit, with a clear operator message.
- Group or split requests to match how finance expects journal entries per site and period.
3. Journal entry creation
- Create one journal entry per payment request through the S/4HANA Journal Entry API.
- Carry the Vault payment request ID as the document reference so the two systems stay joinable.
- Advance the Vault lifecycle to
Extracted for Payment only after SAP confirms the posting.
- Make posting idempotent — a retried request must not create a second journal entry.
4. Payout reconciliation
- Poll the Operational Journal Entry Item API on a schedule for entries cleared since the last run.
- Write payment date, amount, and reference back to Vault and advance the lifecycle to
Payment Completed.
- Flag payments cleared in SAP with no matching Vault request for finance review.
- Report on requests stuck in
Extracted for Payment beyond the expected clearing window.
5. Security and GxP compliance
- Validate the integration under GAMP 5 — requirements, design, IQ/OQ/PQ evidence, and a traceability matrix retained for inspection.
- Meet 21 CFR Part 11 and EU Annex 11 for electronic records and signatures on every GxP-relevant flow.
- Preserve ALCOA+ data integrity — attributable, legible, contemporaneous, original, and accurate — with audit trails no operator can edit.
- Encrypt regulated data in transit and at rest, and keep production payload visibility to validated support roles only.
- Treat a mapping change on a GxP flow as a controlled change under change management, never as a hotfix.
- Site payments touch financial controls as well as clinical ones — align approval and segregation of duties with SOX expectations.
- Never write payment amounts back into Vault from anywhere but the confirmed SAP clearing record.
For pre-built API specifications, implementation templates, and reference architecture, see the MuleSoft Accelerator for Life Sciences on Anypoint Exchange.
Exchange assets
Import these from the MuleSoft Accelerator for Life Sciences use-case page on Anypoint Exchange:
| Asset |
Includes |
| Veeva CTMS System API |
API specification, Implementation Template |
| SAP Accounts Payable System API |
API specification, Implementation Template |
| Site Payments Process API |
Implementation Template |
Sample payload — Payment request ready for posting
{
"paymentRequestId": "V0P00000001842",
"studyId": "STU-2026-0142",
"site": { "siteId": "SITE-00871", "name": "Mythical Research Clinic", "vendorId": "0001099238" },
"currency": "USD",
"totalAmount": 18450.00,
"payableItems": [
{ "itemId": "PI-0099121", "description": "Subject visit 3 - 12 subjects", "amount": 14400.00 },
{ "itemId": "PI-0099122", "description": "Startup fee - milestone 2", "amount": 4050.00 }
],
"lifecycleState": "Ready for Payment"
}
Testing and validation
- Approve a test payment request in Vault and confirm a matching journal entry appears in S/4HANA with the request ID as document reference.
- Verify the Vault lifecycle advances to
Extracted for Payment only after SAP confirms, not before.
- Clear the entry in SAP, run the payout poller, and confirm Vault shows
Payment Completed with payment date and reference.
- Replay the extraction run and confirm no duplicate journal entry is created.
- Submit a request with a 17-character ID and confirm it is rejected with an actionable message rather than failing inside SAP.
Phased rollout
Phase 1 — Connect
- Deploy the Veeva CTMS and SAP Accounts Payable System APIs against sandbox tenants.
- Agree account determination and company code mapping with finance before the first posting.
Phase 2 — Map and validate
- Run one study's payments end to end in a non-production environment, including the payout write-back.
- Complete the duplicate-posting and rejection tests with finance and clinical operations observing.
Phase 3 — Production
- Go live study by study, keeping the manual process available for one payment cycle as a fallback.
- Move stuck-payment reporting into finance operations with an owner and a review cadence.
Success metrics
- Site payment cycle time from
Ready for Payment to Payment Completed reduced against the manual baseline.
- Zero duplicate journal entries for a single payment request.
- Manual reconciliation effort per payment cycle reduced to exception handling only.
- Payment requests stuck beyond the clearing window trending to zero.
Troubleshooting
- SAP rejects the posting on document reference — Likely cause: the Vault payment request ID exceeds SAP's 16-character external reference limit. Fix: Validate ID length before posting and align the Vault ID scheme with the SAP constraint.
- Duplicate journal entries after a failed run — Likely cause: the lifecycle state was advanced after posting, so a retry re-selected the same request. Fix: Key posting idempotency on the payment request ID and check SAP for an existing document before creating one.
- Vault shows
Extracted for Payment indefinitely — Likely cause: the payout poller is filtering on a clearing date range that never matches. Fix: Poll on cleared-since watermark stored in Object Store and widen the initial window for backfill.
- Payment appears in SAP with no Vault counterpart — Likely cause: a manual finance posting outside the integration. Fix: Report unmatched clearings to finance rather than forcing a Vault record to exist.
Implementation starting point
Download the Site payment modernization assets from the MuleSoft Accelerator for Life Sciences on Anypoint Exchange and build from those templates.
Deploy the Veeva CTMS System API and SAP Accounts Payable System API implementation templates, then the Site Payments Process API that orchestrates between them.
Configure the two schedulers: one to extract payment requests in Ready for Payment and post journal entries, one to retrieve cleared payouts and complete the request.
Map company code, cost center, and account determination to your finance configuration, and keep the accelerator's lifecycle state transitions intact.
Deliverable: A scheduled, idempotent integration turning approved Veeva Vault CTMS payment requests into SAP S/4HANA journal entries, with payout status written back as Vault lifecycle transitions.