It's been many years since I used Report Writer, but I don't believe you're allowed to create tables within it. You need to write a select statement to get the data. You can do the create stuff using a script outside report writer to create a temp table. Then query the temp table in the Report Writer script.