How to guide for BP Search Enhancement (Custom search option in “Find By”):
With the advent of S/4 HANA, customer and vendor entities cease to be separate objects.
Business Partner can centrally manage master data for business partners, customers and vendors.
It is a mandatory step to migrate from Customer/Vendor master tables to BP in S/4 HANA. The customer, vendor transactions (XK01/XD01...) become obsolete after migrating to S/4 HANA. With this context, BP transaction has taken a very crucial role even in ECC.
Requirement:
Custom Search is needed in BP transaction to be able to find the business partner based on the legacy partner number, the business is migrating from. The version we used is
S/4 HANA 1709 and
ABAP 7.5, but this can be implemented in the earlier HANA versions also.
Post implementing this enhancement, the custom search is available in the Find By dropdown.
When you click on start, the custom search you implemented needs to be triggered.
This document will provide the steps of how to create the custom search and the logic behind it.
Solution:
Add the new search criteria (one or more fields based on which the end user expects to find the partner) in BUS_JOEL_SEARCH. This structure holds all the search fields related to BP. You will use these fields later while configuring the search help.
Enhance search help BUPA_ALL (or the other specific search helps within it based on your requirement) to add custom search help. This custom search help needs to include the search fields you have added in the above step.
Now comes the linkage.
Go to transaction
LOCA_CUST and create a new entry for the search help. Below are the steps for it.
- Create a function module with importing parameter IV_SEARCH TYPE REF TO CL_BUS_LOCATOR_SEARCH. This FM will hold the logic to populate the result hit list for the custom search.
- Based on how you want your Find By screen to look like, create a DYNPRO using the BUS_JOEL_SEARCH fields you have added initially.
- The short text you will provide in the LOCA_CUST screen, will appear in the “Find by” drop down in BP transaction.
- Link the Search help, FM and screen in this step. Provide the program of the Function Group.
When the custom search is selected by the user, this FM will be called.
In the function module, you derive the partners using the search criteria as per the client requirement. The search criteria will be available in the FM through IV_SEARCH->GV_SEARCH_FIELDS.
The result partner list has to be passed to ADD_PARTNER_GUIDS_TO_RESULT of class CL_BUPA_DIALOG_SEARCHER.
This list will then be visible in the hit list pane of BP transaction.
Note: You will need to add the subroutines ‘bus_locator_get_search_fields ‘ and ‘bus_locator_set_search_fields ‘ to your custom FG as the standard code uses the FROM PROGRAM variant of the PERFORM statement while processing the search logic. The program here refers to the program name you maintained in LOCA_CUST.