How to Use

This tool generates PDF documents from your SAP Business One data. Here's how each document type works.

Sales Order PDF

Generates a sales order document by selecting a customer and adding items from the SAP catalog.

  1. Select Sales Order as the document type
  2. Choose a Customer from the list (pulled from SAP Business Partners)
  3. Search the SAP item catalog and add items to your order — adjust quantities and prices as needed
  4. Click Download PDF to save locally, or Send via Email to trigger the P2P automation

When sent via email, the subject line contains Purchase Order [SO Number] which matches OrderFlow AI's Gmail webhook pattern for customer purchase orders.

Vendor Invoice PDF

Generates a vendor invoice that exactly matches a Purchase Order's line items. This ensures the 3-way match validation in OrderFlow AI passes (PO vs Goods Receipt vs Vendor Invoice).

  1. Select Vendor Invoice as the document type
  2. Choose a Supplier from the list
  3. Select the Purchase Order you want to invoice against
  4. Review the line items — they are pulled directly from the PO to guarantee a match
  5. Click Download PDF to save locally, or Send via Email to trigger the P2P automation

Quick Generate

Use the /generate page to skip the selection flow and enter a document number directly. This is useful when you already know the PO or SO number.

Email Sending (P2P Automation)

When you send a vendor invoice via email, it uses the subject line format PO #XXXX Invoice which matches the Gmail webhook pattern in OrderFlow AI. This triggers the automated P2P flow:

  1. Email arrives in the monitored Gmail inbox
  2. OrderFlow AI's Gmail webhook detects the invoice email
  3. The vendor invoice PDF is extracted and matched to the Purchase Order
  4. A Goods Receipt is created in SAP
  5. 3-way match validation runs (PO vs GR vs Invoice)
  6. An AP Invoice is created in SAP
  7. The P2P chain moves to COMPLETED

Configuration

The following environment variables must be configured in .env.local:

VariableDescription
SAP_BASE_URLSAP B1 Service Layer URL
SAP_COMPANY_DBSAP company database name
SAP_USERNAMESAP login username
SAP_PASSWORDSAP login password
SMTP_HOSTSMTP server host (e.g. smtp.gmail.com)
SMTP_PORTSMTP port (e.g. 587)
SMTP_USERSMTP username / email
SMTP_PASSSMTP password or app password
RECIPIENT_EMAILDefault recipient (OrderFlow AI monitored inbox)
COMPANY_NAMEYour company name for "Bill To" section
COMPANY_ADDRESSCompany street address
COMPANY_CITYCompany city and postcode
COMPANY_VATCompany VAT number