Monday, June 30, 2025

Transaction Handling .?

In this blog, we will see what is Transaction-Handling and how to use it.?

Transaction-Handling:

It refers to the management of a series of operations so they behave as a single unit of work — where either all steps succeed or the process handles failures gracefully to maintain data integrity.

When you enable transaction-handling enabled, it hold locks on resources (e.g., database records, queue entries) for their duration. While this is necessary for consistency, effective transaction management encourages short, well-defined transactions. This minimizes the time resources are locked, reducing contention and improving overall system performance and scalability.

Options:

  • No Transaction: Each step is committed independently. Only suitable for very simple, non-critical scenarios where data consistency is not paramount.
  • Required for JDBC: This ensures that all operations interacting with CPI's internal database (e.g., Data Store operations, Write Variables used with Data Stores) are part of a single transaction. If one fails, all are rolled back.
  • Required for JMS: Similarly, this applies transactional behavior to operations involving JMS queues managed by CPI.

Main Iflow:

Local / Child Iflow:


Transactional processing means that the message (as defined by the steps contained in a process) is processed within one transaction.

For example, consider a process with a Data Store Write operation. If transaction handling is activated, the Data Store entry is only committed if the whole process is executed successfully. In an error case, the transaction is rolled back and the Data Store entry isn't written. If transaction handling is deactivated, the Data Store entry is committed directly when the integration flow step is executed. In an error case, the Data Store entry is nevertheless persisted (and not removed or rolled back).

Note:

  • It's crucial to understand that CPI's transaction handling primarily covers its internal resources (like Data Stores and JMS queues). 
  • It does not provide a distributed transaction coordinator (like a two-phase commit) across heterogeneous external systems (e.g., atomically committing changes in an SAP ERP system and an external Salesforce system). 

For such complex cross-system consistency, you often need to implement patterns like Saga patterns, compensating transactions, or ensure idempotent operations on the external systems.

In conclusion, transaction handling in SAP CPI is a critical enabler for building reliable, fault-tolerant, and data-consistent integration solutions that can gracefully handle errors and maintain the integrity of your business data across interconnected systems.


Source: community.sap.com

Thanks for reading :-)


Credentials Rotation - Best Practices

Credential Rotation and secret management are important BTP Admin responsibilities, especially if you are supporting SAP Integration Suite/CPI, Event Mesh, Cloud Foundry, or Kyma.

Create → Store securely → Use → Rotate → Validate → Revoke old credential



SAP specifically recommends rotating service keys periodically and recreating them when exposed or approaching certificate expiry.

General approach:


What happens if a secret is compromised?



Note:

Controlled credential lifecycle: create credentials with least privilege, store them in a secure secret-management mechanism, never expose them in source code, monitor their expiry, and rotate them periodically or automatically where supported. During rotation, we need to create the new credential first, update and validate all dependent applications such as CPI or Event Mesh, maintain a short overlap period where required, and then revoke the old credential. If a credential is compromised, I revoke it immediately, issue a replacement, update consumers, check audit logs and document the incident. For certificates, I also monitor expiry and automate renewal wherever possible.

Sources: help.sap.com

Thanks for reading :-)


Data Store | Importance

In this blog, I am going to explain what is Data Store, Use Cases and various operations..?

Data Store plays an important role in handling persisted messages or data during integration flows. It allows temporary or long-term storage of messages in a structured way. 

Importance and use cases:

Message Persistence

  • Stores messages that may need to be retried in case of failure (e.g., during asynchronous communication).
  • Useful in scenarios where message delivery guarantees (like at-least-once delivery) are required.

Decoupling Processing Logic

  • Enables decoupling between sender and receiver systems.
  • Data can be collected from multiple sources and stored, then processed later in batches or at scheduled times.

Reliable Integration

  • Acts as a temporary queue or buffer, improving the reliability of the integration process.
  • Helps in recovery from transient failures, since messages can be reprocessed from the data store.

Error Handling and Retry Mechanism

  • Failed messages can be stored for later inspection or manual/automated retry.
  • Greatly enhances monitoring and troubleshooting capability.

Audit and Tracking

  • Supports audit trails, allowing you to track message payloads for compliance or debugging.
  • Messages stored can be indexed with metadata (e.g., ID, timestamp) for searching and reporting.



Considerations:
  • Storage Limits: Be mindful of the overall storage limit (e.g., 32 GB) for data on your CPI tenant. Data stores are for temporary storage, not for long-term archiving or acting as a persistent database.
  • Performance: While data stores offer performance benefits through decoupling, excessive or inefficient use of SELECT operations on very large data stores can impact performance.
  • Security: CPI provides options to encrypt stored messages for enhanced security.

Types of operations:

  1. Write
  2. Get
  3. Select
  4. Delete
