Boil up plenty of salted water. Peel the shallots and halve them if necessary. Wash and halve the tomatoes. Cook the pasta for about 10 minutes until al dente.
Heat the oil in a large coated pan. Sauté the ham and shallots in it for about 5 minutes. Add the tomatoes and fry briefly. Sprinkle with sugar and lightly caramelise. Deglaze with vinegar and 100 ml water, bring to the boil and simmer for about 2 minutes.
Drain the pasta and put it back into the pot. Add the vegetable and ham mixture and mix everything together. Season to taste with salt and pepper. Grate parmesan, sprinkle over it and serve.