Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to provide date and time stamp to the extracted file.

Former Member
0 Kudos

I 'm downloading data from DB to Flat file using GUI_DOWLOAD. whenever it is executed it is creating with a file name.

if i rerun the program the file is overwriting with the same name.

now based on the requirement how many times i executed, that many times file should be individually created and should be added with date and time stamp.

like

if when i executed at the very first time it should saved with filename, date and time.

say "Address.txt 04/05/2007 07:55:10"

When i executed it for second time it doesn't overwrite the file.

it should create a new file.

like "Address.txt 04/05/2007 07:59:20".

Please guide me the way if possible code.

Thanks in advance.

1 ACCEPTED SOLUTION

suresh_datti
Active Contributor
0 Kudos

data: w_filename type string,

w_date(12),

w_time(12).

write sy-datum to w_date dd/mm/yyyy.

write sy-uzeit to w_time using edit mask '__:__:__'. concatenate 'Address.txt' w_date w_time into w_filename separated by space.

~Suresh

code corrected

Message was edited by:

Suresh Datti

Message was edited by:

Suresh Datti

3 REPLIES 3

suresh_datti
Active Contributor
0 Kudos

data: w_filename type string,

w_date(12),

w_time(12).

write sy-datum to w_date dd/mm/yyyy.

write sy-uzeit to w_time using edit mask '__:__:__'. concatenate 'Address.txt' w_date w_time into w_filename separated by space.

~Suresh

code corrected

Message was edited by:

Suresh Datti

Message was edited by:

Suresh Datti

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please check this FM EDI_PATH_CREATE_DATE_TIME.

Regards,

Ferry Lianto

Former Member
0 Kudos

Hi Vamsi,

Use FM 'F4_PROGRAM' to take file from the user .

In this case user will enter the file name. u can append date & time to that file path.

Refer this code.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SY-REPID

DYNPRO_NUMBER = SYST-DYNNR

IMPORTING

FILE_NAME = P_P_FILE.

concatenate P_FILE '04/05/2007 07:59:20' into V_FILE.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = v_file

filetype = 'ASC'

write_field_separator = 'X'

TABLES

data_tab = i_tab

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

.

IF sy-subrc = 0.

MESSAGE i002.

ENDIF.

Reward points if helpful.

Regards,

Hemant.