Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 


During my work in AIF development I sometimes get questions from customers asking how different functionalities are working or what the best way is to solve a specific requirement with SAP Application Interface Framework. From time-to-time I like to describe the solutions to the most common problems in How-To-Guides. If you have a specific topic where it would be nice to have a How-To-Guide drop me a message with the topic request. 

Problem Description

You have a file containing data which needs to be processed and monitored. The file containing the data is a flat file (the data contained in the file has no structural relationship between the records).

AIF provides the possibility to process and monitor flat files. During the processing of the file in AIF you can use all available mapping functionalities like checks, fix values, value mappings,… Afterwards the result of the message processing can be viewed in the Monitoring and Error Handling.

How does it work?

You need to perform the following steps to create an inbound file interface:

  1. Create the DDIC structures for the interface

  2. Develop the interface

  3. Configure the file adapter settings for your interface

  4. Upload File

  5. Check Monitoring and Error Handling transaction

The following example will describe step-by-step how to setup a simple file interface.


This example uses the SAP flight booking example. 


In order to execute this example we require a file containing some test data and corresponding structures.

Create a CSV file and add some entries:

 9999 Fritz Maier Hauptstrasse 291 Stuttgart DE 4242424242424242
9998 Edeltraud Fischer Berliner Str. 8 Hamburg DE 4299424123456789

Use ; to separate the data.

1. Develop the Interface

Create RAW Structure

Create the RAW structure for your interface.

Create a DDIC structure for the line type re-sampling the content of the file. In our example the structure should look like this:

The name used for the structure in this example was ZAIF_BM_FILE_CUSTOMER.

Create a table type for the newly created structure. The table type used in this example was named ZAIF_BM_FILE_CUSTOMER_TT. The table type uses ZAIF_BM_FILE_CUSTOMER as line type.

Create the RAW structure for the interface. The structure contains only one component named LINES with the newly created table type as component type. The DDIC structure should look like this:

In this example ZAIF_BM_RAW_CUSTOMER is used as name for the RAW structure.

Save and activate all structures.

Create SAP Structure

Create the DDIC SAP structure for your interface. The SAP structure re-samples the data in the way it is required by the follow up processing in the system. In order to create the SAP structure we have to check the function module we will use to process the flight customer. In this example we will use function module BAPI_FLCUST_CREATEFROMDATA. The function module requires the customer data in a structure from type BAPISCUNEW. As we have several customers in our file we require a structure as shown below.

The structure will be created bottom to top. Therefore we start to create a structure to contain the customer data (in the example the structure is named as ZAIF_BM_CUSTOMER_DETAIL):

As our file can contain the data of several customer we again require a table type for the newly created structure. Create a table type ZAIF_BM_CUSTOMER_DETAIL_TT and use the newly created structure ZAIF_BM_CUSTOMER_DETAIL as line type.

Create the SAP structure for the interface. The structure contains only one component named CUSTOMERS with the newly created table type as component type. The structure should look like this:

In this example ZAIF_BM_SAP_CUSTOMER is used as name for the SAP structure.

Save and activate all structures.

2. Develop Interface

After creating the required structures for the AIF interface it is time to develop the interface itself.

Create Namespace

Go to AIF customizing and navigate to --> Interface Development --> Define Namespace. Enter a name and description. In this example namespace ZBM_03 is used.

Create Interface

Go to AIF customizing and navigate to --> Interface Development --> Define Interfaces. Select your namespace and create a new interface. Enter a description and maintain the structures created in the first step.


Specify Interface Engines

To ensure the data is processed correctly by AIF the interface engines have to be maintained. Go to AIF customizing --> Interface Development --> Additional Interface Properties --> Specify Interface Engines and select your interface.The AIF file adapter is using AIFs own XML persistence and runtime. Therefore we have to set the Application and Persistene Engine for the interface to XML.


Define Structure Mappings

Go to the AIF customizing and create the mappings for the interface. --> Interface Development --> Define Structure Mappings select your interface.

In the Select source structure dialog create a new entry and select the structure part that will contain the line items. In this example select LINES.

Select the line and nativate to Assign Destination Structure on the left hand side. Create a new entry. As destination structure select the structure part of your SAP structure that will contain the customers.

Navigate to Define Field Mappings. Map all fields of the RAW structure to the corresponding field of the SAP structure. Create the following field mappings:

The Field Mappings should look like this:Save.To finally process the customer data in the system we require an action that will call the BAPI which is used to process the flight customer data. Navigate to Assign Actions in the menu on the left hand side and create a new entry. Enter the namespace and action name and also enter the record type. The record type is the table containing the mapped customers.Save.

