Fm to get employee under manager of all org unit

hi,
i have requirement that i need list of all employee under particular manager i know abt HRWPC_PNP_MANAGED_EMPLOYEES but i don't know how to use it is thr any fm reg it .
thanks in advance

Hi Rajan,
Below is the sample code for your reference...
REPORT zrnd.
*database tables used
TABLES:pa0001, "Infotype 0001 (Org. Assignment)
hrp1001, "Infotype 1001
pa0002. "Infotype 0002 (Personal Data)
*internal tables declaration
**----internal tables for holding
DATA:t1001 LIKE p1001 OCCURS 0 WITH HEADER LINE,
     t1002 LIKE p1001 OCCURS 0 WITH HEADER LINE,
     t1003 LIKE p1001 OCCURS 0 WITH HEADER LINE,
     t1004 LIKE p1001 OCCURS 0 WITH HEADER LINE,
     t1222 LIKE p1222 OCCURS 0 WITH HEADER LINE,
     t0001 LIKE p0001 OCCURS 0 WITH HEADER LINE,
     t0002 TYPE p0002 OCCURS 0 WITH HEADER LINE.
  DATA: w1222 TYPE hrp1222 .
  DATA : z1222 TYPE hrt1222 OCCURS 0 WITH HEADER LINE.
  DATA: res TYPE swhactor OCCURS 0.
  DATA: wa_res TYPE swhactor.
  Data : f_code type ABTNR,
        p_code type ABTNR,
        f_text type VTEXT,
        p_text type VTEXT,
        s_pernr type Pa0001-PERNR,
        s_name type  pa0001-ename.
*variable declaration
**---0 to capture the id of the object "may be orgunit, position, persion.
DATA: g_sobid1 LIKE p1001-objid,
      g_sobid2 LIKE p1001-objid,
      g_sobid3 LIKE p1001-objid,
*      *--to capture the personnel number
      g_pernr LIKE pa0002-pernr.
Constants : c_function type c value 'F',
               c_Proces   type c value 'P'.
*selection screen paramters
**----enter a valid personnel number
PARAMETERS:p_pernr LIKE pa0002-pernr.
*start of selection
START-OF-SELECTION.
*Get the Position for entered Personnel number
*----RH_READ_INFTY function module is used for the OM infotypes ..starting with HRP
  CALL FUNCTION 'RH_READ_INFTY'
    EXPORTING
      plvar                = '01'
      otype                = 'P'
      objid                = p_pernr
      infty                = '1001'
      subty                = 'B008'
      begda                = sy-datum
      endda                = sy-datum
    TABLES
      innnn                = t1001
    EXCEPTIONS
      all_infty_with_subty = 1
      nothing_found        = 2
      no_objects           = 3
      wrong_condition      = 4
      wrong_parameters     = 5
      OTHERS               = 6.
  IF sy-subrc = 0.
*    MESSAGE  'this number is not maintained in hrp1001' TYPE 'I'.
  ENDIF.
*Get the latest record reading T1001 with following values
  SORT t1001 BY begda DESCENDING .
  READ TABLE t1001 WITH KEY objid = p_pernr "personnel number
  otype = 'P' "Person
  rsign = 'B' "hirarchy top down
  relat = '008' "Holder
  sclas = 'S'. "Position
  IF NOT t1001[] IS INITIAL.
    g_sobid1 = t1001-sobid. "ID of Related Object
*Get Org unit for the position obtained from above
    CALL FUNCTION 'RH_READ_INFTY'
      EXPORTING
        plvar                = '01'
        otype                = 'S'
        objid                = g_sobid1
        infty                = '1001'
        subty                = 'A003'
        begda                = sy-datum
        endda                = sy-datum
      TABLES
        innnn                = t1002
      EXCEPTIONS
        all_infty_with_subty = 1
        nothing_found        = 2
        no_objects           = 3
        wrong_condition      = 4
        wrong_parameters     = 5
        OTHERS               = 6.
    IF sy-subrc = 0.
    ENDIF.
  ENDIF.
  SORT t1002 BY begda DESCENDING .
  READ TABLE t1002 WITH KEY objid = g_sobid1
  otype = 'S' "Position
  rsign = 'A' "bottom up
  relat = '003' "Belongs to
  sclas = 'O'. "org unit
  IF NOT t1002[] IS INITIAL.
    g_sobid2 = t1002-sobid.
