Skip to Content
author's profile photo Former Member
Former Member

Fetch File list from a Application server directory (File name > 40 Char)

Hi,

I searched a lot but could not find anything relevent to my requirement. I would like to fetch a list of all files from a Application server.

Now there are many function module which shows the list, but hear is my specific requirement.

The incoming file name length is more than 40 characters, all the FM provides the name till 40 characters.

So can you please let me know how can i fetch the file name whose length is more then 40 characters?

Many thanks.

Regards,

Sourabh

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Dec 14, 2011 at 10:10 AM

    function module ISU_M_GET_FILES_OF_DIR allows 75 characters for DIRNAME and 75 characters for filename

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 14, 2011 at 03:14 PM

    We utilize function module EPS2_GET_DIRECTORY_LISTING....be sure to use the EPS2 version...filenames up to 200 characters returned in the table of file names.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 15, 2011 at 06:01 AM

    Hi Sourabh,

    You can debug the AL11 standard transaction provide by SAP. It will help you to out.

    Check the following code it will display list of file in specified directory which having maximum of 260 character

    Declaration Section

    TYPES: name_of_dir(1024)        TYPE c,                     "1024
           name_of_file(260)        TYPE c, "260
           name_of_path(1285)       TYPE c.                     "1285
    
    TYPES: BEGIN OF ty_data,
            line TYPE string,
           END OF ty_data.
    
    DATA: sap_yes(1)  VALUE 'X'
        , sap_no(1)   VALUE ' '
        , srt(1)      VALUE 'T'
        , no_cs       VALUE ' '            " no MUST_ContainString
        , all_gen     VALUE '*'    " generic filename shall select all
        , strlen      LIKE sy-fdpos
        .
    
    DATA: BEGIN OF file,
            dirname     TYPE name_of_dir,  " name of directory. (possibly truncated.)
            name        TYPE name_of_file, " name of entry. (possibly truncated.)
            type(10)    TYPE c,            " type of entry.
            len(8)      TYPE p,            " length in bytes.
            owner(8)    TYPE c,            " owner of the entry.
            mtime(6)    TYPE p, " last modification date, seconds since 1970
            mode(9)     TYPE c, " like "rwx-r-x--x": protection mode.
            useable(1)  TYPE c,
            subrc(4)    TYPE c,
            errno(3)    TYPE c,
            errmsg(40)  TYPE c,
            mod_date    TYPE d,
            mod_time(8) TYPE c,            " hh:mm:ss
            seen(1)     TYPE c,
            changed(1)  TYPE c,
          END OF file.
    
    DATA: BEGIN OF file_key,
            dirname     TYPE name_of_dir,  " name of directory. (possibly
                                           " truncated.)
            name        TYPE name_of_file, " name of entry. (possibly
                                           " truncated.)
          END OF file_key.
    
    DATA: BEGIN OF file_list OCCURS 100,
            dirname     TYPE name_of_dir,  " name of directory. (possibly truncated.)
            name        TYPE name_of_file, " name of entry. (possibly truncated.)
            type(10)    TYPE c,            " type of entry.
            len(8)      TYPE p,            " length in bytes.
            owner(8)    TYPE c,            " owner of the entry.
            mtime(6)    TYPE p, " last modification date, seconds since 1970
            mode(9)     TYPE c, " like "rwx-r-x--x": protection mode.
            useable(1)  TYPE c,
            subrc(4)    TYPE c,
            errno(3)    TYPE c,
            errmsg(40)  TYPE c,
            mod_date    TYPE d,
            mod_time(8) TYPE c,            " hh:mm:ss
            seen(1)     TYPE c,
            changed(1)  TYPE c,
          END OF file_list.
    PARAMETERS: p_file LIKE sdokpath-pathname DEFAULT '/usr/sap/bancs/vendorpayout' OBLIGATORY.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECTION-SCREEN END OF BLOCK b1.
    
    INITIALIZATION.
    
    START-OF-SELECTION.
      CLEAR lv_file.
    
      PERFORM get_file_list USING lv_file.
    
      PERFORM display_file_list.
    
    END-OF-SELECTION.
    

    Find rest of solution in subsequent post.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Ravi Lanjewar

      Hi Ravi,

      I used this program and it displays all the file regardless of the length of the file. Thanks for the reply. Now i need to fetch the file name list in my program for which i will find a way. I was looking for a FM or some standatd class which gives result in an internal table.

      Regards,

      Sourabh

  • author's profile photo Former Member
    Former Member
    Posted on Dec 14, 2011 at 09:12 AM

    create a command for 'LS' (if its unix system) in SM69) and execute that command by FM (search SDN for with 'SM69'), this will give you your result

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      FM is:

      Test for function group      SXPT
      Function module              SXPG_COMMAND_EXECUTE
      Uppercase/Lowercase   [X] "==>marked lower case here for the additional parameter, not need when called from program
      Runtime:        121,730 Microseconds
      RFC target sys:
      
      
        Import parameters               Value
      
        COMMANDNAME                     LIST_DB2DUMP
        ADDITIONAL_PARAMETERS           /usr
        OPERATINGSYSTEM                 UNIX
        TARGETSYSTEM                    <pass your system host name>
        DESTINATION
        STDOUT                          X
        STDERR                          X
        TERMINATIONWAIT                 X
        TRACE
        DIALOG
      
        Export parameters               Value
        STATUS                          O
        EXITCODE                        0
      
        Tables                          Value
        EXEC_PROTOCOL                      0 Entries
                         Result:           18 Entries  "===> this is holding the results

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.