Your issue stems from a combination of API configuration, exchange rate type handling, and SAP’s rate caching mechanism. Let me provide a comprehensive explanation and solution.
Understanding the Exchange Rate Update Discrepancy:
You’re observing that exchange rates appear current in transaction OB08 but the API returns outdated values. This happens because the pricing API and the OB08 transaction access exchange rate data through different mechanisms. OB08 reads directly from table TCURR in real-time, while the pricing simulation API uses a buffered data structure that’s refreshed on a schedule.
Why Your API Payload Check Isn’t Sufficient:
You mentioned verifying that the API payload includes correct currency pairs and effective dates. However, the payload doesn’t control which exchange rate type SAP uses - that’s determined by your system configuration. The API inherits rate type defaults from your pricing procedure, condition records, or company code settings. If you’re not explicitly specifying a rate type in your API request, SAP applies its configured default, which may not be the ‘M’ (standard) type you’re maintaining.
SAP Shows Updated Rates Because:
When you check OB08, you’re viewing the TCURR table directly with real-time data access. The transaction doesn’t use buffering or caching, so you immediately see any rate updates. The pricing API, however, operates through the application layer which employs multiple caching mechanisms for performance optimization.
Complete Solution:
-
Identify the Active Exchange Rate Type:
- Check your company code configuration in transaction OBY6
- Review field ‘Exchange rate type for translation’ - this is often the API default
- Verify pricing condition records (transaction VK11/VK13) to see if they specify a rate type
- Check table T001 field KURST for company code default rate type
-
Explicitly Specify Rate Type in API Requests:
Modify your API payload to include the exchange rate type parameter:
// Pseudocode - Enhanced API request:
1. Build pricing request with currency pair (USD->EUR)
2. Add parameter: exchangeRateType = 'M' (or your configured type)
3. Include effectiveDate = current_date
4. Set rateSource = 'SAP' to ensure TCURR lookup
5. Send request and validate response rate matches TCURR
// API Documentation: Pricing Simulation API v2 Section 5.3
-
Verify Rate Maintenance Scope:
- Ensure you’re updating exchange rates for ALL rate types that might be used
- In transaction OB08, check which rate types have entries
- If API uses rate type ‘P’ but you only maintain ‘M’, that explains the discrepancy
- Maintain rates consistently across all active rate types
-
Address API Caching:
- Check SAP Gateway cache settings in transaction /IWFND/MAINT_SERVICE
- Look for your pricing service and review cache configuration
- Reduce cache TTL for exchange rate data to 1-4 hours instead of 24 hours
- Consider implementing cache invalidation triggers when rates are updated
-
Implement Rate Buffer Refresh:
- Exchange rates are buffered in table TCURF (rate factors) and internal structures
- Schedule program RFTBFF00 to run after each rate update
- This program refreshes the exchange rate buffer used by APIs
- Alternatively, call function module BAPI_EXCHRATE_CREATEMULTIPLE with refresh flag
-
Configure Real-Time Rate Access:
If your business requires immediate rate updates, modify the pricing API configuration:
- In SPRO, navigate to Sales and Distribution → Basic Functions → Pricing → Exchange Rates
- Enable ‘Direct database access for exchange rates’ option
- This bypasses buffering but may impact API performance
- Test performance impact before enabling in production
-
Validation and Monitoring:
- After implementing changes, test API with known currency pairs
- Compare API-returned rates against OB08 values for same date and rate type
- Set up monitoring to alert when API rates diverge from TCURR by more than threshold
- Log rate type used in each API call for troubleshooting
Recommended Implementation Order:
- First, explicitly specify exchange rate type in API requests
- Verify that you’re maintaining rates for the correct type
- Then address caching if discrepancies persist
- Finally, implement buffer refresh automation
The most common resolution is step 1 - adding explicit rate type specification to your API payload. This ensures the API uses the same rate type you’re maintaining in OB08, eliminating the mismatch. The caching and buffering issues are secondary factors that compound the problem but are less likely to be the root cause if rate types are misaligned.
Once you align the rate type between your maintenance process and API configuration, and implement buffer refresh after updates, your API should consistently return current exchange rates matching what you see in OB08.