"
Supported by

Source-code based class development

popeye

Being used to develop in Java and C++, the way transaction SE24 forces you to navigate between each of its parts and the fact that every method has its own include was very confusing to me when I first started using it. Why does SAP always have to make things so complicated? I eventually got used to it.

At some point in time SE24 introduced the option “source-code based” which shows the class and all its methods in a single text. But for some reason I never felt comfortable using it.

baseado_em_texto_fonte

Today I think I know why. Because I didn’t know of any form of navigation which would allow me to directly jump to a method’s definition or implementation.

But it is there. Just press CTRL-F5 (or the equivalent toolbar button) and you’ll get this popup:

navegador_de_classe

Now we’re talking. I finally can starting to do source-code based development in ABAP.

And so that it becomes a habit, you can change the ABAP Workbench settings to make this the default mode.

Greetings from Abapinho.

Jump to your last change

man-jump

Imagine that you’re editing one of those ancient programs with thousands of lines (yes because today you know that it’s wrong not to modularize (it’s a sin really) your methods (yes because today you always use methods) don’t have more than 200 lines).

So there you are, editing a line somewhere in the middle on all that code when (because you’re not getting younger) the name of a variable you need completely vanishes from your memory. You have no alternative but to press HOME to go to the top of the program where all the variables are declared (yes because whoever made this program didn’t modularize yet but was a very tidy person).

And then you forget the line number of the change you were making. And there you go PAGE DOWNing your way through all that code trying to find your line again.

It’s either that or…

Ler o resto do artigo! »

I call you and you call me

funicular

You you call a function via RFC you need to provide the RFC DESTINATION for the remote system:


CALL FUNCTION ‘ZSNEEZED’
  DESTINATION ’sistema_longe_daqui’.

What if, for some reason, the function running in the remote system needs to call a function in the original system? How would you do it?

Ler o resto do artigo! »

Undo in debugger layout

benjaminbutton

Although a substantial part of an ABAP programmer time is spent debugging code, most programmers I know don’t invest much in getting to know the ABAP debugger. Maybe because they spent too many years working with its previous version which was truly archaic and worthless. But the new one can do much more than you usually ask of it. And Abapinho intends to teach you how.

Today I’ll teach you just a simple key.

Ler o resto do artigo! »

Debugging with baby steps

stepsize_baby

When you debug you use F5 key to move to the next statement (or go inside a sub-routine). But imagine an IF with multiple conditions:


IF A = 1 AND B = 2 AND C = 3.
  WRITE 'I like the word glauc'.
ENDIF.

When you debug through that IF using F5 and one of the expressions is false you’ll step out of the IF without knowing which of the three was false.

But the new debugger has a new very neat functionality which can help you to better understand what happened there.

Ler o resto do artigo! »

SAP helps you translate to any language

buddha

Every once in a while I find yet another hidden SAP virtue. I just found out that there is a transaction which, for a given word in a given language, will help you translate it to another language by showing you which other translations already exist for that same word.

How cool is that? Ok, it’s not Google Translate, but it’s a nice help.

Oh, I almost forgot. The transaction is called STERM.

Thank you Sérgio Fraga for the tip.

Greetings from Abapinho.

Native SQL

watch_movement

Sometimes ABAP SQL doesn’t allow you to do something you’d be able to do using the database’s native SQL. It can still be done.


* Converte para maiúsculas e acrescenta wildcard 
  TRANSLATE l_name1 TO UPPER CASE.
  CONCATENATE l_name1 '%' INTO l_name1.

* Executa SQL nativo para fazer
* uma pesquisa "case insensitive" pelo nome 
  EXEC sql performing SAVE_ROW.
    SELECT kunnr
           INTO :l_kuune
           FROM kna1
           WHERE kna1.mandt        =    :sy-mandt
           AND   UPPER(kna1.name1) LIKE :l_name1
  ENDEXEC.

But pay attention because, unlike the generic ABAP SQL, this SQL will have to be specifically written for the existing database. As a consequence, the code will be less flexible and more complex. So make sure you use this only if you really have no alternativa.

Photo: Photodesaster via VisualHunt.com / CC BY-NC

Greetings from Abapinho.

GROUP BY in LOOPs on internal tables

loops

We’ve all sorted internal tables to use AT NEW on a LOOP.
But starting from 7.40, we can use GROUP BY on LOOPs.

The ability to group by values based on expressions or even methods is great.

The grouping is done on the first LOOP and can be processed afterwards. Try running the code below and I bet you’ll be as impressed as I was.

Ler o resto do artigo! »

Fix bug in SAP standard using an implicit enhancement

remendar

You just found a bug in a standard FORM (or FM or METHDO):


FORM EQUAL_VALUE CHANGING W_DATE TYPE SYDATUM.
  W_DATE = SY-DATUM - 1.
ENDFORM.

You report the error to SAP but you know it will take them several days, weeks or months to publish a correction. And you need it corrected right now.

You decide to act.

So you use the implicit enhancement at the start of the FORM to replace the standard code with your own (just until the correction arrives, of course):


