Show TOC

Function documentationPersistence Layer and Runtime

 

In the SAP Application Interface Framework, the following are available to provide you with fast and parallel message processing:

  • Persistence layer

    Enables the storage of interface messages for processing at a later point in time

  • Runtime environment

    Processes messages and offers a runtime configuration to configure message processing at a later point in time

Integration

The SAP Application Interface Framework supports a number of runtimes that are part of SAP NetWeaver:

  • PI services

  • Web services (web service reliable messaging)

  • ALE/IDOC

In addition, the SAP Application Interface Framework has its own runtime that uses the standard job scheduling mechanisms to process data in background jobs. To monitor background jobs, use the standard transaction code SM37.

Features

The SAP Application Interface Framework persistence layer provides a lean runtime environment by enabling the storage, maintenance, and scheduling of runs for message processing. To enable the storage of messages to be processed asynchronously at a later point in time, the static method TRANSFER_TO_AIF (for single messages) or TRANSFER_TO_AIF_MULT (for multiple messages) of class /AIF/CL_ENABLER_XML can be called by customer-specific reports. The message is stored in a message queue to await processing. To facilitate processing at a later time, a runtime configuration group is provided that defines the processing of a set of messages by the SAP Application Interface Framework runtime environment.

The graphic above shows message processing within the SAP Application Interface Framework runtime environment. Messages are stored in the message queue to be processed. The runtime environment creates persistence runs to manage message processing in background jobs. A run is created automatically for a specific interface, that is, for a certain combination of interface namespace, interface name, and interface version. The messages are processed by run packets, which are also created automatically from the runs. The processing by the runs and run packets can be configured using the runtime configuration group, which you maintain with transaction /AIF/PERS_CGR. In this transaction, you can define several runtime configuration groups with meaningful descriptions per namespace.

The messages are stored in application table /AIF/PERS_QMSG. The message status can be one of the following values:

  • N New

  • A Assigned

  • S Started

  • F Finished

  • R Reprocess

When a message is passed to the persistence layer, the status is set to New. A namespace and a name for a runtime configuration group is provided to manage message processing according to a certain configuration. The runtime environment sets the status according to the processing.

Activities

To process messages in the runtime of the SAP Application Interface Framework, call the enabler for XML, for example, in a report of function module. The enabler for XML provides 2 static methods both of which save the messages in the persistence of the SAP Application Interface Framework and schedule the messages’ processing. Which of the following 2 methods you should call depends on whether you want to process a single message or multiple messages:

  • /AIF/CL_ENABLER_XML=>TRANSFER_TO_AIF

    Call this method if you want to process a single message in the SAP Application Interface Framework’s runtime. In the following table, the method’s most important input parameters are described:

    Parameter Name

    Description

    IT_ANY_STRUCTURE

    You can pass a single message to this importing parameter for processing. The single message should be the type of your raw data structure.

    IV_QUEUE_NS

    (Optional) Namespace of a runtime configuration group

    IV_QUEUE_TYPE

    (Optional) Runtime configuration group

  • /AIF/CL_ENABLER_XML=>TRANSFER_TO_AIF_MULT

    Call this method if you want to process multiple messages. In the following table, the method’s most important input parameters are described:

    Parameter Name

    Description

    IT_ANY_STRUCTURE

    You can pass a table that contains multiple messages to this parameter. The type of the table should be a table type of your raw data structure.

    IV_QUEUE_NS

    (Optional) Namespace of a runtime configuration group

    IV_QUEUE_TYPE

    (Optional) Runtime configuration group

    Note Note

    You can create a runtime configuration group in transaction /AIF/PERS_CGR. If you do not specify a configuration group, the default runtime configuration group is used.

    End of the note.

You need to create an interface in Customizing for SAP Application Interface Framework (transaction code /AIF/CUST) under Start of the navigation path Interface Development Next navigation step Define Interface End of the navigation path. The raw data structure that you maintain should be the same as the one you used when calling the XML enabler. If you used the TRANSFER_TO_AIF_MULT method, the raw data structure and the line type of your table type have to be the same.

In order to monitor messages in Monitoring and Error Handling, in Customizing for SAP Application Interface Framework, you have to define the following engines for an SAP Application Interface Framework interface under Start of the navigation path Interface Development Next navigation step Additional Interface Properties Next navigation step Specify Interface Engines End of the navigation path:

  • Application engine: XML

  • Persistence engine: XML

  • Selection engine: AIF index tables

  • Logging engine: AIF application log

If you created several interfaces for one raw data structure, you have to maintain an interface determination in Customizing for SAP Application Interface Framework under Start of the navigation path System Configuration Next navigation step Interface Determination Next navigation step Interface Determination for XML Interfaces End of the navigation path.

Runtime Configuration Group Creation

You can create your own runtime configuration group. You can access the Runtime Configuration Group overview (transaction code /AIF/PERS_CGR) from the SAP Easy Access menu by choosing Start of the navigation path Cross-Application Components Next navigation step SAP Application Interface Framework Next navigation step Administration Next navigation step Customizing Next navigation step Runtime Configuration Group End of the navigation path. For a selected namespace, you can maintain the following:

  • Runtime Configuration

    A three character identifier for a runtime configuration group

  • Runtime Configuration Group Active

    If you do not select the checkbox, messages are saved to the persistence of the SAP Application Interface Framework but they are not scheduled or processed.

  • Run Scheduled

    If you select the checkbox, the runs are executed asynchronously in a job. Otherwise, the run is executed synchronously.

  • Schedule Packages

    If you select the checkbox, the packages are processed asynchronously. Otherwise, the packages are processed synchronously.

Furthermore, you can specify the user under whom the job is to be processed (you can be this user if you have the correct authorization) and the user that released the scheduled batch job. You can specify the number of messages per package and the number of messages per run.

Default Processing of Messages

In the SAP Application Interface Framework, if you do not define a runtime configuration group, the runtime processes messages based on the following defaults:

  • Background job planning user is SY-UNAME (the user who passes the message to the persistence runtime)

  • Background job execution user is SY-UNAME (the user who passes the message to the persistence runtime)

  • 20 messages are processed per message packet

  • 100 messages are managed per run