IDoc-REST (Async-Sync) Scenario Approach with ALEAUD (2024)

Situation

IDoc is a standard SAP format for electronic data exchange between systems. A typical use case is the integration of a SAP Backend system like SAP S/4HANA via SAP Process Orchestration with a 3rd Party REST service. This requires the connection of an asynchronous IDoc message with a synchronous REST call.

IDoc-REST (Async-Sync) Scenario Approach with ALEAUD (1)

The connection of an asynchronous and a synchronous interface is typically no issue as long no messages are failing. In this case both technical errors (e.g. HTTP 40X) and application errors (e.g. HTTP 500) will be raised on SAP Process Orchestration.

On the other hand there is no monitoring in the backend system possible if the IDoc was successfully transferred to the target service.

Approach

To improve and simplify the operation of the scenario, errors should be visible and raised where the equivalent processor is. Technical errors on SAP Process Orchestration, application errors on SAP Backend.

Additionally confirmation should be sent back to the sender system that the message was successfully processed by the target system.

IDoc-REST (Async-Sync) Scenario Approach with ALEAUD (2)


Key Implementation Steps


(1) Set Adapter-specific Message Attributes in IDoc Sender channel

By setting the adapter-specific message attributes the IDoc adapter will store the IDoc metadata (IDoc number, etc.) to the message header. This information will be used later.

IDoc-REST (Async-Sync) Scenario Approach with ALEAUD (3)

(2) Preserve IDoc number of source IDoc in REST receiver channel

To keep the reference to the original IDoc it is required to preserve the IDoc number during the complete message processing. The DynamicConfigurationBean is used to save the IDoc number of the source message to the module context. After the processing of the REST adapter the DynamicConfigurationBean restores the IDoc number from the module context back to the message header of the response message.

IDoc-REST (Async-Sync) Scenario Approach with ALEAUD (4)

IDoc-REST (Async-Sync) Scenario Approach with ALEAUD (5)

(3) Implement Async-Sync bridge in REST receiver channel

RequestResponseBean and ResponseOnewayBean are used to implement the standard async-sync bridge by module adapters.

IDoc-REST (Async-Sync) Scenario Approach with ALEAUD (6)

IDoc-REST (Async-Sync) Scenario Approach with ALEAUD (7)

(4) Call REST Adapter with Parameters

Depending on the REST service there might by additional parameters necessary.

IDoc-REST (Async-Sync) Scenario Approach with ALEAUD (8)

IDoc-REST (Async-Sync) Scenario Approach with ALEAUD (9)

(5) Implement HTTP Status Code handling in REST receiver channel

In case of a non-technical error (typically HTTP 500) a response message should be triggered. From PI monitoring perspective the message will be treated as successful and no error will be raised.

Additionally for successful processing a response message should be triggered as positive acknowledgement.

IDoc-REST (Async-Sync) Scenario Approach with ALEAUD (10)

(6) Map response message to ALEAUD IDoc

Following fields have to be mapped for a valid ALEAUD message.

DOCNUM = The IDoc number of the source IDoc message. UDF required to read the adapter-specific message attributes

DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);


DynamicConfigurationKey docnums = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/IDoc_AAE", "DOCNUMS");


return conf.get(docnums);

STATUS = 68 (Error) / 53 (Success)

STATXT = Error text in case of error

IDoc-REST (Async-Sync) Scenario Approach with ALEAUD (11)


Result

The ALEAUD IDoc will trigger an update of the original IDoc and will change the IDoc status.

IDOC Status 40 = Error (Error text visible)

IDOC Status 41 = Positive Acknowledgment (IDoc successfully processed by target service)

IDoc-REST (Async-Sync) Scenario Approach with ALEAUD (12)

Example

IDoc-REST (Async-Sync) Scenario Approach with ALEAUD (13)

References


SAP Note 2501469 - Improved HTTP result conversion for custom error messages

IDoc-REST (Async-Sync) Scenario Approach with ALEAUD (2024)

FAQs

Is IDOC asynchronous or synchronous? ›

