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

Based on the directory need to upload file names

Hi Experts,

Parameter:p_filename LIKE rlgrap-filename.

For example I have given the input like 'd:\abc\' what ever the text files is there in that directory those file names I need to store in internal table.

Please suggest me how we can do this.

Thanks.

Sam

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 10, 2008 at 05:04 PM

    Hello,

    You could try CL_GUI_FRONTEND_SERVICES~DIRECTORY_LIST_FILES.

    There is some SAP help for this class as well.

    Regards

    Greg Kern

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 10, 2008 at 05:17 PM

    use the FM TMP_GUI_DIRECTORY_LIST_FILES.

    enter the directory and the filter(file extension).it will retrieve the filenames into the internal table.

    check this sample code.

    data: begin of t_file occurs 0.
    include structure sdokpath.
    data: end of t_file.
    data: begin of t_dir occurs 0.
    include structure sdokpath.
    data: end of t_dir.
    PARAMETERS : p_files(255) TYPE c.
    CALL FUNCTION 'TMP_GUI_DIRECTORY_LIST_FILES'
      EXPORTING
        DIRECTORY        = p_files
       FILTER           = '*.txt*'
    * IMPORTING
    *   FILE_COUNT       =
    *   DIR_COUNT        =
      TABLES
        FILE_TABLE       = t_file
        DIR_TABLE        = t_dir
    * EXCEPTIONS
    *   CNTL_ERROR       = 1
    *   OTHERS           = 2
              .
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    Add a comment
    10|10000 characters needed characters exceeded

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.