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.
Showing results for 
Search instead for 
Did you mean: 

Logical command in ABAP.....Urgent

Former Member
0 Kudos


i am pretty new using ABAP program so i neeed help urgently. i am trying to move a file on the application server from one directory to the other and i was using the open dataset function to do that. but the file i am trying to move is pretty big and because i am using internal table to store, it is causing problems with the space.

i have consulted the basis guys and they have managed to create a logical file for copying from one directory to the other on the application server. to help you furthter. i am enclosing the mail sent to me.

I have created a logical command which should copy the file from one location to the other but you need to pass it the source dir and file name and the destination dir and file name.

The logical command is ZCOPY and uses cmd /c copy

Copies one or more files to another location.

COPY [/V] [/N] [/Y | /-Y] [/Z] [/A | /B ] source [/A | /B]

[+ source [/A | /B] [+ ...]] [destination [/A | /B]]

source Specifies the file or files to be copied.

/A Indicates an ASCII text file.

/B Indicates a binary file.

destination Specifies the directory and/or filename for the new file(s).

/V Verifies that new files are written correctly.

/N Uses short filename, if available, when copying a file with a

non-8dot3 name.

/Y Suppresses prompting to confirm you want to overwrite an

existing destination file.

/-Y Causes prompting to confirm you want to overwrite an

existing destination file.

/Z Copies networked files in restartable mode.

The switch /Y may be preset in the COPYCMD environment variable.

This may be overridden with /-Y on the command line. Default is

to prompt on overwrites unless COPY command is being executed from

within a batch script.

the problem now is i have no idea about how to use the logical command. can any one help me.

Thank you,



Developer Advocate
Developer Advocate
0 Kudos

I'm not familar with this COPY syntax. You should be able to accomplish this using DATASET commands. Is the problem, that you don't have enough memory at runtime to use the DATASET commands?


Rich Heilman

0 Kudos

If memory is not an issue, then there should be no reason why this should not work.

report zrich_0001.

parameters: d1 type localfile default '/usr/sap/TST/SYS/Data1.txt',
            d2 type localfile default '/usr/sap/TST/SYS/Data2.txt'.

data: itab type table of string with header line.


* Read old file
  open dataset d1 for input in text mode.
  if sy-subrc = 0.
      read dataset d1 into itab.
      if sy-subrc <> 0.
      append itab.
  close dataset d1.

* Write to new file
  open dataset d2 for output in text mode.
  loop at itab.
    transfer itab to d2.
  close dataset d2.

* Delete the old file
  delete dataset d1.


Rich Heilman

0 Kudos


i am using dataset in the first place but when i run the program to check. it throughs up with space errors. when i called the basis they told it using up a lot of space to copy the file to the internal table.

Thanks for you reply,


0 Kudos


i am using the same code you have given below, but this causes a lot memory problems as we are temporarly saving it in the internal tables.

Thanks for the help,