The present invention relates to a device and a method for cleaning and sterilizing a filling valve of a beverage filling system for filling a container with a filling product. The device includes a cap for closing a filling product outlet of the filling valve during the cleaning and sterilization, and a valve for opening and closing the through-opening. The cap has a through-opening for discharging sterilization medium during the sterilization. The valve includes a shape-memory material for switching the valve between an open and closed position at a predetermined temperature.