Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
horst_keller
Product and Topic Expert
Product and Topic Expert
26,389

When you google "ABAP CALL SYSTEM" you find a lot of entries that show code like the following:

DATA: command(255),
      BEGIN OF tabl OCCURS 0,
        line(255),
      END OF tabl.
     
command = '...'.
CALL 'SYSTEM' ID 'COMMAND' FIELD command
              ID 'TAB'     FIELD tabl-*sys*.

Fist of all:

You shouldn't use CALL 'SYSTEM' at all. CALL 'SYSTEM' is vulnerable against system command injection and there is a profile parameter rdisp/call_system that can switch that call simply off. A runtime error occurs if you use CALL 'SYSTEM' and it is switched off. Do you want to risk that in your programs? If you have to use system calls, use function modules like SXPG_CALL_SYSTEM or SXPG_COMMAND_EXECUTE instead.

Second:

What is CALL 'SYSTEM'?

CALL 'SYSTEM' is simply a usage of the ABAP statement CALL cfunc. This statement should only be used internally in system programs to call system functions from the c-kernel. SYSTEM is simply one of those system functions. It passes system commands to the operating system and returns the results. You should not call this function at all, see above ...

Third:

What the heck is  tabl-*sys*?

I suspect that most people writing in discussions about CALL 'SYSTEM' have copied their code from somewhere and that the original source is very, very old. If you believe that  tabl-*sys* is somehow connected to CALL 'SYSTEM' - and I have the impression that some people do - you are perfectly wrong.

tabl-*sys* is the outdated and undocumented way of writing tabl[] in order to address the table body of an internal table with header line. That's all.

And of course, you don't even need an internal table with header line for CALL 'SYSTEM' (some people seem to believe that too ...)!

You could also write:

DATA: command TYPE char255,
      tabl    TYPE TABLE OF char255.

command = '...'.
CALL 'SYSTEM' ID 'COMMAND' FIELD command
              ID 'TAB'     FIELD tabl.

No black magic, and as I said you shouldn't use it anyway ...

16 Comments
Labels in this area