技术开发 频道

SAP的HR函数

【IT168 技术文章】

    HOLIDAY_CHECK_AND_GET_INFO Useful for determining whether or not a date is a holiday. Give the function a date, and a holiday calendar, and you can determine if the date is a holiday by checking the parameter HOLIDAY_FOUND.


    Example:

    data: ld_date like scal-datum default sy-datum,
    lc_holiday_cal_id like scal
-hcalid default 'CA',
    ltab_holiday_attributes like thol occurs
0 with header line,
    lc_holiday_found like scal
-indicator.

    CALL FUNCTION
'HOLIDAY_CHECK_AND_GET_INFO'
    EXPORTING
    date
= ld_date
    holiday_calendar_id
= lc_holiday_cal_id
    WITH_HOLIDAY_ATTRIBUTES
= 'X'
    IMPORTING
    HOLIDAY_FOUND
= lc_holiday_found
    tables
    holiday_attributes
= ltab_holiday_attributes
    EXCEPTIONS
    CALENDAR_BUFFER_NOT_LOADABLE
= 1
    DATE_AFTER_RANGE
= 2
    DATE_BEFORE_RANGE
= 3
    DATE_INVALID
= 4
    HOLIDAY_CALENDAR_ID_MISSING
= 5
    HOLIDAY_CALENDAR_NOT_FOUND
= 6
    OTHERS
= 7.

    
if sy-subrc = 0 and
    lc_holiday_found
= 'X'.
    write:
/ ld_date, 'is a holiday'.
    
else.
    write:
/ ld_date, 'is not a holiday, or there was an error calling the function'.
    endif.

 

    HOLIDAY_GET Provides a table of all the holidays based upon a Factory Calendar &/ Holiday Calendar.

    HR_BEN_GET_FROM_FEATURE_BAREA Call the HR feature to determine the Benefit Area for an employee

    HR_BEN_GET_FROM_FEATURE_BENGR Call the HR feature to determine the Benefit Group for an employee

    HR_BEN_GET_FROM_FEATURE_BSTAT Call the HR feature to determine the Benefit Status for an employee

    HR_BEN_GET_FROM_FEATURE_COVGR Call the HR feature to determine the Cover Group for an employee

    HR_BEN_GET_FROM_FEATURE_CSTV1 Call the HR feature to determine the CSTV1 feature for an employee

    HR_BEN_GET_FROM_FEATURE_EECGR Call the HR feature to determine the Employee Cost Group for an employee

    HR_BEN_GET_FROM_FEATURE_ELIGR Call the HR feature to determine the Eligiblity Group for an employee

    HR_BEN_GET_FROM_FEATURE_ERCGR Call the HR feature to determine the Employer Cost Group for an employee

    HR_BEN_GET_FROM_FEATURE_EVTGR Evaluate the EVTGR feature for an employee

    HR_BEN_GET_FROM_FEATURE_FLXGR Evaluate the FLXGR feature for an employee

    HR_BEN_GET_FROM_FEATURE_LDAYW Evaluate the LDAYW feature for an employee

    HR_BEN_GET_FROM_FEATURE_LRPGR Evaluate the LRPGR feature for an employee

    HR_BEN_GET_FROM_FEATURE_TRMGR Evaluate the TRMGR feature for an employee

    HR_BEN_GET_FROM_FEATURE_VARGU Evaluate the VARGU feature for an employee

    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. Also see the additional documentation here.

    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_INFOTYPE_OPERATION BAPI function module to create/change infotypes in HR


    Example:

    REPORT ZZKNB_BAPI_INFOTYPE_CALL .

    
* Use 'BAPI_EMPLOYEE_ENQUEUE' to lock the employee before updating
    DATA: l_bapireturn LIKE bapireturn1.

    DATA: bapipakey_tab LIKE bapipakey OCCURS
0 WITH HEADER LINE.

    data: l_p0169 like p0169.

    parameters: p_pernr like p0169
-pernr default '07000003'.

    start
-of-selection.

    CALL FUNCTION
'BAPI_EMPLOYEE_ENQUEUE'
    EXPORTING
    number
= p_pernr
    IMPORTING
    
return = l_bapireturn.

    IF l_bapireturn
-id NE space.
    WRITE:
/ l_p0169-pernr, 'Enqueue failed'.
    exit.
    ENDIF.

    
*-- Suported operations:
    
*-- change (operation = 'MOD')
    
*-- Create (operation = 'INS')
    
*-- DELETE (operation = 'DEL')
    
*-- CREATESUCCESSOR (operation = 'COP')
    .
    l_p0169
-barea = '7A'.
    l_p0169
-pltyp = 'RRSP'.
    l_p0169
-bplan = 'RRSP'.
    l_p0169
-elidt = '20000101'.
    l_p0169
-enrty = 'M'.
    l_p0169
-perio = '4'.

    CALL FUNCTION
'HR_INFOTYPE_OPERATION'
    EXPORTING
    infty
= '0169'
    subty
= 'RRSP'
    number
= p_pernr
    record
= l_p0169
    validitybegin
= '20021001'
    validityend
= '99991231'
    operation
= 'INS'
    
* dialog_mode = '0' "Use default
    * nocommit = '1' "Use default
    IMPORTING
    
return = l_bapireturn
    key
