Skip to content

Commit 8b238a9

Browse files
committed
new aif tutorial wrt key fields
1 parent d199845 commit 8b238a9

14 files changed

Lines changed: 228 additions & 0 deletions
Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
---
2+
parser: v2
3+
auto_validation: true
4+
time: 20
5+
tags: [ tutorial>beginner, software-product>sap-s-4hana, tutorial>license]
6+
primary_tag: software-product>sap-application-interface-framework
7+
---
8+
9+
# Define Single Key Fields
10+
<!-- description --> Define single key fields to improve error handling in the message monitor of SAP Application Interface Framework.
11+
12+
## Prerequisites
13+
- You've set up SAP Application Interface Framework
14+
- SAP S/4HANA 1709 or later, AIF 4.0
15+
- You've completed the tutorial [Create a Simple IDoc Interface](aif-idoc-monitoring-interface-create)
16+
17+
## You will learn
18+
- How to define single key fields
19+
- How to create a selection screen
20+
21+
## Intro
22+
In this tutorial, you will learn how to define single key fields to simplify the error resolution of an interface in SAP Application Interface Framework.
23+
24+
You can define single key fields and a selection screen to be able to search for messages based on business data.
25+
26+
> This tutorial focuses on customizing an IDoc interface. All the settings are also supported for any other technology that SAP Application Interface Framework supports, such as Proxies or Web Services.
27+
28+
29+
---
30+
31+
32+
### Maintain interface-specific single index table
33+
34+
To be able to search for messages based on business data, you need to enhance the interface-specific index table.
35+
36+
> As a prerequisite, you should have gone through the [Create a Simple IDoc Interface](aif-idoc-monitoring-interface-create) tutorial and hence should have already defined an interface-specific single index table with name `ZIDOC_MON_IDX`. Otherwise, run through **step 7** of the tutorial to create the index table.
37+
38+
1. Run transaction code `SE11`, enter the table name `ZIDOC_MON_IDX` and choose **Change**.
39+
40+
2. Add the following new entries:
41+
42+
| Field | Data element
43+
| :-----------------------| :-------------------------------------------
44+
| **`COUNTRY`** | **`S_COUNTRY`**
45+
| **`REGION`** | **`S_REGION`**
46+
| **`CITY`** | **`CITY`**
47+
| **`CUSTTYPE`** | **`S_CUSTTYPE`**
48+
49+
3. **Save** and **activate** your changes.
50+
51+
<!-- border -->![Enhance index table](index-table-additional-fields.png)
52+
53+
54+
### Create selection screen
55+
56+
To select the additional fields from the index table, you need to create an interface-specific selection screen.
57+
58+
1. Run transaction code `SE38`, enter the program name `ZIDOC_FCUSTOMER_SELSCREEN` and choose **Create**.
59+
60+
<!-- border -->![Create program](selection-screen-create.png)
61+
62+
2. In the upcoming dialog, maintain a **Title**, and select the **Type** `Module pool`. Then select **Save**.
63+
64+
<!-- border -->![Maintain program attributes](selection-screen-attribute.png)
65+
66+
3. In the ABAP editor, maintain the code as follows:
67+
68+
```ABAP
69+
PROGRAM ZIDOC_FCUSTOMER_SELSCREEN.
70+
71+
DATA: lv_country TYPE s_country,
72+
lv_region TYPE s_region,
73+
lv_city TYPE city,
74+
lv_custtype TYPE s_custtype.
75+
76+
SELECTION-SCREEN BEGIN OF SCREEN 0001 AS SUBSCREEN.
77+
SELECT-OPTIONS:
78+
s_cntry FOR lv_country,
79+
s_region FOR lv_region,
80+
s_city FOR lv_city,
81+
s_type FOR lv_custtype.
82+
SELECTION-SCREEN END OF SCREEN 0001.
83+
84+
AT SELECTION-SCREEN OUTPUT.
85+
/aif/cl_global_tools=>get_value_from_mem( ).
86+
87+
```
88+
89+
4. Navigate to **Goto** > **Text Elements** from the main menu, then switch to the **Selection Texts** tab.
90+
91+
5. For each of the selection options, select the **DDIC Reference** flag to copy the text from the ABAP Dictionary.
92+
93+
<!-- border -->![Maintain program texts](selection-screen-texts.png)
94+
95+
6. **Save** and **activate** your changes.
96+
97+
98+
### Assign selection screen to interface
99+
100+
To fill the additional fields of the index table, you need to assign both the index table and the selection screen to your interface.
101+
102+
1. Go to **Customizing** for SAP Application Interface Framework (transaction code `/n/AIF/CUST`) and navigate to **Error Handling** > **Define Namespace-Specific Features**.
103+
104+
2. In the upcoming dialog, enter namespace `DEMO_1`, then press **Enter**.
105+
106+
3. Select **Define Interface-Specific Features** in the menu on the left.
107+
108+
> If you have gone through the [Create a Simple IDoc Interface](aif-idoc-monitoring-interface-create) tutorial, the interface-specific single index table `ZIDOC_MON_IDX` should be already maintained for your interface `FCUSTOMER`. Otherwise, enter `ZIDOC_MON_IDX` into the **Message Idx Table** field.
109+
110+
4. Enter the previously created selection screen `ZIDOC_FCUSTOMER_SELSCREEN` into the **Program Name** field.
111+
112+
5. Finally, enter **Screen Number** `0001`.
113+
114+
<!-- border -->![NS-specific settings](error-handling-ns-specific.png)
115+
116+
6. **Save** your changes.
117+
118+
119+
### Define single key fields
120+
121+
Finally, you need to define the key fields for your interface.
122+
123+
1. In the **Customizing** for SAP Application Interface Framework (transaction code `/n/AIF/CUST`), navigate to **Error Handling** > **Define Interface-Specific Features**.
124+
125+
2. In the upcoming dialog, enter namespace `DEMO_1`, interface `FCUSTOMER`, and version `1`, then press **Enter**.
126+
127+
3. Double-click **Define Key Fields for Multi. Search** in the menu on the left. Add a new entry with **Field Sequence No.** `10` and add the following values:
128+
129+
| Field name | Value
130+
| :---------------------------------| :-------------------------------------------
131+
| Key Field Name | **`COUNTRY`**
132+
| Data element | **`S_COUNTRY`**
133+
| Name Select-Options/Parameter | **`S_CNTRY`**
134+
| Field is Select-Option | **selected**
135+
| Field Name | **`E1SCU_CRE-E1BPSCUNEW-COUNTR`**
136+
| Raw or SAP Structure | **`Source structure`**
137+
| Multi.Selection Type | **`Single selection`**
138+
| Hide Tree Node in the View 1 Tree | **unselected**
139+
| Icon | **`@DV@`**
140+
| Tooltip | **`Country`**
141+
142+
<!-- border -->![Add key field country](error-handling-if-specific-country.png)
143+
144+
4. Add a second new entry with **Field Sequence No.** `20` and the following values:
145+
146+
| Field name | Value
147+
| :---------------------------------| :-------------------------------------------
148+
| Key Field Name | **`REGION`**
149+
| Data element | **`S_REGION`**
150+
| Name Select-Options/Parameter | **`S_REGION`**
151+
| Field is Select-Option | **selected**
152+
| Field Name | **`E1SCU_CRE-E1BPSCUNEW-REGION`**
153+
| Raw or SAP Structure | **`Source structure`**
154+
| Multi.Selection Type | **`Single selection`**
155+
| Hide Tree Node in the View 1 Tree | **unselected**
156+
| Parent Field Sequence Number | **`10`**
157+
| Icon | **`@AM@`**
158+
| Tooltip | **`Region`**
159+
160+
<!-- border -->![Add key field country](error-handling-if-specific-region.png)
161+
162+
5. Add a third new entry with **Field Sequence No.** `30` as follows:
163+
164+
| Field name | Value
165+
| :---------------------------------| :-------------------------------------------
166+
| Key Field Name | **`CITY`**
167+
| Data element | **`CITY`**
168+
| Name Select-Options/Parameter | **`S_CITY`**
169+
| Field is Select-Option | **selected**
170+
| Field Name | **`E1SCU_CRE-E1BPSCUNEW-CITY`**
171+
| Raw or SAP Structure | **`Source structure`**
172+
| Multi.Selection Type | **`Single selection`**
173+
| Hide Tree Node in the View 1 Tree | **selected**
174+
175+
<!-- border -->![Add key field country](error-handling-if-specific-city.png)
176+
177+
6. Add a fourth new entry with **Field Sequence No.** `40` as follows:
178+
179+
| Field name | Value
180+
| :---------------------------------| :-------------------------------------------
181+
| Key Field Name | **`CUSTTYPE`**
182+
| Data element | **`S_CUSTTYPE`**
183+
| Name Select-Options/Parameter | **`S_TYPE`**
184+
| Field is Select-Option | **selected**
185+
| Field Name | **`E1SCU_CRE-E1BPSCUNEW-CUSTTYPE`**
186+
| Raw or SAP Structure | **`Source structure`**
187+
| Multi.Selection Type | **`Single selection`**
188+
| Hide Tree Node in the View 1 Tree | **selected**
189+
190+
<!-- border -->![Add key field country](error-handling-if-specific-type.png)
191+
192+
7. **Save** your changes.
193+
194+
195+
### Send sample requests
196+
197+
Let's create a couple of sample messages to showcase the customizing changes.
198+
199+
Open the **Test Tool for IDoc Processing** (transaction code `WE19`). Send in new test messages with different customer names, countries, regions, and cities maintained. Enter an existing customer type, either `P` or `B`.
200+
201+
<!-- border -->![Sample Data](test-data-nsw.png)
202+
203+
204+
### Monitor your interface
205+
206+
Now, let's check the results of your tests in the Monitoring and Error Handling.
207+
208+
1. Open the **Monitoring and Error Handling** (transaction code `/n/AIF/ERR`).
209+
210+
2. In the selection screen, you'll notice that the additional selection fields have been added.
211+
In the **Status Selection** section, select the **Select All** button. Apply any filter, for example, filter on selection field **B/P customer** with value `P`. Then choose **Execute**.
212+
213+
<!-- border -->![Search message](test-moni-selection-screen.png)
214+
215+
3. In the message monitor, expand the complete navigation tree. You can see that the messages are grouped by country and region hierarchy. Only the messages suitable to your filter should be displayed.
216+
217+
<!-- border -->![Display messages](test-moni-gui-messages.png)
218+
219+
220+
Congratulations! You've successfully defined single key fields.
221+
222+
### Test yourself
223+
224+
225+
226+
227+
228+
---
62.2 KB
Loading
63.9 KB
Loading
63.7 KB
Loading
63 KB
Loading
41.6 KB
Loading
59.5 KB
Loading
30.2 KB
Loading
51.2 KB
Loading
23.5 KB
Loading

0 commit comments

Comments
 (0)