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

Q in Org Mgt .

Is any way(fn mod) to know the Employees respective manager's pernr ?

Rgds,

J.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 01, 2005 at 09:50 AM

    Hi Jothivenkatachalam,

    1. One way is to use the table

    hrp1001

    2. for this u also require

    plans and object type and relationship

    3. code of my Y function module is

    DATA :org1001 TYPE hrp1001.

    DATA :next1001 TYPE hrp1001.

    *----


    Reset

    pernr = ''.

    *----


    Fetch

    SELECT SINGLE *

    FROM hrp1001

    INTO org1001

    WHERE otype = otype

    AND objid = objid

    AND rsign = rsign

    AND relat = relat

    AND begda <= ondate

    AND endda >= ondate.

    IF sy-subrc = 0.

    SELECT SINGLE *

    FROM hrp1001

    INTO next1001

    WHERE otype = 'S'

    AND objid = org1001-sobid

    AND rsign = 'A'

    AND relat = '008'

    AND begda <= ondate

    AND endda >= ondate.

    pernr = next1001-sobid.

    ENDIF.

    4. IMPORTING PARAMETERS ARE

    OTYPE TYPE OTYPE

    OBJID TYPE HROBJID

    RSIGN TYPE RSIGN

    RELAT TYPE RELAT

    ONDATE TYPE SY-DATUM

    5. CHANGING IS (for manager pernr)

    PERNR TYPE PERSNO

    Just go thru the above code .

    Hope the above helps.

    Regards,

    Amit M.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 01, 2005 at 09:54 AM
        SELECT KOKRS KOSTL UP TO 1 ROWS
    *            INTO (PA0001-KOKRS, PA0001-KOSTL)
    *            FROM PA0001
    *            WHERE PERNR = PA0105-PERNR
    *              AND BEGDA <= SY-DATUM
    *              AND ENDDA >= SY-DATUM.
    *        ENDSELECT.
    *        IF SY-SUBRC = 0.
    *          CALL FUNCTION 'BAPI_COSTCENTER_GETDETAIL'
    *            EXPORTING
    *              CONTROLLINGAREA  = PA0001-KOKRS
    *              COSTCENTER       = PA0001-KOSTL
    *              DATE             = SY-DATUM
    *            IMPORTING
    *              PERSON_IN_CHARGE = INCHARGE.
    *          IF SY-SUBRC = 0.
    *            WA_USR_MANAGER-USNAM = WA_MATDOC_TMP-USNAM.
    *            WA_USR_MANAGER-INCHARGE = INCHARGE.
    *            APPEND WA_USR_MANAGER TO IT_USR_MANAGER.
    *          ENDIF.
    *        ENDIF.

    from pernr get kokrs and costl from pa0001 then call this fm, it will give <b>INCHARGE</b> (supervisor).

    hope this solves

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 01, 2005 at 10:28 AM

    Hi,

    You can get it from the table <b>HRP1001</b>.

    *Get supervisor's position id
        CLEAR hrp1001.
        SELECT sobid INTO e_supv_pos
               FROM hrp1001
               WHERE otype = 'O'
                 AND objid = e_orgunit
                 AND plvar = '01'
                 AND rsign = 'B'
                 AND relat = '012'
                 AND istat = '1'
                 AND begda LE i_effdate
                 AND endda GE i_effdate
                 AND sclas = 'S'.
        ENDSELECT.
    
    * Get supervisor's personnel number
        CLEAR hrp1001.
        SELECT sobid INTO hrp1001-sobid
               FROM hrp1001
         WHERE otype = 'S'
         AND objid = e_supv_pos
         AND plvar = '01'
         AND istat = '1'
         AND rsign = 'A'
         AND relat = '008'
         AND sclas = 'P'
         AND begda LE i_effdate
         AND endda GE i_effdate.
        ENDSELECT.
    
        IF sy-subrc EQ 0.
          MOVE hrp1001-sobid+0(8) TO e_supv_pernr.
    
    * Get supervisor's userid
          SELECT usrid INTO e_supv_userid
          FROM pa0105
          WHERE pernr = e_supv_pernr
            AND subty = '0001'
            AND begda LE i_effdate
            AND endda GE i_effdate.
          ENDSELECT.
    
    * Get supervisor's name
          SELECT sname INTO e_supv_name
          FROM pa0001
          WHERE pernr = e_supv_pernr
            AND begda LE i_effdate
            AND endda GE i_effdate.
          ENDSELECT.
        ENDIF.
    
    

    And also check the function module <b>RH_GET_LEADING_POSITION</b>.

      DATA: dl_supvsr(10) ,
            dl_supvsrno(8) .
    
      CLEAR dg_sobid .
      dg_sobid = dg_pernr . " Employee no
    
      CALL FUNCTION 'RH_GET_LEADING_POSITION'
           EXPORTING
                plvar             = '01'
                otype             = 'P'
                sobid             = dg_sobid
                date              = sy-datum
    *            AUTH              = 'X'
    *            BUFFER_MODE       = ' '
           TABLES
                leading_pos       = dt_supervisor
           EXCEPTIONS
                no_lead_pos_found = 1
                OTHERS            = 2 .
    
      IF sy-subrc = 0 .
        LOOP AT dt_supervisor .
    
          SELECT SINGLE sobid FROM hrp1001
                INTO dl_supvsr
                WHERE objid = dt_supervisor-objid AND
                      otype = 'S'  AND
                      rsign = 'A'  AND
                      relat = '008' AND
                      plvar = '01' AND
                      istat = 1     AND
                      endda >= sy-datum AND
                      begda <= sy-datum AND
                      sclas  = 'P' .
    
          IF sy-subrc = 0.
            dl_supvsrno = dl_supvsr+0(8) .
            EXIT.
          ENDIF.
        ENDLOOP.
    
    * Get Supervisor Name
        SELECT SINGLE ename INTO dt_emp-supervisor
        FROM pa0001
               WHERE pernr = dl_supvsrno
               AND   endda GE sy-datum
               AND   begda LE sy-datum.
    
    * Get Supervisor's work phone no
    
        SELECT SINGLE usrid
        FROM pa0105
        INTO dt_emp-super_extn
        WHERE pernr = dl_supvsrno
        AND   subty = 'WORK'
        AND   endda GE sy-datum
        AND   begda LE sy-datum.
      ENDIF.
    
    

    Thanks & Regards,

    Siri.

    Message was edited by: Srilatha T

    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.