German Grammar Problem
Was soll ich .... sagen?
ihn or ihm?
How we can know that?
As I am a German native speaker, I can't tell you the exact reason, but I think it's like this: Ihn = accusative case (used when it's the direct object) Ihm = dative case (used when it's the indirect object) "ihm" is referring to the indirect object of the sentence if I'm not mistaken. The direct object would be whatever "ich" tells him (even though I can't think of a meaningful example sentence with "sagen"..)
Think of the translation: "What should I say to him?" You are thinking of saying something to someone.
The something is the direct object. The someone is the indirect object – the person receiving the direct object – and needs to be in the dative. In this sentence "was" stands for the direct object and "ihm" is the indirect object.
An easier way to think about this if you can't quite wrap your head around direct and indirect objects is to again think of the English "him" in the translated sentence. "Him" and "ihm" are very similar and used in a similar way.
In the sentence "What should I say to him", "him" would NOT be the indirect object; however, it would be the object of the preposition "to". If you wanted to use "him" as an indirect object, you could say "I told him something" with I = subject, told = verb, him = indirect object, and something = direct object.