The boys are having a sandwich infers that the boys are eating the sandwich. But here, with hebben, it only means possession. If you want to say The boys are having (eating) a sandwich, then you would say De jongens eten een boterham. Hope that helped!
It does not accept 'The boys have a sandwich.' but underlines 'sandwich'. Why?