Write Operation: It stores entries in the data store.



  • Data Store Name: Name of the data store where you want to store the message.
  • Visibility: Indicates if the data store is only visible within the integration flow where it is defined or Global - to all the integration flows that are deployed on that tenant.
  • Entry ID: A unique identifier to identify the entry. It can be picked from a header or from the message using XPath. If nothing is provided, the system generates a random GUID for this entry.
  • Retention Threshold for Alerting (in d): Defines the number of days by when the entry must be read. Else an alert is generated in the cloud platform account. Default – 2days.
  • Expiration Period (in d): The number of days (from when the entry is written into the data store) after which the entry must be deleted from the data store.
  • Encrypt Stored Message: Check this if you want to encrypt the message before storing.
  • Overwrite Existing Message:  Check this if you want to overwrite a message (if one already exists) with the same Entry ID in this data store.

Get Operation: To retrieve one entry from the data store



  • Data Store Name:  The name of the data store from where the entry needs to be retrieved.
  • Visibility: indicates if the data store is visible only to this integration flow or to all the integration flows on the tenant.
  • Entry ID: the unique identifier of the entry you want to retrieve from the data store. If this is left empty, the last entry that was added to the data store is retrieved. It can also be picked from a header or from the message using XPath.
  • Delete On Completion: check this if you want to delete the entry from the data store after retrieving.


Select Operation: To retrieve multiple messages from the data store in one bulk.


  • Data Store Name: The name of the data store from where the entries need to be retrieved
  • Visibility: indicates if the data store is visible only to this integration flow or to all the integration flows on the tenant.
  • Number of Polled Messages: enter the number of messages that you would like to retrieve from the data store.
  • Delete On Completion: check this if you want to delete the entry from the data store after retrieving.


Delete Operation: To delete messages from the data store.


  • Data Store Name:  The name of the data store from where an entry needs to be deleted.
  • Visibility: indicates if the data store is visible only to this integration flow or to all the integration flows on the tenant.
  • Entry ID: the unique identifier of the entry you want to delete from the data store. If this is left empty, the last entry that was added to the data store is retrieved. It can also be picked from a header or from the message using XPath.

Notes:

  • Never use the name sap_global_store for your data store, because it is used by the system to store variables created by the Write Variable step.
  • If the message processing fails, the transaction is rolled back and the entry added to the data store will be deleted.
  • If you try to Write an entry to the data store with an entry ID that already exists and “Overwrites Existing Message” is not checked, the message processing will fail.

Thanks for reading :-)

BTP - Global, Directories and Sub-Accounts

Global Account:

A Global Account is your contractual entity with SAP. it’s directly tied to your commercial agreement and license purchase. When your company signs an SAP BTP contract, SAP provisions a Global Account that contains:

  • All purchased entitlements (service quotas you’ve bought)
  • Commercial model assignment (consumption-based, subscription-based, or CPEA)
  • Central user and security management
  • Cross-subaccount governance capabilities

For example: A company buys 50 GB of SAP BTP resources. These entitlements are at the Global Account level, and you need to distribute them to subaccounts based on project needs. The Global Account is where CFOs and Procurement teams see what you’ve purchased. The SAP Architects decide how to allocate those resources based on business requirement.

Directory: Optional grouping of subaccounts

Eg: US-FINANCE-DIR

Subaccount:

Isolated administrative and deployment context

XX-DEV, XX-QA, XX-PROD

Please check the below diagram for better idea...based on your requirement you can create multiple sub-directories and sub-accounts

Account Explorer: 

Landscape Visualization

Account Explorer is your structural view into the entire BTP landscape. It renders your account hierarchy in a tree structure showing:

  • Global Account (Root level)
  • Directories (Optional organizational containers)
  • Subaccounts (working environments)
  • Multi-environment relationships








Account Explorer helps you navigate this structure quickly, check entitlement assignments, and jump into any subaccount’s cockpit. It’s particularly valuable when you have 100+ subaccounts and need to find a specific environment quickly.



Environment selection are available only at "Sub-Accounts" level.
Directories are optional.

Go to Entitlements and assign CloudFoundary and/or required services and then assign units(memory).



Boosters:
Boosters are orchestrated automation scripts that execute complex provisioning scenarios. Instead of creating manually.

Common Booster Examples..
Prepare an Account for Development: Provisions Cloud Foundry environment, creates spaces (dev/test/prod), assigns standard entitlements, and configures basic connectivity.

Set Up Your SAP Build Work Zone, Standard Edition: Creates subaccount, provisions Work Zone service, configures HTML5 repo, sets up required destinations, creates administrator role collection.

Enable SAP Document Management Service: Configures repository, sets up integration with S/4HANA, provisions necessary APIs.

Boosters encode tribal knowledge. They implement SAP’s recommended architecture patterns, so you’re not guessing at the right sequence of configuration steps.


Sources: help.sap.com

Thanks for reading :-)


Local Integration Process, Process Call and Process Direct Adapter

These three are often confused in SAP CPI / Cloud Integration..

Local Integration Process - define that reusable process inside the same iFlow

Process Call - call a reusable process inside the same iFlow

ProcessDirect Adapter - call another iFlow within same cloud platform

For Eg:

Main iFlow

│

├── Process Call

│       │

│       └── Local Integration Process

│              ├── Content Modifier

│              ├── Mapping

│              ├── Router

│              └── Exception handling

│

└── ProcessDirect

        │

        └──────────────> Another iFlow

                         └── Local Integration Process


Local Integration Process:

