This article expands on the topics in the Financials Expert article “SAP Bank Communication Management: What You Need to Know.” It outlines a number of nice-to-have custom developments around payment processing using the SAP standard provided alerts messages.
Key Concept
SAP Bank Communication Management is a relatively new module of SAP’s Financial Supply Chain Management component. SAP Bank Communication Management can be used to efficiently manage inbound (current day reports, prior day reports, payment file, and transaction-level acknowledgments) and outbound (AP, HR, and Treasury payments) communications with banking partners.
SAP payments are critical to standard business operations, so timing and monitoring of these payments are vital to being able to notify key users of issues that may arise. With the use of the alerts described in this article, email notifications are sent to key users when there are issues related to payment processing.
In this article we discuss enhancements using the SAP-delivered alert trigger points in the SAP Bank Communication Management module. This article is the first of three that detail enhancing the SAP standard payment processing functionality with custom development.
The custom developments mentioned in this article should apply across all banks, countries, and companies (all legal entities within one implementation). Typically, in global implementations, there are bank- or country-specific enhancements required. The enhancements mentioned in this article, however, should apply across all payments sent from an SAP system. The enhancements make SAP Bank Communication Management a more robust tool. Before reading about the three developments we describe, read the sidebar “Prerequisites to Using SAP Bank Communication Management” to make sure your system has all the prerequisites for using SAP Bank Communication Management.
Prerequisites to Using SAP Bank Communication Management
Licensing may be required to use the SAP Bank Communication Management module. Check with your SAP account executive before activating SAP Bank Communication Management.
The SAP Bank Communication Management business function (FIN_FSCM_BNK) must be activated using transaction code SFW5. To be able to fully use the functionality offered by SAP Bank Communication Management, the payment method should be defined with the Payment Medium Workbench (PMW) output option.
To add the enhancements mentioned in this article, an ABAP developer is needed. As ABAP code changes are being made, a developer’s key is needed. The ABAP team would normally have a developer’s key.
Alerts in SAP Bank Communication Management Processing
Alerts are important notification messages triggered at specific events. In SAP Bank Communication Management, three different types of payment alerts are available. For each, SAP has provided a Business Add-In (BAdI).
A BAdI is an object-oriented enhancement option that makes it the most sophisticated enhancement type. The main characteristic of a BAdI is that it provides a mechanism to change the functionality of a well-defined business function (e.g., a Business Application Programming Interface [BAPI]) without making changes to the SAP-delivered source code. Future upgrades of the original business function can be applied without losing the customer-specific enhancements.
The three types of payment alerts are displayed in Table 1.
Alert |
Business Add-In (BAdI)
|
Description
|
File Creation Error Alert
|
BNK_BADI_FILE_ERROR_ALRT
|
This alert is triggered if the payment file creation fails.
|
Timeout Alert
|
BNK_BADI_PAYM_ALRT
|
This alert is triggered if too much time passes between two steps in the communication process with the bank on a payment file. When this alert is triggered, the company needs to find out if the bank did not receive the payment file or if the bank failed to acknowledge it.
|
Payment Status Alert
|
BNK_BADI_PAYM_ALRT
|
This alert is triggered if in the communication with the bank (after the file was created and submitted through the external network) there is a failed status message indicating a failed payment.
|
Table 1
SAP-delivered SAP Bank Communication Management alerts
Table 2 lists the steps of an end-to-end SAP Bank Communication Management process flow for a scenario in which no approvals are necessary. The alerts are noted to show where along the process flow the alerts are triggered.
Step |
Transaction code, program, or report
|
Description
|
Automatic payment run is successfully completed |
F110 or F111 |
If SAP Bank Communication Management is not used, the payment accounting documents and payment file are created. With SAP Bank Communication Management, the payment accounting documents are created, but the file is not created. When SAP Bank Communication Management is used, the payment file is not created until the payment processing and approval are successfully completed.
|
Merge payments |
FBPM1/FBPM
|
All AP and treasury payments that are using identification IDs reserved for SAP Bank Communication Management are routed to the SAP Bank Communication Management module for batching.
Now the merge program is run to batch the payments. Merging the payments creates payment batches that are routed for approval.
|
File Creation Error Alert |
NA |
An SAP Bank Communication Management alert is triggered on an error in the payment file creation. |
Payment file is delivered to the bank |
NA |
The payment file is created. The payment file is now transmitted to the bank. The status of the batch is now payment medium created. |
File-level acknowledgment is received and imported into the SAP system |
Program RBNK_IMPORT_PAYM
_STATUS_REPORT |
The file-level acknowledgment confirmations are imported into SAP Bank Communication Management. The SAP system receives the acknowledgment confirmation message and updates the payment status in SAP Bank Communication Management. (This is the file-level acknowledgment.)
This step tells the company the payment file has been received by the bank. Two outcomes are possible:
1. Received by the bank
2. Rejected by the bank
The payment batch status is updated in the SAP system accordingly.
|
Timeout Alert |
NA |
A batch status is identified using a three-character code that changes when a batch moves from one status to another status. An SAP Bank Communication Management timeout alert is triggered if too much time passes between the different acknowledgment files from the bank. |
Transaction-level acknowledgment is received and imported into the SAP system |
Program RBNK_IMPORT_PAYM
_STATUS_REPORT |
The payment-level acknowledgment confirmations are imported into SAP Bank Communication Management. The SAP system receives the acknowledgment confirmation message and updates the payment status in SAP Bank Communication Management. (This is the transaction-level acknowledgment.)
At this step, the payment-level status within a batch is updated. Two outcomes are possible:
1. Payment accepted by bank
2. Payment rejected by bank
The batch status is partially accepted by the bank until positive payment-level acknowledgments are received for all payments in the batch.
|
Payment Status Alert |
NA |
This alert is triggered by a failed status acknowledgment. |
Batch and Payment Monitor |
BNK_MONI |
|
Bank statement imported |
FF.5 |
Intraday and prior-day bank statements are imported. The bank statements show that the payments have cleared the banks. |
Bank statement monitor |
FTE_BSM |
The bank statement monitor shows the statuses of the bank statements imported. |
Table 2
End-to-end process flow with SAP Bank Communication Management
Of the three alerts mentioned, for illustration purposes we fully implement the alert triggered when there is a failed payment.
The steps to implement the alert using the SAP standard BAdI are the following:
- Create the alert using transaction code ALRTCATDEF, or follow menu path Accounting > Financial Supply Chain Management > Bank Communication Management > Environment > Current Settings.
- Assign the recipients to the newly created alert.
- Assign the newly created alert to the failed payment code in the Map External Status to Internal Status configuration.
Note
The steps above show how to use the SAP standard BAdI. If an SAP standard BAdI is used, the BAdI does not need to be activated. We will test this first and then go over the steps to implement custom code for the BAdI.
Step 1. Create the Alert Using Transaction Code ALRTCATDEF
The first step is to create an alert with the appropriate alert category using transaction code ALRTCATDEF (Editing Alert Categories). Transaction code ALRTCATDEF can be found using the application side menu path Accounting > Financial Supply Chain Management > Bank Communication Management > Environment > Current Settings > Define Alerts.
In the Editing Alert Categories transaction, you must define an alert with the appropriate alert category corresponding to the BAdI being used because the alert category acts as a filter value for the BAdI to perform the respective alert logic assigned to it. For the SAP standard failed payment alert, the alert category key must be PAYALRT. Table 3 shows the corresponding alert information that should be used in the definition of the alert for each SAP Bank Communication Management BAdI.
Alert
|
BAdI |
Alert category or element
|
ABAP Data Dictionary type or container |
File Creation Error Alert
|
BNK_BADI_FILE_ERROR_ALRT
|
PAYALRT
|
BNK_STR_PAY_STAT
|
Timeout Alert
|
BNK_BADI_PAYM_ALRT
|
TIMEOUT
|
BNK_STR_TIMEOUT_ALERT_CONT |
Failed Payment Status Alert
|
BNK_BADI_PAYM_ALRT
|
PAYALRT
|
BNK_STR_PAY_STAT |
Table 3
SAP Bank Communication Management alerts and corresponding information
From Table 3, you can see that the file creation error alert and the failed payment status alert have the same alert category type. The SAP system distinguishes the file creation error alert and the payment status alert in that the file creation alert has an empty external status (structure field STSCD), and the internal status (SYS_STAT) is hard-coded to BFE, whereas for the payment status alert, both fields are populated according to the entries in SAP Bank Communication Management Map External Status To Internal Status configuration.
To create the alert category after executing the ALRTCATDEF transaction code, click the Display/Change button to toggle into change mode, and then click the create icon
to create a new alert category, as shown in Figure 1.

