A simple design exapmle with the derivations would be much appreciated. I don't have a ready answer to your problem. I have used LM317 for constant current and constant voltage source applications, but I have never found it to be very suitable for applications which need both current limiting and constant voltage regulation at the same time. For this kind of applications I have used L200 regulator instead. You want two resistors, Rs and R2 between the output and the adjust pin of the 317.
Rs is for current limiting.
Also, Vin is 20-24 and is filtered off a full wave bridge. I have read the app notes but still don't understant. A simple design exapmle with the derivations would be much appreciated. I don't have a ready answer to your problem.