Supported by
Supported by Inetum

Instant RANGE - just add water

images/thumbnail.jpg - Thumbnail
I’m going to teach you a magic formula for creating a RANGE that is almost as easy as just adding water. Imagine that you want to create a RANGE from a database selection to then use it in another SELECT. Obviously you can do it like this: DATA: lt_kunnr TYPE STANDARD TABLE OF kunnr, lr_kunnr TYPE RANGE OF kunnr, wa_kunnr LIKE LINE OF lr_kunnr. FIELD-SYMBOLS: <kunnr> LIKE LINE OF lt_kunnr. SELECT kunnr INTO TABLE lt_kunnr FROM kna1.

LOOP ASSIGNING instead of LOOP INTO

images/thumbnail.jpg - Thumbnail
In the beginning there was INTO. Actually, in the beginning it was not even INTO.

Taking a nap

images/thumbnail.jpg - Thumbnail
Whatever the case, it is necessary to put a program to sleep. And, as with almost everything else, there are several ways to do this, some better than others. The most standard way to do this in ABAP is as follows: WAIT UP TO 10 SECONDS. The advantage of WAIT UP TO N SECONDS is that the process is freed up during these 10 seconds, thereby making it available for those who want it.

Different versions of the same story

images/thumbnail.jpg - Thumbnail
Everyone knows that the SAP versions are a big mess. The lords of Heidelberg who play around with the names they give their things are either an impulsive bunch, are making fun of us, or they must always be in uproar. Here is a little table to help to unravel them: Ano | UI | Edition | Version | Version | BASIS | WebAS | ECC | NetWeaver —|—|—|—|—|—|—|—|— | Terminal

On your marks, get set, go!

images/thumbnail.jpg - Thumbnail
Ladies and gentlemen, boys and girls, the race is about to begin. Introduction The four competitors are as follows. They are 4 internal tables, of different races and creeds, which will fight for the athletics title of speed LOOP. Here they are: Competitor 1: DATA: LT_ITEM TYPE TABLE Competitor 2: DATA: LT_ITEM_HASHED TYPE HASHED TABLE Competitor 3: DATA: LT_ITEM_SORTED TYPE SORTED TABLE Competitor 4: DATA: LT_ITEM TYPE TABLE + INTO INDEX

Global macros

images/thumbnail.jpg - Thumbnail
In a previous article we talked about macros, a relatively obscure and little used feature that can be both useful as well as create a huge mess. But these aren’t the only ABAP macros. There are others that are even more obscure and with even greater potential to mix up a system: the global macros. I don’t know if I should tell you this, as it’s so strange… But, I don’t think it’s a good idea to hide it… Therefore, I’ll tell all.

Start on the right footing

images/thumbnail.jpg - Thumbnail
Normally when you log on to SAP the SAP menu appears. But you can use the function module NAVIGATION_SET_START_TCODE to pre-set an initial transaction. Anyway, it’s better to know it’s there than not to know it’s there, and even better than knowing that it’s not there. Who knows – it could be good for some users. There’s also the function module NAVIGATION_GET_START_TCODE to see what is pre-set. Greetings from Abapinho.

Not even David Copperfield would do better

images/thumbnail.jpg - Thumbnail
Sometimes we want to access a transaction and we don’t have permission. That’s annoying. Luckily there’s the function module ALINK_CALL_TRANSACTION which makes things better. But use it with care or someone will get angry. Welcome to the dark side of Abapinho. If they say it was me that said it, I deny everything. Update: this function module will also do the trick: CALL_TRANSACTION_FROM_TABLE. New update: if all the above fail try this other function module: RS_HDSYS_CALL_TC_VARIANT (clearing flag AUTHORITY_CHECK).

Bate às portas certas

