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

Get the name of the file in the present directory creted by last run

hi,

As per my requirement I need to save the file name concatenated with the present date and time.

In my program I want to move the old file to new directory.

I know I method to do so.

But for that Ineed to get the file name of the last run.

How to get it as the fila name is conactenated by date and time?

Pleases uggest.

Thanks and Regards,

Smriti

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 24, 2009 at 12:40 PM

    generally we use to save in Custom table and get the file name. Othwerwise it will be difficult

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 24, 2009 at 12:41 PM

    Hi smirti,

    please don't put on multiple posts.

    use the FM

    data: it_dir_list like epsfili occurs 0 with header line, "List of Files

    w_dir_name like epsfili-name value 'PL_INB*',

    error_flag(1).

    parameters: p_file type epsf-epsdirnam,

    call function 'EPS_GET_DIRECTORY_LISTING'

    exporting

    dir_name = p_file

    tables

    dir_list = it_dir_list

    exceptions

    invalid_eps_subdir = 1

    sapgparam_failed = 2

    build_directory_failed = 3

    no_authorization = 4

    read_directory_failed = 5

    too_many_read_errors = 6

    empty_directory_list = 7

    others = 8.

    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

  • author's profile photo Former Member
    Former Member
    Posted on Feb 24, 2009 at 12:42 PM

    Get all the file's in the current directory ..

    For Ex : If your file name's are

    Filename_20080101010101.(filename and date and time of run)

    Filename_20080201020202

    Filename_20080301120101 ..

    retrieve all these files and sort these in descending order .. get the first one from the internal table ..

    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.