Sometimes you can directly swap them in the hardware configuration if they are not too different. If they are too different it will give you an error message. The message should say "Slot is occupied, module is too wide, or the functionality of the inserted module is not transferable to the new module."
You can still change it, you just have to do it different.
Select the 315 processor and just delete it.
The program will ask if you wish to "delete module CPU 315 which belongs to the program , ........" Click No so that everything in the Blocks folder will be saved. If you click Yes, all the programs in the blocks folder will be deleted and you will loose anything in there forever.
The processor will be removed, now you can add the 317 in slot 2. Compile the changes and close the hardware configuration.
When you look at the SIMATIC manager again you'll have a station object with the new 317 and an S7 program folder hanging off of the project. The projects blocks are in that S7 program folder, the one under the station object for the 317 is empty. Copy the blocks from the S7 program folder into the Blocks folder of the station object with the 317 and you should be set to go. (Don't copy the system data, just the blocks)