I purchased a electric tankless water heater and I would like to know the following? The unit requires 3 separate 40 amp breakers, one for each line. I have 200 amp service. The subpanel will be located about 30 feet from the main. What would the breaker be at the main and what size wire should I run from the main to the sub-panel.
I'm not sure where you live but US code calls for a minimum of #8 if you're using copper or #6 if you're using aluminum. There would be no advantage in using a larger wire size in this case because at 30ft you will have negligible losses.
I don't know what your voltage is or how many phases you have but for an example of what your losses may be, I will assume a worst case scenario - 100V single phase. If you used the #6 aluminum wire, you would have a maximum of 1.72% voltage drop (loss). If you used the copper #8, you would have a maximum voltage drop of 1.66%. And just remember, when you are calculating losses (voltage drop), the higher the voltage, the better because higher voltages have less voltage drop.
Note: I use the Southwire Voltage Drop Calculator for most of my voltage drop calculations. http://www.southwire.com/support/voltage-drop-calculator.htm
Use #2/3 copper with ground to a 115 or 125 amp single phase subfeeder panel fed with a 2 pole 115 amp breaker. Three 40 amp double pole breakers using 8/2 copper with ground feeding the instant hot from the subfeeder panel.