remote_id)GOAL stores SAP Business One DocEntry on local master rows as remote_id so sync survives code changes in the ERP (ItemCode on OITM, CardCode on OCRD).
| GOAL table | SAP table | ERP code field | Stable key (remote_id) |
|---|---|---|---|
products |
OITM |
ItemCode → products.code |
DocEntry |
business_partners |
OCRD |
CardCode → business_partners.code |
DocEntry |
Database: nullable integer remote_id, unique on (company_id, remote_id) (multiple NULL allowed in PostgreSQL).
For every sync operation:
code = ItemCode or CardCode).remote_id = DocEntry.On success, refresh code (and role codes for partners) from SAP.
| Component | Path / command |
|---|---|
| Canonical action | Domain\Inventory\Master\Product\SyncProductAction |
| Resolver | Domain\Inventory\Master\Product\ResolveProductForSapSyncAction |
| Migration queue | Domain\Sync\Master\ImportProductFromSAPAction → delegates to sync action |
| Change queue job | App\Jobs\SB1\Sync\ProductSyncJob (oitm) |
| Bulk / single CLI | php artisan goal:products:sync-from-sap --company={id} [--code=…] [--offset] [--limit] |
| Per-product CLI | php artisan goal:products sync --company={id} --product={code} |
| REST | POST /v1/inventory/product/products/{id}/sync-product?companyId= |
Mapping: DocEntry → remote_id in UseProducts traits (mapChangesProduct) and SAPProduct::forImport.
See Inventory Products API and CLI catalog.
| Component | Path / command |
|---|---|
| Canonical action | Domain\Base\BusinessPartner\SyncBusinessPartnerFromSapAction |
| Resolver | Domain\Base\BusinessPartner\ResolveBusinessPartnerForSapSyncAction |
| Single import facade | Domain\Base\BusinessPartner\ImportFromSAPAction → delegates to sync action |
| Migration queue | Domain\Sync\Base\ImportBusinessPartnerFromSapAction (dw.dbo.partners_migration) |
| Change queue job | App\Jobs\SB1\Sync\BusinessPartnerSyncJob (ocrd) |
| Bulk / single CLI | php artisan goal:business-partners:sync-from-sap --company={id} [--code=…] [--card-type=C|S|L] [--offset] [--limit] |
| Customers only (legacy) | php artisan goal:sync bps --company={id} → ImporAllCustomerFromSAPAction (CardType = C) |
| REST | GET /v1/base/business-partners/{id}/import-from-sap?companyId= |
Mapping: DocEntry → remote_id, CardCode → code / customer_code in UseBusinessPartner traits (mapChangesBusinessPartner). Adapter helper: listOcrdCardCodes(?cardType, offset, limit).
CardCode rename: sync updates code, customer_code / vendor_code as applicable and relinks address station_code / business_partner_code.
See Business Partners API and CLI catalog.
remote_id on products and business_partners.id should update.SB1SynchronizationProfile / SapSyncService (other entities; separate from this DocEntry pattern)