Where are you trying to tie this p-trap into?
The fixture outlet (the piece going into the trap) usually doesn't have a minimum length because it's really irrelevant. You're amost forced to make it atleast 4" long in most cases.
If you're trying to tie that p-trap into the existing pipe in the hole in the trench there then you shouldn't do that. You'll be creating yourself a nice little s-trap (the fall exceeds the diameter of the pipe before you hit a vent).
The trap outlet needs to be at grade with the horizontal drainage in the ground.
You want to do this: