Skip to Content
author's profile photo
Former Member

Reading file names in App server

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Posted on Aug 20, 2007 at 06:39 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 20, 2007 at 08:16 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 20, 2007 at 09:27 AM

    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

    Add comment
    10|10000 characters needed characters exceeded