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: 

date in filename

Former Member
0 Kudos
653

am using gui_download to create flat file.i want to store file with file name with date on report run i.e. if we run report on 29062006 then file should be stored with name 29062006.txt

11 REPLIES 11

Former Member
0 Kudos
190

am using gui_download to create flat file.i want to store file with file name with date on report run i.e. if we run report on 29062006 then file should be stored with name 29062006.txt

Former Member
0 Kudos
190

store sy-datum in a variable of type string.

concatenate '.txt' to it.

pass this file name to gui_download.

former_member181962
Active Contributor
0 Kudos
190

Do like this:

concatenate sy-datum '.txt' to pfile1.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

FILENAME = p_file1

FILETYPE = 'ASC'

  • APPEND = ' '

WRITE_FIELD_SEPARATOR = 'X'

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

IMPORTING

FILELENGTH = bin_filesize

TABLES

DATA_TAB = int_update

  • FIELDNAMES = FIELDNAMES

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_BATCH = 2

GUI_REFUSE_FILETRANSFER = 3

INVALID_TYPE = 4

NO_AUTHORITY = 5

UNKNOWN_ERROR = 6

HEADER_NOT_ALLOWED = 7

SEPARATOR_NOT_ALLOWED = 8

FILESIZE_NOT_ALLOWED = 9

HEADER_TOO_LONG = 10

DP_ERROR_CREATE = 11

DP_ERROR_SEND = 12

DP_ERROR_WRITE = 13

UNKNOWN_DP_ERROR = 14

ACCESS_DENIED = 15

DP_OUT_OF_MEMORY = 16

DISK_FULL = 17

DP_TIMEOUT = 18

FILE_NOT_FOUND = 19

DATAPROVIDER_EXCEPTION = 20

CONTROL_FLUSH_ERROR = 21

OTHERS = 22

.

Regards,

ravi

Former Member
0 Kudos
190

Hi Purushottam Badhe ,

just Concatinate sy-datum to FileName that u specify in Gui_download.

Regards,

Kiran B

Former Member
0 Kudos
190

hi

you can do likr that

concatenate sy-datum '.txt' into filename.

regards,

sumit.

Former Member
0 Kudos
190

Hi purushottam,

1. <b>SY-DATUM is always in the format YYYYMMDD</b>

so we have to use OFFSET concept

<b> for DDMMYYYY format.</b>

2 data : myfilename type string.

<b>Concatenate sy-datum6(2) sy-datum4(2) sy-datum(4) '.TXT'

into myfilename.</b>

3. now pass this filename in GUI_DOWNLOAD.

regards,

amit m.

Former Member
0 Kudos
190

Hi,

Do this,

lv_file_name = sy-datum.


or 

if u want some initial to filename
then do this 

lv_file_name = sy-datum.
conacatenate 'initial' lv_file_name 
into lv_file_name.

pass lv_file_name to gui_download

former_member188685
Active Contributor
0 Kudos
190

Hi,

concatenate sy-datum+6(2) sy-datum+4(2) sy-datum(4) '.txt'
into p_file.

Now use that p_file and pass it to GUI_DOWNLOAD.

Regards

vijay

Former Member
0 Kudos
190

hi

DATA: str(15),

fname type string.

WRITE sy-datum TO str DD/MM/YYYY.

REPLACE '.' WITH '' INTO str.

REPLACE '.' WITH '' INTO str.

condense str no-gaps.

CONCATENATE str '.txt' INTO str.

fname = str.

WRITE:/ str,fname.(write for ur reference<checking>)

pass fname to 'GUI_DOWNLOAD'

to file name parameter.

Regards,

Ramesh.

Former Member
0 Kudos
190

Hai

Check the following

data : begin of it_mara occurs 0,

matnr like mara-matnr,

mbrsh like mara-mbrsh,

mtart like mara-mtart,

meins like mara-meins,

end of it_mara.

data : v_filename type string.

v_filename = 'C:\'.

Concatenate v_filename sy-datum6(2) sy-datum4(2) sy-datum(4) '.TXT'

into v_filename.

select matnr

mbrsh

mtart

meins

from mara into table it_mara

where mtart = 'ROH'.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = v_filename

FILETYPE = 'ASC'

TABLES

DATA_TAB = it_mara.

Thanks & regards

Sreeni

Former Member
0 Kudos
190

Perfect Migration Prog for u is here

REPORT ZMIGRATE_COUNTRY.

*tables used

TABLES:T500P.

*internal tables

DATA : BEGIN of i_country OCCURS 0,

countryid LIKE T500P-PERSA,

country LIKE T500P-NAME1,

END of i_country.

data : begin of i_file occurs 100 ,

file_data(256) type c,

end of i_file.

*Selection Screen

SELECTION-SCREEN BEGIN OF BLOCK file

WITH FRAME TITLE text-005.

<b>parameters: file like rlgrap-filename Obligatory.</b>

SELECTION-SCREEN END OF BLOCK file.

at SELECTION-SCREEN ON VALUE-REQUEST FOR file .

*Selection Process Starts

start-of-selection.

<b>

Concatenate File SY-DATUM

'_Tbl_Country_St.txt' into File.</b>

<i><b>In place of system date u can put ur date and append some name to distinguish file</b></i>

select persa name1 from T500P

into (i_country-countryid,i_country-country).

append i_country.

endselect.

sort i_country by countryid.

OPEN DATASET FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

loop at i_country.

  • write:/ i_country-countryid,

  • '|',i_country-country.

Concatenate i_country-countryid

i_country-country

into i_file-file_data separated by '|'.

transfer i_file to FILE.

clear i_file.

endloop.<i></i>