Guide for SAP Business One consultants
How to schedule Crystal Reports layouts from SAP Business One
Where the layouts live, which parameters the SAP Business One client fills behind your back, the object types that turn a document layout into a scheduled invoice run, what runtime renders outside the client, and the layouts that cannot leave it.
1. Why the layouts you already have are the right starting point
Most SAP Business One sites spent real money on Crystal Reports layouts: the invoice with the company's logo and legal footer, the statement of account the auditors are used to, the delivery note with the barcode. They print well from the client, and that is the problem: they print only from the client. Someone has to open the document, choose the layout, print to PDF and attach it. Scheduling means running the same .rpt file on a server, with the same parameters the client would have passed, and producing the same page.
That is possible, and it is not magic, but it depends on understanding three things about how SAP Business One uses Crystal: where it stores the layouts, how it fills the parameters, and which layouts depend on the client itself.
2. Where the layouts live: the RDOC table
Since release 8.8, Crystal layouts and reports imported through Administration › Setup › General › Report and Layout Manager are stored inside the company database, not on disk. The table is RDOC: one row per layout or standalone report, with the report file itself as a binary column, the name, the type (document layout or standalone report) and the author; the links between a layout and a document type live in RITM, and the default layout per document type and user is recorded there too. Two consequences:
- The authoritative copy of a layout is in the database. An
.rpton a consultant's laptop may be an older version; a server that reads the layout fromRDOCalways renders what the client prints. - Layouts change when someone imports a new version. A scheduler must notice (compare the stored row, not the name) and refresh its copy.
Standalone reports (the ones in the Reports menu, including the user-added Crystal reports) are rows of the same table with a different type. They take ordinary parameters and are the easiest to schedule.
3. The decorated parameters SAP Business One fills
Open a document layout in the Crystal designer and the parameter list shows names that end in @. They are SAP Business One's convention: the client recognises the suffix and fills the value at print time, so the user never sees a prompt. Outside the client, something else has to fill them.
| Parameter | Meaning | Who fills it on a server |
|---|---|---|
DocKey@ | The DocEntry of the document to print | The scheduler, from the document the run is about |
ObjectId@ | The object type of the document (see below) | A constant per layout, or the scheduler |
Schema@ | The company database (schema on HANA) | The scheduler, from the company connection |
UserCode@, PrintByUserName@ | The printing user, for "printed by" footers | The scheduler, with a service user |
ExtParam@, Package@ | Extra context passed by the client | The scheduler, empty or a fixed value |
Name@SELECT …, …@JOINFROM | Dynamic lists and join conditions; the text after @ is a query the client runs to build a dropdown | The scheduler maps the parameter by its short name and supplies the chosen value |
A document layout is therefore a report with two inputs: which document, and what kind. The second is the object type that SAP Business One uses everywhere (in JDT1.TransType, in the SDK, in the Service Layer):
| ObjectId@ | Document | Header table |
|---|---|---|
| 13 | AR invoice | OINV |
| 14 | AR credit memo | ORIN |
| 15 | Delivery | ODLN |
| 17 | Sales order | ORDR |
| 18 | AP invoice | OPCH |
| 22 | Purchase order | OPOR |
| 24 | Incoming payment | ORCT |
With these two values set, the standard AR Invoice (Item) layout renders the invoice with its lines, totals and subreports exactly as the client would. To schedule "every invoice posted yesterday", the loop is a query over OINV (DocDate = yesterday, CANCELED = 'N') that yields one DocEntry and one recipient per row, and the layout is run once per row with DocKey@ bound to that entry and ObjectId@ fixed to 13.
4. What renders the layout on a server
Crystal Reports for SAP Business One is rendered by the SAP Crystal Reports runtime for .NET Framework, version 13.0, which SAP distributes as a 32-bit and a 64-bit MSI and updates in service packs. The runtime is a .NET Framework 4.x component; it does not run on modern .NET, so a server-side scheduler built on .NET 8 or later needs a separate .NET Framework process that loads the runtime and talks to the scheduler. Four practical rules:
- Bitness. The process must match the installed runtime: a 64-bit runtime needs a 64-bit host, a 32-bit runtime a 32-bit host. Installing both on one server causes more trouble than it solves.
- Service pack. Each service pack carries its own assembly version. A host bound to one exact version breaks when the customer updates the runtime; bind to whatever version is registered.
- Database logon. The layout's data source was saved by the designer. At run time the connection must be replaced with the company's own (HANA ODBC or SQL Server), with the read-only user, on every table and subreport.
- Export formats. The runtime exports PDF, Excel as printed (page-based
.xlsx), Excel data only (record-based.xlsx), Excel 97-2003 and CSV. Older service packs lack the record-based Excel export; the fallback has to be explicit.
The runtime needs no SAP Business One licence of its own, but it is SAP's software: the customer installs it from the SAP portal and accepts SAP's terms for it.
5. Layouts that cannot leave the client
Some layouts depend on the client itself. The system reports that SAP Business One feeds from its print proxy, recognisable by data sources named PLD__ITEMS or similar, receive their rows from the client process rather than from the database; they render as empty pages anywhere else. The same applies to layouts that read a temporary result table the client populates right before printing. The test is simple: open the layout in the Crystal designer, look at the Database Expert, and if every table is a real SAP Business One table or view the layout can be scheduled.
Add-on layouts that call a user-defined function or a stored procedure work as long as the read-only user may execute it, and layouts with external images need the image path reachable from the server.
6. Checklist for the first scheduled layout
- The layout exists in Report and Layout Manager, and the server reads it from the company rather than from a file copy.
- Every parameter is accounted for: mapped to a variable, fixed to a literal, or filled by the engine.
ObjectId@is set for document layouts. - The loop query returns the documents you expect and no cancelled ones; the first run goes to an internal mailbox.
- The Crystal runtime on the server matches the host's bitness, and the service account can read the layout cache folder.
- The company connection uses a read-only user, also inside the subreports.
- A rendered PDF is compared page by page with the client's print of the same document.
- The formats a schedule asks for are formats the installed runtime can produce, or the fallback is understood.
7. How CertiReport does it
CertiReport's Crystal sidecar, CertiReport.CrystalHost, is a .NET Framework 4.8 process built as x64 and x86. It renders layouts through whichever SAP Crystal Reports runtime for .NET Framework is installed on the engine server, 32-bit or 64-bit, any 13.0 service pack, binding to the registered assembly version at run time; the engine picks the executable that matches. The feature is optional and offered by the setup only when SAP's runtime is registered.
Layouts come from an .rpt file on the server or straight from the company's RDOC table, standalone reports and document layouts alike, cached until they change in SAP Business One. The report designer reads a layout's parameters and shows which are mapped, which the engine fills (Schema@, UserCode@, PrintByUserName@, ExtParam@, Package@ and @JOINFROM conditions) and which still need a mapping. The map takes Parameter=Variable, Parameter="literal" or Parameter=From..To for ranges, and a decorated name such as Items@Select * from OITM is reachable as Items. A document run is a report with a dataset over OINV, a variable DocEntry and the map DocKey@=DocEntry, ObjectId@="13"; the schedule iterates over the documents. One sidecar run per layout produces every format the schedule asks for: PDF, Excel as printed, Excel data only, Excel 97-2003 and CSV, with a runtime that lacks a format getting the closest one and a note in the run warnings. Layouts fed by the print proxy are the one thing it does not do. See the Crystal Reports section of the features or book a demo with one of your layouts.
References
- SAP Business One: How to Work with Crystal Reports (Report and Layout Manager, parameter tokens)
- SAP Business One SDK help: object types (BoObjectTypes) and the RDOC / RITM tables
- SAP Crystal Reports, developer version for Microsoft Visual Studio: runtime redistribution and supported platforms