Technical Articles
Definition of changeable fields by cloud customers
Introduction
In the SAP Application Interface Framework it is possible to solve tasks in different ways. In my blogs I want to provide common ways how this specific tasks can be solved.
In case you have additional topics where it would be nice to have a How-To-Guide send me a message with the topic request.
Problem Description
Within AIF Monitoring and Error Handling it is possible to change values of messages.
Up to NW 7.77 (S/4HANA Cloud 1908) it was only possible for SAP to define changeable fields in the AIF interface. Starting with NW 7.78 (S/4HANA Cloud 1911), the cloud customers are also able to define custom specific changeable fields via a new Extension Point (BAdI) using the Custom Field and Logic App under Extensibility Group.
How does it work?
The functionality can be used for existing interfaces. The following steps must be executed.
- Create Enhancement Implementation
- Create BAdI Implementation
- Define Filter Conditions
- Publish BAdI Implementation
Example
This example uses the AIF Create Customer Inbound WebService example.
Prerequisites
Authorization
To be able to work with extensibility apps your user needs business roles that are authorized for the corresponding business catalogs
Business Catalog Name | Business Catalog ID | Description | Supported Applications |
Extensibility | SAP_CORE_BC_EXT | This business catalog enables you to create and maintain custom fields and custom logic, custom business objects, and custom CDS views. | Custom Business Objects, Custom Fields and Logic, Custom CDS Views, Custom Catalog Extensions, Custom Communication Scenarios |
Communication Management – Message Monitoring Configuration | SAP_CA_BC_COM_CONF_PC | This business catalog enables you to configure the monitoring and error handling environment for these cross-system interfaces. You can, for example, define which users are responsible for which interfaces and which types of log messages the users shall see. | Assign Recipients to Users |
Communication Management – Message Monitoring and Error Handling | SAP_CA_BC_COM_ERR_PC | This business catalog enables you to get an overview of these cross-system interfaces and their data messages. You can, for example, analyze the root causes of errors, restart or cancel data messages. | Message Dashboard |
After having assigned your business roles with the right catalog authorizations you’ll have the needed applications on your Home Page within the Extensibility group.
Preparation
In order to execute this example, you require an SAP delivered AIF interface. In this example, I’m using the AIF Create Customer Inbound WebService.
Create Implementation
Open the “Custom Fields and Logic” application
Switch to Custom Logic and execute “Create” Action.
In the opening popup maintain following data:
- Choose Business Context “AIF changeable fields”
- Choose BAdI Description “BADI for setting changeable fields from cloud Custom Fields and Logic”
- Enter Implementation Description “ChangeableFields AIF”
- Enter Implementation ID “CHANGEABLEFIELDSAIF”
Execute “Create” Action.
In the opening window enter the “Draft Logic”
Implement following functionality
General: Change one or more fields from changeable to non-changeable or otherwise from non-changeable to changeable. Adding new fields as changeable.
DATA ls_fields_list TYPE /aif/changeable_field_st.
ct_fields_list = it_fields_list.
* change one field from changeable to non-changeable.
READ TABLE ct_fields_list
WITH KEY field_path = 'CUSTOMER_CREATE_REQUEST-CUSTOMER_NAME'
INTO ls_fields_list.
IF sy-subrc = 0.
ls_fields_list-is_changeable = abap_false.
MODIFY ct_fields_list FROM ls_fields_list
INDEX sy-tabix TRANSPORTING is_changeable.
ENDIF.
* change one field from non-changeable to changeable.
READ TABLE ct_fields_list
WITH KEY field_path = 'CUSTOMER_CREATE_REQUEST-STREET'
INTO ls_fields_list.
IF sy-subrc = 0.
ls_fields_list-is_changeable = abap_true.
MODIFY ct_fields_list FROM ls_fields_list
INDEX sy-tabix TRANSPORTING is_changeable.
ENDIF.
* add a non-existing field to list.
ls_fields_list-field_path = 'CUSTOMER_CREATE_REQUEST-DISCOUNT'.
ls_fields_list-is_changeable = abap_true.
APPEND ls_fields_list TO ct_fields_list .
Execute “Save Draft” Action
Switch to “Filter” and execute “Create” Action
In the opening popup execute “Create” Action three times and maintain following filter conditions:
Filter Parameter | Comparator | Value |
ns | = | /AIFT |
ifname | = | CUST_WS_I |
ifver | = | 00001 |
Save the Filter Conditions
Publish the “Draft Logic”
Testing
To test the newly defined changeable fields, open the Message Dashboard application and select your interface. Jump into the detailed Monitoring and Error Handling view.
Note: If you do not have an erroneous message create a new message containing a wrong value for the field that can be changed.
Select a message in the Data Message view and navigate to the field which was defined as changeable – in this case field CUSTOMER_COUNTRY or DISCOUNT.
Change the value of the field and confirm the change. The value of the changed field is updated in the table. In this example I changed DISCOUNT from 020 to 015. After the field was changed it is necessary to save the change. Press the Save button.
Further information on how to enable users to monitor messages via the message dashboard in the SAP S/4 HANA Cloud take a look at the blog: How to enable users to work with the message dashboard.
Summary
This blog post gave an introduction on how to setup custom specific changeable fields in the S/4HANA Cloud. This is a very simple enhancement and therefore not all possible options on how to use the new Extension Point are described here.
Furthermore, it is only possible to publish one BAdI implementation per filter conditions.