Qeasy Cloud
Get Started

Authoritative Tutorial on the Kingdee Cloud Skylight Payment Voucher Query Interface (ExecuteBillQuery / AP_PAYBILL)

· Engineering Best Practices· 12 views· 5 min read
Kingdee CloudDingTalk付款单executeBillQuery字段手册Incremental Sync

What This Interface Solves

In Kingdee Cloud Skylight × DingTalk integration scenarios, the payment voucher carries the core role of payables, payment approval, fund flow, and reconciliation. This interface incrementally pulls payment voucher master data (with entry-level details and related modification info) from Kingdee Cloud Skylight into DingTalk or a middle platform, enabling DingTalk approval forms to be linked back to Kingdee vouchers, payables management, financial reconciliation, and fund-flow visualization.

Interface Capability Overview

  • API: ExecuteBillQuery (Kingdee Cloud Skylight universal document query, POST)
  • FormId: AP_PAYBILL (payment voucher form)
  • Strategy type: QUERY (read-only, no writes to target)
  • Primary key field: FPAYBILLENTRY_FEntryID (entry-level PK; metadata id points here)
  • Number field: FBillNo (business number; metadata number points here)
  • Incremental condition: FCreateDate>='{{LAST_SYNC_TIME|dateTime}}' (by creation time)
  • Pagination: Limit (max rows), StartRow (offset), TopRowCount (total returned)
  • Schedule: typically */2 9-23 * * * (every 2 minutes, 09:00–23:00)
  • Authentication: Kingdee Cloud Skylight WebAPI standard auth (account set + user + secret; refer to Kingdee's official protocol)

Typical Field Mapping

FieldTypeMeaningField-Tested Notes
FIDstringVoucher header PKUnique per voucher; one voucher can have many entries
FPAYBILLENTRY_FEntryIDstringEntry PKRow-level unique; metadata id MUST be set here, otherwise incremental sync will duplicate
FBillNostringVoucher numberKey for cross-system matching and DingTalk write-back; metadata number MUST be set here
FDOCUMENTSTATUSstringDocument statusDistinguishes draft/submitted/approved; DingTalk side usually uses this to decide whether to sync
FWRITTENOFFSTATUSstringWrite-off statusProgress of matching against AP invoices; essential for reconciliation
FCancelStatus / FCancellerId / FCancelDatestringCancellation infoConfirm with business whether to sync; usually recommend filtering
FCreateDatestringCreation dateField used for incremental sync; Kingdee may return with milliseconds—unify format before comparing
FModifyDatestringLast modified dateSwitch incremental field to this if you need to capture approval/cancellation changes
FPAYORGID / FSETTLEORGID / FPURCHASEORGIDstringPay/settle/purchase orgsAll are FNumber codes; remember the org dimension during cross-system mapping
FCONTACTUNIT / FCONTACTUNITTYPEstringContact unit & typeUsually the supplier; sync fails if supplier master data is missing
FRECTUNIT / FRECTUNITTYPEstringReceiver unit & typeActual payee, may differ from contact unit
FCURRENCYID / FSETTLECUR / FMAINBOOKIDstringCurrency / settle currency / book currencyIn multi-currency cases, must combine with FEXCHANGERATE, FSETTLERATE, FEXCHANGETYPE for conversion
FPAYTOTALAMOUNTFOR_H / FREALPAYAMOUNTFOR_HstringHeader payable/actual pay (original currency)Business currency; do NOT mix with base-currency amounts
FPAYTOTALAMOUNT_H / FPAYAMOUNT / FREALPAYAMOUNT_HstringHeader payable/pay/actual pay (base currency)Authoritative for financial reporting
FPAYAMOUNTFORstringEntry payment amount (original currency)Row-level amount for entry-level reconciliation
FDATEstringBusiness dateBusiness event date, may be later than FCreateDate
FBookingDatestringExpected payment dateUsed for cash planning and scheduling
FTHIRDBILLNOstringThird-party document numberKey link for DingTalk approval write-back; always carry it in integrations
FWBSETTLENOstringBank settlement numberFor reconciliation and bank-receipt matching
FSOURCESYSTEMstringSource systemMarks the origin (DingTalk, Guanyi, etc.); useful for traceability
FSRCBILLNOstringSource document numberLinks upstream docs (PO invoices, payment requests)
FGYACCOUNTWATERID / FGYSHOPNAME / FGYCUSTOMERIDstringGuanyi integration extension fieldsOnly meaningful in Guanyi e-commerce scenarios
FPRESETTEXT1/2, FPRESETBASE1/2, FPRESETASSISTANT1/2stringExtension fieldsCustomer-specific extensions, enable as needed

How to Configure on Qeasy Cloud

On the Qeasy Cloud Data Integration Platform, this interface is usually built with the Kingdee Cloud Skylight adapter + QUERY strategy combination:

  1. Data source connection: Choose Kingdee Cloud Skylight as the data source in Qeasy Cloud and fill in the connection info such as ACCTID (account set), username, appSecret, and serverUrl (refer to the platform wizard for details).
  2. Strategy type: Create a new strategy and choose QUERY_ONLY, with Kingdee Cloud Skylight as the source and DingTalk (or the platform itself) as the target.
  3. Interface selection: In the adapter dropdown pick ExecuteBillQuery and set FormId to AP_PAYBILL.
  4. Metadata configuration:
    • id field: FPAYBILLENTRY_FEntryID
    • number field: FBillNo
    • Incremental field: FCreateDate, FilterString template: FCreateDate>='{{LAST_SYNC_TIME|dateTime}}'
  5. Field mapping: The Qeasy Cloud field mapper will automatically fetch the field list from metadata; drag Kingdee Fxxx fields onto the target-side conceptual fields like payment_voucher_no, payee_code, etc. In multi-currency scenarios, use the built-in "rate conversion" function.
  6. Scheduling: Set crontab to */2 9-23 * * *; the Qeasy Cloud scheduler picks up the incremental watermark automatically and resumes from breakpoints.
  7. Target write: When syncing to DingTalk, route through DingTalk Approval/Log apps and use FTHIRDBILLNO as the link key to write back to the corresponding approval.

Cross-Scenario Field Notes

  1. id MUST be the entry-level PK: Header FID repeats across entries and breaks incremental sync; only FPAYBILLENTRY_FEntryID guarantees row uniqueness.
  2. FBillNo is the lifeline of cross-system linking: DingTalk approval write-back, reconciliation, and document jump all depend on it—set as number and create a unique index on the target side.
  3. FTHIRDBILLNO is the bridge between Kingdee and DingTalk: DingTalk writes this field after approval, so subsequent Kingdee queries can reverse-link to the approval and close the loop.
  4. Choose between two incremental fields: FCreateDate suits "first full, then new"; FModifyDate suits capturing approvals/cancellations. In real projects we usually run both in parallel—new vouchers via FCreateDate, updates via FModifyDate.
  5. Multi-currency must be handled in pairs: Never mix original-currency (_FOR suffix) with base-currency (_H no-suffix) amounts. Always carry rate fields (FEXCHANGERATE, FSETTLERATE) for cross-currency reconciliation or amounts diverge by orders of magnitude.
  6. Never drop the org dimension: FPAYORGID, FSETTLEORGID, and FPURCHASEORGID are often different (especially in multi-org groups); always filter by pay-org for payable or cash-pooling scenarios.

Pitfall Playbook

  1. Pitfall: Using FID as PK causes duplicate rows—multiple entries share the same FID and are skipped as "already exists." Fix: Change id to FPAYBILLENTRY_FEntryID and add a unique constraint on the target side.
  2. Pitfall: FCreateDate time-zone/format mismatch—Kingdee returns time strings in multiple formats (yyyy-MM-dd HH:mm:ss or with milliseconds), and direct string comparison drops records. Fix: Use the Qeasy Cloud field mapper's dateTime function to normalize to yyyy-MM-dd HH:mm:ss before writing LAST_SYNC_TIME.
  3. Pitfall: Empty FTHIRDBILLNO blocks DingTalk write-back—older vouchers have no third-party number, so DingTalk approvals can't be matched. Fix: On the DingTalk side, fall back to FBillNo first, then try FTHIRDBILLNO; log the null rate so the business can backfill.
  4. Pitfall: Multi-currency reconciliation amounts mismatch—only original OR base currency was synced, and rates were lost. Fix: Sync original, base, and rate fields together; do a "amount × rate" cross-check on the target side.
  5. Pitfall: Cancelled vouchers get pushed out—FCancelStatus='B' vouchers are pushed to DingTalk as normal payments. Fix: Append FCancelStatus<>'B' in FilterString, or filter before writing on the target side.

When to Use

Suits Kingdee Cloud Skylight × DingTalk/Guanyi/custom middleware integration with minute-level incremental sync of payment vouchers and closed-loop linking to external approval/reconciliation systems. Not suitable for write-back into Kingdee (use SaveBill-class interfaces for that), nor for purely non-Kingdee financial system integrations.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/engineering/hb-p2-425-all-9e59

Comments