*Get position for the Org unit (Manager)
    CALL FUNCTION 'RH_READ_INFTY'
      EXPORTING
        plvar                = '01'
        otype                = 'O'
        objid                = g_sobid2
        infty                = '1001'
        subty                = 'B012'
        begda                = sy-datum
        endda                = sy-datum
      TABLES
        innnn                = t1003
      EXCEPTIONS
        all_infty_with_subty = 1
        nothing_found        = 2
        no_objects           = 3
        wrong_condition      = 4
        wrong_parameters     = 5
        OTHERS               = 6.
  ENDIF.
  SORT t1003 BY objid.
  READ TABLE t1003 WITH KEY objid = g_sobid2
  otype = 'O' "org unit
  rsign = 'B' "hirarchy top down
  relat = '012' "Manages
  sclas = 'S'. "Position
  IF NOT t1003[] IS INITIAL.
    g_sobid3 = t1003-sobid.
*Get Personnel number for the Manager
    CALL FUNCTION 'RH_READ_INFTY'
      EXPORTING
        plvar                = '01'
        otype                = 'S'
        objid                = g_sobid3
        infty                = '1001'
        subty                = 'A008'
        begda                = sy-datum
        endda                = sy-datum
      TABLES
        innnn                = t1004
      EXCEPTIONS
        all_infty_with_subty = 1
        nothing_found        = 2
        no_objects           = 3
        wrong_condition      = 4
        wrong_parameters     = 5
        OTHERS               = 6.
*    if sy-subrc <> 0.
*       MESSAGE  'this number is not maintained in hrp1001' TYPE 'I'.
*      endif.
  ENDIF.
  READ TABLE t1004 WITH KEY objid = g_sobid3
  otype = 'S' "Position
  rsign = 'A' "bottom up
  relat = '008' "Holder
  sclas = 'P'. "Person
  IF NOT t1004[] IS INITIAL.
    g_pernr = t1004-sobid+0(8).
**--Get name of Manager(Supervisor)
    CALL FUNCTION 'HR_READ_INFOTYPE'
      EXPORTING
        pernr           = g_pernr
        infty           = '0001'
      TABLES
        infty_tab       = t0001
      EXCEPTIONS
        infty_not_found = 1
        OTHERS          = 2.
    SORT t0001 BY pernr begda.
    READ TABLE t0001 INDEX 1.
    IF NOT t0001[] IS INITIAL.
       write  t0001-pernr to s_pernr.
       write  t0001-ename to s_name.
     ENDIF.
    Perform get_function_code using  g_sobid2  .
  ENDIF.
PERFORM display_results.
*&      Form  get_function_code
*       text
*      -->G_SOBID1   text
FORM get_function_code USING org_unit.
  PERFORM get_obj USING org_unit.
  PERFORM get_ab USING w1222-tabnr.
  PERFORM get_text tables z1222.
  IF z1222-attrib IS INITIAL.
    CALL FUNCTION 'RH_STRUC_GET'
      EXPORTING
        act_otype              = 'O'
        act_objid              = org_unit
        act_wegid              = 'A002'
*   ACT_INT_FLAG           =
*   ACT_PLVAR              = ' '
       act_begda              = sy-datum
       act_endda              = sy-datum
       act_tdepth             = 0
       act_tflag              = 'X'
       act_vflag              = 'X'
       authority_check        = 'X'
*   TEXT_BUFFER_FILL       =
*   BUFFER_MODE            =
* IMPORTING
*   ACT_PLVAR              =
     TABLES
       result_tab             = res
*   RESULT_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.
    ENDIF.
    LOOP AT res INTO wa_res.
      PERFORM get_obj  USING  wa_res-objid.
      PERFORM get_ab   USING w1222-tabnr.
      PERFORM get_text tables z1222.
    ENDLOOP.
  ENDIF.
