Try changing the type of bedding you're using. Move the food bowl to a high level in the cage. Change the type of bowl you use for food or the litter tray. Or try feeding at specific times and then remove the food bowl. When your rat poops in the proper place, immediately reward him with a tasty treat. Ignore him when he poops elsewhere. He'll soon get the idea.