Skip to Content

EM : Event Message processing using AIF

In this post I have described how the process works to receive an inbound event message using ES, AIF and how to re-process the failed event messages.




FWO: Forwarding order

TO: Freight order / Transport order

FU: Freight unit

TU: Trailer unit

Using SAP EM Enterprise Service  TrackedProcessEventNotificationCreateRequest_In events are posted in EM. SAP PO/PI service interface and interface mapping required from PI/PO end.

SAP AIF supports for event message re-processing by changing the event details such as location, event code, tracking id and date /time. Authorisation based on event tracking ID is also promising in AIF but it requires custom development in AIF.

Security roles for business users are required to re-process the error event message in AIF. Using event message tracking id, standard EM authorisation is sufficient for accessing AIF monitoring tool.

AIF Monitoring Dashboard selection screen



AIF Event Message re-processing



Data structure space from the right bottom of the AIF dashboard support for event message reprocessing by changing the event details.



Structure value turns to yellow colour by default after changing the values.



Message mapping based on master/ transactional data in AIF is easy to maintain rather than building the complex message mapping in PI/PO or any other integration tools. PI Inbound message  queue can be deleted after the error as it may block the subsequent event processing.

Benefits of using AIF in EM

Event message re-processing

Tracking id mapping and custom business validations

Allowing the business user to re-process the event messages

You must be Logged on to comment or reply to a post.
  • This is informative.

    Can you tell me in details how EM can be set up for integration with application interface framework which you have shown above. Step by step set up will help  a lot

    • I did a similar implementation, here is roughly how to implement it:

      install AIF Add-ons on EM

      install support packs (i faced blocking issues without those)

      Import RFC objects from BAPI (addEventMessage02) in SPROXY

      Create Service Interface using RFC messages

      Create a Proxy for the Service Interface

      in transaction SIW generate AIF code

      using /AIF/CUST and /AIF/IFB, customize structure mappings in /AIF/ (the annoying part), value mappings as you need.

      There are several pain points during the generation of the AIF interface, but you will find the way.

  • secondly if a carrier externally sends an event message and in case message fails due to wrong tracking ID/location etc can we use AIF to reprocess the event messages.

  • I have a couple of points to make here:

    • AIF performs basically the same functions as PI so you don't in fact need PI in this landscape at all unless it's your point of entry in to your system from the outside world. You could receive a carrier 214 in Gentran, Gentran can map that to a generic XML structure and pass it to AIF which will in turn map it in to a structure to call the BAPI to add the event message
    • Whenever you suggest that a tool can modify data received from the outside world you should also state that this is bad practice.... If the supplier has sent you the fact that they are sending your shipment to warehouse ABC and you decide to change it to BCD then where is the integrity of the process? The supplier needs to change it on their end and resubmit it so that both systems are in synch. In some cases it's a compliance issue to manually adjust EDI content and it's the same in this regard. Be careful when changing data - Reserve this for a support function and understand the business process and ramifications fully before proceeding.

    Michal Krawczyk implemented AIF on our EM server about a year ago and wrote several blogs on the step-by-step setup of it. Check it out on SCN.

    • Hi Kevin,

      Integrity of the process is defined/driven by business process not based on tools/personal opinions. you don't need to provide the change option to entire structure of the message, lot of options/authorisations are available to change only to particular data in message.



  • Hi Sukumar,

    Thanks for the post.

    Could you please shed some light on what is the difference between modifying the event message through AIF / modifying the IDOCS to process events messages. Lets say i have a customer pre-processing function module like in the above case to validate BP, Location, Freight Order id and tracking ID and every time the details donot match; i fail the IDOC. I could potentially reprocess the IDOC to post event messages. My understanding is that it works in similar ways to modifying IDOCS except that it offers "n" number of selection criteria and authorization as to what data values can actually be modified by the user. Correct me if i am wrong.


    Abhishek Vasudevan

    • Yes Abhishek your understanding is correct, EM pre-processing FM validation generate invalid event entry in EM table. Using AIF you can stop the event message in AIF and you can get rid of invalid event message entry in table.

      AIF provides business user can able to re-process the message rather than depending on consultants and you can include the business validation and external mapping.

      For application system AIF is useful when the business volume grows and involves more business validation.

      For EM from the day one you will receive more events, for example 1 application document may needed 10 event messages and you can’t process 1000 error event message using idoc and it may require additional resource for support activity.


  • Hi All,

    Steps to enable ES and AIF for event posting.

    1) import SCMEMSRV 9.0  component in PI/PO

    2) it will automatically generate the proxy class in EM

    3) then enable the sproxy class link to AIF using /AIF/CUST

    4) define new interface name space and mapping, error monitoring configuration and selection screen program for interface .

    5) Use the /SAPTRX/SPOT_SE_EM_SERVICES Enhancement Spot for custom validation

        SAP EM ES Standard BADI

    6) You have to pass the return values of BAPI to AIF to set the message as  processed or park as error event.