Cut the cooked ham into small cubes. Peel the onion and cut into half rings. Fry both together in a coated pan. Take out and cover.
Now leave out a piece of butter in the same pan as required and toss the egg spaetzle in it until it is warm and lightly browned. Now add the ham and onions and season with a little pepper.
Grease a flat baking dish a little. Pour the grated cheese and spaetzle mixture into the baking dish.
Baked at around 180 ° C in a preheated oven for approx. 15 minutes. Every now and then, lift through once. Serve hot.