= bapipakey_tab.

    IF l_bapireturn
-id NE space.
    WRITE:
/ p_pernr,
    
20 'Create was unsuccessful',
    l_bapireturn
-id,
    l_bapireturn
-message+0(40).
    ELSE.
    WRITE:
/ p_pernr,
    
20 'Create was successful',
    l_bapireturn
-id,
    l_bapireturn
-message+0(40).
    ENDIF.


    
* Use 'BAPI_EMPLOYEE_DEQUEUE' to un-lock the employee before updating
    CALL FUNCTION
'BAPI_EMPLOYEE_DEQUEUE'
    EXPORTING
    number
= l_p0169-pernr
    IMPORTING
    
return = l_bapireturn.

 

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

    Example:

 

    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_READ_INFOTYPE generic PA infotype read with authorization checks

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

    Example:

    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

 

    HRWPC_RFC_ABKRS_TEXT_GET Get text description for Payroll Area

    HRWPC_RFC_ANRED_TEXT_GET Get text description for Title

    HRWPC_RFC_ANSVH_TEXT_GET Get text description for Work Contract

    HRWPC_RFC_BLAND_TEXT_GET Get text description for Tax Region

    HRWPC_RFC_BTRTL_TEXT_GET Get text description for Personnel Subarea

    HRWPC_RFC_BUKRS_TEXT_GET Get text description for Company Code

    HRWPC_RFC_BVMRK_TEXT_GET Get text description for Processing indicator

    HRWPC_RFC_COMTY_TEXT_GET Get text description for Type of control recipe destination

    HRWPC_RFC_COUNC_TEXT_GET Get text description for County Code

    HRWPC_RFC_CURCY_TEXT_GET Get text description for Currency Key

    HRWPC_RFC_EVGRD_TEXT_GET Get text description for Evaluation Group

    HRWPC_RFC_FAMEI_TEXT_GET Get text description for Family Characteristics  HRWPC_RFC_FAMST_TEXT_GET Get text description for Marital Status Key

    HRWPC_RFC_FISTL_TEXT_GET Get text description for Funds Center

    HRWPC_RFC_FREQU_TEXT_GET Get text description for Period

    HRWPC_RFC_GEBER_TEXT_GET Get text description for Funds

    HRWPC_RFC_GESCH_TEXT_GET Get text description for Gender Key

    HRWPC_RFC_GSBER_TEXT_GET Get text description for Business Area

    HRWPC_RFC_IT0XXX_TEXT_GET Get text stored on the infotype

    HRWPC_RFC_JCODE_TEXT_GET Get text description for Survery Job

    HRWPC_RFC_KOKRS_TEXT_GET Get text description for Controlling Area

    HRWPC_RFC_KONFE_TEXT_GET Get text description for Religious Denomination Key

    HRWPC_RFC_KOSTL_TEXT_GET Get text description for Cost Center

    HRWPC_RFC_LAND_TEXT_GET Get text description for Country of company

    HRWPC_RFC_MASSG_TEXT_GET Get text description for Reason for Action

    HRWPC_RFC_MASSN_TEXT_GET Get text description for Action Type

    HRWPC_RFC_MOLGA_TEXT_GET Get text description for Country Grouping

    HRWPC_RFC_NAMZ2_TEXT_GET Get text description for Name Affix for Name at Birth

    HRWPC_RFC_NAMZU_TEXT_GET Get text description for Other Title

    HRWPC_RFC_NATIO_TEXT_GET Get text description for Nationality

    HRWPC_RFC_ORGEH_TEXT_GET Get text description for Organizational Unit

    HRWPC_RFC_OTYPE_TEXT_GET Get text description for Object Type

    HRWPC_RFC_PERSG_TEXT_GET Get text description for Employee Group

    HRWPC_RFC_PERSK_TEXT_GET Get text description for Employee Subgroup

    HRWPC_RFC_PLANS_TEXT_GET Get text description for Position

    HRWPC_RFC_PLVAR_TEXT_GET Get text description for Plan Version

    HRWPC_RFC_RAILW_TEXT_GET Get text description for Social Subscription Railway

    HRWPC_RFC_SACHX_TEXT_GET Get text description for Administrator

    HRWPC_RFC_SPRSL_TEXT_GET Get text description for Language Key

    HRWPC_RFC_STATV_TEXT_GET Get text description for Statistics indicator for pensions

    HRWPC_RFC_STELL_TEXT_GET Get text description for Job

    HRWPC_RFC_STRDS_TEXT_GET Get text description for Street Abbreviation

    HRWPC_RFC_SUBTY_0XXX_TEXT_GET Get text description for Subtype

    HRWPC_RFC_SUBTY_1XXX_TEXT_GET Get text description for Subtype

    HRWPC_RFC_TITEL_TEXT_GET Get text description for Title

    HRWPC_RFC_TITL2_TEXT_GET Get text description for Second Title

    HRWPC_RFC_TMART_TEXT_GET Get text description for Task Type

    HRWPC_RFC_VDSK1_TEXT_GET Get text description for Organizational Key

    HRWPC_RFC_VORS2_TEXT_GET Get text description for Second Name Prefix

    HRWPC_RFC_VORSW_TEXT_GET Get text description for Name Prefix

    HRWPC_RFC_WERKS_TEXT_GET Get text

0
相关文章