Aggregator
Aggregator
A logistics system sends shipment updates one by one for a single order and billing should only
generae an invoice once all shipments are completed we use aggregator to coleect all shipment
updates for an order before triggereing the invoice
Each shipment update arrives with an Order Id the aggregator groups messages by Order Id
The aggregator waits until all shipmens or that order are recieed
After all shipments are collected CPI sends the final data to the billing system
Use case: Suitable when you need to wait for all related messages before taking action (eg: order
fulfillment ,Invoice generation)
Aggregator :collects messages with Correlation (Order ID etc) and waits until all expected messages are
received
Aggregator Scenario : A ware house sends multiple shipment updates for an order at different times
the order should only be processed when all the shipments are recieved
Gather Scenario: A system sends multiple sales order individually but you need to combine them into
one message before sending it to external system use gather step to merge multiple orders into single
xml/json payload
------------------------------------------------------------------------------------------------------------------------------------------
In SAP CPI, variables play a critical role when we need to store values that are essential for subsequent
runs of an interface.
A common example is **delta data load** scenarios, where the last successful run date is stored as a
variable. This allows us to filter data in the next run, e.g., fetching records where the "last modified
date" is greater than the last successful run date. However, the use cases for variables are endless! You
might need them to store key fields, flags, or any value essential for logic or decision-making across runs.
### **Local vs. Global Variables** SAP CPI offers a **Global Scope** checkbox to define a variable as:
1. **Local Variable**: - Use when the value is required only within the same interface or flow. -
Example: Temporary logic or intermediate processing
2. . 2. **Global Variable**: - Use when the value needs to be shared across multiple interfaces or
dependent flows. - Example: Reusing a stored value like a token, run date, or key across
different flows.
### **Key Tips for Effective Variable Management**
1. **Define Default Values**: - Ensure the variable has a default value for the first run.
Alternatively, write logic to handle the first run and delta runs differently.
2. **Document the Purpose**: - Clearly document whether a variable is local or global and its
role. This improves maintainability and avoids confusion during troubleshooting or
enhancements
3. . **Choose Scope Wisely**: - Evaluate requirements carefully before selecting local or
global scope. A poorly scoped variable can lead to unintended dependencies or errors. ###
**Pro Tip** - Use variables strategically to make your integrations dynamic and efficient.
Proper planning and documentation ensure robust and maintainable interfaces.
If you store values in headers or properties in your iflow, those values will be gone when the
iflow finishes. If you need to store values longer than that, you can store them in a variable
using the Write Variables step. In other words, they're a way to persist data.
A global variable can be accessed by any iflow, but a local variable can only be accessed by
the iflow that wrote it.
You can see all the variables, you've stored, in the Operations view => Manage Stores =>
Variables.
Variables are similar to Data Stores, really. But variables store scalar values (i.e. one
number, one timestamp etc.) whereas Data Stores contain complete payloads (e.g. an XML
or JSON document).
Please note that while there's a Write Variables step, there's no Read Variables step. To
fetch the value of a variable into a property or header, you use a Content Modifer with the
type set to either Local Variable or Global Variable.
In order to store the Last Run Date which will be further used in the same process but in different
execution
A: Local variable can be access via same iFlow only. Global variable can be access via differet iFlows. Q:
How to read local variable and global variable? A: Use Content Modifier read to either header or
property
Q: At iFlow first run, variable not created yet but need to use some initial/default value for processing,
how to handle such chicken-and-egg situation?
Q: Is it possible local and global variable having same name? A: Yes. Since the scope is different between
local and global. Q: How to do delta synchronization via timestamp?
A: Use variable to remember last processed timestamp, so that next scheduled run will resume from
last process timestamp onward. Q: What need to consider when design delta synchronization via
timestamp?
(2) Timestamp should be unique (E.g. only date without time might not work)
. (3) The right date field should use for delta synchronization.
(4) Only update last processed timestamp at last step if all processing success.
A: Build in same iFlow a manualRun/adhocRun flag to set manual timestamp, override value in variable.
A: Use global if other iFlow need to access same variable. Global can behave like local, but not the other
way round.
A: Build generic iflow and use Postman to read write global variable.
Q: What ways can be use to delete variable? A: Manual delete via 'Manage Variables' page. Q: What
other potential use of variable?
A: Access same variable value in different branches of Multicast (because property will not work).
1.Can you please help understand in which situations do we go for Error End and Escalation End? The
only difference that I can see is the message status which is Failed / Escalated. Apart from this, whats
the purpose of both and have you come across real situations needing to use them separately? Please
share your thoughts
2. what is the Major difference between Aggregator vs Gather as both are used to Combine/merge the
messages ?