South African Breweries (SAB) has agreed a settlement with workers after a month-long strike.