Optimized Address Search in S/4HANA 2023

The idea for this article occurred during the review of our latest SAP Fiori Element development in the regular testing phase of our client’s S/4HANA upgrade. This noteworthy release introduces significant improvements to address search capabilities.

Figure 1: SAP Support Package Stack Overview (Source: SAP Support Portal)
Background
A common challenge is the duplication of business partners, which may occur in your system as well, often necessitating workarounds to prevent duplicity post-creation. Our approach focused on enhancing address-matching during mass data uploads. The traditional ABAP toolset has limitations, and combining logical statements or rule sets often leads to complex code that consumes significant resources and time.
Given that S/4HANA operates with an in-memory database (HANA), we aimed to deliver the most advanced solution possible. A brief research led us to the SAP HANA Search Developer Guide.
It appeared to be an ideal solution to address the challenge of duplicity.
Fuzzy search capabilities, in combination with term mappings (see documentation on fuzzy search and term mappings), offered a promising approach.

Figure 2 : Code Snippet for HANA DB Procedure
Technical Concept
The basic concept can be summarized as follows;
HANA supports procedure calls executed directly at the database level using native SQLScript, rather than native or open SQL within the ABAP environment.
Therefore, an Eclipse IDE is required to implement this solution. With this setup, you can incorporate additional statements to enhance your search procedure. In our case, this involved implementing cross-search functionality on names and streets.
According to the business requirements, the first column typically contains the company name, while the second and third columns may include extensions, contact persons, department names, or other relevant identifiers.
Furthermore, due to Switzerland’s multilingual nature, it is necessary to align semantically equivalent designations across languages, such as AG (DE), Ltd (EN), and SA (FR).

Figure 3: term mapping for jurisdictations
Additionally, the 40-character limitation in the database schema introduces challenges when spanning the search across multiple columns. Our solution involved utilizing the ‘contains’ statement with the same input parameter across multiple name columns in the ADRC table.
The following code snippet demonstrates this approach:

Figure 4: This SQLScript code illustrates how fuzzy matching is applied across multiple columns, incorporating term mapping.
By using this approach, the system performs a fuzzy search on multiple database columns, including term mapping. This results in a broader subset of data, making it easier to identify potential duplicates.
Index Improvements in S/4HANA 2023
A major enhancement introduced with the new release is the improved management of indexes, which significantly optimizes search capabilities.
A significant improvement is the ability to create indexes directly within the backend transaction (SE11).

Figure 5: Example of fuzzy or full-text index creation on S/4HANA 2023 using SE11 transaction.
By default, SAP does not provide a fully indexed address table (ADRC). Fuzzy indexing, and thus fuzzy search functionality, is limited to the NAME1, NAME2, and CITY columns.

Figure 6: Default indexes on the ADRC table in SE11, highlighting columns with fuzzy search capabilities.
To implement extended search scenarios, it is necessary to define additional indexes, for example on the NAME3 and STREET columns. In earlier versions, these indexes were created directly on the HANA database using scripts, as there was no integrated tool available within the Suite (see SAP HANA Documentation)
Important consideration: Indexes created using scripts are defined as local objects ($tmp) and must be recreated on each system where the solution is deployed. This means the indexes will be lost during system upgrades. The ability to define indexes directly within the data dictionary is therefore a major improvement.
Conclusion
S/4HANA 2023 introduces a significant enhancement: fuzzy and full-text indexes can now be created directly in SE11. This addresses previous limitations and enables upgrade-safe implementation of advanced search logic at the HANA database level. Use cases such as multilingual name and address matching are now easier to realize, more robust, and scalable. The platform supports custom search scenarios across a wide range of fields.
Should you require assistance or have questions, our team is ready to support you.
Author

Jan Walder
Senior Developer