Ghana has issued a caution to its nationals in South Africa after anti-migrant demonstrations took place in Johannesburg and Durban.