Still Haven't Found What I'm Looking For: Finding Your Code in BSP Applications

SAP Developer Network

Summary

It's not easy finding a string within an entire BSP application. What's worse is trying to find a string among several BSP applications. Currently, you can only perform a local search on a page or an event search, but there is nothing to cover the full picture. This article describes a workaround.

By Eddy De Clercq

29 Mar 2005

 

Background

Google is hot. Its search engine was voted (again) the best professional web site of the year in Belgium (source: Clickx Magazine) and it is increasingly chosen as the second brand with the most global impact (source: Brand Channel). Google is all over the place. Besides the well known search engine, it is active in licensing its technology and hardware, advertising, shopping and news aggregating, blogging, translation of web pages, photo organizing, three-dimensional digital Earth modeling, etc.

And it's coming to your desktop too. Google is now available as a desktop search tool - and as if that's not enough, they're working on a browser. Despite refusing to confirm any rumors, it has been aggressively recruiting developers for this, preferably from companies/groups like Firefox/Mozilla. It wasn't always like that though. Yes, some history will now follow - and no, I'm not a grumpy old man who likes to recall the time that he used to work with punch cards. Speaking of punch cards…. I just want to put things in perspective to show that inventions live longer than (marketing) hype.

Anyway, it all started with Archie (short for archives), which was created back in 1990 (15 years ago already) by Alan Emtage, a student at McGill University in Montreal. The goal was to set up a database on scattered files spread over FTP servers. Alternatives soon came: Jughead for Gopher - the predecessor of the web as we now know it, named after the mascot of University of Minnesota, where it was created – and Veronica for flat text files. It didn't take long before a web version appeared. The first web robot was intended to measure web growth, but the World Wide Web Wanderer, a.k.a. Wandex, soon captured URLs automatically.

In late 1993, Martijn Koster announced in a newsgroup: "ALIWEB is an experiment in automatic "distributed" indexing: a WWW server advertises its contents in a local file, which is automatically retrieved and processed proactively by a single site. The combined database of these indices can of course be searched from the Web." I mention this because the engine can still be found at Aliweb. To cut things short, I'll just mention a few names such as (in order of appearance) JumpStation, the World Wide Web Worm, the Repository-Based Software Engineering spider, Excite, EINet Galaxy, etc. It was April 1994 when David Filo and Jerry Yang created Yahoo as a simple collection of their favorite web pages. Then other well known names started to appear: WebCrawler, Lycos, Infoseek, AltaVista, Looksmart, Inkotimi HotBot, Ask Jeeves, and Northern Light. "Where is Google?" you may ask. Well, it wasn't before 1998 that both Google and MSN search appeared. The rest is well-known history.

Finally I want to mention two recently launched alternative projects : Nutch, an open source search engine who wants to fight the nearby monopoly, and Dipsie, which claims to cover the other 99% of the Web. By the way, if you want to work in downtown Chicago, they're looking for people with a "take no prisoners attitude." Anyway, the site isn't really up yet, so I tried to join beta program, but all I got was a blank page. Emails to the guys were never answered.

You might wonder what all this has to do with SAP. Well, I always wanted to find a string among a whole (or even several) BSP applications. Currently, only a local search in a page or event is available, but there is nothing to cover the full picture. Sure, there is "where used" for FMs, but that's it. There is no global search available in SE80. So we tried several alternatives.

WebDAV

The obvious choice was WebDAV (WebDAV within Web AS). First we tried to do a find within Windows Explorer. It can find files, but finding string doesn't seem to be possible. Even the new version of Web Folders (MS KB 892211) doesn't mention any improvements.

Then we tried WebDAV via Macromedia Dreamweaver, but that gave us some WebDAV 501 return codes (see also WebDAV return codes) for the OPTIONS method (see also WebDAV verbs) . Some investigation of the problem revealed that our reverse proxy didn't like WebDAV too much. We managed to proceed after tackling this but we didn't get much further. We could choose the network location but it didn't show any folder for us to choose to search in.

After these two attempts and looking at this Internet draft on WebDAV Search, I was wondering if our efforts were a bit premature. But I'm rather stubborn when it comes to these things and tried other paths. I tried the new Google Desktop for this article. After installation it was clear that it didn't index network places. After digging around, I was still unsure if it was able to index network content, although support and an API is promised for its next release. Neither a release, nor a date was mentioned in the undated document. But if it wasn't able to search network places, it can certainly do a search on "normal" drives. The other day I came across this product called WebDrive. It claims that it can map (S) FTP and WebDav network locations to a simple drive. That would surely be our rescue. After a swift installation, I immediately tried Google Desktop, but it didn't want to recognize my drive at all. Grrr In a forum I found that one can fool Google Desktop by setting "My documents" to the path of the WebDrive. It'll complain a bit but it is possible to do this. The result remains the same though. Google won't index anything I want to. Maybe it's the version that I've downloaded, I don't know, so I decided to leave this path. I could have taken a look at Yahoo desktop, but I didn't want to spend time on that anymore.

