【SAP HCM】获取员工使用过的信息类型

2021-12-30 11:15:49 浏览数 (1)

用于获取员工的信息类型使用的情况,如A员工使用了0000/0001/0002/0003/0006/0185,B员工使用了0000/0001/0002/0003/0009/0008信息类型;

代码语言:javascript复制
FUNCTION ZHR_GET_PERSON_INFOTYPE.
*"----------------------------------------------------------------------
*"*"本地接口:
*"  IMPORTING
*"     REFERENCE(IV_PERNR) TYPE  P0000-PERNR
*"  TABLES
*"      OT_PER_INFOCOUNT STRUCTURE  ZHRS_PER_INFO
*"----------------------------------------------------------------------
DATA: LT_T588B TYPE TABLE OF T588B WITH HEADER LINE.
DATA:ls_t777d        TYPE t777d.
DATA:lr_view_records TYPE REF TO data.
  FIELD-SYMBOLS: <ls_main_struc>   TYPE any,
                 <ls_view_struc>   TYPE any,
                 <lv_infty>        TYPE infty,
                 <lt_main_records> TYPE ANY TABLE,
                 <lt_view_records> TYPE ANY TABLE.
    DATA: lv_dbname       TYPE dbtabl.
DATA:LS_PERINFO TYPE ZHRS_PER_INFO.

SELECT * INTO TABLE LT_T588B FROM T588B
WHERE MNTYP = 'I' AND USERG = '28' AND MENUE LE '05'
AND MENUE GE '01'.
SORT LT_T588B BY infty.
DELETE ADJACENT DUPLICATES FROM LT_T588B COMPARING ALL FIELDS.
LOOP AT LT_T588B.
  IF LT_T588B-infty IS NOT INITIAL.
          CALL FUNCTION 'HR_T777D_READ'                          "ANDUNI
               EXPORTING
              infty = LT_T588B-INFTY
               IMPORTING
              t777d = ls_t777d.
lv_dbname = ls_t777d-dbtab.
          CREATE DATA lr_view_records TYPE STANDARD TABLE OF (ls_t777d-ppnnn). 
          ASSIGN lr_view_records->* TO <lt_view_records>.
          SELECT * FROM (lv_dbname) INTO CORRESPONDING FIELDS OF TABLE <lt_view_records>
                                    WHERE pernr EQ IV_PERNR
                                    AND   begda LE '99991231'
                                    AND   endda GE '18000101'
                                    ORDER BY PRIMARY KEY.
IF SY-SUBRC = 0 .
LS_PERINFO-infty = LT_T588B-INFTY.
LS_PERINFO-COUNT = lines( <lt_view_records> ).
APPEND LS_PERINFO  TO  OT_PER_INFOCOUNT.
ENDIF.
ENDIF.
ENDLOOP.
ENDFUNCTION. 

0 人点赞