Use the forward navigation to jump into the action. Doubleclick the action to navigate forward.

Change the Action definition. Enter a meaningful description for the action and set the commit mode and the commit level. Maintain the main component type. The main component type is the name of the structure which is used to store the details of a flight customer in the SAP structure.


Navigate to Define Functions in the menu on the left hand side and create a new entry. If the Function Module does not yet exist you will be asked if you want to create the function module.


Navigate into the new function module by double clicking the name. In the function module call the follow up processing by inserting the coding displayed below:
customer_data = curr_line-CUSTOMER_DATA
customernumber = curr_line-id
return = return_tab.

In addition CURR_LINE does not have a type yet. Navigate to the changing parameters and enter the associated type for parameter CURR_LINE (Hint: it should be the same type like the Main Component Type used in the step before).

Save and activate the function module.

3. Configure File Adapter

To be finally be able to process the file in AIF the details have to be specified. The configuration is done in the AIF customizing under System Configuration --> Configure File Adapter.

Select your namespace and create a new fileadapter configuration.

In this example we use a CSV file. To process the file correctly we have to select text file as type. The content of the file is a flat structure. Enter ; as Field Separator. The file contains a specified header line, therefore we have to select "Header Line Exists". The final step is to enter the RAW structure name in field structure name. Beside the RAW structure the field in the structure that will contain the imported lines need to be selected. In this example the value for Field Name is LINES.


4. Upload File

The final step is to select and upload the file. The AIF File Upload can be found in the SAP Menu under SAP Menu -> Cross-Application Components --> SAP Application Interface Framework --> File Upload (or directly via transaction /AIF/LFA_UPLOAD_FILE).

Select your File Adapter Configuration (Config. Namespace and Config ID created in step 3). In section Upload from select the path where your file is stored.

Press execute.

You will be forwarded to a log view where the log messages which have occurred during upload are displayed.

5. Check Monitoring and Error Handling

The final step: check the result in the monitoring and error handling. Go to transaction /AIF/ERR and select your interface (if you did assign a recipient to the interface you can also jump to the Monitoring and Error Handling via Interface Monitor).

Press execute. You are forwarded to the Monitoring and Error Handling View. Check the messages displayed in the data messages view by double clicking on the interface name.

This is one possibility to create an AIF interface for a simple file upload.


This blog post gave an introduction on how to use the AIF file upload to process a flat file. As the file is processed by AIF it is possible to use all mapping functionalities provided by AIF. This is a very simple interface and therefore not all possible functionalities that can be used during the processing of a file in AIF are described here.

Active Contributor
0 Kudos
Very nice and easy explanation,

Former Member
0 Kudos

If I understand it correctly, the file upload is performed via a JOB which means I cannot debug the function module? Is there a way how to debug it?


0 Kudos
hi, how are you? i've tried to use the same process to get and upload an xml file, using the file adapter, but, i dont know how config the file adapter, i have created the transformation, but, iam stuck, could you explain me how upload the XML file??? thanks in advance
Active Contributor
0 Kudos
Nice document. could you please help me with the structure of your main component created?

i am trying to replicate the same one in my ides and then start of implementing some of the same scenarios in to my client system.
Do you mean the structure used as main component type in the action?

In the Assign Action we assigned the table containing the customer data as record type. In the action we have to define the DDIC type of the structure used in the customer table as main component type.

0 Kudos
Hi Britta,

Can you please provide details about how to setup Odata service monitoring using AIF? may be small example?

I already tried –>


0 Kudos
Good day Britta,

This is an awesome step-by-step guide for AIF Config for monitoring File, May you please share the AIF for monitoring any of below Interfaces:

1).Configure SAP AIF to monitor Web Services.

2).Configure SAP AIF to monitor OData Services.

3). Configure SAP AIF to monitor qRFCs.  

4). Configure SAP AIF to monitor tRFCs.   

5). Configure SAP AIF to monitor IDOCs.

6). Configure SAP AIF to monitor Batch Input(BDC)

7). Configure SAP AIF to monitor BRF+


Tumelo Modise
Hi Tumelo,

thanks for the feedback.

For some of your topics there is already some content available. Check out this blog on how to monitor RFC messages or this document on how to monitor IDocs.

Best Regards

0 Kudos
This is very helpful, Could you please explain how to process the entire file once with AIF file interface for a scenario where we will have header as well as item data in the file.
0 Kudos

thanks for the feedback. I will see if I can provide another blog in the future describing your scenario.

Best Regards

0 Kudos
You can debug AIF application using /AIF/IFTEST (interface test tool) -

0 Kudos

I am looking for a way to set up AIF for an inbound flat file with a header and item records in it. Any tips on how to set it up?