So I tried the classical applications again. File Explorer remained blind for searching within WebDAV files, WebDrive or not. I tried Dreamweaver again. It didn't want to search on WebDAV either, but surprise, surprise - it was very willing towards WebDrive. Hip, hip, hurray. So what does one need to do for this? Open Dreamweaver (I'm using MX) and select Find and Replace (Ctrl-F) from the Dreamweaver menu. You'll get this popup.

Select "Find in Folder…" and specify the application or any other folder on your WebDrive. This example is tutorial_1 on WebDrive W. Do a search on body for example, and click on "Find All." You get a list of results. Double-click on a result item and you get the source with the text that was found highlighted. Simple, isn't it?

Not content with this success, I wondered why a simple search engine doesn't do what Dreamweaver does. I decided to give it one more try. But instead of using a classic search engine, I decide to have a go with Copernic desktop search. Copernic became famous with its Copernic Agents and searches on the search engines and summarizes the result avoiding duplicates and clutter. I installed Copernic Desktop. It does index all files on the WebDrive and does find text in the files. A couple of comments though. It is definitely overkill if you only want to use this product for searching BSP applications. It can also index things like email, web history, etc. Secondly, the preview will render the HTML. So it tries to interpret HTMLB and ABAP, which doesn't work well of course. But it is a good alternative and maybe useful for the next chapter.

SAP

There is one gap not covered by the search methods mentioned above: event handlers. So we tried to achieve this with SAP. As said, search functionality isn't available for BSPs, but there is a workaround available given by OSS after we asked what to do in order to enable searches on our code. This code is also mentioned in this forum thread. I've posted the code as is, without any changes. It is posted separately since it's too large to put in the article itself. The code can be found at ABAP Code Sample for Download of a BSP Application.

For questions and possible problems concerning this code, I have to refer you to SAP OSS though. All you need to do is create a report and paste the code in it.

So what does it do? Well, it's plain and simple. It'll ask for the application and a location on your local machine.

The whole application will be downloaded on your local drive. For each BSP page it will make one htm file, containing all the page attributes, event handlers, etc. The result looks like this.

*-------------------------------------------------------------------
* layout
*-------------------------------------------------------------------
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content>
  <htmlb:page title="my Title">
… snip …
  </htmlb:page>
</htmlb:content>
				
*-------------------------------------------------------------------
* eventhandler OnInputProcessing
*-------------------------------------------------------------------
CLASS CL_HTMLB_MANAGER DEFINITION LOAD.
				
* Optional: test that this is an event from HTMLB library.
IF event_id = CL_HTMLB_MANAGER=>EVENT_ID.
				
* See if upload is triggered from button
.. snip… 
				

Now it's up to you. You can use the tools mentioned above or your preferred search tool(s) to do a search on the text you want to find.

Conclusion

So what method do you need to use? It all depends on your needs. If you want to be able to search on everything concerning a BSP application, the SAP method is the best method. If you need WebDAV integration and have the budget for WebDrive, you might opt for that method. In any case, you will be able to find what you are looking for now.

Disclaimer & Liability Notice

This document may discuss sample coding, which does not include official interfaces and therefore is not supported. Changes made based on this information are not supported and can be overwritten during an upgrade.

SAP will not be held liable for any damages caused by using or misusing of the code and methods suggested here, and anyone using these methods, is doing it under his/her own responsibility.

SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of the technical article, including any liability resulting from incompatibility between the content of the technical article and the materials and services offered by SAP. You agree that you will not hold SAP responsible or liable with respect to the content of the Technical Article or seek to do so.

Author Bio

Eddy De Clercq has 20 years experience in computing. Currently he works at the Katholieke Universiteit Leuven (Belgium), the oldest university of the Low Countries and the largest Flemish university. Eddy makes up part of the E-university team which creates mostly self services (web) applications.

Table of Contents



Content Options

Copyright © 2005 SAP AG, Inc. All Rights Reserved. SAP, mySAP, mySAP.com, xApps, xApp, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product, service names, trademarks and registered trademarks mentioned are the trademarks of their respective owners.

SAP Developer Network