Figure 1
Create a new alert category
In the new line that is created, enter the alert category and description for the new alert, as shown in Figure 2.

Figure 2
Enter an alert category and a description
In the Properties tab, the Description field is automatically populated from the description entered in Figure 2. In the Application Pac field, enter FIN_BNK_COM for the Main Package for SAP Alert Management System. In the Original Language field, enter EN for English, as shown in Figure 3. The Priority, Max. No. of Dels, and Expry Time in Min. fields default to the values shown in Figure 3. The Max. No. of Dels field stands for the maximum number of times an alert is sent (delivered) for a specific failed payment.

Figure 3
Enter details in the Properties tab of the alert
Select the Container tab and then click the create icon and populate the following fields, as shown in Figure 4:
- In the Element field, enter PAYALRT
- In the Name field, enter a short name for the alert
- In the Short Descript. (description) field, enter a short description for the alert
- In the ABAP Dict. Data Type field, enter BNK_STR_PAY_STAT if using a standard BAdI. The structure entered here drives the default information that can be used in the alert (email) triggered. In other words, only fields in this structure can be used to specify information about the alert. When using the SAP standard BAdI, you must use the BNK_STR_PAY_STAT structure because that is the structure the BAdI is programmed to use. (In other words, this structure is hard-coded in the SAP standard BAdI ABAP code.)

