What do you mean exactly when you say it doesn't shift to P?
If the gear lever physically does not go past the R gear, then you need to have the transmission inspected from the dealership.
If the lever itself goes into into the P position but the car detects it still in N or R in dashboard, then you need to get your brake switch checked. There is a small connector / switch in the driver side footwell right above the brake pedal that can come loose after some time if your foot often touches or brushes against it. If that happens, the brake signal doesn't propagate properly and the car often doesn't shift into P or start if it was shut down. You can easily test for this problem by pressing the brake pedal and asking someone to see if the brake lights come on. If they don't, then your switch is loose and you need to tighten it by hand.