cancel
Showing results for 
Search instead for 
Did you mean: 

Need FM for Org Mannagement, Employees from lower org units

Former Member
0 Kudos

hi,

I have a person/manager suppose in Org Unit 'A' from whome I need to find out employeees belonging to org units at lower level to 'A'.

Now I also have to check that I should get employees of the lower org units till I get a org unit with manger position if manager position is available stop otherwise need to keep searching the lower level org units.

I am in search of any function module available for such requirement.

Please reply me if anyone has any idea on this.

thanks and regards,

Akash.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You can use FM RH_STRUC_GET with evaluation path ORGAS to get the position and organizational unit the user is linked to.

Also, try FM HR_GETEMPLOYEEDATA_FROMUSER.

Just for your information.....

If you want to read the attributes of an Organizational Unit or position then you can use the function module RH_OM_ATTRIBUTES_READ.

The FM you can also try is CALL FUNCTION 'RH_STRUC_GET'.

For example

-


***INCLUDE LZ_GET_ORG_STRUCTF01 .

-


&----


*& Form get_user

&----


  • text

-


  • -->P_W_TYPE text

  • -->P_W_OBJID text

-


FORM get_user USING W_TYPE

W_OBJID.

data: lt_objec type standard table of objec,

wa_lt_objec type objec,

w_usrid like sy-uname,

lt_agents type standard table of swhactor,

  • lt_objec type standard table of objec,

wa_lt_agents type swhactor,

actor_tab type standard table of swhactor.

refresh lt_objec.

CALL FUNCTION 'RH_STRUC_GET'

EXPORTING

ACT_OTYPE = w_type

ACT_OBJID = w_objid

ACT_WEGID = 'TASK_USR'

  • ACT_BEGDA = SY-DATUM

ACT_ENDDA = SY-DATUM

  • IMPORTING

  • ACT_PLVAR =

TABLES

  • RESULT_TAB = lt_agents

RESULT_OBJEC = lt_objec

  • RESULT_STRUC =

EXCEPTIONS

  • NO_PLVAR_FOUND = 1

NO_ENTRY_FOUND = 2

OTHERS = 3 .

IF SY-SUBRC 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

exit.

ENDIF.

loop at lt_objec into wa_lt_objec

where otype eq 'P'

and ISTAT ne ' '.

w_objid = wa_lt_objec-objid.

  • now return in Agent format (US+UserID)

select usrid from m_premu

into w_usrid

where usrty eq '0001'

and pernr eq w_objid.

endselect.

wa_lt_agents-otype = 'US'.

wa_lt_agents-objid = w_usrid.

append wa_lt_agents to actor_tab.

endloop.

lt_agents] = actor_tab[.

export lt_agents to memory id 'zbus2080'.

endform.

*

The values in ACT_WEGID should be any that exist in table T778A.

Object type is P, O, S, US etc.

If you have the personnel number a useful value for the WEGID is SAP_USOG but experiment with values from table T778A.

Use SE37 in test mode for quick testing

hope this helps u.

regs,

hema.

Former Member
0 Kudos

Hi,

I tried the way you have suggested, but seems this is not going to work.

Please reply if you have any other alternative.

thanks,

Akash