You just need to know what you’re doing.
At least a few of those fare buckets you listed are award fares, so those are never going to earn miles.
Next, Lufthansa (and its cadre of carriers) are notorious for these fares. Lufthansa K is the easiest economy fare to get from them and it earns 0% to almost every program in star alliance. I say K because it’s the one I know for sure, but K is gonna be paired with a bunch of those other codes as well.
As far as the P fare, that credits to a few but presumably that’s “deeply discounted business”. So it’s not gonna credit to most.
Now, as far as how to see the booking class on LH and how to change it to a higher one, I don’t know, I rarely use their website. Best guess is you can buy up a bit but you’d have to find it.
It’s interesting that you called out Expedia by name, they absolutely do show you the booking class.
It’s only hard because you’re European based and trying to use the Lufthansa group. Fly Aegean as much as you can and if you EVER take a trip to the US/Canada/Asia avoid the LH group.
if you only fly intra-Europe, then you might wanna just adopt one of the LH group mileage programs.