Figure 4
Enter details in the Create Container Element screen
After you click the enter icon
in the pop-up screen, the screen looks like the one in Figure 5. Click the save icon (not shown) to save the changes.

Figure 5
Container information for the alert
Click the Long and Short Text tab and populate the following fields, as shown in Figure 6:

Figure 6
Specify the subject and body of the alert email
- In the Message title field, enter what you would like the subject of the email message that is triggered when there is a failed payment.
- Select the Long Text (E-Mail, Fax) tab and enter the message that should be sent in the email that is triggered when there is a failed payment. You can populate any fields of the BNK_STR_PAY_STAT structure, which was the container entered in Figure 4, as data to be inserted into the email message about the failed payment, as is shown in the Long Text (E-Mail, Fax) tab in Figure 6. The format to add fields of the BNK_STR_PAY_STAT structure is & BNK_STR_PAY_STAT.field_name& (e.g., &BNK_STR_PAY_STAT.BATCH_NO&). (To view the BNK_STR_PAY_STAT structure, use transaction code SE11 and put the structure in the Data type field (not shown). When doing this, you will see the fields of the structure.)
Click the save icon (not shown) to save the changes.
Step 2. Assign the Recipients to the Newly Created Alert
Use transaction code ALRTCATDEF to enter the recipients of the alerts. Select the tab to the left of the alert created and click the Fixed Recipients button to display the screen in Figure 7. Click the New Entries button (not shown) to enter the SAP login IDs of the people who should receive the alerts, as shown in Figure 7. Click the save icon when complete to save the changes to a transport. The SAP system then uses the email address for this user stored in User Maintenance transaction code SU01.

Figure 7
Enter the recipients of alert messages
Step 3. Assign the Newly Created Alert to the Failed Payment Code in the Map External Status to Internal Status Configuration
The alert category created above must also be assigned to the external status code for a rejected payment. This configuration is done through the IMG > Financial Supply Chain Management > Bank Communication Management > Payment Status Management > Map External Status to Internal Status, as shown in Figure 8.

