You would need a conversion barrel. The breech cut is sized to hold a .40. A 9mm barrel would not fit. Even a conversion barrel would likely need a 9mm ejector and extractor. Even if those parts were available for HK, I would only use it for range practice a not life dependent activities. If you want a 9mm you should trade for it or sell your .40 and buy a 9mm.
"What is right and what is fair are often not the same."
"Si vis pacem, para bellum"