Category > Tips & tricks
Supported by
Supported by Inetum

Debugging with baby steps

images/thumbnail.jpg - Thumbnail
When you debug you use F5 key to move to the next statement (or go inside a sub-routine). But imagine an IF with multiple conditions: IF A = 1 AND B = 2 AND C = 3. WRITE 'I like the word glauc'. ENDIF. When you debug through that IF using F5 and one of the expressions is false you’ll step out of the IF without knowing which of the three was false. But the new debugger has a new very neat functionality which can help you to better understand what happened there.

SAP helps you translate to any language

images/thumbnail.jpg - Thumbnail
Every once in a while I find yet another hidden SAP virtue. I just found out that there is a transaction which, for a given word in a given language, will help you translate it to another language by showing you which other translations already exist for that same word. How cool is that? Ok, it’s not Google Translate, but it’s a nice help. Oh, I almost forgot. The transaction is called STERM.

Native SQL

images/thumbnail.jpg - Thumbnail
Sometimes ABAP SQL doesn’t allow you to do something you’d be able to do using the database’s native SQL. It can still be done. * Converte para maiúsculas e acrescenta wildcard TRANSLATE l_name1 TO UPPER CASE. CONCATENATE l_name1 '%' INTO l_name1. * Executa SQL nativo para fazer * uma pesquisa "case insensitive" pelo nome EXEC sql performing SAVE_ROW. SELECT kunnr INTO :l_kuune FROM kna1 WHERE kna1.mandt = :sy-mandt AND UPPER(kna1.name1) LIKE :l_name1 ENDEXEC.

Fix bug in SAP standard using an implicit enhancement

images/thumbnail.jpg - Thumbnail
You just found a bug in a standard FORM (or FM or METHDO): FORM EQUAL_VALUE CHANGING W_DATE TYPE SYDATUM. W_DATE = SY-DATUM - 1. ENDFORM. You report the error to SAP but you know it will take them several days, weeks or months to publish a correction. And you need it corrected right now. You decide to act. So you use the implicit enhancement at the start of the FORM to replace the standard code with your own (just until the correction arrives, of course):

Disable value history for a single field

images/thumbnail.jpg - Thumbnail
SapGUI usually keeps a history of the last values entered on each field. This is usually a good thing. But you may very well not want it to happen (in case you’re entering pornographic values in a specific field for example). You could always turn it off globally in the SapGUI settings. But what if you just want to disable it in one particular field? Abapinho tells you how to do it.

Add parameters to standard methods and functions

images/thumbnail.jpg - Thumbnail
We are all aware of SAP implicit enhancements which allow you to add code to the top or bottom of any block of standard code (methods, functions, etc). We’ve all used it to make a change to a BAPI or other standard piece of code. But only recently did I find that you can also use these implicit enhancements to add parameters to standard methods and functions.

ZTOAD - Editor de SQL

images/thumbnail.jpg - Thumbnail
Toad is a very famous SQL tool which allows you to build and execute SQL queries in an easy and interactive way. And now, thanks to Mr. Sébastien HERMANN, SAP has a simplified version of this wonderful tool. I’ll let him explain. Thank you Sérgio Fraga for spotting this. Greetings from Abapinho.

Program the program programming

images/thumbnail.jpg - Thumbnail
One of the few things that separates us humans from all the other animals is our ability to think about thoughts. A sparrow may think “I’m scared, I’ll say chirp chirp chirp” and, as a direct consequence, whoever stands close to it will hear “chirp chirp chirp”.

Use the "where used" tool in a program

images/thumbnail.jpg - Thumbnail
The “where used” tool is very dear to any ABAP developer. Through it one can find out where a given object is used. Doesn’t look like much but we all know how important this is.

Class CL_GUI_FRONTEND_SERVICES

images/thumbnail.jpg - Thumbnail
Class CL_GUI_FRONTEND_SERVICES is commonly used to upload and download files from and to the user’s local computer. But it can do many more good things. For example:

SAP can take selfies!

images/thumbnail.jpg - Thumbnail
I just found out that SAP can take selfies. I still don’t see why one would need it. But that’s understandable because I never really understood the need for selfies anyway. Here’s how SAP can take a selfie:

Do you know the ASCII code for CR_LF and its buddies?

images/thumbnail.jpg - Thumbnail
I don’t. And I don’t want to. Why waste memory on stuff like that? And I don’t need to because ABAP has a class just for that.

SELECT from a set of known values

images/thumbnail.jpg - Thumbnail
Someone asks you to select records based on a criteria for which you’ll have a small set of known values which you’re told will never change. Did you know you can do it directly in the SELECT? SELECT * INTO T_T005T FROM T005T WHERE LAND1 = I_LAND1 AND SPRAS IN ( 'PT', EN' ). I need to remind you that hard coding values in programs is not the best idea so make sure you know what you’re doing when you choose to apply this approach.

You can save variants in SE16N

images/thumbnail.jpg - Thumbnail
And that’s it really. That’s the whole tip right there at the title. This has always been right under your nose but you probably never thought about it: you can save variants in SE16N. And they can even be user-specific. So useful and so little known. Thank you Sérgio Fraga for the tip. Thank you Cloudtail for the photo. Greetings from Abapinho.

Limitar execução em background ou foreground

images/thumbnail.jpg - Thumbnail
You’ve developed a report which you know will take over 12 hours to run. So you don’t want anyone to try to run it in foreground. I’ll show you a way to make sure it doesn’t happen.