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?

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.

How to sabotage standard texts

images/thumbnail.jpg - Thumbnail

Some times I don’t like the names SAP gave to things. So I change them.

For example, one day I was very angry and thought all customers were parasites.

So I did the following:

Formating variables when concatenating strings using <i>pipes</i>

images/thumbnail.jpg - Thumbnail

Pipes are the new trend when it comes to manipulating strings:

str = |Hi { sy-uname }, | &
      |today's date is { sy-datum }.|.

Besides looking cool, it’s way more practical than using the dreaded CONCATENATE.

But I only recently found out that you can directly apply formatting to the variables:

Is the GUI available?

images/thumbnail.jpg - Thumbnail

To check if a program is running in background usually one takes a peek at SY-BATCH. SY-BINPT can also be used to check if the background program is a BDC session. You usually check one of these.

There is a similar but not exactly equal question, though. How do you ask if the GUI is available? Most times both questions will have the same answer. But not always.

It’s like saying the Sun can be seen during the day while the Moon can be seen during the night. If the sky is cloudy you won’t be seeing them.

How to avoid timeout when running a program

images/thumbnail.jpg - Thumbnail

Usually SAP systems have a predefined time limit for running a program interactively. If the program takes longer to run than that you’ll get a runtime execution error. A dump.

In ABAP's name, I baptize you

images/thumbnail.jpg - Thumbnail

When we learn ABAP, we are taught a series of rules on how to name variables. Not everyone uses the same rules but, still, some strict rules are shared between many people:

  • Local variables must start with L: L_BUKRS;

  • Global variables must start with G: G_MODE;

  • Internal tables must have T_: LT_MARA;

  • Structures must have S_: LS_MARA;

  • Object references must have R_: R_CUSTOMER;

  • input parameters must start with I, output with O, changing with C and returning with R.

  • And the most stupid of all, field-symbols must start with FS_: <FS_MARA>.

In the early XXI century those rules made some sense (except for the field-symbols on, which was, and still is, as stupid as writing ‘pencil’ in all our pencils). Today they don’t make much sense anymore. Let me explain.

Abapinho Dev Tools: Translator

images/thumbnail.jpg - Thumbnail

Nuno Morais has developed another very useful tool to help simplify mass translations of most SAP objects. The toold is not for automatic translation between two languages. Instead, it has the following features: Export an Excel file with texts Import an Excel file with texts Copy texts from one language into one or more languages Create a transport order with the changed texts

Abapinho Dev Tools: Dependencies

images/thumbnail.jpg - Thumbnail

Nuno Morais developed a very useful tool which can compare objects between systems and works much better than transaction SREPO. Abapinho will be its official repository. Code in GitHub. Soon, an instruction manual. Until then, go on and try it. If you like it or have any suggestion please leave a comment here. Thank you Nuno for having developed this and for sharing it with the world in Abapinho. Greetings from Abapinho.

Shortcuts for making small and big letters

images/thumbnail.jpg - Thumbnail

You may not even know how to program but if you’re able to type fast and know enough keyboard shortcuts everyone will think you’re an expert. In the ABAP editor write the following word: subdermatoglyphic Now try the following shortcuts: CTRL+U: SUBDERMATOGLYPHIC BIG LETTERS! UPPER CASE! CTRL+L: subdermatoglyphic small letters! lower case! CTRL+J: Subdermatoglyphic The First Letter Of Each Word In Upper case! CTRL+K: sUBDERMATOGLYPHIC tHe BiG aRe NoW sMaLl AnD tHe SmAlL ArE nOw BiG!

SE16H - Aggregate data without using Excel

images/thumbnail.jpg - Thumbnail

A long time ago transaction SE17 was used to look at database tables content. They quickly felt ashamed and decided to improve it, creating SE16. When ALV was invented, SE16N was released (although until today many people still use SE16, go figure!).

Today I present you SE16H.

CONCATENATE LINES OF itbl

images/thumbnail.jpg - Thumbnail

If you want to serialize a set of strings stored in an internal table there are two ways to do it. One is dull, the other one is full of style.

Modify one field in all lines of an internal table

images/thumbnail.jpg - Thumbnail

What I’m about to show you is not exactly new. It has even been used in Abapinho before. But since there is still a lot of people out there using LOOP to change a single field of an internal table, I thought it would be worth talking about it.

Bye bye READ TABLE

images/thumbnail.jpg - Thumbnail

Pré 7.4: DATA l_idade type i. READ TABLE lt_folk INTO ls_folk WITH KEY name = l_name. l_age = ls_folk-age. Pós 7.4: data(l_age) = lt_folk[ name = l_name ]-age ) Thanks Sérgio Fraga for the tip. Greeetings from Abapinho.