Hi Experets,
i am new in abap hr please suggest me how to get hod of an employee and trying to do with bellow codes, kindly suggest me.
select single ORGEH from pa0001 into lv_orgeh where pernr = employeenumber
and ENDDA = '99991231'.
if sy-subrc = 0.
select single sobid from HRP1001 into lv_sobid where OBJID = lv_orgeh
and rsign = 'A'
and relat = '803'
and endda = '99991231'.
if sy-subrc = 0.
SELECT SINGLE objid FROM HRP1001 INTO lv_objid
WHERE OTYPE = 'O'
AND OBJID = lv_sobid
AND RELAT = '12'
AND RSIGN = 'B'
AND ENDDA = '99991231' .
IF SY-SUBRC EQ 0.
SELECT SINGLE sobid INTO lv_sobid
FROM hrp1001
WHERE otype EQ 'S'
AND objid EQ lv_objid
AND plvar EQ '01'
AND rsign EQ 'A'
AND relat EQ '008'
AND istat EQ '1'
AND endda EQ '99991231'.
IF sy-subrc EQ 0.
lv_pernr = lv_sobid.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.