Category > Tips & tricks
Supported by
Supported by Inetum

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.

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 }, | &amp; |today&#39;s date is { sy-datum }.|. Besides looking cool, it&rsquo;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&rsquo;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&rsquo;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&rsquo;ll get a runtime execution error. A dump.

Shortcuts for making small and big letters

images/thumbnail.jpg - Thumbnail
You may not even know how to program but if you&rsquo;re able to type fast and know enough keyboard shortcuts everyone will think you&rsquo;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. Say you have an internal table with one million and two hundred thousand entries and want to change the field ICON so that it has ‘@FM@‘ in all lines.

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.

So much new stuff in 7.4, I don't know where to begin

images/thumbnail.jpg - Thumbnail
Abapinho will slowly start posting tips specific to AS ABAP 7.4. Slowly because there are still only a few people with access to this version. But there are so many new things to tell that I feel tempted to start posting all of them. ABAP was a flabby middle aged guy with a beer belly. It underwent major plastic surgery and now looks like a lean 20 year old kid who can party until 9am, drink 7 gin tonics and then, before going to bed, do 100 burpees just to sleep better.

Breakpoint in message from inside the debugger

images/thumbnail.jpg - Thumbnail
You&rsquo;re in the middle of a debug and want it to stop at a specific message. What to do?

Multiple OR selections in SE16N

images/thumbnail.jpg - Thumbnail
If you are one of those persons who still uses SE16, this article is not for you. If you keep reading, you might find yet another reason to finally start using SE16N (as if all others were not enough already). Imagine that you want to select all materials whose name contains &ldquo;PREGO&rdquo; and whose type is &ldquo;FERRAGENS&rdquo;, and all materials whose name contains &ldquo;GUARDANAPO&rdquo; and whose type is &ldquo;COMIDA&rdquo;. In other words, &ldquo;PREGO_NO_PAO&rdquo; or &ldquo;GUARDANAPO_PAPEL&rdquo; won&rsquo;t be part of the result set. What you want is this: (MATNR = “PREGO%” AND MTART = “FERR” ) OR (MATNR = “GUARDANAPO%” AND MAKT = “COMI” ) As you know, using SE16N in a regular way (which doesn&rsquo;t use what I&rsquo;m about to show you) you would need to execute it twice and manually compare data, because the selection screen does not allow you to make multiple OR selections. Or does it?

CASE inside a SELECT (available soon)

images/thumbnail.jpg - Thumbnail
Get ready because you&rsquo;ll soon be running into a lot of surprises. ABAP is learning new tricks. Look at this one: CONSTANTS: lc_menina TYPE STRING VALUE ‘GIRL&#39;, lc_menino TYPE STRING VALUE ‘BOY’, lc_senhor TYPE STRING VALUE ’GENTLEMAN’, lc_senhora TYPE STRING VALUE ‘LADY’. SELECT nome, CASE WHEN sexo_id = ‘M&#39; AND idade &lt; 18 THEN @lc_menino WHEN sexo_id = ‘F’ AND idade &lt; 18 THEN @lc_menina WHEN sexo_id = ‘M&#39; AND idade &gt;=18 THEN @lc_senhor WHEN sexo_id = ‘F’ AND idade &gt;=18 THEN @lc_senhora END AS titulo FROM zpessoa WHERE pessoa_id = @pessoa_id INTO CORRESPONDING FIELDS OF @lt_pessoas.

Search for notes directly in Google Chrome

images/thumbnail.jpg - Thumbnail
Google Chrome has an app for searching SAP notes. It&rsquo;s called SAP Notes finder. You can install it here. Thank you Fernanda Mirabile and Talita Polanczyk for the tip. Greetings from Abapinho.

[:pt]CALL FUNCTION com DESTINATION ‘NONE' cria nova LUW[:]

images/thumbnail.jpg - Thumbnail
[:pt]Sabias que quando invocas uma função com a opção DESTINATION ‘NONE’ estás a iniciar uma nova LUW? Isto pode parecer apenas uma curiosidade, mas há um caso em que pode fazer toda a diferença: sabes aqueles módulos de função que ao serem chamados uma segunda vez têm um comportamento diferente da primeira vez? Isto acontece porque eles hão-de ter alterado alguma variável global ao grupo de funções. Ora se iniciares uma nova LUW quando chamares a função, o seu grupo de funções é automaticamente inicializado e assim garantes que o comportamento da função é o esperado.