1、使用函数读取员工工资。
①数据结构工资结果
DATA: GT_RGDIR TYPE TABLE OF PC261 , GS_RGDIR TYPE PC261 , GT_PAYRESULT TYPE PAYCN_RESULT , GS_RT TYPE PC207 , GV_NR TYPE PC261-SEQNR.
GET PERNR. CALL FUNCTION 'CU_READ_RGDIR' EXPORTING PERSNR = PERNR-PERNR * BUFFER = * NO_AUTHORITY_CHECK = ' ' * IMPORTING * MOLGA = TABLES IN_RGDIR = GT_RGDIR EXCEPTIONS NO_RECORD_FOUND = 1 OTHERS = 2 . CALL FUNCTION 'CD_READ_LAST' EXPORTING BEGIN_DATE = PN-BEGDA END_DATE = PN-ENDDA IMPORTING OUT_SEQNR = GV_NR TABLES RGDIR = GT_RGDIR EXCEPTIONS NO_RECORD_FOUND = 1 OTHERS = 2. IF SY-SUBRC = 0. CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT' EXPORTING * CLUSTERID = 'CN' EMPLOYEENUMBER = PERNR-PERNR SEQUENCENUMBER = GV_NR * READ_ONLY_BUFFER = ' ' * READ_ONLY_INTERNATIONAL = ' ' * ARC_GROUP = ' ' * CHECK_READ_AUTHORITY = 'X' * FILTER_CUMULATIONS = 'X' * CLIENT = * IMPORTING * VERSION_NUMBER_PAYVN = * VERSION_NUMBER_PCL2 = CHANGING PAYROLL_RESULT = GT_PAYRESULT EXCEPTIONS ILLEGAL_ISOCODE_OR_CLUSTERID = 1 ERROR_GENERATING_IMPORT = 2 IMPORT_MISMATCH_ERROR = 3 SUBPOOL_DIR_FULL = 4 NO_READ_AUTHORITY = 5 NO_RECORD_FOUND = 6 VERSIONS_DO_NOT_MATCH = 7 ERROR_READING_ARCHIVE = 8 ERROR_READING_RELID = 9 OTHERS = 10 . ENDIF. LOOP AT GT_PAYRESULT-INTER-RT INTO GS_RT . WRITE:/GS_RT-LGART GS_RT-BETRG . ENDLOOP.
②表类型工资结果。
DATA: RESULT_TAB TYPE HRPAY99_TAB_OF_RESULTS, RESULT_HEADER TYPE PAY99_RESULT, RT_HEADER TYPE LINE OF HRPAY99_RT, RGDIR LIKE PC261 OCCURS 0 WITH HEADER LINE, PERIOD TYPE PC261-INPER. SELECT-OPTIONS: S_STATUS FOR RESULT_HEADER-EVP-SRTZA DEFAULT 'A'. START-OF-SELECTION. SELECT SINGLE * FROM T549A WHERE ABKRS = PNPXABKR. PERIOD = PN-PAPER. GET PERNR . CALL FUNCTION 'PYXX_GET_EVALUATION_PERIODS' EXPORTING CLUSTERID = 'CN' EMPLOYEENUMBER = PERNR-PERNR * BONUS_DATE = INPER_MODIF = T549A-PERMO INPER = PERIOD * PAY_TYPE = * PAY_IDENT = * READ_ONLY_INTERNATIONAL = TABLES RGDIR = RGDIR EVALUATED_PERIODS = RESULT_TAB * EXCEPTIONS * NO_PAYROLL_RESULTS = 1 * NO_ENTRY_FOUND_ON_CU = 2 * IMPORT_ERROR = 3 * OTHERS = 4 . IF SY-SUBRC <> 0. ELSE. LOOP AT RESULT_TAB INTO RESULT_HEADER. CHECK S_STATUS. WRITE:/ 'FOR PERIOD', RESULT_HEADER-INTER-VERSC-FPPER, RESULT_HEADER-INTER-VERSC-ABKRS, / 'IN-PERIOD', RESULT_HEADER-INTER-VERSC-INPER, RESULT_HEADER-INTER-VERSC-IABKRS. LOOP AT RESULT_HEADER-INTER-RT INTO RT_HEADER. WRITE: RT_HEADER-LGART, RT_HEADER-BETRG. ENDLOOP. ENDLOOP. ENDIF.
2、GET PAYROLL 获取。
TABLES: PYORGSCREEN , PYTIMESCREEN. NODES: PAYROLL TYPE PAYCN_RESULT . GET PERNR . GET PAYROLL . * PAYROLL-EVP-FPPER * PAYROLL-EVP-INPER DATA WA_RT LIKE LINE OF PAYROLL-INTER-RT . LOOP AT PAYROLL-INTER-RT INTO WA_RT. WRITE: / WA_RT- LGART, WA_RT-BETRG . ENDLOOP.