This is one of those "do it because you can" projects.
If you want a CDI 240D, which would be a what? E240CDI?
Its possible...
1. Get a nice 240D with a blown engine, that shouldn't be that hard to do.
2. Find, somehow, a 4 cylinder MB CDI engine, with all the computers that are needed to make it run. You will probably also need transmission.
3. Place CDI engine in the 240D, which is the simple part. Now hook up the computers and get it to work.
M120 into 560SL (With Pictures!)
While a different engine and car, thats about what you are going to have to do.