Modify Error Handling with Custom Objects
Maintain custom objects to customize the error handling in the message monitor of SAP Application Interface Framework.
Overview
You will learn
- How to create a custom hint to provide additional information about how to solve a particular error
- How to create a custom data link that links a particular error code to a field in the data structure
- How to create a custom message text to replace the default log message text with a user-specific text
- How to create a custom function to navigate to a transaction
Prerequisites
Prerequisites
- You’ve set up SAP Application Interface Framework
- SAP S/4HANA 1709 or later, AIF 4.0
- You’ve completed the tutorial Create a Simple IDoc Interface
Steps
Intro
In this tutorial, you will learn how to use custom objects to simplify the error resolution of an interface in SAP Application Interface Framework.
You can link custom objects, such as hints, data links, message texts, and functions, to a log message and an interface to modify the error handling process to your preference.
This tutorial focuses on creating custom objects for an IDoc interface. Note that custom objects are also supported for any other technology that SAP Application Interface Framework supports, such as Proxies or Web Services.
As custom objects are defined directly in the Message Monitor based on an existing log message, let’s first create a couple of sample messages to use later.
Send in new test IDocs, for example using the Test Tool for IDoc Processing (transaction code WE19).
Send in a new test message with a new customer. The message should be processed successfully.
Send in a new test message with a wrong customer type (for example, change CUSTTYPE to
X). This message should run into an error.In SAP GUI, check the results of your test in the Interface Monitor (transaction code
/n/AIF/IFMON).When you select the summary line for your interface, you’re forwarded to Monitoring and Error Handling, where you can see your selected test messages. Choose either the Success or the Error icon to display the respective message. One message should be in status
Successfulwith the message text confirming that the flight customer has been created. The other message should be in statusErrorwith the message textCustomer type can be only B or P.

Once the new flight customer has been created, you want to navigate to the customer record to display its details. Let’s configure this navigation using a custom function.
In Monitoring and Error Handling, select the successful message.
In the Log Messages section, select the message text stating that the flight customer has been created.
In the menu, choose Customize > Custom Functions.

Menu Custom Functions In the Custom Function Action section, enter transaction
BC_GLOBAL_SCUST_DISP.In the Parameter table, maintain a new entry with the following details:
Parameter ID Fill Method Value from Message Variable CSMMessage Variable[MsgVar2]
Create Custom Function Maintain the following details in section Custom Function Attributes:
Parameter Value Text Display customerTooltip Display customerIcon @A0@Skip First Screen check the box Save your changes
Selecting the Display customer icon in the Log Messages section now forwards you to the customer record display screen.
For the erroneous message, you’d prefer an own custom text instead of the default log message.
Select the erroneous message.
In the Log Messages section, select the message text stating that the customer type can only be B or P.
In the menu, choose Customize > Custom Message Text.

Menu Custom Message Text In the upcoming dialog, enter the New Message
Wrong customer type.
Create Custom Message Text Save your changes.
The customized message text is now displayed in the message log.
For the erroneous message, you also want to maintain a hint that describes how to fix the error.
Select the erroneous message.
In the Log Messages section, select the new customized message text.
In the menu, choose Customize > Custom Hints.

Menu Custom Hints In the upcoming dialog, enter the Tooltip
Wrong customer type.Maintain the Text by copying and pasting the following hint:
CodeYou have entered a wrong customer type. To be able to proceed with the customer creation, navigate to the Customer Type field in your message, and enter a valid type, i.e., either B or P, then save and restart the message.
Create Custom Hint Save your changes.
Selecting the icon in the Hints column in the Log Messages section now displays your custom hint text.
To facilitate the error resolution, you’d like to directly navigate to the field in the data structure that causes the error.
Select the erroneous message.
In the Log Messages section, select your customized message text.
In the Data Structure section, double-click the data structure
E1BPSCUNEW.In the Data Content section, scroll to the very right, and select the field in column
CUSTTYPE.In the Log Messages menu, choose Customize > Custom Data Link.

Menu Custom Data Link In the upcoming dialog, choose Create to confirm the creation of the new data link.

Create Custom Data Link The value of the field
CUSTTYPEis highlighted in red.Double-clicking the log message now navigates you to the problematic field in the Data Content section.
Before testing the custom objects, let’s change the customer type field so we can fix the error.
Go to Customizing for SAP Application Interface Framework (transaction code
/n/AIF/CUST) and navigate to Error Handling > Define Interface-Specific Features.In the upcoming dialog, enter namespace
DEMO_1, interfaceFCUSTOMER, and version1, then press Enter.Double-click Define Changeable Fields in the menu on the left. Add a new entry with Index number
10and Field PathE1SCU_CRE-E1BPSCUNEW-CUSTTYPE.
Define Changeable Fields Save your changes.
Back in the Monitoring and Error Handling screen, the field Customer Type is now editable in the Data Content section.
If you opened Customizing in a new screen, you might have to restart Monitoring and Error Handling for the changes to be visible.
Now finally, let’s test that the custom objects we configured are working as planned.
As in step 1, send in a new test message with a wrong customer type to force an error.
In Monitoring and Error Handling, refresh the list of messages. The new message should be in status
Error.Your custom message text
Wrong customer typeshould be displayed.
Monitoring and Error Handling Choose the icon in the Hints column to display the custom hint you maintained.

Show Hint Choose Close.
Use your custom data link to find the source of the erroneous message and double-click the message log text. You’re navigated to the field CUSTTYPE.
Maintain a valid value for the field CUSTTYPE - either
BorP- and choose Confirm.
Edit Field Save the changes.

Save Field Change Restart the data message. It should now process without errors.
To test your custom function, click the Display customer icon that has appeared for your log message in column Function.

Navigate To Transaction The customer record details are displayed.

Display customer record
Congratulations! You’ve successfully configured a custom hint, custom function, custom message text, and custom data link for a log message.
Resources
Discussion
Share feedback on this tutorial or join the conversation in SAP Community.