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

Moving application server files to another folder

Former Member
0 Likes
597

Hi,

Could anyone please tell me how to move the application server files from one folder to

another through a program?

Regards,

Sudeep

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
506

Hi

U can copy the file from a folder to a target one by statament OPEN DATASET

* Open original file
OPEN DATASET FILE1 FOR INPUT IN TEXT MODE ENCODING DEFAULT. 
IF SY-SUBRC = 0.
* Open target file
  OPEN DATASET FILE2 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
  IF SY-SUBRC = 0.
     DO.
* Read file 1
        READ DATSET FILE1 INTO W_FILE.
        IF SY-SUBRC <> 0. EXIT. ENDIF.
* Move file 1 to file 2
        TRANSFER W_FILE TO FILE2.
     ENDDO.
     CLOSE DATASET FILE1.
     CLOSE DATASET FILE2.
  ENDIF.
ENDIF.

But you can use FTP command, in this case try to see the program demo RSFTP007

Max

Hi,

Could anyone please tell me how to move the application server files from one folder to

another through a program?

Regards,

Sudeep

2 REPLIES 2
Read only

Former Member
0 Likes
507

Hi

U can copy the file from a folder to a target one by statament OPEN DATASET

* Open original file
OPEN DATASET FILE1 FOR INPUT IN TEXT MODE ENCODING DEFAULT. 
IF SY-SUBRC = 0.
* Open target file
  OPEN DATASET FILE2 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
  IF SY-SUBRC = 0.
     DO.
* Read file 1
        READ DATSET FILE1 INTO W_FILE.
        IF SY-SUBRC <> 0. EXIT. ENDIF.
* Move file 1 to file 2
        TRANSFER W_FILE TO FILE2.
     ENDDO.
     CLOSE DATASET FILE1.
     CLOSE DATASET FILE2.
  ENDIF.
ENDIF.

But you can use FTP command, in this case try to see the program demo RSFTP007

Max

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
506

Hi,

Refer:

Tranfer file between folder in application server

https://www.sdn.sap.com/irj/scn/wiki?path=/display/community/transfer%252bfile%252bbetween%252bfolde...

Hope this helps you.

Regards,

Tarun