ABAP Sourcecode Search
Searching within the whole source code repository of the ABAP system was never so easy as it is with the ABAP development tools for Eclipse. With the new version ADT 2.19 which is available since a couple of weeks we offer you a new search console in eclipse. With that feature you can search for arbitrary code snippets and navigate to the related development objects in the editor.
Feature is only available on AS ABAP Systems >= 7.40 SP05. As we are using the HANA Textsearch engine this feature is only working when HANA is your primary database of your ABAP system.
In this video you will see how you can use the new ABAP Sourcecode Search:
Remark about the memory consumption:
Enabling the ABAP Source Search will cause an increased memory consumption in the respective system. The required full text index will consume at least one but regularly several GBs of additional memory, so ensure that the system can provide the needed space!
Before you start you have to enable your backend system for the feature:
In order to enable the ABAP Source Search, you need to switch on the business function SRIS_SOURCE_SEARCH
. To be able to do that, you need activation authorizations in the Switch Framework (authorization object S_SWITCH
, activity 07
). Open transaction SFW5, expand the ENTERPRISE_BUSINESS_FUNCTIONS
node and look for the SRIS_SOURCE_SEARCH
business function. Switch on the checkbox in the column ‘Planned Status’ and press the button “Activate Changes”. The activation process will take place in a background job. Please check transaction SM37 for the progress.
Remark:
The index activation may be finished within seconds, but please be aware, that the indexing takes place asynchronously and may take up to several hours. You can also use report SRIS_CODE_SEARCH_PREPARATION
in order to check the status. It also checks another index on the TADIR table which is under normal circumstances updated regularly with the where-used index. If this TADIR index is incomplete, you can schedule an index rebuild also with this report.
Have Fun with the new feature !
Kind Regards,
Thomas.
Wow, that's really interesting, I tried it as you said and I functions very well. Thank you ...
Hi Thomas,
a really cool feature. Is it possible to restrict the search to a package,...?
Regards,
Christian
Hi Christian,
not yet. But with the next version you can restrict the search to packages, object types (e.g. only classes) and to compilation units (e.g. searching only in a specific report or function group). It is like in google when you restrict the search for a specific web site via the addition "site:www.sap.com".
Regards,
Thomas.
Hi Thomas,
This additions will be very useful, I'll try to test the tool here.
Best Regards,
Guilherme.
Hi Thomas,
Is the activation of the switch SRIS_CODE_SEARCH_PREPARATION client dependent?
I asked my IT contacts to activate it and they asked me in which client to do it.
Best Regards.
Hi Guilherme,
the business function is not client dependent. So it doesn't make a difference in which client the activation is performed. It will become active in all clients afterwards.
Best regards, Sebastian
Hi,
depending on the package size, you can just add it as favorite and use load full package content (will download to eclipse virtualfs) and you can use the normal eclipse search functions on your workspace.
D.
Hi Daniel,
this only works when the development object have been loaded in the editor already.
Only then the source is cached on the local client and the local search works.
But for me it is not a recommended workaround.
Regards,
Thomas.
Hi Thomas,
This is no workaround, this is how the search is supposed to work in Eclipse - It is no different than checking out Java Projects into the workspace and searching then.
Also, this was a response to someone asking how to search in a given package - I find this very suitable, and the problems could be around BIG packages; - which in fact resumes to bad design from SAP, but this is a different topic.
Hi Thomas,
What is the SP level requirements for the ABAP backend?
Just checked in our ERP 607 system with ABAP 7.40 SP004, but couldn't find SRIS_SOURCE_SEARCH.
Is it only available with SP005?
Thanks,
Peter
Hi Peter,
you need at least 7.40 SP05.
I have added this information now to the blog.
Regards,
Thomas.
Hi Thomas,
Thanks for the quick reply.
This explains why it's not available in our SP004 system.
Cheers,
Peter
It would have been nice if you had mentioned that the feature is only available for systems running on HANA. I activated the switch, ran
SRIS_CODE_SEARCH_PREPARATION
and got :'Hey there! Get a HANA, get the search!'
I then read the switch release information and there I found that this only works on HANA.
We recently upgraded to 7.40 SP05, so I thought this would be a very nice feature. Guess not.
Regards,
Freek
Hi Thomas,
you you should really update the blog with the information that the feature is only available on HANA. I also activated the function before noticing its HANA-only.
So I'll have to continue using the good old RS_ABAP_SOURCE_SCAN
Christian
Hi all,
this is to inform you that after activation of this business function in our ERP EHP7 the HANA (latest patchlevel 92) database grew over 90GB. For example REPOSRC disk usage increased from 5,5GB to over 44GB and indexing was still running for new fulltext index SRC. I'm not sure if it's a bug somewhere because we deactivated business function after we noticed the growth.
Regards
Markus
Hi Markus,
unfortunately, this is not a bug as the required HANA full text index for such a big REPOSRC table just requires that amount of memory.
We are currently evaluating on how we can address that. Sorry for the inconvenience!
Best regards, Sebastian
Hi Sebastian,
thanks for your reply. Unfortunately I only read about 10GB in documentation of business function and for example note 1918229. Maybe it should be mentioned that this index for a normal ECC EHP7 takes a lot more diskspace in HANA.
Regards
Markus
Hi Sebastian
We encountered exactly same problem with extra space consumption.
Is it possible to turn off this function and release to previous memory consumption level ?
Is it enough to switch off SFW5 ? Should we also delete some indexes in HANA ?
Best regards
Marcin
Hi Marcin,
yes it's absolutely sufficient to switch off the business function via SFW5 again. The system will remove all HANA indexes automatically and you should have the same memory consumption as before.
Best regards, Sebastian
Hi Marcin,
it is enough to reverse the switch in SFW5 and objects in HANA will be deleted, but diskspace is still allocated (and will be reused). To free diskspace you unfortunately need to do a restore.
Regards
Markus
Hello Thomas,
we also noticed a relative high memory consumption after activating this very nice BF. We need the search function only in our development systems, not in Q or P systems. Within SFW5 it is not possible to keep this function from being transported to Q and P Systems. (It will be transported next time another BF will be transported!).
Is it possible to switch off indexing in Q and P systems while BF is active, but keeping it active in D systems?
Regards
Marcus
Hallo Marcus,
same Issue in Hamburg.
Just again for the third time we ran into this. No really nice solution in my current view….
First deactivate the SRIS_SOURCE_SEARCH in dev. release TA and activate again …
Check Transports? might be an option.
But for now …. ?
EDIT:
in Productive System Report: SFW_OP_MODE_REVERSIBLE_BF helps to deactivate the BF again.
I’ve had several attempts at using this feature and always found it a bit unreliable. Finally got time to properly play with it, and there are definitely some reproducible ‘features’.
Here’s one example I narrowed down: Create global class ZCL_FOO:
Now create a program that uses the attribute:
So the text search should throw up two instances of blah1234, right?
Wrong:
Hi Mike,
do you still encounter this "feature"? Did you open a ticket?
We are just switching to HANA, so I am curious whether it is worth it.
(Performance of RS_ABAP_SOURCE_SCAN seems to be roughly the same as pre-HANA.)
By the way, if you decide not to switch on the HANA search, check out my enhancements to RS_ABAP_SOURCE_SCAN: https://blogs.sap.com/2018/09/19/code-search-in-modifications-and-enhancements/ .
Cheers,
Edo
Hi Edo,
No, I didn't open a ticket, posted here because individuals can't raise tickets and can't always commit to following one at a customer site for potentially several months (and a small dose of #tooLazyToRaiseOSS thrown in for good measure).
The HANA systems I have access to at the moment don't have text search enabled, so I can't tell if the bug still exists. 🙁
But I would still say that switching it on is definitely worth it, it's really quick. Set it up, try the procedure above and if it's still not right then just be aware that you can't rely on negatives. Maybe you're in a better position than I am to raise a ticket.
Cheers,
Mike
yes, we will try it out. I am sure SAP is looking forward to my feedback 😉
Hi Thomas, is there any recommended maintenance task which should be done after this business function is activated? I just activated it, index building is done according to report SRIS_CODE_SEARCH_PREPARATION, but now all reading and writing operations to REPOSRC,TRDIR tables seem to be dramatically slowed down.
Appreciate your help.
Hi Thomas
I tried this on a 16GB RAM docker ABAP 1909 and SAP crashed!
Kindly put minimum memory requirements for this 128GB 512 GB RAM whatever and also CPU power needed for indexing.
Trial SAP is a smaller REPOSRC but standard S4/HANA with all the SAP code
will take a huge time to index without resources.
Regards
Jayanta