How to send custom infotype over SAP ALE

There is a number of infotypes in SAP which are local to some country. SAP doesn’t provide any standard solution to send these country-specific or custom infotypes over ALE, cause standard IDOC contains only international infotypes. If you develop your infotype and want to send it over ALE there are some tips and tricks to handle. Today I want to tell you how to send custom infotype or country-specific infotype over SAP ALE. It’s going to be a long tutorial with a lot of images. More than I’d like to show you what is a short and long infotype record in terms of SAP integration and IDOC structure. And, of course, ABAP source codes will be provided for your convenience. Take a cup of coffee and join me with this unique tutorial never been shared before.

Sending short infotypes over SAP ALE

A short infotype is an infotype, the size of which fits into one IDOC segment. How to check? Open SE11 transaction, find an infotype structure which is PXXXX (XXXX – infotype code), sum all length fields. One IDOC segment can store 1000 symbols. If the infotype structure is longer than 1000 symbols it’s a long infotype and we will need to split it to send over SAP ALE. Will show later how it works.

To add custom infotype to a standard HRMD_A IDOC in WE31 transaction create a new segment to include it into IDOC and send over ALE. Naming rule is Z1PXXXX, 7 symbols. It’s done for prior 4.6C compatibility, so if you work with modern systems you can use longer names. The first three letters ‘Z1P’ is a must. To save time and avoid human mistakes typing all SE11 fields into segment manually you can create a segment from a template. In menu Segment -> Create with template choose DDIC structure and type in PXXXX, where XXXX is your infotype code. When you save segment systems checks its length to comply with 1000 IDOC segment length.

In my scenario, I’ll use country-specific infotype 0293. Here is how it looks like in segment.

New IDOC segment

New IDOC segment

 

Don’t forget to release the segment in Edit menu.

For this tutorial, I’ve set ALE integration within one SAP instance. It means sender and receiver both in the same system on the same server. So all settings are distributed across both sender and receiver clients. If you send data outside of one server you need to perform some settings on receiving system.

I both systems we need to specify IDOC segment in T777D view like in a picture below.

In both systems in WE30 create IDOC extension for basic type HRMD_A.

Add our new segment to IDOC structure. Adding this will say ALE infrastructure to send not basic HRMD_A IDOC but use your custom infotype segment on top of standard IDOC.

Half the job done. Release this extension in Edit menu.

In WE82 add our extension to message type HRMD_A so the system will use it instead of standard IDOC.

Change partner profile to send an extended version of HRMD_A IDOC. It could be done in WE20 or BD64 transaction.

Let’s test. Open PFAL and send your personnel number. We can see our segment filled out with data correctly.

You’re done and can send almost any hr infotype in ALE distribution model. Almost any because a lot of infotypes and specifically custom infotypes are not that long to use long infotype ALE distribution solution.

Sending long infotype over ALE

It’s a little more complicated. Overall we can send custom infotype over ALE with the length no more than 3000 symbols. We remember one segment is 1000 long, so we need to split our infotype into three chunks. The solution is simple. We need to have something unique in each segment to be able to build infotype back after we’ve split it. Best practice is to include a well-known PSKEY structure as a key field into each segment. It would allow us to split infotype without any data loss and build it again in receiving system. Very easy! Like a blockchain in SAP HR :) Once receiving system gets this IDOC it reads all segments with the same key and recovers the whole picture.

For this example, I’ll take a long infotype which is almost 1600 symbols long. We’ll use two segments. The first segment is Z1PA0294 and second is Z1PB0294.

To connect two segments we make them dependable on each other. The first segment is a parent, second is a child.

Don’t forget to say system we have a couple of segments in our infotype. In T777D fill second segment field with our data.

Run PFAL and here is what we see. Child segment is empty. What’s wrong?

Here is a trick. SAP doesn’t know how we want to fill our segments. In case one segment it’s very simple – the system just copies data with move-corresponding ABAP statement. We need to help SAP to fill this data. Create a project in CMOD with this RHALE001 enhancement.

Inside activate two components. One to split infotype into chunks and second to glue chunks into one whole piece.

EXIT_SAPLRHAL_003 – split
EXIT_SAPLRHAL_004 – glue

I’ve written two functional modules to do data conversion. Sources provided at the end of this article.

ZCONVERT_P0294_TO_Z1PA0294
ZCONVERT_Z1PA0294_TO_P0294

By the name you can guess that one converts the infotype into a segment, the second is the reverse. Pay attention both FMs refers to the first, parent segment, not both.

Activate functional modules, activate CMOD project and run PFAL. You’ll see the child segment filled with data.

In case you need to do some data conversion you can do it inside these functional modules or use standard solution which I described in another post: Data conversion in SAP ALE

Share this post with your SAP friends and colleagues. It won’t cost you anything but will motivate us to write more interesting content.