Product Documentation > IDoc messaging (outbound/inbound)

Version: 9.32204-rev3 / Last update: June 15, 2022

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
page

How to configure IDoc outbound/inbound messaging

IDoc messages have been the gold standard of reliable SAP-to-SAP communication for many years in SAP ERP, and are still strategic and relevant for SAP S/4HANA – ASAPIO Integration Add-on now allows you to use all your SAP standard and custom IDocs in today’s heterogeneous IT landscapes and for event-driven architecture – code-less!

  • On-the-fly IDoc conversion to JSON-based messages, bidirectional
  • for SAP-to-SAP connectivity via data brokers and platforms
  • for SAP-to-any connectivity, using IDocs as a proven and reliable interface

Send IDocs as outbound JSON message

Create IDoc Port

  • Transaction: WE21
  • Select the created Connection
  • Go to section ABAP-PI
  • Add New Entry and specify:
    • Port: choose a name (e.g., ACI_IDOC)
    • Description: choose a description
    • Function module: /ASADEV/ACI_IDOC_PORT_TRIGGER

Ein Bild, das Text enthält. Automatisch generierte Beschreibung

Create Partner profiles

Note:

Make sure a Distribution model is available (Transaction BD64)

  • Transaction: WE20
  • Open folder: Partner Type LS
  • Go to section Outbound Options.
    • Receiver port: ACI_IDOC
    • Basic Type: MATMAS05

Create Outbound Object

Note:

In the example below, we want to trigger an outbound message for SAP material master IDocs (IDoc name “MATMAS”), convert the IDoc payload to JSON and send it to an event broker instance.

  • Transaction: SPRO
  • Goto ASAPIO Cloud Integrator – Connection and Replication Object Customizing
  • Or go directly to transaction: /ASADEV/68000202
  • Select the created Connection
  • Go to section Outbound Objects
  • Add New Entry and specify:
    • Object: name of the outbound configuration
    • Extraction Func. Module: /ASADEV/ACI_GEN_VIEW_EXTRACTOR
    • Message Type: Specific message type (Example: Z_SAP_EM_MATMAS)
    • Load Type: Incremental Load
    • Trace: activate for testing purposes
    • Extraction view name: EDID4
  • Formatting Function: /ASADEV/ACI_GEN_IDOC_FORMATTER

Data extraction will be carried on by a generic extractor (/ASADEV/ACI_GEN_VIEW_EXTRACTOR) with message type Z_SAP_EM_MATMAS. The generic extractor reads and extracts the data contained in the view EDID4, which has the information related to the IDOCs.

Example configuration:

Ein Bild, das Text enthält. Automatisch generierte Beschreibung

Data extraction will be carried out by a generic extractor (/ASADEV/ACI_GEN_VIEW_EXTRACTOR) with message type Z_SAP_EM_MATMAS. The generic extractor reads and extracts the data contained in the view EDID4, which has the information related to the IDOCs.

Set up ‘Event Linkage’

Link the configuration of the outbound object to a Business Object event:

  • Navigate to Outbound Objects 🡪 Event Linkage or use transaction SWE2.
  • Add New Entry and specify:
    • Object Category: BO BOR Object Type
    • Object Type: /ASADEV/ID
    • Event: ACI_TRIGGER_EVENT
    • Receiver Function Module: /ASADEV/ACI_EVENTS_TRIGGER
    • Linkage Activated: tick the checkbox
    • Check Function Module: /ASADEV/ACI_EVENTS_CHECK

Ein Bild, das Text enthält. Automatisch generierte Beschreibung

Set-up ‘Header Attributes’

Specific for the IDoc Outbound use-case you have to specify the header attributes:

BOR_ATTRIBUTE_MessageType with the actual message type of the IDoc you want to send (e.g. MATMAS). This will be used in the check function module to filter out IDocs that are not relevant.

Test the outbound IDoc event creation

Note:
Message type
 should be MATMAS in our example (screenshot shows ARTMAS because it’s a retail system)

Start transaction BD10 to test the described formatter:

Ein Bild, das Text enthält. Automatisch generierte Beschreibung

Results can be shown in transaction /ASADEV/ACI_MONITOR.

