Skip to main content
Solved

How to save filename with timestamp for excel exported directly from SAP

  • 26 March 2024
  • 2 replies
  • 119 views

m creating a bot to automate the process below at requested time everyday:

 

Login SAP

run T-CODE

get the data of certain countries

export the data in .xlsx (need to indicate the date and the time with the filename)

open the excel

delete unnecessary columns 

save the excel

send the excel via email to PIC

 

Currently still stuck at step 4.

 

Due to the bot need to run twice a day, the PIC requested to indicate the date and time for the excel filename. Previously this bot was created with Brity RPA so they used java script to set the file name as something like ddmmyyyy_TCODE.

 

Initially I planned to save the excel file with ‘set text’ first, then run a batch file to change the filename every time I run this bot.

 

But after doing some research, I found that batch file seems like only can create new folder or new file with timestamp instead of changing the filename of an existing file.

 

So right now I came back with the idea to use the actions in AA360 instead.

 

The filename can be changed even after the excel file is edited. It will do as long as the filename comes with timestamp before it’s sent out.

 

It would be much appreciated if anyone could help on this issue.

 

Thank you~!

2 replies

Badge +2

this gives current to to vCurrentDate in format of YYYYMMDD. Imitate that to get a time variable then add both as “vFilename_vCurrentDate_vCurrentTime.xlsx” as filename being created

Userlevel 3
Badge +7

Janet’s answer is great, but you can do this in a single line using the system Date variable, and the “Date:To string” action.

for more information on working with Date variables see: 
https://docs.automationanywhere.com/bundle/enterprise-v2019/page/enterprise-cloud/topics/aae-client/bot-creator/commands/cloud-date-time-formats.html

Using Custom Datetime formats can be a time saver.
 

 

Reply