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 get the created data of files on the server

Former Member
0 Kudos
98

hi everyone,

I wanna get files' created data on the server for some goal, what way to make it? Any suggestion is appreciated.

Best Regards,

Julia

1 ACCEPTED SOLUTION

anversha_s
Active Contributor
0 Kudos
63

hi junlian,

chk this sample code.

report zfiles.

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.

data: wa type string.

start-of-selection.

  • Read file

open dataset d1 for input in text mode.

if sy-subrc = 0.

do.

read dataset d1 into wa.

if sy-subrc <> 0.

exit.

endif.

append wa to itab.

enddo.

endif.

close dataset d1.

  • Copy to new file

open dataset d2 for output in text mode.

loop at itab into wa.

transfer wa to d2.

endloop.

close dataset d2.

  • Delete the first

delete dataset d1.

regards,

anver

if helped pls amrk points

4 REPLIES 4

Former Member
0 Kudos
63

hi Julian,

if that is an application server then use ..

FM <b>'/SAPDMC/LSM_F4_FRONTEND_FILE</b>' for fetching the data from the application server path...

Regards,

Santosh

anversha_s
Active Contributor
0 Kudos
64

hi junlian,

chk this sample code.

report zfiles.

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.

data: wa type string.

start-of-selection.

  • Read file

open dataset d1 for input in text mode.

if sy-subrc = 0.

do.

read dataset d1 into wa.

if sy-subrc <> 0.

exit.

endif.

append wa to itab.

enddo.

endif.

close dataset d1.

  • Copy to new file

open dataset d2 for output in text mode.

loop at itab into wa.

transfer wa to d2.

endloop.

close dataset d2.

  • Delete the first

delete dataset d1.

regards,

anver

if helped pls amrk points

Former Member
0 Kudos
63

...or just use FTP...

Former Member
0 Kudos
63

Dear Julian

If you need to get the list of files on application server, can use FM: /SAPDMC/LSM_F4_SERVER_FILE.

If you like to know how the data has to be read, please check the following link:

Hope this helps you.

Kind Regards

Eswar