Category > Articles

Request Based Debugging

images/thumbnail.jpg - Thumbnail

If you look up the UNAME system variable in debug within a RFC call you may think it kind of odd to find a username that is not your own. What happens is that the system adopts a specific username for remote calls and a new session is started. A new session implies a new execution context and, hence, all our strategically placed breakpoints will no longer be recognised.

This problem can hinder a simple debug forcing us to run through the code looking for THAT remote call to THAT particular system.

SAP has a solution.

The ABAP detective

images/thumbnail.jpg - Thumbnail

When a development is completed in SAP, the time to send it to other systems where it can be duly tested and then executed by users has finally arrived. Before that occurs, however, it has to be checked for lapses, errors and other problems that could lead to our programmes behaving in an unpredictable manner. There is a very useful tool that allows some of these errors and gaps to be filtered out. It is called ABAP Code Inspector.

Mathematics problem

images/thumbnail.jpg - Thumbnail

Do you know the difference between a mystery and an enigma puzzle? An enigma puzzle is known to have a solution, but with a mystery you don’t know if there is solution.

Do you agree with this? 5 * 3 / 10 = ( 5 * 3 ) / 10 = 5 * ( 3 / 10 ) = 1.5

If you don’t, you should agree because it is a mathematical fact.

Now let’s do some experiments.

Steal data from a SALV

images/thumbnail.jpg - Thumbnail

A friend of a friend of a friend said that a friend of his knew a friend who explained to him in a shady club bar in the docks area of Lisbon how to steal data from a SALV.

Have you used regular expressions before?

images/thumbnail.jpg - Thumbnail

Regularly expressions have been around for ages. But they’re not very well known and even less used. They are a sort of descriptive language that allows for making research and very sophisticated replacements in alpha-numeric chains. A simple example: to validate an email address. If you have to do this through an algorithm you’ll have to work hard. However, with regular expressions, only two or three code lines and the regular expression "\b[A-Z0-9.

Read code from the web and execute it

images/thumbnail.jpg - Thumbnail

This is a 2-in-1 article. That is to say, you’ll learn two subjects at once.

But get ready, what you’ll learn is dynamite, and, in the wrong hands, it can implode your universe.

First, you’ll learn how to read content on the web. And right after that, assuming that this content is ABAP code, you’ll learn how to execute it in the blink of an eye.

With many fields avoid INTO CORRESPONDING FIELDS

images/thumbnail.jpg - Thumbnail

I have already advised here that, in tables with many fields, it’s always recommended to avoid using SELECT *, you must always select, explicitly, only the necessary fields.

But I didn’t warn you that there’s yet another optimisation worth making: avoid INTO CORRESPONDING FIELDS OF TABLE.

R3TR vs LIMU

images/thumbnail.jpg - Thumbnail

You’ve screwed up the productive system. You made a change to a method of a class (or to a function, whatever). Someone else makes another change to another method of the same class (or to another function of the same group of functions, whatever) and saves it to a different transport. When you transport your changes to the productive system, you discover that the class (or function, whatever) now has a syntax error because the changes had interdependencies. You also discover that now, until you get this problem resolved, all your functional co-workers hate you.

SAPlink

images/thumbnail.jpg - Thumbnail

SAPlink is a Z program that is installed in the development environment and which enables a wide variety of object types to be imported and exported from the Workbench.

Take a look here at some examples of how SAPlink can be used:

  • To transfer a table from one SAP system to another

  • To share a class on the internet

  • To make a local security backup of a set of programs before making a dangerous change

  • To keep a development in our personal repository (in Evernote, of course) in case you need it later in another project

  • Etc.

Hey dad, look...no hands

images/thumbnail.jpg - Thumbnail

In today’s article I will show you (and explain!) how you can make a selection screen refresh itself on a regular basis without user intervention.

Are you ready?

Finally ABAP knows Excel

images/thumbnail.jpg - Thumbnail

There are various ways of creating an Excel spreadsheet in ABAP. Some are more masochistic than others and some are certainly more lousy than others.

Insert variables in standard texts

images/thumbnail.jpg - Thumbnail

Everyone uses standard texts. But did you know that standard texts can have dynamic fields in the middle? SAP calls them “text symbols”. The way to do it is identical to that of the old forms of the harmful SE71, in other words wrapping them in the & symbol. Thus: &KNA1-NAME1;&. It’s really handy. I’ll show you how it’s done.

Search object attributes in an internal table

images/thumbnail.jpg - Thumbnail

There are increasingly more objects in ABAP, gradually less fear of them and, lo and behold, more and more people are writing and using them. It is normal and desirable, if objects begin to appear everywhere, to start to stuff them into internal tables. I also stored a load of objects in tables a while back, unfortunately I did not know at that time what I am going to teach you here. It could have come in handy.

So, what exactly am I going to teach you here?

Implementing private methods in BADIs

images/thumbnail.jpg - Thumbnail

A little while ago I had an idea as eccentric as it was amazing that today I have decided to share here, namely, how to create private methods in BADI classes.

Let me explain.

How to sabotage tables

images/thumbnail.jpg - Thumbnail

Another article to help those who are into sneaky subversion Spies, take note on how to edit a table that cannot be (and probably shouldn’t be) edited. I’ll show you three techniques. The first stopped being useful a few years ago, the second is about to become obsolete and the third, well, we’ll just have to see for how long it will work. 1. SE16 /H OK_CODE EDIT The first technique dates back to the twentieth century and uses the old transaction SE16.