Price List Data Synchronization
Documentation for the intelligent price list generation and synchronization between KDL and SAT systems
Price List Data Synchronization
The price list synchronization ensures that SAT receives transformed, deduplicated, and intelligently grouped price lists based on customer buying groups and business rules, rather than simple direct exports from KDL.
SAT's price list scheduler then runs every five minutes and pulls the newly generated pricelists from KDL to SAT through the API api/sap/pull-pricelist
Overview
This scheduled integration point runs twice daily (11:00 and 16:00), generating comprehensive price lists that are constructed according to customer buying groups, checked for duplicates, and enhanced with product details including alternate units of measure.
Technical Details
Code Location
- Scheduled Command:
sat-pull:populate-new-price-list - Registration:
app/Console/Kernel.php - Controller:
NewPriceListController.php - Key Methods:
populatePriceList: Generates price list combinationsgetPriceListWithProducts: Enriches with product details
Execution Schedule
// Laravel Scheduler - twice daily
$schedule->command('sat-pull:populate-new-price-list')->twiceDaily(11, 16);Primary Tables
- Core:
ArCustomer,NewPricelist,NewPricelistGroup - Linking:
customer_price_list - Product Data:
InvMaster,SorContractPrice - Configuration:
buying_groups
Price List Generation Process
1. Customer Analysis
For each customer, the system analyzes buying group configurations:
// Example customer buying groups
$customer = [
'BuyingGroup1' => 'RETAIL',
'BuyingGroup2' => 'WHOLESALE',
'BuyingGroup3' => null,
'BuyingGroup4' => 'PROMO',
'BuyingGroup5' => null
];2. Combination Generation
All possible price list combinations are generated from non-null buying groups:
// Generated combinations for above customer
$combinations = [
['RETAIL'],
['WHOLESALE'],
['PROMO'],
['RETAIL', 'WHOLESALE'],
['RETAIL', 'PROMO'],
['WHOLESALE', 'PROMO'],
['RETAIL', 'WHOLESALE', 'PROMO']
];3. Deduplication & Naming
// Price list naming convention
$pricelistName = implode('-', $buyingGroups);
// Example: "RETAIL-WHOLESALE-PROMO"
// Check for existing price lists to avoid duplicates
$existing = NewPricelist::where('pricelist_name', $pricelistName)->first();4. Customer Assignment
// Update customer with new price list code
$customer->update([
'SATPriceList' => $newPricelist->price_list_id,
'SAT_SYNC' => 'Y'
]);Data Mapping & Transformation
Price List Header
| Source Field(s) | Source Table(s) | SAT Field | Transformation Notes |
|---|---|---|---|
BuyingGroup1-5 | ArCustomer | buying_group | Used to generate combinations |
| Generated | NewPricelist | pricelist_name | Concatenated buying groups |
price_list_id | customer_price_list | pricelist_code | Unique identifier |
Price List Products
| Source Field | Source Table | SAT Field | Transformation Notes |
|---|---|---|---|
product_code | InvMaster/SorContractPrice | product_code | Direct mapping |
Description | InvMaster | product_name | Direct mapping |
Price | SorContractPrice | price | Includes UOM conversion |
StockUom | InvMaster | uom_code | Primary UOM |
AlternateUom | InvMaster | alt_uom_code | Alternate UOM |
ConvFactAltUom | InvMaster | conversion_alt | Used for price calculation |
UOM Price Calculations
// Primary UOM price (direct from contract)
$primaryPrice = $contractPrice->Price;
// Alternate UOM price (converted)
if ($product->AlternateUom && $product->ConvFactAltUom) {
$alternatePrice = $primaryPrice / $product->ConvFactAltUom;
}Troubleshooting
Issue: Price Lists Not Generating
Symptoms: Customers not getting price list assignments
Diagnostic Steps:
- Check customer buying group configuration
- Verify buying group price data exists
- Review scheduler execution