I have made a dipole for 40 m, no swr to speak of on 7040 kHz, but I've been told that it should also work on 20 m as it is 20 meters long (2× 9,92 m) but there I get SWR in the 7-9 range. Will this improve if I add a balun to the center?
A 1 wavelength dipole will always present a high impedance. Low feedpoint impedance occurs at odd half wave harmonics, so 1 half wave, 3 half waves, etc. A 40m dipole will usually present an acceptable SWR on 15 meters, not 20. A 4:1 balun at the feed point may allow you to tune the antenna on 20 meters, but losses in the coax will be extremely high on both bands then, because of the transformation of the impedance on both 40m and 20m without achieving a perfect match on either. A better bet is to turn it in to a fan dipole by adding a 20 meter element to it, which should give you a nice triband antenna.
That said, dipoles should always have baluns if at all possible, ideally ferrite toroid 1:1 choke baluns, as these have a wide bandwidth and will keep RFI to a minimum. While single band dipoles will often work without one, they're more prone to causing or receiving RFI and noise due to common mode current on the coax shield.