Blog > SAP AIF multi index table with single index tables

SAP AIF multi index table with single index tables

SAP_AIF_Multi_Index_tables_single_table_Nowak
Mateusz Nowak SAP Integration Consultant, SAP Press Author
icon__calendar 2018-06-10

SAP AIF multi index and single index tables

Hi there! In this blog I will show you how you can use SAP AIF multi index table and single index tables in your interfaces.

This blog is the extension of the previous blog: How To Create a Single Index Table in SAP AIF and therefore some steps will be explained in a more general way. You can always visit the previous blog in case you occur any issues with details, but I believe that you won’t have any problems, as you mastered this knowledge last time reading the previous blog! 🙂

Multiple selection index tables are used in situations you want to create additional selection screen for the values, that appear more than once in a single message (for example plant ID on item level or material number in Sales Order).

In this blog I will show you how to use multiple index table to handle selection for the material number in inbound IDoc sales order interface in IDoc segment E1EDP01-E1EDP19-IDTNR. 

How to create SAP AIF multi index table?

First of all, you have to create an additional table based on a template table: /AIF/MIDX_TEMPL  in transaction SE11. Once you created the table, add a field MATNR at the end of the table with type MATNR, in the same way, you did it for single index table. In addition, you will see, that this template table contains another field COUNTER, that has our favourite data type: INT4 🙂 This field is added right after MSGUID field and has to be defined as Key field:

Template table for SAP AIF multi index table

 

Module pool program for SAP AIF multi index table

Next, we have to create or extend existing module pool program. I will extend the module pool used in previous blog with the select options for material number. In case of any issues see the following code snippet of this program. For multiple index table, we need additional S_MAT select-options.

PROGRAM ZAIF_SEL_SCREEN_0001.
DATA: gv_po_num TYPE bstkd,
      gv_kunnr  TYPE kunag,
      gv_matnr  TYPE matnr.

SELECTION-SCREEN BEGIN OF SCREEN 0001 AS SUBSCREEN.
SELECT-OPTIONS:
    s_po  FOR gv_po_num,
    s_kun FOR gv_kunnr,
    s_mat FOR gv_matnr.
    .
SELECTION-SCREEN END OF SCREEN 0001.

AT SELECTION-SCREEN OUTPUT.
  /aif/cl_global_tools=>get_value_from_mem( ).

 

SAP AIF Customization required for multi index tables

In the last step, you have to configure newly created index table in AIF Customizing. Go to transaction /n/AIF/CUST and go to SAP Application Interface Framework –> Error Handling –> Define Interface-Specific Features.

Here you can see one difference between a single index and multi-index tables configuration. For single index table you have to add table name in Define Namespace-Specific features first. For multiple index tables you shouldn’t do it, because you will add it directly in Interface-Specific features.

Add a New entry. As first thing change Multi.Selection Type to M Multiple Selection and click ENTER. Then fill all the rest information as the one shown in the screenshot below:

SAP AIF multi index table customization

SAP AIF multi index table customization

Congrats! Multiple index table in SAP AIF is configured properly!

Now when you send via WE19 or SOAPUI a message with two line items and you open your multi-index table in SE16N you should see two entries with the same SAP AIF GUID, but with different material numbers. Thanks to this we know, that our AIF multi-index works!

Content Preview of SAP AIF Multi Index table in SE16n

Content Preview of SAP AIF Multi Index table in SE16n

Conclusion

I hope that creation and configuration of SAP AIF MultiIndex tables and Single Index tables are now a piece of cake for you!

I am curious, for which field do you use multi index tables in your scenarios?

We are describing this and other processes in the more detailed way in our new book on which we are still working on. I can tell you, that book will be available in October as an E-Bite on SAP Press!

Mateusz Nowak SAP Integration Consultant, SAP Press Author
SAP Integration consultant since 2016. Mateusz is the author of SAP Press Book: Interface Monitoring and Error Handling with SAP AIF. He's also a trainer in the openSAP course Virtualize and Automate Your SAP Testing Using Int4 IFTT. Matt has been involved in multiple integrational projects as ABAP Developer, AIF lead and consultant. Skilled at a variety of tools and development techniques including ABAP, AIF, PO, BRFplus, IDocs, Adobe Forms, Smartforms, IDocs, ALE, SCPI.