2006 Oct 20 6:32 PM
Hi,
Can someone tell me how to retrieve the entire org structure of an employee using the Get OBJEC event. The below code is retrieving the org units only upto one level.
I am not sure if i can use a Get event with another Get event or not.
Start-Of-Selection.
Get objec.
Loop at p1001.
If p1001-sclas = 'O'.
Select *
from HRP1010
into table i_hrp1010
where objid = p1001-sobid and plvar = '01' and begda <= sy-datum and endda >= sy-datum and subty = w_subty.
Loop at i_hrp1010.
Move i_hrp1010 to w_hrp1010.
endloop.
w_hrp1010 = i_hrp1010.
If sy-subrc = '0'.
DO 82 TIMES VARYING l_HILFM FROM w_hrp1010-HILFM NEXT w_hrp1010-HILFM001.
IF l_HILFM IS INITIAL.
EXIT.
ELSEIF l_HILFM = W_HILFM. " Found
l_flag = '1'.
EXIT.
ELSEIF l_HILFM = W_STOP. " Found a company
l_stop = '1'.
ELSE. " Not found but can continue
l_flag = '2'.
ENDIF.
ENDDO.
IF l_stop = '1' and l_flag = '2'. " found a company before finding the required org unit
raise ORG_NOT_FOUND.
ELSEIF l_flag = '1'.
select SINGLE STEXT SHORT
from HRP1000
into (w_stext , w_short)
where otype = 'O' and objid = p1001-sobid and begda <= sy-datum and endda >= sy-datum.
write 😕 p1001-sobid, w_stext, w_short.
EXIT.
ENDIF.
endif.
endif.
Endloop.
End-Of-Selection.
2006 Oct 20 7:47 PM