I dont know if you can book a bike online for a train in Germany. I know for certain that you cannot in Denmark. You have to ring the call centre and book it that way.
If you arrive at a train station in Germany or Denmark you can buy tickets for yourself but not your bikes by using the automats. To get a ticket for the bike you need to go into the ticket office. I found the best way is to buy both tickets at the ticket office. The reason I say that is that you may know where you want to go and have it worked out in your head how to get there, but the ticket office people know better than us. They know quicker ways and which stations have lifts for bikes. I have found this out from experience.
If the ticket office is closed, get the tickets for yourself from the automat and explain to the guard on the train about the ticket office. That is the advice I was given. I found German bikes great for bikes as you just push them on the train. Danish trains often have 3 bloody great big steps to drag the bike up.