Figure 8
Assign an alert category to the external failed payment status code
A batch status is identified using a three-character code, which changes when a batch moves from one status to another as acknowledgment files are received from the banks. The batch status is reflected in the Status ID field on the Batch and Payment Monitor (transaction code BNK_MONI).
In the Map External Status to Internal Status configuration, the external status code is mapped to an SAP internal status code. The external status codes are the codes in the acknowledgment files sent from the banks. All the external status codes (on the left) need to be mapped to internal status codes. In Figure 8, the SAP system’s internal status codes are displayed on the right. In our example, you map the external bank status code of DLV_REJECTED to the internal status code of BRE (rejected by bank). You also add the alert category that should be triggered when there is a failed payment in the transaction acknowledgment file imported. After you enter the mappings, click the save icon, and save the changes to a transport (not shown).
Note
The PAIN_ABCD status code must be configured and it must be assigned to code BSP. If this is not entered, you encounter error messages when importing the acknowledgment files.
Now that you have completed the three set-up steps, you are ready to test the alert by importing a failed payment status file. The program to import the status file is RBNK_IMPORT_PAYM_STATUS_REPORT. To use this program, you must define a file server directory for the input files, the processed files that do not have errors, and the processed files with errors to be used when processing the acknowledgment files. The logical file paths are defined using the Change View Logical File Path Definition: Overview or use transaction code FILE. Defining the directories is not shown here.
The RBNK_IMPORT_PAYM_STATUS_REPORT program does not have a transaction code assigned to it. Therefore, to execute this program, you use transaction code SE38. In the screen that appears (Figure 9), enter RBNK_IMPORT_PAYM_STATUS_REPORT in the Program field. Then click the execute icon.

Figure 9
Run the import acknowledgment file program
You then are taken to the Upload payment status report input screen (Figure 10). Enter the import, archive, and error directories. As mentioned above, these must have been defined previously. The Pattern in File Name field can be populated with the pattern in the acknowledgment files. This pattern acts as a filter on the files imported. In the Name of XSLT Transformation field, enter PAIN002_V3_TO_CPON if importing a PAIN.002 file; otherwise, enter the transformation mapping to be used based on the format of the acknowledgement file.

Figure 10
The import acknowledgment file
With the failed payment status file in the Import Files directory, click the execute icon in the RBNK_IMPORT_PAYM_STATUS_REPORT program. (Note: This program should be run periodically throughout the day on a scheduled basis.)
Note
It is helpful to know that when you are mocking up a failed payment status file, the SAP system uses the DME number (map this to a payment in the REGUT table, field RENUM [not shown]) in the <OrgnlMsgId> tag in the PAIN.002 payment status file and the External Status Code (in the Map External Status to Internal Status configuration [not shown]).
After the SAP system imports the acknowledgment file, the output screen shows the status of the import, as shown in Figure 11. In our case, the acknowledgment file was successfully imported and an alert was triggered.

Figure 11
Output after importing a payment acknowledgment file
After the SAP system imports a rejected payment status file, the Display Alerts report (transaction code ALRTDISP) can be used to view the alerts that have been triggered, as shown in Figure 12. (The Display Alert report (transaction code ALRDISP) is not on the SAP application side menu. Therefore, to get to this report, use the command field box in the upper left section of the SAP window.)

Figure 12
The Display Alerts report input screen
Enter the date the alerts were triggered in the Created From (Date) field and click the execute icon. You then are shown the alerts triggered (Figure 13). Click the display icon
to view all information on the alert.

Figure 13
The Display Alerts report output
When the failed payment acknowledgment file is imported and the alert is triggered, the SAP system sends an email to the fixed recipients specified in the definition of the alert. Figure 14 shows the email message that was triggered for our example. You can compare this email with the definition of the alert in Figure 6.

