Skip to Content
Technical Articles
Author's profile photo Sharon Zhang

How to define custom naming rules for payment medium files

The goal of this post is to describe the step-by-step process of how to define custom naming rule for payment medium files downloaded from the Manage Payment Media app. Based on the best practice experience, it will be explained for you with an example: define custom naming rule for a payment medium file.

Content Overview

Context

As you may know, previously when you download a payment file in the Manage Payment Media app, the file name is set by default as the following format: Payment_Media_DateTime.xml. For example, Payment_Media_22020811062706.xml. With the BAdI enhancement Payment Medium: Change File Name, you can define your own specific naming rule for the payment files to be downloaded.

* The new BAdI is planned for the SAP S/4HANA Cloud 2208.1 (2208 HFC7) update (subject to change).

Prerequisite

Before you implement the BAdI, complete the following preliminary steps to configure the payment medium formats. The BAdI works only when the payment medium format can be mapped by the DME engine and when it doesn’t have any alternative format type.

  1. In your configuration environment, open the configuration activity Create Payment Medium Formats and maintain your format. In the Program Control settings, select the Mapping using DME engine option.
  2. In the configuration activity Set Up Payment Methods for Each Country/Region for Payment Transactions, select No Alternative Format Type for your PMW format.

           Set payment medium format per company code

 

Create a new enhancement implementation

You use the enhancement Payment Medium: Change File Name to implement your own logic to change payment file name.

Note: To be able to access this app and follow the described process, your user must be assigned a role that has the authorization as defined in the business catalog Extensibility (SAP_CORE_BC_EXT).

1.Open the Custom Logic app from the Extensibility business group on your launchpad.

2. Choose + (Create) to add and create new enhancement implementation.

Fill out the dialog box as described in the following screenshot and then choose Create.

Field Explanation
Business Context

Select Finance: Payment Medium.

BAdI Description

Select Payment Medium: Change File Name.

Implementation Description

Enter a description, for example DMEE_EVENT_21.

Implementation ID

The field is filled out automatically as you enter the implementation description. You can change the ID if you like.

The following is an example:*The Implementation ID is filled out as you enter the implementation description.

3. Switch to the Filter tab and choose + (Add) to add a filter condition.

 

Fill out the dialog box as explained in the following table and then choose Save.

Field

Explanation

Filter Parameter

Select format.

Comparator

Select =.

Value

Enter the payment medium format for which you want to define naming convention rules.

Example: I want to define file name for the payment medium format DE_CGI_XML_CT, so I enter the value here as DE_CGI_XML_CT.

4. Create draft logic.

To define a naming rule for the format, adapt the draft logic based on your needs. The following is the default logic for the file name.

I want to define the payment medium format file naming rule as CompanyCode_HouseBank_XML_ReferenceNumber.xml, so I define the data in the available fields.

Define paying company code with the field zbukr in payment data

Define house bank with the field hbkid in payment data

Define reference number with the field renum in payment prepared data

The following is the value that I defined for the fields.

Adapt the draft logic code to include the values that I have defined and save the draft.

5. Test the coding.

From test result we can see the the filename 1010_testpayee_123456789.xml is exactly what I have defined in the draft logic.

6. Publish the draft logic.

Testing

1.Call up the application Manage Automatic Payments.

 

2. Create a payment run and schedule a payment.

3. Export payment medium file.

Use the app Manage Payment Media to download the payment file.

4. Check file name.

We can see that the name of the payment file is consistent with the rule that I have defined for this payment medium format.

 

This blog guided you through the process of defining a naming rule for payment medium files downloaded from the Manage Payment Media app. Would you like more process description like this? Please follow my profile and leave your thoughts in the comment section below.

 

For more information about this BAdI implementation, see Custom Fields App and Custom Logic App.

Read more about Payment Medium formats and tools associated with them in Payment Medium Formats and Payment Formats Overview.

 

 

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.