Heat the oil in a wok, add the shallots, garlic and shrimp paste and fry over a low heat, stirring frequently, for 5 minutes, until the shallots are softened.
Add the beans, increase the heat to moderate and fry, stirring occasionally, for 8 minutes, until the beans are cooked but not too soft.
Stir in the sambal oelek, sugar and a little salt and continue frying the beans for a further 1 minute. Taste and add a little more salt if necessary. Serve the sambal hot.