on 12-22-2020 6:16 AM
Hello Experts,
I am building a logic that extracts Business Partner based on Address. To implement that I have created below CDS.
@AbapCatalog.sqlViewName: 'ZCDS_BP_SEARCH'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Business Partner search'
@OData.publish: true
define view zcds_bupa_search
as select from but000
inner join but020 on but000.client = but020.client
and but000.partner = but020.partner
inner join adrc on but020.client = adrc.client
and adrc.addrnumber = but020.addrnumber
{
key but000.client,
key but000.partner,
adrc.addrnumber,
@Search.fuzzinessThreshold: 0.7
adrc.name1 as name,
@Search.fuzzinessThreshold: 0.7
adrc.city1 as city,
@Search.fuzzinessThreshold: 0.7
adrc.post_code1 as postalcode,
@Search.fuzzinessThreshold: 0.7
adrc.street as street,
@Search.fuzzinessThreshold: 0.7
adrc.str_suppl3 as street4,
@Search.fuzzinessThreshold: 0.7
adrc.country
}
Below is my AMDP method with SELECT query that uses Fuzzy Search.
et_data = select score( ) as score,
partner,
addrnumber,
name,
* city,
postalcode,
street,
street4,
country
from zcds_bp_search
WHERE
CONTAINS ( zcds_bp_search.name, :iv_name1, FUZZY(0.8, 'similarCalculationMode=compare, textSearch=compare, bestMatchingTokenWeight=0.3' ) ) AND
CONTAINS ( zcds_bp_search.postalcode, :iv_post_code1, FUZZY(0.8) ) AND
CONTAINS ( ( zcds_bp_search.street, zcds_bp_search.street4 ), :iv_street, FUZZY(0.7) ) AND
( :iv_country = '' OR zcds_bp_search.country = :iv_country )
ORDER BY score( ) DESC ;
In the :iv_street the expectation is, the first few characters of Name3(optional), Street and Street4 followed by * is passed.
For E.g., Let's say Name3 is "Department of Engineering", Street is "1st Floor A Block" and Street4 is "123 Random Street" then, :iv_street will be passed as "Department o* 1st F* 123 R*".
Since I am running fuzzy search on Street and Street4, the query fetches records only when there is "Department" string in either Street or Street4. Since Name3 is optional, I would want my query to still fetch the record that is matching "1st F* 123 R*". How to achieve this? Any better approach or suggestions?
Reference: https://answers.sap.com/questions/704790/amdp-causes-dump-score-cannot-be-used-in-this-plan.html
Best Regards,
Kiran
Hi Kiran,
In your method, try using scm as SearchCompare, and tweaking the thresholds. Note result set will vary for difference scm modes. Refer official SAP document for more details.
Regards,
Deo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think there are two approaches to achieve search by two fields:
1) use WEIGHT addtion and increase weight for column with street
2) use UNION and separate you sql
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Kiran,
Unfortunately, it seems to be taking longer than usual for your question to be answered. You might want to try an alternative route to speed things up.
Please check if a similar question has already been asked in the Community. We have found that sometimes questions that have been answered before are no longer receiving responses.
The easiest way to do this, is to visit the All Questions page and search for your specific topic.
You could also check the SAP Support Portal and search for SAP Notes, SAP Knowledge Base Articles and more.
If all of this doesn’t work, I would suggest that you create a support ticket. All you need to do is log onto the SAP Support Portal with your S-user ID and password: http://service.sap.com/message
Thanks,
Mozi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
9 | |
5 | |
5 | |
3 | |
3 | |
2 | |
2 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.