ENDFORM.                    "GET_TEXT
*&      Form  GET_OBJ
*       text
*      -->P_OB  text
*      -->P_OJ  text
FORM get_obj  USING p_oj.
  SELECT SINGLE * FROM hrp1222 INTO w1222 WHERE otype = 'O'
                                           AND objid = p_oj.
ENDFORM.                    " GET_OBJ
*&      Form  GET_AB
*       text
*      -->P_TAB  text
FORM get_ab  USING  p_tab.
  SELECT  * FROM hrt1222 INTO table z1222 WHERE tabnr = p_tab.
ENDFORM.                    " GET_AB
*&      Form  GET_TEXT
*       text
*      -->P_Z1222_LOW  text
FORM get_text  tables p_txt STRUCTURE hrt1222.
loop at p_txt.
if p_txt-low+0(1) = c_function.
    write p_txt-low to f_code.
  SELECT single vtext FROM zfunctiont INTO f_text  WHERE abtnr = p_txt-low.
    ELSEIf p_txt-low+0(1) = c_Proces.
      write p_txt-low to P_code.
     SELECT single vtext FROM ZPROCESST INTO   p_text  WHERE abtnr = p_txt-low.
      endif.
endloop.
ENDFORM.                    " GET_TEXT
form display_results.
  write :/ s_pernr,
          30 s_name.
  WRITE :/ f_code,
          30  f_text.
  WRITE :/ p_code,
          30  p_text.
  ULINE.
endform.
Thanks,
Chidanand

