Now we come to the tricky part of the story.
In most cases shocks of enduro, Adventurer, or Rally models are used.
Why? It is hard to find out the internal differences.
These Link-system-shocks of KTM/WP we are looking for, are interchangable cross KTM from the outside (!) specs.
Regardless, if you have an EXC, SMC, Enduro, SX, Duke... But internally...
A shock for an EXC may not be the first choice for a (Street-)Duke and vice versa.
(This would need detailed part-listing, WP-shock building knowledge and detailed comparison of the different bike physics)
For an WP reworker it might be easy to turn a street shock into a hardenduro one, he has the spare parts.
Even higher or lower is possible (change of the rods), but Money?
If you have a KTM dealer near you:
Ask him, without mention the KLR in the first step:
"for an 2004 Enduro some one offered you a Duke2 shock of 2004"
If not recommended, why?
Later you might mention the KLR and with a little luck you have your shock service...
To your mentioned shock:
The overall length with 398mm eye-to-eye should be ok.
It will keep the original high of the KLR.
From the Part-drawing it looks, that it might also have an angled reservoir mount.
(not straight in line with the upper mounting bolt)
But I am not sure if the Duke shocks are restricted in the moving distance.
It is from the second Duke generation starting in 2004.
Also the internal setup might be for street use.
(Compared with the enduro versions, for example this is numbered 0118Y734 for the 2004)
I personally would go for an Enduro/Adventurer (rare) /Rally (more than rare) shock, just to avoid.
(I bought mine as beeing used as an update in an 300 EXC an saw later that it was originally from a SuMo.
If anything is changed internally, I do not know)
The shock:
http://www.ktm-versand.de/product_info. ... ---04.html
(click on any of the motorbike drawings, don´t be afraid of the German the rest is English)
Pix of the Duke 2:
https://www.google.de/search?q=640+duke ... DjMQsAQIGw