Search This Blog

Search This Blog

Regular Payroll Processing in HR-ABAP


* USING  CU_READ_RGDIR  
*        CD_READ_LAST  
       PYXX_READ_PAYROLL_RESULT

REPORT  ZCLASS_H15.

TABLES PERNR.

START-OF-SELECTION.

  DATA ITAB TYPE PC261 OCCURS 0 WITH HEADER LINE.
  DATA G_SEQNR LIKE  PC261-SEQNR.

  DATA IT_RESULTS TYPE PAYIN_RESULT.

  DATA WA_CRT TYPE PC208.
  DATA WA_BT TYPE PC209.

GET PERNR.
  CALL FUNCTION 'CU_READ_RGDIR'
    EXPORTING
      PERSNR                   = PERNR-PERNR
*   BUFFER                   =
*   NO_AUTHORITY_CHECK       = ' '
* IMPORTING
*   MOLGA                    =
    TABLES
      IN_RGDIR                 = ITAB
* EXCEPTIONS
*   NO_RECORD_FOUND          = 1
*   OTHERS                   = 2
            .
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  CALL FUNCTION 'CD_READ_LAST'
    EXPORTING
      BEGIN_DATE            = PN-BEGDA
      END_DATE              = PN-ENDDA
   IMPORTING
     OUT_SEQNR             = G_SEQNR
    TABLES
      RGDIR                 = ITAB
*   EXCEPTIONS
*     NO_RECORD_FOUND       = 1
*     OTHERS                = 2
            .
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
    EXPORTING
*     CLUSTERID                          =
      EMPLOYEENUMBER                     = PERNR-PERNR
      SEQUENCENUMBER                     = G_SEQNR
*     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                     = IT_RESULTS
*   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
            .
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  LOOP AT IT_RESULTS-INTER-CRT INTO WA_CRT.
    WRITE:/ PERNR-PERNR, PERNR-ENAME, WA_CRT-LGART, WA_CRT-BETRG, WA_CRT-CUMTY.
  ENDLOOP.

  LOOP AT IT_RESULTS-INTER-BT INTO WA_BT.
    WRITE:/ WA_BT-BANKN, WA_BT-LGART, WA_BT-BETRG.
  ENDLOOP.