on 2008 Apr 24 7:16 AM
Hi ,
I need list of supervisors, there first name, last name, grade, and also the list of direct reports to him/her....
i guess i must be interactive report...
plz help me...
thnx
rohit
Hi ,
U can trythis code hope this will be usefull to you
DATA : l_lead_ty TYPE otype,
l_lead_id TYPE realo.
DATA : itab_0105 TYPE TABLE OF p0105,
wa_0105 LIKE LINE OF itab_0105.
DATA: l_otype TYPE otype,
l_objid TYPE realo.
*-- Start of changeNLYK01- Change in logic--*
DATA: l_plvar TYPE plvar,
l_pernr TYPE realo.
DATA: BEGIN OF it_result OCCURS 0.
INCLUDE STRUCTURE swhactor.
DATA: END OF it_result.
DATA: BEGIN OF it_object OCCURS 0.
INCLUDE STRUCTURE objec.
DATA: END OF it_object.
DATA: i1001 LIKE p1001 OCCURS 0 WITH HEADER LINE,
g_objid TYPE hrobjid,
g_pernr like P0105-PERNR,
u_objid like P0105-USRID.
*-- End of change-NLYK01- Change in logic----*
DATA: l_date LIKE sy-datum. "wipptg01
l_date = sy-datum. "wipptg01
IF sy-sysid = 'SB2' AND sy-datum LE '20071016'. "wipptg01
l_date = '20071016'. "wipptg01
ENDIF. "wipptg01
IF NOT eff_date IS INITIAL. "puxg01
l_date = eff_date. "puxg01
ENDIF. "puxg01
Code
check for value entered in one field only
IF initial IS INITIAL AND pernr IS INITIAL AND position IS INITIAL .
RAISE no_export_parameters.
ELSEIF initial IS NOT INITIAL AND pernr IS NOT INITIAL .
RAISE more_export_parameters.
ELSEIF initial IS NOT INITIAL AND position IS NOT INITIAL .
RAISE more_export_parameters.
ELSEIF pernr IS NOT INITIAL AND position IS NOT INITIAL .
RAISE more_export_parameters.
ENDIF.
IF NOT pernr IS INITIAL.
l_otype = c_p.
l_objid = pernr.
ELSEIF NOT position IS INITIAL.
l_otype = c_s.
l_objid = position.
ELSEIF NOT initial IS INITIAL.
l_otype = c_us.
l_objid = initial.
ENDIF.
IF l_otype NE space AND l_objid NE space.
*Function Module to get Chief.
CALL FUNCTION 'RH_GET_LEADER'
EXPORTING
plvar = c_01
KEYDATE = SY-DATUM "wipptg01
keydate = l_date "wipptg01
otype = l_otype
objid = l_objid
IMPORTING
leader_type = l_lead_ty
leader_id = l_lead_id
EXCEPTIONS
no_leader_found = 1
no_leading_position_found = 2
OTHERS = 3.
IF sy-subrc = 0.
chief_pernr = l_lead_id.
----Start of change -NLYK01-New Logic updated to get the chief------
IF sy-subrc = 1.
RAISE NO_LEADER_FOUND.
ELSEIF sy-subrc = 2.
RAISE no_leading_position_found.
ELSEIF sy-subrc = 3.
RAISE others.
ENDIF.
ELSEIF sy-subrc NE 0.
IF l_otype EQ c_p.
MOVE l_objid TO l_pernr.
ELSEIF l_otype = c_s.
MOVE l_objid to g_objid.
CALL FUNCTION 'RH_READ_INFTY'
EXPORTING
authority = c_disp
with_stru_auth = c_x
plvar = c_plvar
otype = c_s
objid = g_objid
infty = c_infty
istat = c_istat
extend = c_x
subty = c_subty
begda = l_date
endda = l_date
condition = c_00000
inftb = c_1
sort = c_x
via_t777d = ' '
TABLES
innnn = i1001
EXCEPTIONS
all_infty_with_subty = 1
nothing_found = 2
no_objects = 3
wrong_condition = 4
wrong_parameters = 5
OTHERS = 6.
IF sy-subrc EQ 0.
READ TABLE i1001 WITH KEY sclas = c_p.
IF sy-subrc EQ 0.
MOVE i1001-sobid TO l_pernr.
ENDIF.
ENDIF.
ELSEIF l_otype EQ c_us.
Move l_objid to U_objid.
CALL FUNCTION 'RP_GET_PERNR_FROM_USERID'
EXPORTING
begda = l_date
endda = l_date
usrid = u_objid
usrty = c_0001
IMPORTING
USR_PERNR = g_pernr
EXCEPTIONS
RETCD = 1
OTHERS = 2
.
IF sy-subrc EQ 0.
l_otype = c_p.
l_objid = g_pernr.
l_pernr = l_objid.
ENDIF.
ENDIF.
CALL FUNCTION 'RH_STRUC_GET'
EXPORTING
act_otype = l_otype
act_objid = l_objid
act_wegid = c_wegid
act_plvar = l_plvar
act_begda = l_date
act_endda = l_date
act_tdepth = 0
act_tflag = c_x
act_vflag = c_x
authority_check = c_x
TABLES
result_tab = it_result
result_objec = it_object
EXCEPTIONS
no_plvar_found = 1
no_entry_found = 2
OTHERS = 3.
IF sy-subrc EQ 0.
LOOP AT it_result WHERE otype = c_o.
CLEAR: l_objid,l_otype,l_lead_ty,l_lead_id.
MOVE c_o TO l_otype.
MOVE it_result-objid TO l_objid.
CALL FUNCTION 'RH_GET_LEADER'
EXPORTING
plvar = c_01
keydate = l_date
otype = l_otype
objid = l_objid
IMPORTING
leader_type = l_lead_ty
leader_id = l_lead_id
EXCEPTIONS
no_leader_found = 1
no_leading_position_found = 2
OTHERS = 3.
IF sy-subrc = 0.
IF l_pernr NE l_lead_id.
chief_pernr = l_lead_id.
EXIT.
ENDIF.
ENDIF.
ENDLOOP.
IF chief_pernr IS INITIAL.
RAISE no_leader_found.
ENDIF.
ELSEIF sy-subrc NE 0.
RAISE no_leader_found. "Raise - NO LEADER FOUND error instead of OTHER.
ENDIF.
ENDIF.
ENDIF.
----End of change -NLYKNew Logic updated to get the chief----
*Function Module read the records of Infotype.
REFRESH: itab_0105. "NLYK01
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
tclas = c_a
pernr = chief_pernr
infty = c_01o5
BEGDA = SY-DATUM "wipptg01
ENDDA = SY-DATUM "wipptg01
begda = l_date "wipptg01
endda = l_date "wipptg01
TABLES
infty_tab = itab_0105
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
IF sy-subrc = 0.
READ TABLE itab_0105 INTO wa_0105 WITH KEY usrty = c_0001.
IF sy-subrc = 0.
chief_initial = wa_0105-usrid.
ENDIF.
ENDIF.
Here onceu get the related pernr u can found the relevent details
Award points if found usefull
Regards,
rahul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Can you explain your problem in details.
I have written a function module that takes Employee Pernr
as Import parameter and return the Administrator Personal no.
Regards
Kulvendra Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use the Ad-Hoc query..........(SQ01)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
105 | |
8 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.