A Local Integration Process (LIP) is a reusable subprocess inside the same iFlow.

When to use it?

Use LIP when you have a piece of processing that:

  • is needed multiple times within the same iFlow
  • makes the main iFlow easier to understand
  • contains reusable transformation/validation logic
  • should remain private to that iFlow

Process Call:

Process Call is the mechanism used to invoke a Local Integration Process.

Process Call = "execute this subprocess-Local Integration Process."

Why use Process Call?

It improves modularity and maintainability.

Instead of having a huge iFlow.

ProcessDirect:

ProcessDirect is used for communication between separate integration flows within the same Cloud Integration tenant.

For example:

iFlow A

Customer API

    |

    | ProcessDirect

    ↓

iFlow B

Customer Processing

    |

    ↓

SAP S/4HANA

iFlow A

HTTP Sender

    ↓

ProcessDirect Receiver

    ↓

with an address such as:

/customer/address

iFlow B

ProcessDirect Sender

        ↓

Validation

        ↓

Mapping

        ↓

SAP S/4HANA

The ProcessDirect address connects the two iFlows.


Main Differences...


You can add multiple HTTP Sender adapters as shown below..


Now,  test them from Postman..



Note:
Process Direct Adapter:

Good for internal CPI-to-CPI communication.

HTTP Adapter:

Use HTTP when you need an actual HTTP/API interaction, particularly when the consumer is outside the internal CPI runtime model.

Sources: help.sap.com

Thanks for reading :-)

Groovy - Script

Introduction

Groovy Script is an important component in the SAP Integration Suite, especially in the place of SAP Cloud Platform Integration (CPI). It's a dynamic scripting language for the Java platform that enhances the productivity of integration developers.

Purpose: Groovy Script is used to implement custom logic during the integration process or mapping. It provides flexibility to manipulate messages, transform data formats, and handle complex integration flows.

Integration: It seamlessly integrates with Java, allowing developers to use existing Java libraries and frameworks in their scripts.

Features: Groovy offers features like easy-to-read syntax, error handling, and native support for XML and JSON, making it ideal for integration jobs.

Use Cases: Common use cases in SAP CPI include message mapping, data transformation, content enrichment and dynamic routing.

Why Groovy Script.?

  • In the place of Groovy script, you can choose Jave script also. But Groovy is built on Java Platform and allowing seamless integration with Java libraries and functionalities, crucial in Java-heavy SAP environments.
  • Groovy has excellent built-in support for XML and JSON, simplifying parsing and manipulation of these data formats in integration processes.
  • Groovy provides superior error handling, especially useful in managing integration-specific exceptions.

Common use cases..
  • Dynamic Header and Property manipulation
  • Content transformation like XML to JSON, XML to CSV or vice-versa
  • Conditional Logic
  • Payload Enrichment or cleanup
  • Custom Logging
  • Data Mapping and Lookup
  • Custom Error Handling
  • Signature Generation
  • Date and Time Calculation
  • Complex math calculation

Build a simple flow and place Groovy script step in iFlow and copy/paste the following script..
import com.sap.gateway.ip.core.customdev.util.Message
 
def Message processData(Message message) {
    //code here
    message.setBody('Hello World')
    return message
}


Then, deploy the flow and test it.

Ref.. for more examples:


XSLT - Mapping

In this blog, we will see what is XSLT mapping and how to use it in SAP CPI.? 

What is XSLT.?
XSLT is Extensible Stylesheet Language Transformations
XSLT is a language designed for transforming XML documents. In SAP Cloud Integration, it allows for dynamic modifications to messages, including altering headers and properties. This capability is particularly useful for applying conditional logic or handling complex transformations that go beyond simple field mapping.

Benefits of XSLT Mapping in SAP CPI

  • Data Consistency: Data consistency can be achieved by XSLT mapping, which is one of its main benefits. You can preserve the integrity of your data as it flows across various systems and apps by establishing precise rules for transformation.
  • Flexibility: Data transformations are flexible when using XSLT mapping. The mapping rules can be adjusted and changed as your company's needs.
  • Integration Capabilities: The smooth integration of SAP CPI with multiple systems is a key feature. This integration is made possible through XSLT mapping, which makes sure that data is formatted correctly for each target system.
  • Efficiency: A crucial component of XSLT mapping is efficiency. Processes for transforming data are streamlined, which lowers the chance of mistakes.

Example:
At the target side, or in the output we want that the Employee whose age is not mentioned should be excluded from the xml. So in this case we used the XSLT Mapping.

Incoming payload is:

<root>
<employee>
<name>Jay</name>
<age>20</age>
</employee>
<employee>
<name>Kiran</name>
</employee>
<employee>
<name>Kisan</name>
<age>21</age>
</employee>
</root>

XSLT:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match = "employee[not(Age)]"/>
</xsl:stylesheet>


Save the iflow and deploy it. Test it from Postman.



In the response payload, employee details are excluded only when <age> is missing from incoming payload.

Source: community.sap.com

Thanks for reading :-)

OData Adapter | Sender and Receiver

What is OData Adapter?  An OData Adapter is an integration component that lets cloud platforms or enterprise systems connect to and communic...