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: 

Reading file names in App server

Former Member
0 Kudos

Hi Friends,

I have an urgent requirement like i have to read and write all the file names which starts with <b>SFA.POS</b>. from the application server which is in the<b> /usr/sap/trans/db1data/pos/HEP</b>platform directory and store those file names in a ZTABLE.....

Pls anyone put light on this and suggest me how to do this..

Regards...

Balaji

3 REPLIES 3

amit_khare
Active Contributor
0 Kudos

Use this FM to read all the files in the directory in an Internal Table - RZL_READ_DIR

Now search the table for your required file name.

Regards,

Amit

Reward all helpful replies.

Former Member
0 Kudos

Hi Balaji,

CG3Z - to upload file from presentation server to application server.

Upload a empty .txt file any path in the application server using CG3Z tcode and use this path in the program.

Thanks

Naveen khan

Former Member
0 Kudos

Hi Balaji,

Use this code to get the file name

p_file = '/usr/sap/trans/db1data/pos/HEP'

lc_command(3) = 'ls '.

lc_command+3(45) = p_file.

CALL 'SYSTEM' ID 'COMMAND' FIELD lc_command

ID 'TAB' FIELD t_tabl-sys.

  • Check any files exits in the directory.......................

IF t_tabl[] IS INITIAL.

MESSAGE e006 WITH p_file.

ENDIF.

SORT t_tabl BY line DESCENDING.

LOOP AT t_tabl.

<b>* HERE YOU GET THE FILE NAMES.</b>

ENDLOOP.

Regards

Arun