记录一下用过的几个HR函数,备忘
信息类型获取:适用于单个人员编号查询
<style></style> CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
* TCLAS = 'A'
pernr = ps_zpernr "人员编号
infty = ps_field "信息类型
begda = ps_bdate "开始时间
endda = ps_edate "结束时间
* BYPASS_BUFFER = ' '
* LEGACY_MODE = ' '
IMPORTING
subrc = lv_subrc
TABLES
infty_tab = pt_tab ”查询结果内表
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
信息类型修改:单个人员编号单个信息类型修改
<style></style> CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE' "锁定人员编号
EXPORTING
number = lt_pa0022-pernr.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '0022'
number = lt_pa0022-pernr "人员编号
record = lt_pa0022 "修改内容,需要参考p****结构,不能参考pa表
operation = lv_actio "操作方式(INS/MOD/DEL)
validityend = ls_pa0022-endda
validitybegin = ls_pa0022-begda
IMPORTING
return = lt_bapireturn. "返回消息
<style></style>
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE' "解锁人员编号
EXPORTING
number = lt_pa0022-pernr.