Skip to Content
author's profile photo Former Member
Former Member

Need FM for Org Mannagement, Employees from lower org units

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.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Feb 01, 2008 at 03:39 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.