Adaptations are how the engine computer learns the particular behavior of the engine and uses that information to "tune" the engine. For instance, the BMW engineers know that for a certain amount of air flowing into the engine, it will require a certain amount of fuel. But each engine and each MAF sensor is different, so the whole system of engine, sensors, fuel injectors etc. has to be calibrated to work correctly with one another.
By leaving the oil cap off, you introduced a lot of "false air" into the engine and it disrupted the adaptation values stored in the ECU. By erasing the error codes in the ECU, you will re-set the adaptation values back to the factory defaults. After driving for a while, the adaptations will eventually return to where they were prior to this mishap.