The meaning and the question answered identify the role.
RoleQuestion answeredExamplemaf'ul bihiwhom or what received the action?ضَرَبْتُهُmaf'ul mutlaqhow is the action emphasized, described or counted?ضَرَبْتُهُ ضَرْبًاmaf'ul lahuwhy did the action occur?ضَرَبْتُهُ تَأْدِيبًا
Do not classify from the case ending alone; all three can be mansub.