Application Development and Automation 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: 
Read only

app server

Former Member
0 Likes
1,094

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,056

Hello,

Use this statement:

CONCATENATE FILE sy-datum sy-uzeit into FILE.

Vasanth

10 REPLIES 10
Read only

Former Member
0 Likes
1,056

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

Read only

Former Member
0 Likes
1,056

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

Read only

Former Member
0 Likes
1,056

data: file_name(30) type c.

concatenate sy-datum sy-tims into file_name.

then give the path with file name.

Cheers.

Read only

Former Member
0 Likes
1,057

Hello,

Use this statement:

CONCATENATE FILE sy-datum sy-uzeit into FILE.

Vasanth

Read only

0 Likes
1,056

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

Read only

0 Likes
1,056

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.

Read only

0 Likes
1,056

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

Read only

0 Likes
1,056

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

Read only

0 Likes
1,056

hi,

thanks for u r answers

it works fine now

senthil

Read only

Former Member
0 Likes
1,056
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