Category > Tips & tricks

SORTED instead of STANDARD in the cache tables

images/thumbnail.jpg - Thumbnail

Some time ago I wrote a post here showing the advantages of using internal tables with defined indexes instead of simple STANDARD tables. Confession: that habit is so ingrained that since then, almost all the internal tables I have created have continued to be STANDARD TABLE. It’s very common to create internal tables to cache data that I know I’ll often use inside LOOPS to avoid having to SELECT SINGLES inside them.

Share constants among several classes

images/thumbnail.jpg - Thumbnail

Imagine you have a herd of related classes sharing between them a whole bunch of constants. Saying the same thing a different way, would you like all the classes of the herd to have easy access to the bunch of constants?

(If you’re confused, then let me tell you that the “herd” thing was just to baffle you)

Carrying on…..

SAP for rent

images/thumbnail.jpg - Thumbnail

If you really need to access an SAP and nobody lets you, and you don’t have a computer where you can install it or you don’t have enough know-how or patience to do it, you can always rent.

Colour hallucination

images/thumbnail.jpg - Thumbnail

This is not really an article. It’s hardly a tip. It’s closer to getting something off my chest in all the colours of the rainbow.

Create RANGEs in DDIC without getting all wound up

images/thumbnail.jpg - Thumbnail

I am using RANGEs more and more. I use them at breakfast, lunch, and dinner and outside meal times. It’s like soy sauce. A few spoonfuls and everything is instantly tastier.

Lock data in Z-tables without a locking object

images/thumbnail.jpg - Thumbnail

If I needed to create locking entries in a ZCOISO table I had created, up to two days ago I would have gone to SE11 to create a locking object for the ZCOISO table so that I could then use the function module generated by the locking object to lock the data.

But not anymore.

SAP system name in the window title

images/thumbnail.jpg - Thumbnail

The client where I’m working at the moment owns more SAP systems than the number of volcanoes in Chile. And, of course, it’s inevitable to have multiple sessions open for several of those systems. With the windows minimized it’s impossible to know the matching between systems and sessions. I mean, it was impossible, because today that’s already possible:

Execute commands in the user’s computer

images/thumbnail.jpg - Thumbnail

It’s been a while since Abapinho played with fire. Today he will. Because today he’ll show you how to execute DOS commands on the user’s local machine. After you finish reading this article, you’ll be ready to format the hard disks of all your users. Dealing with danger helps make us aware of the power we have and the responsibility that comes with it. Dear reader, listen to your conscience.

Benefits of LIKE LINE OF

images/thumbnail.jpg - Thumbnail

Let’s start by assuming that you have some dignity and so you don’t use internal tables with HEADER LINE anymore ;)

Given this, let’s suppose you declare an internal table:

Maintaining table maintenance authorisation groups

images/thumbnail.jpg - Thumbnail

There are some projects in which the authorisations group associated with table maintenance is always &NC;&, that is, Not Classified. It signals that everything there is friendly and nobody is hurting anyone else. But there are other projects where authorisation groups are taken seriously. But this is not synonymous with saying that they are organised. Serious or not, usually it all ends in a big mess, with nobody knowing who is authorised to do what.

This tip may help.

INSERT and APPEND with ASSIGNING FIELD-SYMBOL

images/thumbnail.jpg - Thumbnail

The harsh truth, at all costs, is that structures are out of date. Nowadays FIELD-SYMBOLS are in.

When you make a LOOP to an internal table of course that you also use ASSIGNING FIELD-SYMBOL instead of INTO Structure,correct?

But what was screwing everything over was APPEND and INSERT. I did not know how to use a structure to add records

No one cares for LISTBOX

images/thumbnail.jpg - Thumbnail

For some strange reason, LISTBOX is rarely used in report selection screens. Even though it’s widely used throughout the web. Who knows why.

Dear reader, I suggest you pay attention to its advantages:

SAParrot

images/thumbnail.jpg - Thumbnail

Go to SE38 and create a program with the code below. Then turn the computer sound on and press F8. INCLUDE ole2incl. DATA : ole TYPE ole2_object, voz TYPE ole2_object, texto TYPE string. CREATE OBJECT voz 'SAPI.SpVoice'. texto = 'Olá eu sou o SAP e falo português com sotaque estrangeiro'. CALL METHOD OF voz 'Speak' = ole EXPORTING #1 = texto. Note: the parrot not in the photo, just the macaw with which he was talking :)

Are you serious or just joking?

images/thumbnail.jpg - Thumbnail

Some things can only happen in production. While with some others it’s quite the opposite.

If you still don't use ABAP Objects you're chicken

images/thumbnail.jpg - Thumbnail

SAP has a book called Official ABAP Programming Guidelines which describes rules and best practices on how to program in ABAP. In there you can read: Page 42: Rule 3.1: Use ABAP Objects whenever possible for new and further developments. Classic processing blocks may be newly created in exceptional cases only. Page 45: Within such a [classic] processing block, however, you should immediately delegate the execution to a suitable method (see Rule 6.