Figure 14
An email message triggered by an alert
How to Customize the BAdI
Now that we have successfully configured and tested the failed payment SAP Bank Communication Management alert using the SAP standard BAdI, we show the steps required to create a custom BAdI for the failed payment alert. The custom solution BAdI example provides more information on the failed payment in the alert email. We include specific information about the failed payment, such as the payment document number, the amount, the payment run ID, and the run date, all of which are fields that are not available when using the standard BAdI. We are showing a custom BAdI for the failed payment alert.
Note
The steps to create a custom BAdI are similar across the different SAP Bank Communication Management alerts.
To add custom logic in the failed payment BAdI, follow these steps:
- Update the alert created previously in configuration
- Copy the SAP-delivered implementing class and enhancement implementation for the failed payment BAdI to custom versions of each
- Enter the custom code as needed
- Save and activate the custom code changes
Step 1. Update the Alert Created Previously in Configuration
To update the alert created previously, execute transaction code ALRTCATDEF. Transaction code ALRTCATDEF can be found using the following application side menu path Accounting > Financial Supply Chain Management > Bank Communication Management > Environment > Current Settings > Define Alerts.
To change the alert category from the ALRTCATDEF transaction code, click the Display / Change icon to toggle into change mode. Next, double-click the FAILED_PAYMENT_ALERT created previously. Select the Container tab, as shown in Figure 15.

Figure 15
Change the existing alert
First, place your cursor on the Failed Payment Alert text under Expression, and then click the display/change icon in the Container tab to change the structure associated with the alert. This action opens the pop-up screen shown in Figure 16. When you use the SAP standard BAdI, the structure in the container field in the alert must be BNK_STR_PAY_STAT. For our custom BAdI, we want to display additional information about the failed payment. Therefore, we need to change the structure in the container from BNK_STR_PAY_STAT to BNK_STR_BATCH_ITEM.

Figure 16
Enter an alert category and a description
Note
The structure entered in the ABAP Dict. Data Type field is used in the BAdI to provide fields on the payment to be available within the alert email. When you use the SAP standard BAdI, the structure BNK_STR_PAY_STAT must be used as it is hard-coded in the BAdI (Figure 16). To make other fields available to the alert email, you need to change the structure to BNK_STR_BATCH_ITEM, which contains additional payment information. Within the custom BAdI, populate the fields in BNK_STR_BATCH_ITEM that are not in BNK_STR_PAY_STAT.
Figure 16 shows the Container Element defined in the alert originally created. Change the structure in the ABAP Dict. Data Type field from BNK_STR_PAY_STAT to BNK_STR_BATCH_ITEM, as shown in Figure 17. Click the enter icon on the bottom right of the pop-up when you are done.

Figure 17
Change the structure associated with the alert
In the next screen select the Long and Short Text tab and change the fields on the Long Text (E-Mail, Fax), as shown on Figure 18. Because you changed the structure associated with the alert, you now have different fields available about the payment that can be put in the alert email. As was the case for the SAP standard BAdI, the format to add fields of the BNK_STR_BATCH_ITEM structure to the alert email is & BNK_STR_BATCH_ITEM.field_name& (e.g., & BNK_STR_BATCH_ITEM.VBLNR&). Update the Long Text field of the alert to include the fields shown in Figure 18. (To view the BNK_STR_BATCH_ITEM structure, use transaction code SE11 and put the structure in the Data type field [not shown]).

