iDoc Collection and Package Size – S4 HANA and PI/PO Configuration

Outbound iDocs can be processed as batches or packages in SAP. This technique is also known as packaging or bundling of iDocs. The packaging allows us to send iDocs as a collection or as one data packet to the target system. The iDoc packaging method is highly useful if you want to send multiple iDocs as a single message to the target system.

In this article, we will discuss the SAP ALE/iDoc configuration related to iDoc packing. Also, we will look at iDoc adapter (iDoc_AAE) configuration for bundling iDocs in SAP Process Orchestrator version 7.1 or higher. Moreover, we’ll learn how to process bundled outbound iDocs using program RSEOUT00.

Pack Size in Outbound iDoc Partner Profile

To configure the iDoc collection in SAP, we need to set up the Pack Size of the outbound parameters of the Partner Profile. But, this parameter can be used only in conjunction with Output Mode “Collect iDocs”.

To configure the Pack size, go to transaction we20 in SAP back-end system and navigate to the outbound iDoc configuration (outbound parameters).

Outbound parameters of iDoc Partner Profile for iDoc collection with message type, reciever partner, pack. size.
Outbound parameters of iDoc Partner Profile – we20

Then assign the number of iDocs per message in the Pack Size parameter.

Pack. Size and Output Mode "Collect iDocs" configured in Partner Profile. Transaction we20
Pack. Size and Output Mode “Collect iDocs” configured in Partner Profile

In this example, every 10 outbound iDocs are sent to the target system as one message.


iDoc Package Size in Sender iDoc Adapter

If you are using the middleware SAP Process Integration 7.1 or higher, for iDoc bundling to work you need to configure the sender iDoc adapter in conjunction with Partner Profile.

In the sender iDoc adapter (iDoc_AAE) there are two important parameters related to iDoc collection under “Inbound Message Settings” of “Adapter-Specific” parameters.

  1. The checkbox “Multiple iDocs in single XI message”
  2. Numeric parameter “Number of iDocs in single XI message

To enable receiving multiple iDocs in the same message, flag the parameter “Multiple iDocs in single XI message”. Next, define the maximum number of iDocs allowed in a single message in parameter “Number of iDocs in single XI message”.

Sender iDoc_AAE adapter configuration for iDoc Collection. Inbound message settings "Multiple iDocs in Single XI message" configured. transport protocol tRFC, message protocol iDoc XML and adapter type iDoc_aae
Sender iDoc_AAE adapter configuration for iDoc Collection

Java iDoc adapter iDoc_AAE uses tRFC transfer protocol and iDoc XML message protocol by default.

In the example shown here, every 10 iDocs are bundled together in one XI message. In the Message Mapping program, you can map the bulk iDoc message to the target message.


iDoc Packing and Program RSEOUT00

When the “Collect iDoc” configuration is activated in the iDoc Partner Profile, outbound iDocs created from outputs, programs, master data distribution framework, etc. will be assigned to status (30) “iDoc ready to be dispatched”. To process iDocs in status 30 and send them to the outbound Port, standard outbound iDoc processing program RSEOUT00 should be executed.

The standard practice is to schedule this program as a periodic batch job in quality and productive environment to process outbound iDocs. Each scheduled job of RSEOUT00 should process one iDoc Message Type and iDoc Basic Type combination.

Selection Screen of Outbound iDoc Processing Program RSEOUT00 with Basic type, message type and maximum number of iDocs set.
Selection Screen of Outbound iDoc Processing Program RSEOUT00

The parameter “Maximum Number of iDocs” defines the maximum number of iDocs transferred before COMMIT WORK is executed. This parameter only has an impact if you are packaging iDocs in SAP.

But, you need to make sure a reasonable number is assigned to Maximum number of iDocs depending on the size of an individual iDoc processed and system resources. If too high a number is assigned, the system can run into short dumps.

Take the size of an individual outbound iDoc when assigning the maximum number of iDocs to RSEOUT00 background job. If the size of the iDoc is large, a lower number should be assigned. But if the iDoc size is low you have the freedom to assign a higher number. For example, ARTMAS (article master) iDoc is a comparatively heavy iDoc. Hence, a lower number of maximum iDocs should be assigned. On the other hand, for COND_A (price conditions) iDoc a higher number can be assigned as COND_A iDocs are smaller in size.


iDoc Pack Size in SAP vs Number of iDocs in SAP PI/PO iDoc_AAE

As you may have noticed there are two different pack size parameters we can configure in SAP and SAP PI/PO.

  1. iDoc Pack. Size in Partner Profile – SAP back-end system
  2. Maximum number of iDocs in single XI message – SAP PI/PO adapter iDoc_AAE

What will happen if the number of iDocs configured in each of these parameters is different?

Let us look at the combinations we can have,

  1. iDoc Pack size in Partner Profile is equal to the number of iDocs in iDoc_AAE adapter.
  2. iDoc Pack size in Partner Profile is greater than in iDoc_AAE adapter.
  3. iDoc Pack size in Partner Profile is less than in iDoc_AAE adapter.
  4. The maximum number of iDocs in the iDoc_AAE communication channel is blank.