Similar Messages

  • For an Org Unit, how do we get all Reporting Org units (Also employees reporting to the sub org unit) & Employees ?

    Hi Experts,
    I have a very common requirement in SAP HCM ABAP development.
    For an Org Unit, how do we get all Reporting Org units(Also employees reporting to the sub org unit) & Employees ?
    I have tried using RH_STRUC_GET_MULTIPLE_ROOTS and RHPH_STRUCTURE_READ, but the evaluation path is insufficient to get all objects under it. I tried with both O-S-P and O-O-S-P evaluation paths and as per some constraints, I can’t create a customized evaluation path for a reason.
    I am using PNPCE database for user selection screen and user would be advising the Org unit. I even referred the standard transaction ‘S_AHR_61016495’ which is using PCH logical database.
    I would really appreciate if anyone could provide a solution for this. (Rewards guranteed )
    Kindly help.
    Thank you.
    Regards,
    Mahesh Konade

    Hi Alexandre,
    Although I could not respond in time, thank you so much for your prompt reply.
    I had used the same RHPH_STRUCTURE_READ and passed the appropriate values to it, but it did not populate the required results. I cross checked the results manually, may be some relations issue. But later I tried using RH_STRUC_GET_MULTIPLE_ROOTS and it worked fine.
    Meanwhile I had done a workaround with PCH and RH_STRUC_GET and it served the purpose of getting all the Org units, it’s reporting sub-org-units, positions and persons (The deepest structure from the root org unit advised on selection screen).
    The solution I used is, I captured the org-units advised on selection screen by user using PCH logical database and then by looping on sub-org units reporting to the main org-unit I populated related positions and persons holding them and assigned it to the PNPCE logical database.
    Thank you so much for the help.
    Regards,
    Mahesh Konade

  • Manager of an org unit

    Dear expert,
    My company use PA and stored only internal employees (P object) and no external sub contractor.
    Unfortunatly, an external sub contrator takes the management of an org unit ad interim (temporary),
    We do not want register this external people as person (object P),
    Have you an idea to allow him to manage org unit and approve leave request (for instance) ?
    Merci

    I suppose you have to customize new OADP service for MSS.
    New analysis way in transaction OOAW with objects: O - S - US - P  (maybe 012 S - US - connection )
    System recognize sap user as a manager of employee (MSS role needed).
    We realize manager's substitution in this way.

  • ECM spent budget was clean up when approval manager reject an org unit?

    Hi HR Experts,
    When an approval manager rejects an org unit, the spent budget of this org unit is clean up but the budget still distributed to each employee in that org in the infotype 0759 therefore leads to inconsistency of budget in ECM.
    Is there any body experience this issue?
    Thanks,
    Duy

    i lived through this painful process very much, we made a quick SM30 tcode transaction to be able to do data maintenace on HRPADPM - this is where the budget spent amount is actually saved. 
    the key for this table is stored on the budget unit to org unit relationship in HRP1001.
    if anyone has a better process to fix out sync spent budgets please let us know...

  • Manager of the org.unit in HRMD_A

    Hi All
    I would like to send manager of the org.unit by using HRMD_A.
    As I have setup HRMD_A with filter on Infotypes 0000, 0001, 0002, 0006, 1000 & 1001.
    I thought the manager relationship will be send in IT 1001. But I don't see that information include in HRMD_A.
    Any information or experience on this matter will be highly appreciated. Any other suggestions to how this problems can be solved are also welcome.
    Thanks in advance.
    Best regards,
    Anpan

    Yes as part of transaction BD64 you can create a filter for this. In fact I think you can limit it even further so that it filters just the managers.  You can  do this by not only selecting the infotype and object, but you can also limit is by 'related object' and subtype.  So you can put the B12 as the subtype ( I think this is the chief subtype).   
    You could also  use the evaluation path, but if your evaluation path generates too much data then you can limited using the filters in BD64.  
    As for using the change pointers programs versus PFAL I am not sure, I am currently having the same delima on which one to use.
    Everett

  • Get Employees under a manager

    Hi,
    How to get all the employees reporting to a manager based on the manager's personnel number.
    How to use this FM RH_STRUC_GET to find all the employees reporting to a manager with the pernr of the manager.
    Please reply at the earliest.
    Thanks

    Hi
    Give the following inputs for the FM RH_STRUC_GET
    ACT_OTYPE : O
    ACT_OBJID   :Manager's Org unit ID
    ACT_WEGID : MSSDIREC-Evaluation path(If you are looking only at the direct reportees)
    This combination gives you the Direct reportees of the Manger.
    Hope this helps you.
    Regards
    Devi

  • Finding employees 'under' manager in org.management in HR

    hi there,
    i have to know which employees are 'under' a person in org.management.
    e.g. i need to know all employees from a specific manager.
    is there any function call and/or method of class which can achive this ?
    best regards, Martin

    ACT_OTYPE                       P                      
    ACT_OBJID                       00078042               
    ACT_WEGID                       O_S_P                  
    ACT_INT_FLAG                                           
    ACT_PLVAR                       01                     
    ACT_BEGDA                       13.05.2008             
    ACT_ENDDA                       13.05.2008             
    ACT_TDEPTH                          0                  
    ACT_TFLAG                       X                      
    ACT_VFLAG                       X                      
    AUTHORITY_CHECK                 X                      
    TEXT_BUFFER_FILL                X                      
    BUFFER_MODE                     X                      
    this is what i pass............... in act_wegid i can put in also other names of eval.path, i got always the message with the agent
    reg, Martin

  • How to get the General Manager of an Org. Unit?

    Hi experts,
    Given a BP, I want to find out to which Org. Unit it belongs to and furthermore the name and email of the General Manager of that Org. Unit.
    Any hints or ideas on how to go about it?
    Thanks in advance.

    Hi,
    maybe one of this options will help you:
    - Function module CRM_ORGMAN_ORGOBJECTS_FIND_2
    - Method GET_ORG_UNIT_DETAILS  of class CL_CRM_PPM_UM_TOOLKIT
    good luck.
    Kind regards
    Manfred

  • FM or Table to get the BP ID of Root org unit

    Hello All
    We are triggering code from ECC which replicates Ship to Address to SRM.
    We want to know an FM or Table which will provide us with the BP # of the root org unit. ( Purchasing company)
    It is preferable if we don't have to hard code this.
    Thanks
    Kedar

    Hi Kedar,
    Create a custom table to store the business partner  of the root org unit or the company code and then use that table to get the BP and create ship to address for that org.
    The could BP will be different in different environmnet so you cannot hard code that .. also there is no function module to get the BP of the Root  org id or compnay code...
    there are FM and table to get all id of company code etc but all reuqire input busines spartner which you willhave to enter ...
    Thanks
    Iftekhar Alam

  • Permitting a Manager of one org unit access to another org unit

    Hi,
    I have a problem with the use of relationships between the position and org units.
    If a manager has an A012 relationship to org unit 123, but should be able to view & approve leave for employees from another org unit 456.
    Is it possible to have a different relationship to org unit 456? To provide access to employees who are not part of the managers direct reporting structure.
    Thanks in advance
    Sujeet

    1. Create a separate relationship for the special access.
    2. You might need to add the new relationship to evaluation path
    3. If you are using MSS and need to display this, that evaluation path needs to be updated
    4. Structural authorization profile needs to be updated
    5. Role needs to be updated. Context senstive authorization needs to be activated and PA authorization + structure abc, PA authorization + structure xyz needs to be added to the role
    Hope it help.

  • Evaluation Path: User - all Org-Units (TA OOAW, FM RH_GET_STRUCTURE)

    Hi,
    I am working on an Evaluation Path which gives me all hierarchies (Type O) above one user. I don't get it yet :-(. I tried:
    10     *     B     008     Inhaber     *     S
    40     S     A     002     berichtet (L) an     *     *
    Whats wrong? Thanks in advance.

    - done.

  • User under more Positions or Org Units

    Hi experts
    i'd like to know if there is a way (FM, Program, Transaction, BSP) to see how many Organizational Units or Positions are connected with the same User.
    I know that i can see it by PPOMA_BBP but it is not what i desire.
    regards
    andrea

    Hi
    As per standard SRM org structure, one user can hold in only one position at a time in the org structure. Are you facing any issue, please explain?
    Regards
    Kiran

  • How ti find employee's manager name

    Hi All,
    I tried in SDN but i am not able to find suitable thread. Anybody can tell me which function module i should use to get employee's manager name.
    Thanks,
    Maheedhar

    Maybe this could be achieved by RH_STRUC_GET but you need to provide proper ACT_WEGID . The custom way however would be like this
    DATA lt_p1001 TYPE TABLE OF p1001.
        DATA lt_manager TYPE TABLE OF p1001.
        DATA l_pernr    TYPE persno.
        DATA l_objid    TYPE HROBJID.
        FIELD-SYMBOLS: <wa_p1001>   LIKE LINE OF lt_p1001,
                       <wa_manager> LIKE LINE OF lt_manager.
    "get manager of EE's org unit
        CALL FUNCTION 'RH_READ_INFTY_1001'
          EXPORTING
            plvar            = '01'
            otype            = 'O'
            objid            = "EE org unit here
            begda            = sy-datum
            endda            = sy-datum
            subty            = 'B012'   "is managed by
          TABLES
            i1001            = lt_p1001
          EXCEPTIONS
            nothing_found    = 1
            wrong_condition  = 2
            wrong_parameters = 3
            OTHERS           = 4.
        LOOP AT lt_p1001 ASSIGNING <wa_p1001>
                         WHERE sclas = 'S'.  "position
          l_objid = <wa_p1001>-sobid.
    "get person for this position
          CALL FUNCTION 'RH_READ_INFTY_1001'
            EXPORTING
              plvar            = '01'
              otype            = 'S'
              objid            = l_objid
              begda            = sy-datum
              endda            = sy-datum
              subty            = 'A008'   "holds
            TABLES
              i1001            = lt_manager
            EXCEPTIONS
              nothing_found    = 1
              wrong_condition  = 2
              wrong_parameters = 3
              OTHERS           = 4.
          LOOP AT lt_manager ASSIGNING <wa_manager> WHERE sclas = 'P'.
            l_pernr = <wa_manager>-sobid.       
            EXIT.
          ENDLOOP.
        ENDLOOP.
    Manager -> l_pernr
    Manager name -> get from IT0002 for l_pernr
    Regards
    Marcin
    Juest checked FM HRCM_ORGUNIT_MANAGER_GET which is working too. On input you can either provide EE's position or org unit.
    Edited by: Marcin Pciak on Oct 28, 2010 9:12 AM

  • How to find the all the org units of chief org unit

    Hi All,
    i have one cheif org unit which belongs to IT. i Just need to take all the org units into one internal table upto last org unit.
    ex: 500000 is the chief org unit then we check that belongs to taht
    550000 and 560000
    and agian 550000 is having or units
    556000 and 557000 ....
    now requirement is now i input on 500000 on selection--screen and i need to get
    550000
    556000
    557000
    560000
    I used evaluation path as o-o and used call function 'HRCM_ORGSTRUC_INFO_TABLE_GET'.
    but able to get only the just next level org units.ie. 550000 and 560000 Not others ..So is there any way where we can find all the org units that comes under the MAIN ORG UNIT 5000000.
    waiting for your valuable inputs...
    Regards
    sas

    Hi
    Use the FM: RH_STRUC_GET with the evaluation path : ORGEH.
    If you are still not able to get the required results,then go to Tcode: OOAW and find the suitable evalution path for your requirement.
    Hope definetely u will get the results.
    Regards,
    Sreeram
    Edited by: Sreeram Kumar Madisetty on Apr 22, 2009 8:25 AM

  • BP - Employee relationships to an org unit and changes

    Dear Colleagues of CRM,
    The scenario pertains to an employee and its relationship to an org unit to which it is assigned. Once an employee is assigned to an org unit, a relationship too gets created with the Employee as BP. This relationship has the contact info that was available in the BP master data at that point of time.
    Later on, if the employee is transferred and hence assigned to another org unit, the assignment in the org unit is changed to the new org unit. On the new org unit assignment, a new relationship gets created with the BP. However, the earlier relationship doesn't get deleted when the earlier assignment to the org unit was deleted. If I attempt to delete the relationship in the BP, it doesn't allow and prompts to u201Cu2026.Change through the HR mastersu201D.  The HR master though has nothing of the contact details vis-à-vis this relationship.
    The existence of this initial relationship is causing error in all my dependent programs / activities which pick up the contact details of this employee and hence trigger emails etc.
    Request solution as to how do I remove this u2018oldu2019 and irrelevant relationship from the BP. It may be noted that the subsequent changes of assignment u2013 deletions in particular u2013 are deleting the relationship too but the initial one exists all throughout.
    Seek your kind advise to resolve the matter .
    Regards,
    Tariq

    Contact SAP they have given two custom reports to check and repair BUT050 entries when we have similar issue.
    Regards,
    Rajesh.