Receive IDocs from inbound JSON message

Note:

In the example below, we want to receive an inbound message for SAP material object from an event broker, which will be a JSON format. The JSON payload will be converted into an IDoc (IDoc name “MATMAS”).

Create Message Type

  • Create message type, If not already done before during the Outbound configuration.
  • Transaction: WE81

Activate Message Type

  • Transaction: BD50
  • Add New Entry and specify:
    • Message Type: the created message type
    • Active: tick the checkbox

Create Partner profiles

  • Transaction: WE20
  • Open folder: Partner Type LS
  • Select your Partner No.
  • Go to section Inbound parameters.
  • Add New Entry and specify:
    • Message type: MATMAS
    • Process code: MATM
    • Message Type: the created message type (Example: MATMAS)

Ein Bild, das Text enthält. Automatisch generierte Beschreibung

Create Inbound Object

  • Transaction: SPRO

  • Go to ASAPIO Cloud Integrator – Connection and Replication Object Customizing
  • Or go directly to transaction: /ASADEV/68000202
  • Select the created Connection
  • Go to section Inbound Objects
  • Add New Entry and specify:
    • Object: name of the inbound configuration
    • Extraction Func. Module: /ASADEV/ACI_JSON_TO_IDOC
    • Message Type: the created message type (Example: MATMAS)
    • Trace: activate for testing purposes

Example configuration:

Ein Bild, das Text enthält. Automatisch generierte Beschreibung

Ein Bild, das Text enthält. Automatisch generierte Beschreibung

Data extraction will be carried on by a generic extractor (/ASADEV/ACI_JSON_TO_IDOC) with message type MATMAS. The generic extractor reads and extracts the data into 1 to multiple IDOCs.

Set-up ‘Header Attributes’

In addition, header attributes of message type MATMAS are filled with the topics (depending on your connector):

Ein Bild, das Text enthält. Automatisch generierte Beschreibung

JSON schema for IDoc creation

When an Inbound message is received from the broker, it will usually be a JSON format.

The ASAPIO Integration Add-on will create an IDoc out of the JSON file.

In order to see which fields are needed for the IDoc creation go to transaction WE60. There you will find a documentation and XML schema with the fields that are available for the according IDoc.

Example MATMAS05:

  • Transaction: WE60
  • Basic type: MATMAS05
  • Select More à Documentation à XML Schema

Ein Bild, das Text enthält. Automatisch generierte Beschreibung

The WE60 documentation will provide you the available fields in an XML format, which can be part of your JSON file, that you want to send Inbound.

Ein Bild, das Text enthält. Automatisch generierte Beschreibung

Note:
Watch the mandatory fields of the JSON header highlighted as seen below.

“EDI_DC40”: [

{

“TABNAM”: “”,

“MANDT”: “”,

“DOCNUM”: “”,

“DOCREL”: “”,

“STATUS”: “”,

“DIRECT”: “”,

“OUTMOD”: “”,

“IDOCTYP”: “MATMAS05”,

“MESTYP”: “MATMAS”,

“SNDPOR”: “ACI_TEST”,

“SNDPRT”: “LS”,

“SNDPRN”: “LOCAL”,

“RCVPOR”: “”,

“RCVPRT”: “LS”,

“RCVPRN”: “”,

“CREDAT”: “”,

“CRETIM”: “”,

“SERIAL”: “”

}

],

Test the inbound IDoc creation

Note:
Message type
 should be ARTMAS in our example (ECC)

Start transaction BD10 to send a material to the topic:

Ein Bild, das Text enthält. Automatisch generierte Beschreibung

Note:
If you already have objects in a topic at a broker of your choice, the steps above are not needed and you can start testing from here.

Start transaction /n/ASADEV/ACI

Choose your configured Connection and Replication Object:

    • Connection: 00Confluent
    • Replication Object: KAFKA_MATMAS_INBOUND

Ein Bild, das Text enthält. Automatisch generierte Beschreibung

Ein Bild, das Text enthält. Automatisch generierte Beschreibung

Ein Bild, das Tisch enthält. Automatisch generierte Beschreibung

Scroll to Top