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: 

How to rename a file on SAP server?

Former Member
0 Kudos

Hallo guys,

I have to rename a file on SAP server. How to do it?

Is there some FM for that?

Thanks.

4 REPLIES 4

Former Member
0 Kudos

Hi,

Check this link -

Regards,

Omkaram.

0 Kudos

Maybe I could create a new file with changed name, copy content of old file into new one and than delete the old one.

What are the commands for doing that?

Thanks.

Former Member
0 Kudos

if u wanto rename the se38 Program

than goto se38 and give ur old program name and select program which is in menu bar and click on that u find rename (CTRL+f6)than rename ur program

karol_seman
Active Participant
0 Kudos

Hi Marek,

till now I know 3 possibilities

- to create a new unix command "mv..." in SM69 and then call this command - for that I am pretty sure you don't have authorization

- to use FM SXPG_CALL_SYSTEM with "mv command"

- or your suggested solution to copy it into new file and to delete the old one:


DATA: f1 type localfile value '/temp/file1.txt',
          f2 type localfile value '/temp/file2.txt'.
 
data: lt_tab(50) type table of c.
data: wa_tab(50) type c.
 
start-of-selection.
 
  open dataset f1 for input in text mode.
  if sy-subrc = 0.
    do.
      read dataset f1 into wa_tab.
      if sy-subrc  0.
        exit.
      endif.
      append wa_tab to lt_tab.
    enddo.
  endif.
  close dataset f1.
 
  open dataset f2 for output in text mode.
  loop at lt_tab into wa_tab.
    transfer wa_tab to f2.
  endloop.
  close dataset f2.
 
delete dataset f1.

Regards,

Karol