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 move a file across folders

Former Member
0 Kudos

Hi to all experts ,

my requirement is to move a file across folder in application server how can we achieve this

1 ACCEPTED SOLUTION

I355602
Advisor
Advisor
0 Kudos
10 REPLIES 10

I355602
Advisor
Advisor
0 Kudos

Former Member
0 Kudos

if i have to move the file across directories

Former Member
0 Kudos

Hi tarun,

how to get this file name from this string *
sapbo1\Share\MM_SCUBCode_PDAtxt_Upload\OUT-1090000001-200903062203.txt* i want to get OUT-1090000001-200903062203.txt in a variable

0 Kudos

Hi,

Create an internal table with one field.


DATA : BEGIN OF itab OCCURS 0,
         file_name TYPE string,
       END OF itab.

Now use code:


SPLIT <file_path> AT '/' INTO TABLE itab.
"this will spilt text at '/' into different lines

DATA : line_count TYPE i.

DESCRIBE TABLE itab
LINES line_count.

READ TABLE itab INDEX line_count.
"now you will have the file name in the header line

Hope this helps you.

Regards,

Tarun

Former Member
0 Kudos

Hi,

Use this FM to split file name from file path,

CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'

EXPORTING

full_name = p_fpath

IMPORTING

stripped_name = v_filename

  • FILE_PATH =

EXCEPTIONS

X_ERROR = 1

OTHERS = 2

.

IF sy-subrc <> 0.

Endif.

Here p_fpath is ur entire path,

v_filename is ur filename.

0 Kudos

Use this FM, to get the stripped file name from the path

TRINT_SPLIT_FILE_AND_PATH

Former Member
0 Kudos

Hi,

[https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/202a850a-58e0-2910-eeb3-bfc3e081257f]

[]

former_member156446
Active Contributor
0 Kudos

Use function module ARCHIVFILE_SERVER_TO_SERVER

J@Y

Former Member
0 Kudos

Use:

Function Modules:

CL_GUI_FRONTEND_SERVICES=>Copy_file

ITS_FILE_COPY

Or,

Follow:

1) Read File to inter table using.

Open dataset <Filename> for Output

Read Dataset

Close Dataset.

2) Move it to another Directory using.

Open Dataset <New Filename> for input

Translate

Close Dataset

Regards,

Gurpreet