Tuesday, August 20, 2013

Function module HRCM_ORGUNIT_EMPLOYEE_LIST_GET is used to get the list employees under one org.Unit.


REPORT ZTEST_PRG1.

DATA PLVAR          TYPE PLOG-PLVAR.
DATA OTYPE          TYPE PLOG-OTYPE.
DATA OBJID          TYPE PLOG-OBJID.
DATA BEGDA          TYPE SY-DATUM.
DATA ENDDA          TYPE SY-DATUM.
DATA PATH_ID        TYPE T778A-WEGID.
DATA PERNR_TABLE    TYPE STANDARD TABLE OF HRPERNR.
DATA LS_PERNR_TABLE TYPE HRPERNR.

PLVAR   = '01'.
OTYPE   = 'O'.
OBJID   = '10501076'.  "Org Unit
BEGDA   = SY-DATUM.
ENDDA   = SY-DATUM.
PATH_ID = 'O-S-P'.

CALL FUNCTION 'HRCM_ORGUNIT_EMPLOYEE_LIST_GET'
  EXPORTING
    PLVAR              = PLVAR
    OTYPE              = OTYPE
    OBJID              = OBJID
    BEGDA              = BEGDA
    ENDDA              = ENDDA
    PATH_ID            = PATH_ID
  TABLES
    PERNR_TABLE        = PERNR_TABLE
  EXCEPTIONS
    PATH_ERROR         = 1
    ROOT_ERROR         = 2
    NO_EMPLOYEES_FOUND = 3.

LOOP AT PERNR_TABLE INTO LS_PERNR_TABLE.
  WRITE:/ LS_PERNR_TABLE-PERNR.
ENDLOOP.

Function module RH_DIR_ORG_STRUC_GET

REPORT ZTEST_PRG2.
DATA ACT_ORGUNIT    TYPE OBJEC-OBJID.
DATA ACT_PLVAR      TYPE OBJEC-PLVAR.
DATA ACT_DATE       TYPE SY-DATUM.
DATA PERSON_TAB     TYPE STANDARD TABLE OF RHLDAPP.
DATA LS_PERSON_TAB  TYPE RHLDAPP.

ACT_ORGUNIT = '10501076'.  "Org Unit
ACT_PLVAR   = '01'.
ACT_DATE    = SY-DATUM.

CALL FUNCTION 'RH_DIR_ORG_STRUC_GET'
  EXPORTING
    ACT_ORGUNIT     = ACT_ORGUNIT
    ACT_PLVAR       = ACT_PLVAR
    ACT_DATE        = SY-DATUM
  TABLES
    PERSON_TAB      = PERSON_TAB
  EXCEPTIONS
    NO_ACTIVE_PLVAR = 1.

0 comments:

Post a Comment

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.