FORM EQUAL_VALUE CHANGING W_DATE TYPE SYDATUM.
ENHANCEMENT...
* While the SAP standard says: W_DATE = SY-DATUM - 1.
  W_DATE = SY-DATUM - 2.
  EXIT. "salta fora
ENDENHANCEMENT
W_DATE = SY-DATUM - 1.
ENDFORM.

I know, it’s not elegant. But you just solved your urgent problem.

Thank you Pierre Ameye for the tip.

Thank you Sherri Lynn Wood for the photo.

Greetings from Abapinho.

Can you really do it right the first time?

cinderela

Checkpoints is a very powerful ABAP framework which almost nobody uses. Why? Probably for the same reason hardly anyone listens to Sun Ra and knows that Frank Zappa has 102 albums. Because, even though really good, it’s obscure and not commercial. Checkpoints são, indeed, really good and not commercial. But they should be more like Mozart and the Beach Boys which are both good and commercial.

Ler o resto do artigo! »

STA Ticket System improve SAP incident handling times

STA_654x885_t

Today we have a guest, Tamás Holics. He owns STA Consulting, a Hungarian company which has created 2 very interesting SAP products. In this article Tamás presents the STA Ticket System.

The problem

A lot of time is wasted in SAP software testing and maintenance processes due to incomplete or incorrect error reports from users and testers. Support people (analysts, developers) usually have to ask for more information about the error. This takes a lot of valuable working time from both the reporters of the error and support people. Solving the problem is often blocked until every information is available.

Ler o resto do artigo! »

The rot is noble after all

lateharvest

For many years I’ve been complaining about how backward ABAP development ecosystem is and how long it takes to evolve. Every time he heard me saying it a good friend of mine would wisely advise me to never bite the hand that feeds you.

But how can a man not speak out?

Ler o resto do artigo! »

Software design patterns in ABAP

burberry

We are constantly learning. But once in a while we learn something which is a leap forward forcing us to look in a new way to everything we do.

The last time this had happened was when I started using OO in ABAP. OO was not new to me as I had already used it extensively in Java, C#, C++, etc. But to finally be able to apply these precious concepts on my daily job was a relief and a big improvement in the quality, flexibility and speed of my work.

I feel now in the middle of a new leap forward. Because I’m finally learning how to use software design patterns. I’ve always heard about them but never gave them much though. For example, the ABAP site ZEVOLVING already talked about them a long time ago and I remember having read many of these articles. But somehow I still hadn’t found a text which not only explains them but also makes their advantages clear.

Now, thanks to Miguel Jorge, I have found one:: Head First Design Patterns. Besides being funny, it explains in a clear and simple way, the limitations of OO paradigms and how patterns can help overcome them.

This site has links to several interesting texts on this subject. It even has a link to a PDF version of the aforementioned book. And also to this page which lists them and even criticizes them.

From now on, whenever I’m designing software in OO I’ll always try to be aware of the available patterns and try to apply them whenever appropriate.

Thank you Miguel Jorge!

Greetings from Abapinho.

Disable value history for a single field

adam_eve

SapGUI usually keeps a history of the last values entered on each field. This is usually a good thing. But you may very well not want it to happen (in case you’re entering pornographic values in a specific field for example). You could always turn it off globally in the SapGUI settings.

But what if you just want to disable it in one particular field? Abapinho tells you how to do it.

Ler o resto do artigo! »

Add parameters to standard methods and functions

esquilo

We are all aware of SAP implicit enhancements which allow you to add code to the top or bottom of any block of standard code (methods, functions, etc). We’ve all used it to make a change to a BAPI or other standard piece of code.

But only recently did I find that you can also use these implicit enhancements to add parameters to standard methods and functions.

Ler o resto do artigo! »

ZTOAD – Editor de SQL

toad-world-logo

Toad is a very famous SQL tool which allows you to build and execute SQL queries in an easy and interactive way. And now, thanks to Mr. Sébastien HERMANN, SAP has a simplified version of this wonder tool.

I’ll let him explain.

Thank you Sérgio Fraga for spotting this.

Greetings from Abapinho.

Internal table secondary indexes

postits

This is how internal tables used to be declared:


DATA: itbl TYPE TABLE OF bkpf.

Ler o resto do artigo! »

Program the program programming

cerebro_fios

One of the few things that separates us humans from all the other animals is our ability to think about thoughts.

A sparrow may think “I’m scared, I’ll say chirp chirp chirp” and, as a direct consequence, whoever stands close to it will hear “chirp chirp chirp”.

Ler o resto do artigo! »

Use the “where used” tool in a program

Book Illustration Depicting Sherlock Holmes and Dr. Watson in a Train Cabin

The “where used” tool is very dear to any ABAP developer. Through it one can find out where a given object is used. Doesn’t look like much but we all know how important this is.

Ler o resto do artigo! »

Class CL_GUI_FRONTEND_SERVICES

nariz

Class CL_GUI_FRONTEND_SERVICES is commonly used to upload and download files from and to the user’s local computer. But it can do many more good things. For example:

Ler o resto do artigo! »


About Abapinho
Abapinho runs on WordPress
Articles (RSS) e Comments (RSS).