Custom naming rules and hash algorithms supported in payment medium files
The goal of this blog post is to introduce the following updates on payment medium files downloaded from the Manage Payment Media app:
- viewing hash algorithm and hash value
- defining custom naming rule
Based on the best practice experience, I’ll describe the step-by-step process of how to define custom naming rule for payment medium files with an example.
- Viewing hash algorithm and hash value in payment files
- Defining custom naming rule for payment files
- Create a new enhancement implementation
Viewing hash algorithm and hash value in payment files
Hash algorithm processes the contents of a payment file and generates hash value that identifies the contents of the file. If the file contents are modified, the hash value changes. This helps to ensure the security of the file content. The following SHA-2 family algorithms are now supported:
- SHA 256
- SHA 384
- SHA 512
* This feature is planned for the SAP S/4HANA Cloud 2302 release (subject to change).
After payment run, you can view the hash algorithm and hash value in payment medium file in the Manage Payment Media app. The hash value and hash algorithm will also display in the standard payment accompanying sheet if they are properly configured.
To enable hash value for payment transaction on company code level, hash algorithm must be configured in payment medium format. In your configuration environment, use the search function to open the following activity: Set Up Payment Methods for Each Country/Region for Payment Transactions.
In the settings for Format in Company Code, choose a hash algorithm for the payment medium format per company code.
In Format Settings, make sure that the format output type is XML and DME mapping engine is used.
Defining custom naming rule for payment files
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.
- 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.
- In the configuration activity Set Up Payment Methods for Each Country/Region for Payment Transactions, select No Alternative Format Type for your PMW format.
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.
Select Finance: Payment Medium.
Select Payment Medium: Change File Name.
Enter a description, for example DMEE_EVENT_21.
The field is filled out automatically as you enter the implementation description. You can change the ID if you like.
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.
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
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.
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 introduces the hash algorithm and hash value displayed in the payment files, and guided you through the process of defining a naming rule for payment files downloaded from the Manage Payment Media app. Would you like more information 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.