Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

C function in SAP

Former Member
0 Kudos

CALL 'SYSTEM' ID 'COMMAND' FIELD l_parcom_loc

ID 'TAB' FIELD t_file-sys.

Can someone explain me the above line of codes.

When I execute this line, I get SY-SUBRC as 1-, what does it mean?

2 REPLIES 2

Former Member
0 Kudos

Hi Anurita,

CALL 'SYSTEM' calls the system function 'SYSTEM'. The relevant function must exist in the file sapactab.h. If you change or recreate a function, you have to compile and link the SAP kernel again. For this, you need the C source code files.

ID is used to pass parameter to this Function call

Usuall, it is used for SAP internal use and not in application program.

In your case, its calling a SYSTEM function and passing the commad to be executed.

Reward if helpful

former_member435013
Active Participant
0 Kudos

Hi,

it is an interface to the oprating system.

Try this (Windows, change parcom for Unix):

REPORT ztest.

DATA:

parcom(250),

BEGIN OF tabl OCCURS 0,

line(200),

END OF tabl,

str(250).

parcom = 'dir'.

  • parcom = 'ls'. "Unix

CALL 'SYSTEM' ID 'COMMAND' FIELD parcom

ID 'TAB' FIELD tabl-sys.

LOOP AT tabl.

WRITE: / tabl-line.

ENDLOOP.

regards

Walter Habich