@alfie ,ALFRED, If vehicle ran fine right up to the time of sparking battery,chances are the ECU may have taken a hit and will have to be tested and evaluated by a qualified technician with proper equipment. If able to hook up a code reader/scanner and check for error codes as a first step. Good luck. I hope this helped you out, if so let me know by pressing the helpful button.
@bugalu , Fernando Hodge, It sounds like you may have a bad sensor and when you undo the battery you are resetting it temporarily. Instead of just guessing have the Hyundai Santa Fe checked for engine error codes to possibly pin point the issue. Some of the auto parts suppliers offer free code reading like Pepboys, Nappa, Advanced auto parts,etc and some of the guys are very knowledgeable and may have seen the issue often and put you on the right track. Good luck. I hope this helped you out, if so let me know by pressing the helpful button.