‎2006 Dec 20 2:11 PM
dera gurus,
My requireemnt is like this
when i am writing some date to application server
the csv file name should be with date & time
DATA:file(200) TYPE c VALUE 'F:\usr\sap\DEV\DVEBMGS00\data\<b>X.txt'.</b>
the file should be with date & time how can i achieve this
senthil
‎2006 Dec 20 2:22 PM
Hello,
Use this statement:
CONCATENATE FILE sy-datum sy-uzeit into FILE.
Vasanth
‎2006 Dec 20 2:14 PM
Use concatenate
e.g
<b>COncatenate file sy-datum sy-uzeit '.txt' into file_name.</b>
Now use file_name to write to application server
‎2006 Dec 20 2:19 PM
hi,
DATA:LV_REC(8) TYPE C.
CONCATENATE P_OFILE SY-DATUM SY-UZEIT
INTO P_OFILE.
CONDENSE P_OFILE NO-GAPS.
OPEN DATASET P_OFILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC EQ 0.
WRITE GV_TREC TO LV_REC.
CONCATENATE 'Total Input Records:' LV_REC INTO GV_MSG.
TRANSFER GV_MSG TO P_OFILE.
WRITE GV_AREC TO LV_REC.
CONCATENATE 'Total Existing Records:' LV_REC INTO GV_MSG.
TRANSFER GV_MSG TO P_OFILE.
WRITE GV_DUPREC TO LV_REC.
CONCATENATE 'Total Duplicate Records:' LV_REC INTO GV_MSG.
TRANSFER GV_MSG TO P_OFILE.
CLEAR: LV_REC, GV_MSG.
WRITE GV_MAR_DEL TO LV_REC.
CONCATENATE 'Records Marked for deletion:' LV_REC INTO GV_MSG.
TRANSFER GV_MSG TO P_OFILE.
CLEAR: LV_REC, GV_MSG.
WRITE GV_INVALID TO LV_REC.
CONCATENATE 'Total Invalid Records:' LV_REC INTO GV_MSG.
TRANSFER GV_MSG TO P_OFILE.
CLEAR: LV_REC, GV_MSG.
WRITE GV_VALIDREC TO LV_REC.
CONCATENATE 'Total Valid Records:' LV_REC INTO GV_MSG.
TRANSFER GV_MSG TO P_OFILE.
CLEAR: LV_REC, GV_MSG.
WRITE GV_SREC TO LV_REC.
CONCATENATE 'Total Successful Records:' LV_REC INTO GV_MSG.
TRANSFER GV_MSG TO P_OFILE.
WRITE GV_EREC TO LV_REC.
CONCATENATE 'Total Error Records:' LV_REC INTO GV_MSG.
TRANSFER GV_MSG TO P_OFILE.
regards
warun
‎2006 Dec 20 2:19 PM
data: file_name(30) type c.
concatenate sy-datum sy-tims into file_name.
then give the path with file name.
Cheers.
‎2006 Dec 20 2:22 PM
Hello,
Use this statement:
CONCATENATE FILE sy-datum sy-uzeit into FILE.
Vasanth
‎2006 Dec 20 2:29 PM
hi guys,
thanx for u r replis
DATA:file(200) TYPE c VALUE 'F:\usr\sap\DEV\DVEBMGS00\data\X.txt'.
i am writing some data to the applicatin server with the text name as X.txt as of now
instead of X.txt i want that text name as date& time
i have tried with u r code but unable to get it
senthil
‎2006 Dec 20 2:32 PM
DATA : c_x type c VALUE 'X'.
DATA : ws_date(20) type c.
COncatenate sy-datum sy-uzeit into ws_date.
REPLACE c_x in file with ws_date.
This should work.
‎2006 Dec 20 2:34 PM
It can be done simply like this. Here %% is a place holder in your file path, then we are just replacing it with the concatenation of sy-datum and sy-uzeit. Are you having some other problem?
data: file_name type string.
DATA: file(200) TYPE c VALUE 'F:usrsapDEVDVEBMGS00data%%.txt'.
concatenate sy-datum sy-uzeit into file_name.
replace '%%' with file_name into file.
condense file no-gaps.
Regards,
Rich Heilman
‎2006 Dec 20 2:36 PM
If you are not getting the file at all on the application server, it could be that it is having a problem with F: in the file path, Not sure that you need this when writing to app server. At least not in my system.
<b>'F:</b>\usr\sap\DEV\DVEBMGS00\data\X.txt'.
You might want to try.
'\usr\sap\DEV\DVEBMGS00\data\X.txt'.
Regards,
Rich Heilman
‎2006 Dec 20 2:36 PM
‎2006 Dec 20 2:32 PM
Hi Senthil,
1. Use the below FM to split the filename and path
call function 'SO_SPLIT_FILE_AND_PATH'
exporting
full_name = fname
importing
stripped_name = short_fname
file_path = fpath
exceptions
x_error = 1
others = 2.
2. use the below FM and pass short_fname which u will get from above FM
call function 'SPLIT_FILENAME'
exporting
long_filename = int_dbaml-log_name
importing
pure_filename = local_actid
pure_extension = local_actid.
3. now u will get the pure file name without extension in the value local_actid from the above FM
3. Concatenate local_actid sy-datum sy-uzeit into local_actid .
4.now it will be in the format 20061220201845<Filename>
5.Now concatenate fpath local_actid local_actid into fpath.Message was edited by:
Chandrasekhar Jagarlamudi