Ok, first of all: Is your transmission an automatic? Or Manual? You can't have both, and especially since you specifically mentioned the 4HP22EH (which is automatic).
Automatics have P-R-N-D-3-2-1 on the shifter lever. So, based on that, here is some info:
First, do a complete transmission fluid change including filter. I personally recommend taking it to a BMW shop or a shop that specializes with imports.
The transmission fluid is self contained (i.e.: not shared with any other system). Transmission fluid and brake fluid are completely different. If you poured brake fluid into the tranny, then yes, you need to do a transmission fluid flush and filter change immediately.
If you poured ATF (Automatic Transmission Fluid) into the brake chamber, then you have to flush the brakes out IMMEDIATELY along with a tranny flush.
That is the simplest thing first. Second you have all sorts of sensors. The next simplest thing is the gear selector sensor. This is located on the shifter lever inside the car underneath the center console. Clean the contacts. (You can find links in my signature)
Next you have the output shaft speed sensor. If that is goosed, then this might be your problem.
Next up is your torque converter has given up the ghost.
But don't let the last two scare you. Work on the fluid change and the gear selector sensor and report back.