1、PNP逻辑数据库。
LOOP获取信息类型数据。
TABLES: PERNR . INFOTYPES: 0000, 0001 . START-OF-SELECTION. GET PERNR . LOOP AT P0000 WHERE ... ... ENDLOOP. LOOP AT P0001 WHERE ... ... ENDLOOP.
宏获取信息类型数据。
TABLES: PERNR, T001P. INFOTYPES: 0000, 0001 . GET PERNR . RP_PROVIDE_FROM_FRST P0000 SPACE PN-BEGDA PN-ENDDA. IF PNP-SW-FOUND = 1. ENDIF. RP_PROVIDE_FROM_FRST P0001 SPACE PN-BEGDA PN-ENDDA. RP-READ-T001P P0001-WERKS P0001-BTRTL SPACE. WRITE T001P-BTEXT.
2、通过函数获取。
INFOTYPES: 0000, 0001 . DATA RETURN LIKE SY-SUBRC. CALL FUNCTION 'HR_READ_INFOTYPE' EXPORTING * TCLAS = 'A' PERNR = PERNR INFTY = '0000' * BEGDA = '18000101' * ENDDA = '99991231' * BYPASS_BUFFER = ' ' * LEGACY_MODE = ' ' IMPORTING SUBRC = RETURN TABLES INFTY_TAB = P0000 EXCEPTIONS INFTY_NOT_FOUND = 1 OTHERS = 2 .
获取雇佣日期
INFOTYPES: 0000 . DATA GV_HDATE TYPE SY-DATUM. CALL FUNCTION 'RP_GET_HIRE_DATE' EXPORTING PERSNR = PERNR CHECK_INFOTYPES = '0000' * DATUMSART = '01' * STATUS2 = '3' * P0016_OPTIONEN = ' ' IMPORTING HIREDATE = GV_HDATE .