Category > Tips & tricks
Supported by
Supported by Inetum

Have extra control over your selection screen

images/thumbnail.jpg - Thumbnail

The PARAMETERS and SELECT-OPTIONS already have some configuration options. But sometimes you need more control, more customising. Interestingly, although it’s not simple nor obvious, it can be done through a standard function module.

Debug on a user without debug permissions

images/thumbnail.jpg - Thumbnail

In a well protected system, normal users don’t have debug permissions. Very often, this makes it harder for ABAP programmers to help solve the users' problems, not being able to debug directly in their session.

But there is a legit, albeit obscure, work-around for this problem.

Edit standard programs without a key

images/thumbnail.jpg - Thumbnail

Here we are again facing a dilemma: hide something because it is dangerous and someone can do bad things using this information or teach it because it would be condescending to presume the readers are not responsible enough to know it. Dictatorships usually go for the first: burning books, censorship, etc. Abapinho like to believe that its readers are responsible people and deserve the right to know.

Thus, here it is. No, it’s not a user manual on how to enrich uranium nor a formula for homemade nitroglycerin. But it’s something similar: a trick that allows you to change standard objects without the need for a key.

Edit transport requests even if they don't let you

images/thumbnail.jpg - Thumbnail

As we all know, system adminstrators are very bad, cold blooded and cruel people. To prove it you just need to read the Bastard Operator from Hell.

We, ABAP programmers, are hopeless victims in the hands of these evil creatures.

But not always do we have to be smashed under their hairy fingers.

Show values in SE16N without conversion exit

images/thumbnail.jpg - Thumbnail

By default SE16N always shows the values in the external format, applying the conversion exit to all of them. Until recently, I used to go the ancient SE17 whenever I needed to see them in their internal format. But Rui Nunes told me how to do it in SE16N.

Abracadabra reveals secret parameter

images/thumbnail.jpg - Thumbnail

Here’s a not very orthodox wat to deal with a report’s selection screen. Sometimes you may need to have a special parameter which you prefer to hide from normal users but still need access to. Example: a flag to activate a debug/trace mode. I’ll show you how you can do this by just typing the magic word, ABRACADABRA. It goes like this: DATA: unhide_parameters TYPE flag. PARAMETERS: p_debug AS CHECKBOX. AT SELECTION-SCREEN.

Classe para garantir segurança em programação dinâmica

images/thumbnail.jpg - Thumbnail

I recently found a program which was generating an SQL statement by concatenating several variables with fixed SQL parts. But, either by not paying attention or simple ignorance, the person who did it, thought it would make sense to associate a text-symbol to each of these variables with. Something like this:

SALV consistency report

images/thumbnail.jpg - Thumbnail

Sometimes a SALV has inconsistencies which can go unnoticed. For example, if its structure has an amount field which doesn’t have an associated currency field:

Go into a transaction skipping its selection screen

images/thumbnail.jpg - Thumbnail

Once again SAPGui surprises me with yet another obscure shortcut I didn’t know about. Let’s use the customer display transaction XD03 as an example: Go into the transaction’s selection screen with /NXD03 Fill in the customer number an press ENTER to display its details Do whatever it is you want to do there and get out of it Suddenly… you remember that you needed to do something else there

Copy a Code Inspector variant to another system

images/thumbnail.jpg - Thumbnail

In my current customer, I have three development systems. There used to be only one. And that’s where I customized and fine tuned the Code Inspector_ variant I use to run Abap Test Cockpit. When the other two appeared, before manually copying the variant into them, I decided to investigate a little bit. Much to my surprise, I found in GitHun project upDOWNci which does exactly what I needed: export and import Code Inspector Now, copying the variant was a piece of cake.

Physical vs logical folders

images/thumbnail.jpg - Thumbnail

If in your report called APP1 you need to save a file in a server folder (ex.: /export/app1/) and you don’t want it to be a selection screen parameter, how do you do it?

Automatically close the doors you open

images/thumbnail.jpg - Thumbnail

You’re in the editor. You type ( or [ or { or ' and SAP is dumb and doesn’t close it right away like a proper IDE would. Well, Click on the lower right corner icon which gives you access to the SAPGui options where you configure code templates. In the formatting option, activate Enable Auto Brackets and voilá, SAP will now automatically close any doors you open. I don’t see why this isn’t set by default.

ASSERT vs Exception

images/thumbnail.jpg - Thumbnail

If you read Abapinho you already know how much I like exception classes. But this is not the only ABAP mechanism for dealing with errors.

There is another one, called ASSERT, which should be used more often.

The curious case of the partially protected structure

images/thumbnail.jpg - Thumbnail

The other day I was trying (and failing) to modify a line of a SORTED TABLE.

Weird things happen when you pass SY-TABIX as a parameter

images/thumbnail.jpg - Thumbnail

The other day a very strange thing happened to me. I was sending SY-TABIX as a parameter into a method. Before the call it contained 1 but, once inside, the parameter’s value was 0. Weird. o_thingalizer->very_strange_thing(sy-tabix). I was hearing “Why?! Why?!” repeatedly inside my head. But suddenly I understood it! When you send some field of the SYST as a by parameter you have to pass it by value and not by reference.