Main steps to get the email ID of a employee
- Go to the PA30 with info type 0105 (communication ) and subtype 0010 (email id) click on the display button
- Call SE37 Call function model ‘HR_READ_SUBTYPE
- Here ENDA must be entered to get the email id
Code snips :
CALL FUNCTION 'HR_READ_SUBTYPE'
EXPORTING
* TCLAS = 'A'
pernr = p_num "Personnel number of the employee
infty = '0105' " Info type
SUBTY = '0010' " Subtyp
ENDDA = '99991231'
TABLES
infty_tab = l_t_p0105 "Records fetched
EXCEPTIONS
INFTY_NOT_FOUND = 1
INVALID_INPUT = 2
OTHERS = 3.
EXPORTING
* TCLAS = 'A'
pernr = p_num "Personnel number of the employee
infty = '0105' " Info type
SUBTY = '0010' " Subtyp
ENDDA = '99991231'
TABLES
infty_tab = l_t_p0105 "Records fetched
EXCEPTIONS
INFTY_NOT_FOUND = 1
INVALID_INPUT = 2
OTHERS = 3.
READ TABLE l_t_p0105 INTO l_r_p0105 INDEX 1.
IF sy-subrc = 0.
IF sy-subrc = 0.
p_EMAIL = l_r_p0105-usrid_long " usrid_long is the email id
Endif.
Endif.