How to Use
Sales Order PDF
Generates a sales order document by selecting a customer and adding items from the SAP catalog.
- Select Sales Order as the document type
- Choose a Customer from the list (pulled from SAP Business Partners)
- Search the SAP item catalog and add items to your order — adjust quantities and prices as needed
- 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).
- Select Vendor Invoice as the document type
- Choose a Supplier from the list
- Select the Purchase Order you want to invoice against
- Review the line items — they are pulled directly from the PO to guarantee a match
- 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:
- Email arrives in the monitored Gmail inbox
- OrderFlow AI's Gmail webhook detects the invoice email
- The vendor invoice PDF is extracted and matched to the Purchase Order
- A Goods Receipt is created in SAP
- 3-way match validation runs (PO vs GR vs Invoice)
- An AP Invoice is created in SAP
- The P2P chain moves to COMPLETED
Configuration
The following environment variables must be configured in .env.local:
| Variable | Description |
|---|---|
| SAP_BASE_URL | SAP B1 Service Layer URL |
| SAP_COMPANY_DB | SAP company database name |
| SAP_USERNAME | SAP login username |
| SAP_PASSWORD | SAP login password |
| SMTP_HOST | SMTP server host (e.g. smtp.gmail.com) |
| SMTP_PORT | SMTP port (e.g. 587) |
| SMTP_USER | SMTP username / email |
| SMTP_PASS | SMTP password or app password |
| RECIPIENT_EMAIL | Default recipient (OrderFlow AI monitored inbox) |
| COMPANY_NAME | Your company name for "Bill To" section |
| COMPANY_ADDRESS | Company street address |
| COMPANY_CITY | Company city and postcode |
| COMPANY_VAT | Company VAT number |