Supported by
Supported by Inetum

With many fields avoid INTO CORRESPONDING FIELDS

images/thumbnail.jpg - Thumbnail

I have already advised here that, in tables with many fields, it’s always recommended to avoid using SELECT *, you must always select, explicitly, only the necessary fields.

But I didn’t warn you that there’s yet another optimisation worth making: avoid INTO CORRESPONDING FIELDS OF TABLE.

Free SAP course on HANA

images/thumbnail.jpg - Thumbnail

SAP started last week a free course on HANA. Run!

QUICKINFO: tip on how to give tips.

images/thumbnail.jpg - Thumbnail

In my opinion, this tip has arrived a few years too late, as it is now rare to use the WRITE command to directly write things to the screen. Therefore, we can say it’s a retro tip. A vintage tip. But let’s assume we are still in the twentieth century grappling with ABAP’s most Baroque command, WRITE. Then, imagine yourself sitting in front of SAP, listening to Pearl Jam, wearing black headphones and writing WRITEs of a series of values on the screen, which you would like the user to have more information on.

Is that RFC system alive?

images/thumbnail.jpg - Thumbnail

You want to call an RFC function in another system but, because you’re not a carrion eater, you only want to do it if it’s alive. Hence, you need a way of checking whether that particular destination RFC system is alive. How do you do that? Charles Santana does it like this: DATE: rfcdest TYPE rfcdest, ping_status TYPE /sdf/e2e_traffic_light_numeric. CALL FUNCTION '/SDF/RFC_CHECK' EXPORTING iv_destination = rfcdest iv_ping = 'X' * iv_logon = 'X' * iv_latency = 'X' IMPORTING ev_ping_status = ping_status.

Does the function exist?

images/thumbnail.jpg - Thumbnail

You call a function. Imagine it doesn’t answer. It may be that it’s staying silent. Or it’s shy. Or dumb. Or, of all the misfortunes, it doesn’t exist.

To make sure and put your mind to rest you then do:

Writing money without any decimal worries

images/thumbnail.jpg - Thumbnail

Some people read the TCURX to find out the number of decimal places of a CURRENCY when they need to write a money field to an alphanumeric variable.

Are you one of those people? Don’t be.

R3TR vs LIMU

images/thumbnail.jpg - Thumbnail

You’ve screwed up the productive system. You made a change to a method of a class (or to a function, whatever). Someone else makes another change to another method of the same class (or to another function of the same group of functions, whatever) and saves it to a different transport. When you transport your changes to the productive system, you discover that the class (or function, whatever) now has a syntax error because the changes had interdependencies. You also discover that now, until you get this problem resolved, all your functional co-workers hate you.

Finally, expressions can be concatenated

images/thumbnail.jpg - Thumbnail

Finally, the SAP NetWeaver 7.0 Enhancement Package 2 makes ABAP start to seem like a normal programming language.

It even allows expressions to be concatenated, no less!

Decimal to alphanumeric without depending on the user

images/thumbnail.jpg - Thumbnail

When reading a file with numeric values to an internal table or vice versa, the success of the conversion depends on whether the user has defined the dot or comma as the decimal separator. It is customary to then go and read the user setting and then adjust the values from the file with a dot or a comma as required.

But this is unfortunate and rather inelegant. There should be a way of not making this depend on the user.

And there is.

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.