设中国护士网为首页 | 中国护士网专注于知识的分享,因为专注,所以更好!
分享到:

SAP HR 常用函数

来源:  作者:

    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.