Skip to Content
0
Mar 06, 2013 at 01:38 AM

Unix command - returning sy-subrc = 1

755 Views

Hello

I have an issue with using moving files from one folder to another. I am using the following code.

LOOP AT it_tab1 INTO wa_tab1.

CLEAR:var_file.

var_file = wa_tab1-lines.


CONCATENATE p_src '/' var_file INTO var_src.

CONCATENATE p_trg '/' var_file INTO var_trg.

CLEAR: var_command.

CONCATENATE 'mv' var_src var_trg INTO var_command

SEPARATED BY space.

CALL 'SYSTEM' ID 'COMMAND' FIELD var_command.

The wierd thing is it is working all fine for some files.

I run this command inside a loop and for each file, in my internal table I execute the command and move them.

After moving some files, the sy-subrc for CALL 'SYSTEM' command is returning '1' .

I dont understand why this is happening. The unix command is not working after running for few files.

Any pointers will be of very great help. It is a simple command and works for some few files in the loop. All the files are of same type and same name formats. If I wait for sometime(few seconds/minutes ... donno how much time), it moves the remaining files tooo....

Any pointers will be of great help.