BMW - Vehicle Identification Number (VIN) VDS
The vehicle type code can be determined using the Vehicle Description Section (VDS).
Examples:
AA13 325is E30 M20B25 1989-91
AA23 325isA E30 M20B25 1987-88
AA23 325isA E30 M20B25 1989-91
AB03 325iXA E30/16 M20B25 1989-91
If the entire VIN is known, the determination of the last 7 digits makes more sense.