Figure 18
Change the body of alert email
Click the save icon to save the changes. The SAP system then displays the following message: Data was saved. The new alert has now been updated.
Step 2. Copy the SAP-Delivered Implementing Class and Enhancement Implementation for the Failed Payment BAdI to Custom Versions of Each
Table 4 outlines the different aspects of the BAdI that you customize.
Description |
SAP Name
|
Notes |
Enhancement implementation
|
BNK_BADI_PAYM_ALRT_DEF_IMPL
|
This is the SAP standard enhancement of the BADI BNK_BADI_PAYM_ALRT, which is the BCM alert we are changing. We create a Z version of this that includes a custom implementing class. Our enhancement is active along with the SAP version and is controlled by a BAdI filter that determines the logic that will be used. |
Implementing class
|
CL_BNK_BADI_PAYM_ALRT_IMPL |
We start by making a copy of this class as this contains the custom methods to allow us to fill in the additional fields of the structure. A copy is needed so we do not modify standard SAP code. Making a copy of the standard then changing it is easier than creating a new class from scratch.
|
Interface
|
IF_EX_BNK_PAYM_ALRT
|
The interface contains the different methods. We add custom logic to one of them (SEND_ALERT). (See the next row in this table.)
|
Method
|
SEND_ALERT |
The SEND_ALERT method is the function that is called when the alert is triggered. This is where we add custom logic.
|
Table 4
Different components of the failed payment BAdI
To summarize, the enhancement implementation includes the implementing class, which includes the interface, which includes the methods. Because you want to make changes in the SEND_ALERT method, you need custom versions of the enhancement implementation and the implementing class for the failed payment BAdI, which is what we show you how to do in this step.
First, create a custom version of the implementing class CL_BNK_BADI_PAYM_ALRT_IMPL. Do this by following menu path Tools > ABAP Workbench > Development > Class Builder. Alternatively, enter transaction code SE24. In the screen that displays (Figure 19), enter the SAP standard object name CL_BNK_BADI_PAYM_ALRT_IMPL in the Object type field and click the copy icon. You need to copy the SAP implementing class to a Z-version because you need to make changes to the implementing class. Assign a name to the implementing class, such as ZCL_IM_BNK_BADI_PAYM_ALRT.

Figure 19
The class builder entry screen
In the pop-up screen that appears after you click the copy icon
(Figure 20), enter the target (new) custom BAdI name to be created in the Copy to field and then click the enter icon. We recommend adding a Z to the SAP standard class for the name of the target class.

Figure 20
Copy class to Z-version
You then see a pop-up screen similar to the one shown in Figure 21. In the Package field, enter the appropriate package for treasury custom code (the developer should know which package to use) and then click the save icon.

Figure 21
Add the Z-version to the package
This action displays a pop-up screen for a workbench transport in which you include the changes (Figure 22). In the Request field, enter or select the appropriate workbench transport and then click the enter icon on the bottom of the pop-up window. The SAP system then displays the following message: Class CL BNK BADI PAYM ALRT IMPL copied to ZCL BNK BADI PAYM ALRT IMPL.

Figure 22
Add changes to a workbench transport
In addition to a custom version of the implementing class CL_BNK_BADI_PAYM_ALRT_IMPL, a custom version of the enhancement implementation is needed. To do this, follow menu path Tools > ABAP Workbench > Utilities > Business Add-Ins > Implementation. Alternatively, enter transaction code SE19. In the screen that displays, enter the SAP standard BAdI implementation name BNK_BADI_PAYM_ALRT_DEF_IMPL in the Enhancement Implementation field, as shown in Figure 23, and then click the copy icon.

Figure 23
Enter the SAP standard BAdI to be copied
In the pop-up screen that appears (Figure 24), enter the target (new) custom BAdI name to be created in the Enh. Impl. (Target) field and click the enter icon. We recommend naming the target implementation the same as the SAP standard but with a Z as the first character.

Figure 24
Copy the enhancement implementation to Z-version
You then see a pop-up screen like the one shown in Figure 25. In the Package field, enter the appropriate package for treasury custom code (the developer should know which package to use) and then click the save icon on the bottom of the pop-up window.

Figure 26
Add changes to a workbench transport
After you click the save icon, a pop-up screen appears for a workbench transport in which you can include the changes (Figure 26). In the Request field, enter or select the appropriate transport and click the enter icon. The SAP system then displays the following message: Text saved.

Figure 26
Add changes to a workbench transport
Now, we explain how to make changes to the custom implementation. From transaction code SE19 (menu path provided above), enter the new custom implementation name in the Enhancement Implementation field, as shown in Figure 27. Click the Change button.

Figure 27
The initial screen for BAdIs
In the next screen (Figure 28), double-click the Implementing Class text to view the implementing class for this BAdI.

