Sometimes, when you're writing a program, you come across a requirement, and you know there must be something already...
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
in the system to deal with it. But how do you find that code?
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:
- The old and venerable -- but still very useful -- Function Modules; and
- The new and "swish" classes.
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.
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.
Dig Deeper on SAP ABAP