/HS Command
Most functionals, and even the hardcore functionals, knows that in order to start debugging an ABAP program, we use the /H command. But few programmers, even the hardcode programmers, will know the purpose of the /HS command.
Most functionals, and even the hardcore functionals, knows that in order to start debugging an ABAP program, we use the /H command. But few programmers, even the hardcode programmers, will know the purpose of the /HS command.
Regularly expressions have been around for ages. But they’re not very well known and even less used. They are a sort of descriptive language that allows for making research and very sophisticated replacements in alpha-numeric chains.
A simple example: to validate an email address. If you have to do this through an algorithm you’ll have to work hard. However, with regular expressions, only two or three code lines and the regular expression "\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b" are enough.
This is a 2-in-1 article. That is to say, you’ll learn two subjects at once.
But get ready, what you’ll learn is dynamite, and, in the wrong hands, it can implode your universe.
First, you’ll learn how to read content on the web. And right after that, assuming that this content is ABAP code, you’ll learn how to execute it in the blink of an eye.
Today’s hint is not a hint - it’s an advice.
After creating a table, you create its maintenance views. The maintenance views dwell within a group of functions. This group of functions is requested from you at the time of their creation. Since, after all, that’s no more than a set of generated code, and most of it is, nonetheless, standard includes. Loads.
I give you the problem: there are those who create their own Z functions and put them in groups of functions with maintenance views. It’s true. Some do this.
In the ‘bad old days’ when the ABAP was even more old-fashioned than today, variable statements were all made through LIKE and were referenced to table fields:
DATA: V_KUNNR LIKE KNA1-KUNNR.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.
SAP started last week a free course on HANA. Run!
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. But you don’t have room on the screen to give that information. SAP thought of this:
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.
if lv_ping_status <> 1.
* it’s dead.
endif.Thanks Charles.