SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

HR functional modules



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> HR
View previous topic :: View next topic  
Author Message
Lord
Профессионал
Профессионал



Joined: 10 Sep 2007
Posts: 168

PostPosted: Wed Sep 19, 2007 3:20 pm    Post subject: HR functional modules Reply with quote

HR_DISPLAY_BASIC_LIST - is an HR function, but can be used for any data. You pass it data, and column headers, and it provides a table control with the ability to manipulate the data, and send it to Word or Excel.

LIST_LEVEL - List level in the Table Control. This value is useful only if the function module is called several times from a single program. This value must be maintained manually in the program. The main use of the list level is to allow the use of multiple configurations for the Table Control.

ADDITIONAL_OPTIONS - With this parameter further options can be transferred. The following specification is supported:
NO_WORD The call to MS Word is not offered on the display.

NO_EXCEL The call to MS Excel is not offered on the display.

START_WORD Start MS Word on the local PC

START_EXCEL Start MS Excel on the local PC

START_ROW In the stringer Addition_Options is located to START_ROW:xxxx, whereby xxxx a valid line number of the DATA_TAB

MAILUSER:xxxxxxx The data are sent darkly as Mail to the indicated Mailuser. The FB is afterwards left directly. It takes place thus no further output.

NO_IMG this function can be used in connection with the error table ERROR_TAB. In the Additonal_Options if the stringer NO_IMG is specified, then no Moeglichgkeit consists to branch into the Custominzing (IMG) in the error list. o LINESELMODE:1 is set, then only one line in the TableControl can be marked.

WORD_DOCUMENT - If the form letter fields in an existing Word document are to be merged, then the name of the Word of document which can be transferred. The functional module checks whether the indicated document exists. If this file is present, then it is loaded. If the file is not found a selection box is displayed, and a new file name can be input.

The name of the document must be complete i.e. with path specification and ending DOC.

Code:
REPORT ZKBTST25.

TABLES:
  MARAV.

DATA: BEGIN OF MTAB_MATERIALS OCCURS 0,
        MATNR LIKE MARAV
        VPSTA LIKE MARAV
        PSTAT LIKE MARAV
        MAKTX LIKE MARAV
      END OF MTAB_MATERIALS.

DATA: BEGIN OF MTAB_FIELDNAMES OCCURS 3,
      TITLE(60) TYPE C,
      TABLE(6)  TYPE C,
      FIELD(10) TYPE C,
      TYPE(1)   TYPE C,
      END OF MTAB_FIELDNAMES.

START

  SELECT * UP TO 500 ROWS FROM MARAV INTO CORRESPONDING FIELDS OF TABLE
    MTAB_MATERIALS.

END
  PERFORM SETUP_COLUMN_HEADERS.

  CALL FUNCTION 'HR_DISPLAY_BASIC_LIST'
       EXPORTING
            BASIC_LIST_TITLE     = 'Test of list form MM'
            FILE_NAME            = SY
*         HEAD_LINE1           = ' '
*         HEAD_LINE2           = ' '
*         FOOT_NOTE1           = ' '
*         FOOT_NOTE2           = ' '
*         FOOT_NOTE3           = ' '
*         lay_out              = 0
*         DYN_PUSHBUTTON_TEXT1 =
*         DYN_PUSHBUTTON_TEXT2 =
*         DYN_PUSHBUTTON_TEXT3 =
*         DYN_PUSHBUTTON_TEXT4 =
*         DYN_PUSHBUTTON_TEXT5 =
*         DYN_PUSHBUTTON_TEXT6 =
*         DATA_STRUCTURE       = ' '
*         HEAD_LINE3           = ' '
*         HEAD_LINE4           = ' '
*         CURRENT_REPORT       =
*         LIST_LEVEL           = ' '
*         ADDITIONAL_OPTIONS   = ' '
*         WORD_DOCUMENT        =
*    IMPORTING
*         RETURN_CODE          =
       TABLES
            DATA_TAB             = MTAB_MATERIALS
            FIELDNAME_TAB        = MTAB_FIELDNAMES
