离退休人员

FUNCTION Z_HR_RETIRE_001.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     VALUE(P_DATE) TYPE  CHAR8
*"  EXPORTING
*"     VALUE(MSGFLAG) TYPE  CHAR1
*"  TABLES
*"      PO_01 STRUCTURE  ZSTR_HRP_TXYG01 OPTIONAL
*"----------------------------------------------------------------------
  DATA HR_TABLE LIKE STANDARD TABLE OF ZSTR_HRP_TXYG01 WITH HEADER LINE.

  DATA FK_TABLE LIKE TABLE OF ZHR_RETIRE_LOG WITH HEADER LINE.

*通过日期查出离职或退休人员信息
  SELECT * INTO CORRESPONDING FIELDS
           OF TABLE HR_TABLE FROM PA0000 WHERE BEGDA >= P_DATE AND ( MASSN = 'C4' OR MASSN = 'C6' ).

*查询记录反馈表里存在的员工号
  SELECT PERNR
   INTO CORRESPONDING FIELDS OF TABLE FK_TABLE FROM ZHR_RETIRE_LOG.

*剔除重复提交的员工号
  LOOP AT HR_TABLE.
    READ TABLE FK_TABLE WITH KEY
      PERNR = HR_TABLE-PERNR.
    IF SY-SUBRC = 0.
      DELETE TABLE HR_TABLE FROM HR_TABLE.
    ENDIF.
  ENDLOOP.

*查询ZESS表,取出相同员工工号的OA登入名
  SELECT * INTO CORRESPONDING FIELDS OF TABLE PO_01
    FROM ZESS_LOGON FOR ALL ENTRIES IN HR_TABLE
    WHERE PERNR = HR_TABLE-PERNR.

*删除重复值
  DELETE ADJACENT DUPLICATES FROM PO_01[] COMPARING PERNR.

  LOOP AT PO_01.
    CLEAR HR_TABLE.
    READ TABLE HR_TABLE WITH KEY PERNR = PO_01-PERNR.

    PO_01-BEGDA = HR_TABLE-BEGDA.
    PO_01-MASSN = HR_TABLE-MASSN.
    MODIFY PO_01.
  ENDLOOP.

  IF SY-SUBRC = 0.
    MSGFLAG = 0.
  ELSE.
    MSGFLAG = 1.
  ENDIF.

 

ENDFUNCTION.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值