Hello and welcome to justanswer.com
DTC P740 is for the torque converter clutch. There was a service bulletin to replace the solenoid and reprogram the ecm/tcm for the harsh shifting. If you have high mileage you may have other internal transmission problems but this was the usual fix for those problems.
ASE Certified Technician
BMW Tech ASE Certified Technician