Hello Vidhura,
Please tell me how you are sending is it through a standard or z program.
We have a function module or BAPI BAPI_USER_GET_DETAIL which will get the complete details about the user. Generally user can be inactive in different ways like Validity period ends(Logon data in SU01D) and user locking status.
In this BAPI we have export parameter as ISLOCKED which will display the locking status.