Maybe you are looking for

  • Need help for Visual Web application onkeydown event

    hi, I have create a visual web application. I have include a text field and a button in my webpage. When user press a key in the text field, i would like to change the button to enable. I try to use the keydown event to call the function in java pack

  • Mail in my sent box won't open if sent prior to 11/26/12

    I'm running OS X 10.7.4 and Mail 5.2. Today I needed to refer to an email I sent on 11/17.  When I clicked on it all I got is the spinning "loading" message and it never opened.  I tried clicking on some other sent emails and discovered that anything

  • Printing issue in Illustrator

    Hey all. One of my users is having an issue whenever she prints a multi page document in illustrator (usually on 11x17). Prior to printing, each page of the document is rotated from portrait to landscape, and then the document is saved. Once printed,

  • Mac Mini and Airport Utility

    Hello, I bought a Mac Mini last weekend, and I'm very happy with it so far, but I can't seem to be able to share my Internet connection wirelessly ..that's why I am trying to "find" the AirPort Utility. The Mac Mini came with Airport Extreme build-in

  • New Non-ASM Standby Trying to use ASM during recovery

    Oracle 11.2.0.3 on RH6 x86_64. Cross-posting from oracle-l. We have a database on ASM. We want to migrate to filesystem storage on same host (Oracle ZFS). Recommended path from Oracle is to create a standby and then do a failover when ready. Simple e