Michal’s tips: Application Interface Framework (AIF) – IDOC with custom selection criteria (index tables).
In my previous article I’ve shown how to process IDOCs via the AIF flow –
Michal’s PI tips: Application Interface Framework (AIF) – IDOC processing with AIF actions. One of the advantages of processing IDOCs via the whole AIF flow and not only as shown in my other article – Michal’s PI tips: Application Interface Framework (AIF) 2.0 – monitoring existing IDOCs is that you can define your own search criteria for IDOCs. In a typical IDOC scenario we’re using transactions WE05/WE05 or BD87 to monitor IDOCs but if we want to search one IDOC which created a single transaction (let’s say a sales order) among thousands of IDOCs there is no easy way to do it quickly. We can use transaction WE09 which allows searching IDOCs on the basis of the IDOC payload but this transaction does not use any indexes and instead it’s looking up the IDOC segments and only then it can extract the data from those segments. Therefor WE09 is very slow. AIF gives us a much faster and more comfortable to use option – we can create index tables which and by means of simple configuration point out which fields should be indexed and later on we can use those fields on the standard error handling monitoring transaction for searching for our IDOCs.
How can we do that?
1. At first we need to create a index table with the fields we want to monitor (use for search parameters).
2. Then we need to create a program with subselection screen which will be called from the standard error handling monitoring transaction once we select our interface number.
3. After that we need to assign out index table and selection screen program to the AIF interface number.
4. Finaly we need to select the field we want to use for searching and assign it to the selection parameter from the subselection screen.
For the purpose of the article I will be using the same AIF interface as was created in the first article – Michal’s PI tips: Application Interface Framework (AIF) – IDOC processing with AIF actions. In order to create an AIF index table we need to use an AIF template (also default index) table – /AIF/STD_IDX_TBL and copy it. Then we can assign our own selection criteria fields. IDOC SYSTAT01 has a field called REPID – Program Name which I’d like to use for searching – that’s why I will add one field to the custom index table called KEY_FIELD_1 (it has less chars than REPID but for the purpose of the article we don’t care about it). Figure below shows how a table like that can look like.
The second step is to create a selection screen which will be using our search parameter. The program can look exactly as the one listed below you just need to make sure that the program needs to be of type – Module Pool.
|Selection screen with one parameter – listing
SELECTION-SCREEN BEGIN OF SCREEN 0001 AS SUBSCREEN.
PARAMETERS: p_c2 TYPE string.
SELECTION-SCREEN END OF SCREEN 0001.
AT SELECTION-SCREEN OUTPUT.
The next step is to assign the index table and selection screen program to the AIF interface in transaction in Transaction – /AIF/CUST – Error Handling – Namespace Specific Features as shown in the Figure below.
Final configuration step is to select the field you want to use from the IDOC structure and assign it to the parameter from the selection screen program in Transaction – /AIF/CUST – Error Handling – Interface Specific Features. You can also select the icon and tooltip which will be displayed once the selection is made.
After the configuration is completed you can start your IDOC flow and check it there are any entries in the index table. If there are that means that the configuration is working and you can open standard transaction – Transaction – /AIF/ERR select the interface with the appropriate button and you should be able to see the custom selection screen parameter which you can use to input the search value.
Once you run the selection you will see the messages with this specific parameter only and you can also see the value of the key field next to them.