Figure 28
Change the Z-version of the enhancement implementation
This action displays the screen shown in Figure 29. In the Implementing Class field, change the implementing class from CL_BNK_BADI_PAYM_ALRT_IMPL to the custom implementation class created, ZCL_BNK_BADI_PAYM_ALRT_IMPL.

Figure 29
View the implementing class
Step 3. Enter the Custom Code in the SEND_ALERT Method
To complete this step, double-click the IF_EX_BNK_PAYM_ALRT~SEND_ALERT (Figure 29) to open the screen that displays the code that is changed when the alert is triggered. For our example, you see the code of the SEND_ALERT method (Figure 30). Ensure you are in change mode. If you are not in change mode, click the display /change icon shown in Figure 29.

Figure 30
The SEND_ALERT method is called when the alert is triggered
Figure 31 shows the lines of code that should be changed or modified in blue highlighting. Change or add only the lines of code in blue highlighting. All the other existing code should remain, including the sections that are shown below as ‘…’.
DATA:
* container carries the dynamic part of the alert
li_container TYPE REF TO if_swf_cnt_container,
l_str_pay_alrt TYPE bnk_str_batch_item ,
wa_tbnk_xst_2_ist TYPE tbnk_xst_2_ist,
bus_tran_text TYPE tj01t-txt,
l_alrt_cat TYPE salrtdcat,
l_laufd TYPE laufd, "nte1389302
l_laufi TYPE laufi,
l_srtf3 TYPE srtf1_fpm,
l_rest(28).
DATA: l_str_reguhm TYPE reguhm.
* begin of note 1733090
DATA: l_bnk_batch_item TYPE bnk_batch_item.
… (Keep the existing code in this section that is not displayed)
IF wa_tbnk_xst_2_ist-int_bus_tran IS NOT INITIAL.
CALL FUNCTION 'BSV_GET_TEXT_VRGNG'
EXPORTING
langu = sy-langu
vrgng = wa_tbnk_xst_2_ist-int_bus_tran
IMPORTING
txt = bus_tran_text.
ENDIF.
l_str_pay_alrt-batch_no = i_batch_no.
l_str_pay_alrt-item_no = i_item_no.
* l_str_pay_alrt-stscd = i_stats_cd.
* l_str_pay_alrt-sys_stat = wa_tbnk_xst_2_ist-int_bus_tran. "nte1389302
* l_str_pay_alrt-sys_stat_text = bus_tran_text.
l_str_pay_alrt-zbukr = l_str_reguhm-zbukr.
l_str_pay_alrt-hbkid = l_str_reguhm-hbkid.
* New fields
l_str_pay_alrt-laufd = l_str_reguhm-laufd.
l_str_pay_alrt-laufi = l_str_reguhm-laufi.
l_str_pay_alrt-amt_rulecu = l_bnk_batch_item-amt_rulecu.
… (Keep the existing code in this section that is not displayed)
* Declaration of the alert-container including application data
TRY.
li_container = cl_swf_cnt_factory=>create( ).
CATCH cx_swf_utl_no_instance_found
cx_swf_utl_obj_create_failed .
MESSAGE text-013 TYPE 'E'.
ENDTRY.
TRY.
li_container->element_set(
name = 'BNK_STR_BATCH_ITEM'
value = l_str_pay_alrt ).
Figure 31
Coding adjustments to the SEND_ALERT method
To reiterate, the change we are showing you how to make is to populate the additional fields in the BNK_STR_BATCH_ITEM structure so that those fields will be available to display in the alert email message when there is a failed payment. The fields you add are the payment document number, the amount, the payment run ID, and the run date. These new fields are contained in the BNK_STR_BATCH_ITEM structure.
Now click the green arrow (shown in Figure 30) to go back once. In the screen that appears, double-click the Filter Val. text, as shown in Figure 32.

Figure 32
View fields of the enhancement implementation
This action displays the pop-up screen shown in Figure 33.

