Skip to Content

file pattern (string)

I need to find out the files from the internal table which are in the given date range.

for example Files will be in the following format,

<b> fielname_YYYYMMDD</b>

here <b>yyyymmdd</b> is the date. If the date range is 20071002 to 20071004 then i need to fetch 3 files from the internal table. the files are




can someone help me how to do this in an efficient way.



Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Oct 04, 2007 at 10:30 PM


    Please try this.

    data: l_datum like sy-datum,
          l_date1 like sy-datum,
          l_date2 like sy-datum.     
    l_date1 = '20071002'.
    l_date2 = '20071004'.
    loop at itab.
      clear l_datum.
      l_datum = itab-file+9(8). 
      if l_datum between l_date1 and l_date2.  
        move itab-file to itab2-file.
        append itab2.


    Ferry Lianto

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 04, 2007 at 10:29 PM


    Let's assume if you have v_date_low and v_date_high

    * Create a new intenral table to have the dates.
      DATA: t_date type standard table of sydatum.
      data: s_date type sydatum.  
        if sy-index = 1.
          s_date = v_date_low.
          append s_date to t_date.
        v_date_low = v_date_ low + 1.    " Increment the date low
        s_date = v_date_low.
        append s_date to t_date.
    * Exit condition.
        if v_date_low = v_date_high.
    ***Now you have all the dates in the intenral table T_DATE.
      LOOP AT t_date into s_date.
    * concatenate to get the filename.
        CONCATENATE 'FILENAME' s_date INTO v_filename.
    * Call the function module RZL_READ_DIR_LOCAL with the variable v_filename
    * to get the file contents.



    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.