*         SELECT_TAB           =
*         ERROR_TAB            =
       EXCEPTIONS
            DOWNLOAD_PROBLEM     = 1
            NO_DATA_TAB_ENTIRIES = 2
            TABLE_MISMATCH       = 3
            PRINT_PROBLEMS       = 4
            OTHERS               = 5.

*
*       FORM SETUP_COLUMN_HEADERS                 *
*
*       ........              *
*
FORM SETUP_COLUMN_HEADERS.

  MTAB_FIELDNAMES
  MTAB_FIELDNAMES
  MTAB_FIELDNAMES
  MTAB_FIELDNAMES
  append MTAB_FIELDNAMES.

  MTAB_FIELDNAMES
  MTAB_FIELDNAMES
  MTAB_FIELDNAMES
  MTAB_FIELDNAMES
  APPEND MTAB_FIELDNAMES.

  MTAB_FIELDNAMES
  MTAB_FIELDNAMES
  MTAB_FIELDNAMES
  MTAB_FIELDNAMES
  APPEND MTAB_FIELDNAMES.

  MTAB_FIELDNAMES
  MTAB_FIELDNAMES
  MTAB_FIELDNAMES
  MTAB_FIELDNAMES
  APPEND MTAB_FIELDNAMES.

ENDFORM.           " SETUP_COLUMN_HEADERS


HR_GET_LEAVE_DATA - Get all leave information (includes leave entitlement, used holidays/paid out holidays)

HR_IE_NUM_PRSI_WEEKS - Return the number of weeks between two dates.

HR_PAYROLL_PERIODS_GET - Get the payroll period for a particular date. (provided by Francois Henrotte)
Code:

  DATA: IT_T549Q TYPE T549Q OCCURS 0 WITH HEADER LINE,
        IT_ZL TYPE PC2BF OCCURS 0 WITH HEADER LINE.

  W_BEGDA = '20010101'.
  W_PERNR = '00000001'.

  CALL FUNCTION 'HR_PAYROLL_PERIODS_GET'
       EXPORTING
            get_begda       = w_begda
       TABLES
            get_periods     = it_t549q
       EXCEPTIONS
            no_period_found = 1
            no_valid_permo  = 2.
  CHECK sy-subrc = 0.

  CALL FUNCTION 'HR_TIME_RESULTS_GET'
       EXPORTING
            get_pernr             = w_pernr
            get_pabrj             = it_t549q-pabrj
            get_pabrp             = it_t549q-pabrp
       TABLES
            get_zl                = it_zl
       EXCEPTIONS
            no_period_specified   = 1
            wrong_cluster_version = 2
            no_read_authority     = 3
            cluster_archived      = 4
            technical_error       = 5.

NOTE: it_zl-iftyp = 'A'   absence
      it_zl-iftyp = 'S'   at work


HR_TIME_RESULTS_GET - Get the time results for a payroll period. (provided by Francois Henrotte)
Code:

  DATA: IT_T549Q TYPE T549Q OCCURS 0 WITH HEADER LINE,
        IT_ZL TYPE PC2BF OCCURS 0 WITH HEADER LINE.

  W_BEGDA = '20010101'.
  W_PERNR = '00000001'.

  CALL FUNCTION 'HR_PAYROLL_PERIODS_GET'
       EXPORTING
            get_begda       = w_begda
       TABLES
            get_periods     = it_t549q
       EXCEPTIONS
            no_period_found = 1
            no_valid_permo  = 2.
  CHECK sy-subrc = 0.

  CALL FUNCTION 'HR_TIME_RESULTS_GET'
       EXPORTING
            get_pernr             = w_pernr
            get_pabrj             = it_t549q-pabrj
            get_pabrp             = it_t549q-pabrp
       TABLES
            get_zl                = it_zl
       EXCEPTIONS
            no_period_specified   = 1
            wrong_cluster_version = 2
            no_read_authority     = 3
            cluster_archived      = 4
            technical_error       = 5.

