Combine beans and a small amount of water in a saucepan, over a moderate flame. Bring to a boil, reduce heat, cover, and cook until tender and heated through. Remove from heat, drain well.
Combine bacon and onions in a skillet, over a moderate flame heat and stir for 5-10 minutes, until lightly browned.
Add beer and sugar. Mix well. Season to taste with salt and pepper. Heat to boiling.
Remove from heat, add the spaetzle and pour over beans.
Serve hot timing is everything with this dish. There's no way (nor is it desirable) to keep the bacon grease out of this dish, but it is not pleasant once it is cold. If you foresee timing difficulties, keep the sauce separated from the spaetzle until ready to serve, then microwave the sauce and spaetzle, stir the sauce thoroughly and mix them before you pour over the beans.
A note as to beer: Wow. Gee. What to recommend as a beer? Believe it or not, the best for this recipe is the cheapest beer you can find. Get something like the old Stag or Falstaff brands or Pabst Blue Ribbon, maybe. The strong flavor of those old-fashioned brands really helps. If you insist on having "good" beer, try Dortmunder Union. I like a dark beer with this recipe, but it is not essential.