员工信息代码.docx
《员工信息代码.docx》由会员分享,可在线阅读,更多相关《员工信息代码.docx(12页珍藏版)》请在冰豆网上搜索。
![员工信息代码.docx](https://file1.bdocx.com/fileroot1/2023-2/1/19b1d07a-a149-46df-abf6-812f8fbdbd51/19b1d07a-a149-46df-abf6-812f8fbdbd511.gif)
员工信息代码
*&---------------------------------------------------------------------*
*& Report ZRHCM_BASICDATA
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zrhcm_basicdata.
*---------------------------------------------------------------------*
* 说明:
记录修改历史记录 *
* 修改人,修改日期,修改原因,传输请求号 *
*---------------------------------------------------------------------*
INCLUDE zrhcm_basicdata_modify_log.
*---------------------------------------------------------------------*
* 说明:
定义表 *
*---------------------------------------------------------------------*
TABLES:
pernr.
NODES:
peras.
INFOTYPES:
0000,
0001,
0002,
0006,
0016,
0022,
0105,
0185,
0529,
0532,
0534.
*---------------------------------------------------------------------*
* 说明:
定义相关变量、内表 *
*---------------------------------------------------------------------*
TYPES:
BEGIN OF typ_tab,
stext1 LIKE hrp1000-stext, "第一层部门
objid1 TYPE hrobjid, " 第一层部门id
stext2 LIKE hrp1000-stext, "第二层部门
objid2 TYPE hrobjid, " 第二层部门id
stext3 LIKE hrp1000-stext, "第三层部门
objid3 TYPE hrobjid, " 第三层部门id
stext4 LIKE hrp1000-stext, "第四层部门
objid4 TYPE hrobjid, " 第四层部门id
stext5 LIKE hrp1000-stext, "第五层部门
objid5 TYPE hrobjid, " 第五层部门id
stext6 LIKE hrp1000-stext, "第六层部门
objid6 TYPE hrobjid, " 第六层部门id
stext7 LIKE hrp1000-stext, "第七层部门
objid7 TYPE hrobjid, " 第七层部门id
pernr LIKE p0001-pernr, "工号
ename LIKE p0001-ename, "姓名
gesch
(2) TYPE c, "性别
gbdat LIKE p0002-gbdat, "出生日期
icnum LIKE p0185-icnum,"身份证
natio LIKE t005t-landx, "国籍
gbort LIKE p0002-gbort, "籍贯
famst LIKE t502t-ftext, "婚姻状态
racky LIKE t505s-ltext, "民族
slabs LIKE t519t-stext, " 最高学历
pcode LIKE t7cn5r-ptext, "政治面貌
locat LIKE p0006-locat, "户籍地址
locat1 LIKE p0006-locat, "现住地址
phone LIKE p0105-usrid, " 手机号码
cell LIKE p0105-usrid, "固定电话
zorgeh LIKE hrp1000-stext, "直接部门
orgeh LIKE p0001-orgeh, "直属部门id
plans TYPE plans, "职位id
title LIKE hrp1000-stext, "职位
zsscj like hrp9102-zsscj, "职位层级
zzjdj like hrp9102-zzjdj, "职位等级
cttyp LIKE t547s-cttxt, "合同类别
conty LIKE t7cn2y-tytxt, "社保类型
zzsum TYPE i, "计数
END OF typ_tab.
DATA :
gitb_tab TYPE STANDARD TABLE OF typ_tab,
gwa_tab TYPE typ_tab.
DATA :
gt_hrp1000 TYPE hrp1000 OCCURS 100 WITH HEADER LINE,
gt_hrp9102 TYPE hrp9102 OCCURS 100 WITH HEADER LINE,
gt_t502t TYPE t502t OCCURS 100 WITH HEADER LINE,
gt_t505s TYPE t505s OCCURS 100 WITH HEADER LINE,
gt_t005t TYPE t005t OCCURS 100 WITH HEADER LINE,
gt_t527x TYPE t527x OCCURS 100 WITH HEADER LINE,
gt_t547s TYPE t547s OCCURS 100 WITH HEADER LINE,
gt_t7cn2y TYPE t7cn2y OCCURS 100 WITH HEADER LINE,
gt_t7cn5r TYPE t7cn5r OCCURS 100 WITH HEADER LINE.
INCLUDE zhcm_top.
*---------------------------------------------------------------------*
* 说明:
定义选择屏幕 *
*---------------------------------------------------------------------*
PARAMETERS:
p_layout TYPE disvariant-variant.
*---------------------------------------------------------------------*
* 说明:
处理选择屏幕字段事件 *
*---------------------------------------------------------------------*
*AT SELECTION-SCREEN ON pnpbegda.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_layout.
PERFORM frm_f4_layouts USING cl_salv_layout=>restrict_none CHANGING p_layout.
*---------------------------------------------------------------------*
* 说明:
初始化事件 *
*---------------------------------------------------------------------*
INITIALIZATION.
*---------------------------------------------------------------------*
* 说明:
定义页眉、页尾 *
*---------------------------------------------------------------------*
***top-of-page
***top-of-page during line-selection
***end-of-page
*---------------------------------------------------------------------*
* 说明:
数据检索 *
*---------------------------------------------------------------------*
START-OF-SELECTION.
REFRESH:
gt_hrp1000,gt_hrp9102.
PERFORM frm_init_data.
GET peras.
PERFORM frm_sel_data.
END-OF-SELECTION.
CALL METHOD zawhr_comm=>frm_alv_output
EXPORTING
iv_repid = sy-repid
iv_stats = 'STANDARD_FULLSCREEN'
iv_layout = p_layout
changing
it_tab = gitb_tab
.
*---------------------------------------------------------------------*
* 说明:
交互式功能控制 *
*---------------------------------------------------------------------*
AT USER-COMMAND.
AT LINE-SELECTION.
*&---------------------------------------------------------------------*
*& Form FRM_SEL_DATA
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM frm_sel_data .
DATA :
ls_p0001 TYPE p0001.
LOOP AT p0000 WHERE begda LE pn-endda AND endda GE pn-begda .
EXIT.
ENDLOOP.
IF sy-subrc EQ 0.
gwa_tab-pernr = pernr-pernr. "编号
gwa_tab-zzsum = 1.
LOOP AT p0001 WHERE begda LE pn-endda AND endda GE pn-begda.
gwa_tab-ename = p0001-ename. "姓名
gwa_tab-orgeh = p0001-orgeh. "直属部门id
ENDLOOP.
READ TABLE p0001 INTO ls_p0001 INDEX 1.
PERFORM frm_levelo_get USING ls_p0001-orgeh.
LOOP AT p0002 WHERE begda LE pn-endda AND endda GE pn-begda.
IF p0002-gesch = '1'. "性别
gwa_tab-gesch = '男'.
ELSEIF p0002-gesch = '2'.
gwa_tab-gesch = '女'.
ENDIF.
gwa_tab-gbdat = p0002-gbdat. "出生日期
gwa_tab-gbort = p0002-gbort. "籍贯
ENDLOOP.
LOOP AT p0006 WHERE begda LE pn-endda AND endda GE pn-begda.
CASE p0006-subty.
WHEN '2'.
gwa_tab-locat = p0006-locat. "户籍地址
WHEN '1'.
gwa_tab-locat1 = p0006-locat. "居住地址
WHEN OTHERS.
ENDCASE.
ENDLOOP.
READ TABLE p0534 INDEX 1.
READ TABLE gt_t7cn5r WITH KEY pcode = p0534-pcode.
IF sy-subrc = 0.
gwa_tab-pcode = gt_t7cn5r-ptext.
ENDIF.
READ TABLE p0185 WITH KEY ictyp = '01'.
IF sy-subrc = 0.
gwa_tab-icnum = p0185-icnum. "身份证号码
ENDIF.
READ TABLE p0105 WITH KEY subty = 'MPHN'.
IF sy-subrc = 0.
gwa_tab-phone = p0105-usrid. "手机号码
ENDIF.
READ TABLE p0105 WITH KEY subty = 'CELL'.
IF sy-subrc = 0.
gwa_tab-cell = p0105-usrid. "固定电话
ENDIF.
READ TABLE gt_t502t WITH KEY famst = p0002-famst. "婚姻状态
IF sy-subrc EQ 0.
gwa_tab-famst = gt_t502t-ftext.
ENDIF.
READ TABLE p0529 INDEX 1.
READ TABLE gt_t505s WITH KEY racky = p0529-racky. "民族
IF sy-subrc EQ 0.
gwa_tab-racky = gt_t505s-ltext.
ENDIF.
READ TABLE gt_t005t WITH KEY land1 = p0002-natio. "国籍
IF sy-subrc EQ 0.
gwa_tab-natio = gt_t005t-landx.
ENDIF.
READ TABLE gt_t527x WITH KEY orgeh = p0001-orgeh. "直属部门
IF sy-subrc EQ 0.
gwa_tab-zorgeh = gt_t527x-orgtx.
ENDIF.
gwa_tab-plans = p0001-plans.
READ TABLE gt_hrp1000 WITH KEY objid = p0001-plans. "职位
IF sy-subrc EQ 0.
gwa_tab-title = gt_hrp1000-stext.
ENDIF.
READ TABLE gt_hrp9102 with key objid = p0001-plans.
if sy-subrc = 0.
gwa_tab-zsscj = gt_hrp9102-zsscj. "职位层级
gwa_tab-zzjdj = gt_hrp9102-zzjdj. "职位等级
endif.
READ TABLE p0016 INDEX 1.
READ TABLE gt_t547s WITH KEY sprsl = sy-langu cttyp = p0016-cttyp. "合同类别
IF sy-subrc EQ 0.
gwa_tab-cttyp = gt_t547s-cttxt.
ENDIF.
READ TABLE p0532 INDEX 1.
READ TABLE gt_t7cn2y WITH KEY sprsl = sy-langu infty = '0532' conbr = p0532-conty conar = p0532-conar. "社保类型
IF sy-subrc EQ 0.
gwa_tab-conty = gt_t7cn2y-tytxt.
ENDIF.
SELECT MAX( slabs ) INTO gwa_tab-slabs FROM pa0022 WHERE pernr = gwa_tab-pernr. "最高学历
SELECT SINGLE stext INTO gwa_tab-slabs FROM t519t WHERE slabs = gwa_tab-slabs.
APPEND gwa_tab TO gitb_tab.
SORT gitb_tab BY objid1 objid2 objid3 objid4 objid5 objid6 objid7 ASCENDING.
ENDIF.
CLEAR :
gwa_tab.
ENDFORM. " FRM_SEL_DATA
*&---------------------------------------------------------------------*
*& Form frm_F4_LAYOUTS
*----------------------------------------------------------------------*
* -->P_IF_SALV_C_LAYOUT=>RESTRICT_NON text
* <--P_P_LAYOUT text
*----------------------------------------------------------------------*
FORM frm_f4_layouts USING i_restrict TYPE salv_de_layout_restriction
CHANGING c_layout TYPE disvariant-variant.
DATA:
ls_layout TYPE salv_s_layout_info,
ls_key TYPE salv_s_layout_key.
ls_key-report = sy-repid.
ls_layout = cl_salv_layout_servic