The main theme in both works is human suffering and they both share heavy existentialist undertones.
Tolstoy's "The Death of Ivan Ilyich" focuses on the struggle of a russian high-court judge who is dying from a terminal illness. This sends him on a downwards spiral questioning how one can live a meaningful life and truly be connected to himself while knowing death is inevitable and the heart is made of weak spots.
In Munch's painting "The Scream", the fragility of the human condition is meant to reflect the internal perspective of a man who's walking on the pier and suddenly suffers some kind of panic attack or climax of severe anxiety. Panic attacks are known to make people feel like they're literally going to die.
Hope this helps!