NOTE: it_zl-iftyp = 'A'   absence
      it_zl-iftyp = 'S'   at work


RH_GET_ACTIVE_WF_PLVAR - Return the active HR Plan

RHP0_POPUP_F4_SEARK - is a matchcode for any type of HR Planning object, including the possibility to fill the field that you want
Examples: search for any organizational structure

F4 = 'X'
PLVAR = '01'
OTYPE = 'O '

search for any persons

F4 = 'X'
PLVAR = '01'
OTYPE = 'P '

MULTI_SELECT = 'X' to allow multiple selection
EASY = 'X' for user-dependent matchcode

Unfortunately, the use of table BASE_OBJIDS is disabled, so you can't specify
a root for the hierarchy you display

SWD_HELP_F4_ORG_OBJECTS - HR Matchcode tailored for organizational units. Includes a button so that you can browse the hierarchy too.

BAPI_PERSDATA_CHANGE - Change personal data

BAPI_PERSDATA_CREATE - Create personal data

BAPI_PERSDATA_CREATESUCCESSOR - Create subs.personal data record

BAPI_PERSDATA_DELETE - Delete personal data

BAPI_PERSDATA_DELIMIT - Delimit personal data validity period

BAPI_PERSDATA_GETDETAIL - Read personal data

BAPI_PERSDATA_GETDETAILEDLIST - Read instances with data

BAPI_PERSDATA_GETLIST - Read instances

BAPI_PERSDATA_SIMULATECREATION - Simulation: Create personal data

HR_INFOTYPE_OPERATION - create or update the employee record

Code:

Report z_update_PA0001.
*Data
DATA : P0001 LIKE P0001.
DATA : RETURN LIKE BAPIRETURN1.
DATA : KEY LIKE BAPIPAKEY.
DATA : RETURNE LIKE BAPIRETURN1 .

*Values (Change as per Requirement)
P0015-PERNR = '1'.
P0015-BEGDA = '2061101'.
P0015-ENDDA = '2061101'.

*First Enqu
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
  EXPORTING
    NUMBER = p0001-pernr
  IMPORTING
    RETURN = RETURNE.

*Update
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
  EXPORTING
    INFTY = '001'
    NUMBER = P0001-PERNR
    SUBTYPE = P0001-SUBTY
    OBJECTID = P0001-OBJPS
    LOCKINDICATOR = P0001-SPRPS
    VALIDITYEND = P0001-ENDDA
    VALIDITYBEGIN = P0001-BEGDA
    RECORDNUMBER = P0001-SEQNR
    RECORD = P0001
    OPERATION = 'INS'
    TCLAS = 'A'
    DIALOG_MODE = '0'
  IMPORTING
    RETURN = RETURN
    KEY = KEY.

IF RETURN IS NOT INITIAL.
  WRITE :/ 'Error Occurred'.
ENDIF.

* Dequeue
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
NUMBER = P0001-PERNR.


RH_READ_OBJECT - Read infotype 1002 data.

Code:
  CALL FUNCTION 'RH_READ_OBJECT'
    EXPORTING
      plvar     = wa_hrv1002a-plvar
      otype     = wa_hrv1002a-otype
      objid     = wa_hrv1002a-objid
      begda     = wa_hrv1002a-begda
      endda     = wa_hrv1002a-endda
    IMPORTING
      obeg      = wa_etype-etbeg
      oend      = wa_etype-etend
      short     = wa_etype-etsht
      stext     = wa_etype-etstx
    EXCEPTIONS
      not_found = 1
      OTHERS    = 2.


BAPI_BUS_EVENT_LIST - Retrieve actual scheduled occurance of course.

Code:
  CALL FUNCTION 'BAPI_BUS_EVENT_LIST'
    EXPORTING
      plvar                   = '01'
      objid                   = gd_objid
      begin_date              = gd_begda  "'20040101'
      end_date                = gd_endda  "'99991231'
    TABLES
      event_list              = it_elist 
    EXCEPTIONS
      NO_EVENTS               = 1
      NO_ACTIVE_PLVAR         = 2
      UNKNOWN_EXCEPTION       = 3
      OTHERS                  = 4.