IDocs are used for asynchronous transactions: Each IDoc generated exists as a self-contained text file that can then be transmitted to the requesting workstation without connecting to the central database.

What is the difference between synchronous and asynchronous interface in SAP? ›

In a synchronous scenario, CPI needs to analyze the response and determine if the journal entry post was successful. In an asynchronous scenario, the monitoring and error handling is carried out in SAP S/4HC using the Application Interface Framework (AIF).

What is the difference between EDI and IDOC? ›

EDI is nothing but Electronic data interchange. SAP will support EDI through Intermediate documents (IDOCS). EDI (Electronic Document interchange) - EDI is the electronic exchange of business documents between the computer systems of business partners, using a standard format over a communication network.

What is the full form of IDOC? ›

IDOC stands for Intermediary DOCument. IDOC is an SAP proprietary format for storing business data that needs to be communicated across systems.

Can IDoc be synchronous? ›

6) Processing Mode: IDoc ports can be configured for various processing modes, such as synchronous or asynchronous. In synchronous processing, the IDoc is sent and processed immediately, while asynchronous processing involves queuing the IDoc for later processing.

How do I make IDoc synchronous in SAP? ›

Scenario is IDOC to HTTPS synchronous scenario: Idoc will be sending to PI where PI posts HTTPS post to the 3rd party external system, then the 3rd party external system sends back the HTTPS response and that needs to be mapped with the idoc structure and push that information again to the R/3 ECC system.

What is the difference between synchronous and asynchronous OTP? ›

Synchronous tokens – use your private key and the current time to create a one-time password. Asynchronous tokens – use Challenge Response Authentication Mechanism (CRAM), a group of protocols in which the server presents a challenge, and the token must generate the correct answer.

What is the difference between asynchronous and synchronous REST API? ›

Synchronous APIs provide instant responses; asynchronous APIs use callbacks. Synchronous requests are sequential, leading to delays; asynchronous enables parallel processing. Event-driven architecture enhances real-time experience and efficiency. Asynchronous APIs return calls instantly and process in the background.

What is synchronous and asynchronous process in SAP? ›

Synchronous processes run synchronously if you initiate them through a Web service call. Otherwise, processes modeled as synchronous processes are executed asynchronously if you start them in the Process Repository or with the Debugger (see Starting a Process ).

How do I know if my API is synchronous or asynchronous? ›

The difference between asynchronous and synchronous APIs

Synchronous APIs often use HTTP or HTTPS for transport, and HTTP is a unidirectional protocol. The client sends a request to the server, and then the server sends an HTTP or HTTPS response back. Asynchronous APIs tend to use bidirectional protocols like HTTP/2.

Is message broker synchronous or asynchronous? ›

Asynchronous messaging refers to the type of inter-application communication that message brokers make possible. It prevents the loss of valuable data and enables systems to continue functioning even in the face of the intermittent connectivity or latency issues common on public networks.

What is the basic type of IDoc? ›

IDOC (BASIC) TYPE

IDoc Types are based on the EDI standards and mostly on EDIFACT standards. Basic Types (or IDoc Type) defines the structure of an IDoc. Each basic type describes standard IDoc segments, format of data fields and their size. Basic Type also defines number of segments and fields in an IDoc.

Is HTTP synchronous or asynchronous? ›

HTTP is a synchronous protocol. The client sends a request and waits for a response from the service. That's independent of the client code execution that could be synchronous (thread is blocked) or asynchronous (thread isn't blocked, and the response will reach a callback eventually).

Top Articles
Latest Posts
Article information

Author: Dr. Pierre Goyette

Last Updated:

Views: 5467

Rating: 5 / 5 (50 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Dr. Pierre Goyette

Birthday: 1998-01-29

Address: Apt. 611 3357 Yong Plain, West Audra, IL 70053

Phone: +5819954278378

Job: Construction Director

Hobby: Embroidery, Creative writing, Shopping, Driving, Stand-up comedy, Coffee roasting, Scrapbooking

Introduction: My name is Dr. Pierre Goyette, I am a enchanting, powerful, jolly, rich, graceful, colorful, zany person who loves writing and wants to share my knowledge and understanding with you.