simulate this circuit – Schematic created using CircuitLab
I used OA1 as feedback for adjust pin and OA2 as a buffer, there's a 10 mA load at the output to meet the minimum load requirement of the LM317.
The output voltage of LM317 is now totally dependent on the load on the output. Why? When there's no load output voltage is 9.5V and connecting the non-inverting input of OA2 to any voltage pulls the output of LM317 to 22V and stays there.
Now if I connect any load, voltage will drop depending on the amount of load and it doesn't matter to what voltage the non-inverting pin of OA2 is connected!
How can I control the output of LM317 digitally and have a constant voltage?