Figure 33
Alert filter when using the SAP standard BAdI
The alert category acts as a filter value for the BAdIs to perform the respective alert logic assigned to it. In the Value 1 field of the screen shown in Figure 33, change the alert from the PAYALRT, which you used when testing the SAP standard BAdI, to the FAILED_PAYMENT_ALERT. That will be used when using the custom BAdI (Figure 34). Then click the enter icon (the green check mark shown in Figure 33).

Figure 34
Alert filter when using the custom BAdI
Step 4. Activate the Code Changes
When you have finished incorporating the logic, you must activate your objects. When you activate your changes, the activation process checks for syntax errors, creates a new active version, and saves the changes.
After you change the alerts and click the enter icon as shown at the end of step 3, the system displays the screen shown in Figure 35. Click the activate icon
to activate the BAdI implementation.

Figure 35
Activate changes
At this stage of this step, you click the activate icon twice to activate the changes to both the enhancement implementation (through transaction code SE19) and the class (through transaction code SE24). After you click the activate icon, SAP activates and saves the changes. The system then displays the pop-up screen shown in Figure 36. Click the enter icon
in the lower right of the pop-up screen.

Figure 36
Message indicating the SAP standard package for failed payment BAdI
The system then displays the object list in a pop-up screen shown in Figure 37. Click the enter icon (not shown). The following message is then displayed: Object(s) activated.

Figure 37
Objects being activated
Now that the changes for the custom BAdI have been made, we are ready to explain how to test the changes by importing a failed payment status file. The program to import the status file is RBNK_IMPORT_PAYM_STATUS_REPORT. To use this program, you must define a file server directory for the input files, the processed files that do not have errors, and the processed files with errors to be used when processing the acknowledgment files. The logical file paths are defined using the Change View Logical File Path Definition: Overview or use transaction code FILE. Defining the directories is not shown here.
The RBNK_IMPORT_PAYM_STATUS_REPORT program does not have a transaction code assigned to it. Therefore, to execute this program, use transaction code SE38 and in the screen that appears (not shown), enter RBNK_IMPORT_PAYM_STATUS_REPORT in the Program field and click the execute icon (not shown). In the next screen (Figure 38), you see the Upload payment status report. (This program should be run periodically throughout the day on a scheduled basis.)

Figure 38
The import payment status file (acknowledgement file)
After placing an acknowledgement file in the file server directory associated with the Logical Path for Import Files, as shown in Figure 39, and setting the archive and error file directories, you can execute the Upload payment status report (program). Click the execute icon in the program displayed in Figure 38.

Figure 39
The failed payment acknowledgment file placed on the file server
After you execute the Upload payment status report (program), the SAP system displays a log similar to the one shown in Figure 40. As indicated, the payment status file (failed payment acknowledgment file) was successfully imported

Figure 40
A log after importing payment status file(s)
In addition, the alert that was triggered generated an email to the recipients tied to the alert in configuration. The email message sent is displayed in Figure 41. Notice that in the failed payment email additional information is now provided. The additional information is the payment document number, payment amount, payment run ID, and the payment run date.

Figure 41
An updated alert email triggered by a custom alert
Mary Loughran
Mary Loughran has been specializing in the SAP Financials area since 1997 and has worked with numerous clients throughout North America and Europe in the areas of finance and treasury. She was employed as a consultant with SAP America and was a designated expert within SAP America for treasury before she left SAP in 2004. Mary’s expertise is in the areas of SAP Treasury and Risk Management, SAP In-House Cash, Liquidity Planner, Accounts Payable, payments from SAP in general, Cash Management, and Electronic Banking. Mary was an independent consultant from 2004 to 2016.
You may contact the author at loughran@gmail.com.
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.

Brent Olsen
Brent Olsen has been a developer and technical specialist in SAP systems since 1996. He has worked with numerous clients throughout North America. Since 2010 he has worked at e5 Solutions Group, where he has developed more of a focus on the SAP Treasury and Risk Management module.
You may contact the author at brent.olsen@e5solutions.com.
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.