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

Generating file name with date

Former Member
0 Likes
2,012

Hello,

I try to create via ABAP a file name with date in it. Normaly my script must run but the script won't run. Please help. Thanks.

data = sy-datum. " = data set to sys date

data+6(2) = '01'. " = first day of month

data = data - 1. " = last day of last month

  • file name creation

p_filename+0(21) = '/sapio/flatfiles/xxx/'. " = first part of file name

p_filename21(6) = data0(6). " = second part of file name

p_filename+27(15) = '_XXXX_XXXXX.csv'. " = last part of file name

p_subrc = 0.

Regards, Thomas

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,617

Concatenate name and date into the file name ...

v_date = data+0(6).

Concatenate '/sapio/flatfiles/xxx/' v_date '_XXXX_XXXXX.csv' into

p_filename.

Hello,

I try to create via ABAP a file name with date in it. Normaly my script must run but the script won't run. Please help. Thanks.

data = sy-datum. " = data set to sys date

data+6(2) = '01'. " = first day of month

data = data - 1. " = last day of last month

  • file name creation

p_filename+0(21) = '/sapio/flatfiles/xxx/'. " = first part of file name

p_filename21(6) = data0(6). " = second part of file name

p_filename+27(15) = '_XXXX_XXXXX.csv'. " = last part of file name

p_subrc = 0.

Regards, Thomas

7 REPLIES 7
Read only

Former Member
0 Likes
1,618

Concatenate name and date into the file name ...

v_date = data+0(6).

Concatenate '/sapio/flatfiles/xxx/' v_date '_XXXX_XXXXX.csv' into

p_filename.

Read only

0 Likes
1,617

Hi again!

Now I try it with your hints but now I got a save error.


program conversion_routine.
* Type pools used by conversion program
type-pools: rsarc, rsarr, rssm.
tables: rsldpsel.
* Global code used by conversion rules
*$*$ begin of global - insert your declaration only below this line  *-*
* TABLES: ...
* DATA:   ...
data: data like sy-datum.
*$*$ end of global - insert your declaration only before this line   *-*
* -------------------------------------------------------------------
form compute_flat_file_filename
     using p_infopackage type rslogdpid
  changing p_filename    like rsldpsel-filename
           p_subrc       like sy-subrc.
*       Insert source code to current selection field
*$*$ begin of routine - insert your code only below this line        *-*

* Datum wird gebaut
data = sy-datum.  " = data set to actual date
data+6(2) = '01'. " = first day of month
data = data - 1.  " = last day of month before
v_date = data+0(6).

* Dateiname wird gebaut
p_filename = '/sapio/flatfiles/XXX/'v_date'_XXXX_XXXX.csv'.

p_subrc = 0.
*$*$ end of routine - insert your code only before this line         *-*
endform.

Read only

0 Likes
1,617

U need to Concatenate ... using the below statement .. and then use

p_filename

Concatenate '/sapio/flatfiles/xxx/' v_date '_XXXX_XXXXX.csv' into

p_filename.

Read only

0 Likes
1,617

Hi,

I try but error again.


* create file name
CONCATENATE '/sapio/flatfiles/xxx/'v_date'_xxxx_xxxxx.csv' INTO p_filename.

Regards, Thomas

Edited by: Thomas Franke on Mar 5, 2008 11:30 AM

Read only

0 Likes
1,617

Please let me know the error UR getting ...

Read only

0 Likes
1,617

Hi,

I click on the save button and afterwards a error occurs.

The syntax check produced errors in the form routine.

Hmm ... need help.

Thanks a lot for your time.

Regards, Thomas

Read only

0 Likes
1,617

Hi,

I found the error. I replaced v_date with data and the error doesn't occurred again. Hope that is the solution.

Regards, Thomas