Tip

How to find a piece of SAP ABAP code without debugging

Sometimes, when you're writing a program, you come across a requirement, and you know there must be something already in the system to deal with it. But how do you find that code?

    Requires Free Membership to View

For example, say you need to read from the clipboard into your ABAP program. You know that this is possible. After all, the option is available with select-options. But how can you find the code that does this – and then use it for your own purpose?

Obviously, one method is to find the code by debugging the program. But debugging can be a painful process. If the code you're looking for has been embedded in a system program, you will probably have to go through hundreds of lines of very low-level code.

Are there any other options aside from debugging? Two spring to mind:

 

It's really easy to search for an appropriate Function Module. Just go to transaction code SE37, hit the Find button and start playing with combinations of Function Module names and descriptions.

 
Get tips and advice from SearchSAP.com application development expert Matthew Billingham.

Read his advice on application development or pose your own question to him or our panel of other SAP experts.

In the past, with early SAP stuff, before the SAP programmers cottoned to the layer model, you could find a Function Module that did what you want, but it would be wrapped up in all sort of screen controls and difficult to get at. If this is still the case, you might just have to cut and paste the appropriate code into your own Function Module.

I've searched transaction SE37 for a Function Module matching *clipboard* but haven't found anything usable. So I'll try with classes.

Things should be easier now, since classes are much more likely to be well componentized. The hard part is finding an appropriate method. You can search the repository for classes, using transaction code SE24, but that's usually too blunt an instrument. What I do (there may be a better way) is simply look in table SEOCOMPO via SE16. Here, I can enter a partial method name, and find all the methods and classes that correspond.

I've tried *clipboard* as method name, and – there it is: CL_GUI_FRONTEND_SERVICES=>clipboard_import.

That'll do nicely!

About the creator of this tip: Matthew Billingham is SearchSAP.com's application development expert. He has worked for companies such as Eurotunnel and Vodafone, served as development manager for Coats PLc, and as head of application development with Novartis Pharma in Switzerland, managing the development side of a global SAP rollout. He now runs his own SAP consultancy, providing guidance and designing solutions (particularly for intractable problems) for third parties. His expertise is in program design, troubleshooting and knowing just how SAP works; his clients describe him as "Consultant for everything." He is co-founder of SecureBI, delivering innovative software solutions in the SAP security space.
 

This was first published in August 2009

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.