iDoc Pack size in Partner Profile is equal to the number of iDocs in iDoc_AAE adapter.

Pack Size in Partner ProfilePackage Size in Sender Adapter (iDoc_AAE)Number of iDocs Processed (sent from SAP HANA)Number of XI messages in PI/PO (iDocs in the XI message)
101081 (8)
101091 (9)
1010101 (10)
1010111 (10) + 1(1)

iDoc Pack size in Partner Profile is greater than in iDoc_AAE adapter.

Pack Size in Partner ProfilePackage Size in Sender Adapter (iDoc_AAE)Number of iDocs Processed (sent from SAP HANA)Number of XI messages in PI/PO (iDocs in the XI message)
10981 (8)
10991 (9)
109101 (9) + 1 (1)
109111 (9) + 1(1) + 1(1)

iDoc Pack size in Partner Profile is less than in iDoc_AAE adapter.

Pack Size in Partner ProfilePackage Size inSender Adapter (iDoc_AAE)Number of iDocs Processed (sent from SAP HANA)Number of XI messages in PI/PO (iDocs in the XI message)
81071 (7)
81081 (8)
81091 (8) + 1 (1)
810101 (8) + 1 (2)
810111 (8) + 1 (3)

The maximum number of iDocs in the iDoc_AAE communication channel is blank.

The parameter “Maximum number of iDocs in Single XI message” of iDoc_AAE adapter is optional. Hence, you can leave it blank in the sender iDoc Communication Channel.

if you leave the parameter blank and control package size via iDoc partner profile, Packaging would behave the same way as to pack size equal to the sender adapter pack size.

One advantage of leaving this parameter blank is that you will be able to use the same sender iDoc Communication Channel in different integration scenarios with different package sizes in partner profile.

Sample-Bundled Outbound iDoc XML

Let us look at how a bundled iDoc XML looks like. Here we have the output iDoc XML of iDocs packed with size 5.

Sample XML of multiple COND_A outbound iDocs collected to one XML or XI message. Multiple <iDoc> segments under <COND_A> segment in the xml.
COND_A iDocs collected to on XML (XI) message

When you package iDocs, under the main iDoc basic type tag (in the example <COND_A04>) you will find repeating <iDoc> XML segments. At runtime this entire message will be passed to the mapping program in SAP PI/PO at once.

Message Mapping and Operation Mapping of Bundled iDoc

In SAP PI/PO single stack versions with iDoc_AAE adapter you can use the iDoc imported from SAP as the source message of the Massage Mapping program and Source Operation of Operation Mapping program.

With HTTP iDoc adapter and new Java only SAP PI/PO, you do not have to adjust the iDoc XSD manually to change the occurrence.

iDoc service interface used as the Source Operation of iDoc Collection Scenario
Source Operation of iDoc Collection Scenario
iDoc Type used as Source Message Type
iDoc Type used as Source Message Type

Outbound Service Interface

Use imported iDoc service interface as the outbound service interface of iDoc collection scenario.

iDoc service interface used as the Outbound Service Interface of iDoc Collection Scenario
Outbound Service Interface of iDoc Collection Scenario

To summarize, you control outbound iDoc packaging using Pack Size in Partner Profile and iDoc_AAE sender adapter. Depending on the package sizes defined, the process of bundling will differ. Collected outbound iDocs should be processed using program RSEOUT00. The program should be scheduled as a background job to process iDocs automatically.

If you have any questions, please leave a comment below.

Encode Message Payload to Base64 on CPI!

How to use Base64 message encoder in SAP Integration Suite.

Subscribe for more

My First Interface on CPI!

Learn how to develop your first iFlow on SAP Integration Suite within 7 minutes!

Subscribe for more

3 thoughts on “iDoc Collection and Package Size – S4 HANA and PI/PO Configuration

  1. sai says:

    Hi Sir,

    It was a great blog on idoc Packaging scenario.
    In the same way can you please explain idoc serialization and idoc acknowledgment ALEAUD in sap po scenarios.
    Thanks sai.

  2. Prameela says:

    Hi Sir,

    I followed the same but i am not getting the bundled idocs to PO.

    IDOC message type and only one IDOC under this.
    Ex:

    Kindly help me.

  3. Jamaic says:

    Hi Isuru,

    Thanks for your post about collecting multiple IDocs into a single XI message. This scenario is especially useful if for example you want to create an EDI X12 message with multiple transaction sets ST corresponding each IDoc in the XI message.

    However, i came across the following write-up which says that to make the collection of multiple IDocs into a single XI message work, you have to create an XML-HTTP or XML-File port type in tcode WE21 as oppose to the normal RFC port type for PI.

    https://fdocuments.in/document/how-to-send-multiple-idocs-within-one-xi-message-multiple-idocs-within-one.html

    Regards,
    Jamaic

Leave a Reply

Your email address will not be published. Required fields are marked *