images/thumbnail.jpg - Thumbnail
Para tua conveniência, aqui tens as portas TCP/IP utilizadas pelo NetWeaver Application Server ABAP e pelo Internet Connection Manager (ICM) : <table border="0"> <thead> <tr> <th>Serviço</td> <th>Número porta/Nome serviço</td> <th>Por defeito</td> <th>Fixo</td> </tr> </thead> <tbody> <tr> <td>Dispatcher</td> <td>32NN/sapdpNN</td> <td>3200</td> <td>x</td> </tr> <tr> <td>Gateway</td> <td>33NN/sapgwNN</td> <td>3300</td> <td>x</td> </tr> <tr> <td>Gateway</td> <td>48NN/sapgwNNs</td> <td>4800</td> <td>x</td> </tr> <tr> <td>ICM HTTP</td> <td>80NN</td> <td>8000</td> <td> </td> </tr> <tr> <td>ICM HTTPS</td> <td>443NN</td> <td>Inactivo</td> <td> </td> </tr> <tr> <td>ICM SMTP</td> <td>25</td> <td>Inactivo</td> <td> </td> </tr> <tr> <td>Message Server</td> <td>36NN/sapmsSID</td> <td>3600/sapmsC11</td> <td> </td> </tr> <tr> <td>Message Server HTTP</td> <td>81NN</td> <td>8100</td> <td> </td> </tr> <tr> <td>Message Server HTTPS</td> <td>444NN</td> <td>Inactivo</td> <td> </td> </tr> <tr> <td>Central System Log</td> <td>UDP: 12NN, 13NN, 14NN, 15NN</td> <td>Inactivo</td> <td> </td> </tr> </tbody> </table> Para saberes mais consulta este documento da SAP.

ABAP Ninja

images/thumbnail.jpg - Thumbnail
One of the major new features in ERP 6.0 is the Enhancement Framework, a kind of “landlord’s friend” that allows you to hammer on all the SAP walls without chipping the paintwork. Unfortunately there’s still very little documentation about this and it’s always difficult to find the right Enhancement Point for the hammering you want. The a ABAP Ninja site tries to help. It’s an Enhancement search engine. They say they have more than 13,000 Enhancement Points waiting to be found.

St. Isidore of Seville

images/thumbnail.jpg - Thumbnail
Don’t know who to pray to in moments of desperation? Now you can relax. Programmers have a saint – St. Isidore of Seville. A very learned and intelligent gentleman who lived in Spain in the 6th and 7th centuries and, to quote Wikipedia, “wrote about mathematics, astronomy, medicine, human anatomy, zoology, geography, meteorology, geology, mineralogy, botany and agriculture. He added nothing innovative or original, carried out no experiment, made no new observations or reinterpretations and discovered nothing, but his influence on the Middle Ages and the Renaissance was great”.

LOOP FROM INDEX

images/thumbnail.jpg - Thumbnail
It’s very easy to get tied up in knots where performance is concerned when you’re working with internal tables – especially when they’re getting really big. In fact these problems often only arise after a few months, when the tables tend to grow as time goes by. For example, when you’re looping two tables, one of headers and another of entries, do you do this? LOOP AT itab1 ASSIGNING <fs1>. LOOP AT itab2 ASSGNING <fs2> WHERE field1 = <fs1>-field1.

Progress indicator

images/thumbnail.jpg - Thumbnail
You know those progress bars that show how long it will take for a process to end? The ones that sometimes go back to the beginning when they reach the end and leave you frustrated and confused and wondering what use they are anyway? Here’s how you can use them in an ABAP program. DATA: lv_texto TYPE char40, lv_valor type i. DO 10 TIMES. WAIT UP TO 1 SECONDS. CLEAR lv_texto.

<!--:pt-->Executa um comando no teu computador<!--:-->

images/thumbnail.jpg - Thumbnail
Imagina que queres executar um programa no teu PC a partir de um programa ABAP. Não sei porque carga de água quererás tu fazer isto mas ok, se queres mesmo fazer, é assim: DATA: i_returncode TYPE i. CALL FUNCTION &#39;GUI_EXEC&#39; EXPORTING command = &#39;Notepad.exe&#39; parameter = &#39;eu_sou_um_texto.txt&#39; IMPORTING returncode = i_returncode. É provável que dê para fazer coisas boas com isto. Mas está à vista a grande javardice que se pode fazer por isso pensa bem antes de começares para aí a escangalhar os computadores dos utilizadores todos.

SAT – The new execution analysis tool

images/thumbnail.jpg - Thumbnail
Since I was small I have been using the SE30 transaction for two different things: To analyze a (normally standard) program I don’t know in order to find out what functions it uses, what BADIs it offers, etc; To analyze a program of mine to search for performance problems. The simple truth is that the SE30 transaction is a total mess. It’s extremely limited and inflexible and it’s useless for any more complex analysis.