Hi Mayank,
where exactly your trying to implement this logic?
1) for getting object id there is a class CL_CRM_CMPIC_MAIL_WRAPPER_SC in that there is attribute gt_aui_mail_workitem this will gives the work items.
lt_workitems = CL_CRM_CMPIC_MAIL_WRAPPER_SC=>gt_aui_mail_workitem.
2) do one thing provide a break point in the component crmcmp_ccs_eml mail body view and attachment view try to debug you can come to know how this will happen.
Regards,
Srinivas.