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

Naming file dynamically in Application server

Former Member
0 Likes
1,620


Hi,

I am uploading a file in application server using open data set. The application server path is given in the selection screen. How can i name the file dynamically while it is getting uploaded in the application server?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,183

Hi,

Thanks for the reply.

But the condition here is, multiple pdf are being generated and i have to give seperate names to each pdf and then upload it into al11.

7 REPLIES 7
Read only

custodio_deoliveira
Active Contributor
0 Likes
1,183

Hi Sri,

You can give it any name you want for a new file, so you just need to concatenate the path with whatever you want to name the file whatever you want, ie:

*concatenates path + constant "/myfile/" + system date

lv_file = |{ p_path }/myfile/{ sy-datum }|.


OPEN DATASET lv_file FOR OUTPUT.

Read only

aarif_baig
Active Participant
0 Likes
1,183

Hi Shristi,

              Put your condition before your open dataset  code

If sy-name = x.

v_file = whatever name you want.

Endif.

OPEN DATASET v_file FOR OUTPUT IN TEXT MODE.


Thanks.


Read only

Former Member
0 Likes
1,184

Hi,

Thanks for the reply.

But the condition here is, multiple pdf are being generated and i have to give seperate names to each pdf and then upload it into al11.

Read only

0 Likes
1,183

Hi Shristi,

               So multiple pdf is displaying data from different internal tables right?

CASE 'PDF1'.

file = 'X'

OPEN DATASET v_file FOR OUTPUT IN TEXT MODE.

TRANSFER `1234567890` TO file.

CLOSE DATASET file.

CASE 'PDF2'.


OPEN DATASET v_file FOR OUTPUT IN TEXT MODE.

file = 'y'.

TRANSFER `1234567890` TO file.

CLOSE DATASET file.

and so on.

Read only

0 Likes
1,183
  • You can concatenate file name with the system date (sy-datum) and system time (sy-uzeit) so that each and every file will be uniquely named.

Regards,

Philip.

Read only

0 Likes
1,183

As I said, you can concatenate whatever you want to file name.  You can concatenate sy-uname / sy-uzeit as mention before (just don't forget to use get time before this or you may have same uzeit and even this is not guaranteed), or you can create a counter variable and concatenate this counter as well (guaranteed you will not have same filename)

Read only

0 Likes
1,183

Thank you Custodio