Application Development and Automation 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: 
Read only

Rename file on application server using Call 'Systemcommand not successful.

Former Member
0 Likes
800

Hi,

Does anybody know what the return code (sy-subrc = 1-) mean when calling external command using:

call 'SYSTEM' id 'COMMAND' field cmd id 'TAB'   field  ITAB-*SYS*.

where the cmd is:

cp <old file name including full directory address> <new file name in the same directory> ;

The goal is the copy the old file to a new file and both exists in the same directory on the application server.

I have check the authorization and get the sy-subrc = 0 for both of the following checks:

AUTHORITY-CHECK OBJECT 'S_C_FUNCT' ID 'PROGRAM' FIELD SY-REPID ID 'ACTVT'     FIELD '16' ID 'CFUNCNAME' FIELD 'C_DIR_READ_START'.

AUTHORITY-CHECK OBJECT 'S_C_FUNCT' ID 'PROGRAM'   FIELD SY-REPID ID 'ACTVT' FIELD '16' ID 'CFUNCNAME' FIELD 'SYSTEM'.

Since the file will be huge, OPEN another dataset is

4 REPLIES 4
Read only

Former Member
0 Likes
723

Continue....

Since the file is huge, open another dataset for the new file is not preferable.

The purpose is to rename a file (or copy) a file to a new file name after the data is extraction completely.

Any advice is appreciated.

Thank you,

Minami

Read only

0 Likes
723

Not sure about call statements, but you can create an external command at OS level with 'MV' command.

And execute the same using SXGP~EXECUTECOMMAND FM.

Then delete the old file after successfully execute of the above FM

REgds

Manohar

Read only

Former Member
0 Likes
723

Hi Minami

You could program a "normal" BAT file with the command to rename the file: rename <drive>:\<old file> <new file>.

When you have created the BAT file you create an external command via transaction SM69 where execute the BAT file you have just created.

Now you have 2 ways of executing your external command: either online via transaction SM49 or you can code an ABAP program to execute the external command via submitting a batchjob. You do this by calling the following functions in the listed order:

1. JOB_OPEN

2. JOB_SUBMIT

2a. If the submit function fails you execute function: BP_JOB_DELETE

3. JOB_CLOSE

I hope this helps.

Best regards

Arne

Read only

Former Member
0 Likes
723

Hi Minami,

I need to rename the file on Appl server in my program please tell me how did you do that?

Thanks

Dany