BAPI_BUS_EVENTTYPE_INFO - Retrieve business event type(BET) data (Global description of course).
Such as description, suitablility, tutors, other relationship details etc

Code:
  CALL FUNCTION 'BAPI_BUS_EVENTTYPE_INFO'
    EXPORTING
      plvar             = '01'
      objid             = gd_etyid
      begin_date        = gd_begda  "'20040101'
      end_date          = gd_endda  "'99991231'
    TABLES
      eventtype_desc    = it_evttypedesc
    EXCEPTIONS
      root_not_found    = 1
      no_active_plvar   = 2
      unknown_exception = 3
      OTHERS            = 4.

BAPI_BUS_EVENT_INFO - Retrieve business event(BE) data (Actual occurance of course).
Such as description, suitablility, tutors, other relationship details etc. Data entered at this level should be used instead of that found at BET level
Code:
  CALL FUNCTION 'BAPI_BUS_EVENT_INFO'
    EXPORTING
      plvar                   = '01'
      objid                   = objid
      begin_date              = gd_begda     "'20040101'
      end_date                = gd_endda    "'99991231'
      language                = 'E'
    TABLES
      event_desc              = it_evtdesc
      event_resou             = it_evtresou
      event_quali             = it_evtquali
    EXCEPTIONS
      no_root_found           = 1
      no_active_plvar         = 2
      unknown_exception       = 3
      OTHERS                  = 4.


RH_READ_EVENT_SCHEDULE - Retrieve schedule information of course instance such as date(s) and time(s).
Code:
  CALL FUNCTION 'RH_READ_EVENT_SCHEDULE'
    TABLES
      eventlist     = it_eventlist
      schedule_tab  = it_schedule
    EXCEPTIONS
      nothing_found = 1
      OTHERS        = 2.


'RH_GET_ACTORS' - Resolve Role

Code:

FUNCTION z_tr3_godk_i_gruppe.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     VALUE(PURGRP) LIKE  T024-EKGRP
*"  TABLES
*"      APPROVER STRUCTURE  SWHACTOR
*"  EXCEPTIONS
*"      ERROR
*"----------------------------------------------------------------------

  DATA: lt_cont TYPE swcont OCCURS 0 WITH HEADER LINE,
        lt_0105 TYPE pa0105 OCCURS 0 WITH HEADER LINE,
        lv_pernr TYPE pernr_d,
        lv_sobid LIKE hrp1001-sobid,
        lv_plvar LIKE hrp1001-plvar,
        lt_APPROVER TYPE swhactor OCCURS 0 WITH HEADER LINE.

  REFRESH: lt_cont, lt_APPROVER, APPROVER.

  lt_cont-element = 'PURCHASINGGROUP'.
  lt_cont-value   = purgrp.
  APPEND lt_cont.

  CALL FUNCTION 'RH_GET_ACTORS'
    EXPORTING
      act_object                      = 'AC96100002'
*   ACT_TASK                        =
*   ACT_WI_ID                       =
*   ACT_PLVAR                       =
      search_date                     = sy-datum
    TABLES
      actor_container                 = lt_cont
*   EXCLUDED_AGENTS                 =
      actor_tab                       = lt_APPROVER
*   ERROR_TAB                       =
   EXCEPTIONS
     no_active_plvar                 = 1
     no_actor_found                  = 2
     exception_of_role_raised        = 3
     no_valid_agent_determined       = 4
     OTHERS                          = 5
            .
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 RAISING error.
  ENDIF.

  LOOP AT lt_APPROVER.
* APPROVERtype US
    IF lt_APPROVER-otype = 'US'.
      APPROVER-otype = 'US'.
      APPROVER-objid = lt_APPROVER-objid.
    ENDIF.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> HR All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.