Saturday, 22 April 2017

To find wage type and joining date and Exit date of employee

1. To get Joining Date and Exit Date

CONSTANTS c_join TYPE char2  VALUE 'Z1',         " Date of Join
            c_exit TYPE char2  VALUE 'Z8'.        " Date of Exit


*To get Joining and Exit date
  rp-provide-from-last p0041 space pn-begda pn-endda.
  IF pnp-sw-found 1.
    DO 12 TIMES VARYING lv_datetype FROM p0041-dar01 NEXT p0041-dar02
                VARYING lv_date     FROM p0041-dat01 NEXT p0041-dat02.

      IF lv_datetype c_join.
        MOVE lv_date TO ls_final-join_date.
      ELSEIF lv_datetype c_exit.
        MOVE lv_date TO ls_final-exit_date.
      ENDIF.
    ENDDO.
  ENDIF.



2. Calculate the years, months, days & cal days between 2 dates.

DATAno_cal_day TYPE i,
      no_month   TYPE i,
      no_year    TYPE i.


CALL FUNCTION 'HR_AUPBS_MONTH_DAY'
      EXPORTING
        beg_da     p0000-begda  " HIRE DATE
        end_da     p0015-begda  " LAST WORKING DATE
      IMPORTING
*       NO_DAY     =
        no_month   no_month
        no_year    no_year
        no_cal_day no_cal_day.

3. To find wage type and text

    rp-provide-from-last p0008 space pn-begda pn-endda.
    IF pnp-sw-found '1'.
      DO 40 TIMES VARYING gv_lga01 FROM p0008-lga01 NEXT p0008-lga02
                   VARYING gv_bet01 FROM p0008-bet01 NEXT p0008-bet02
                   VARYING gv_ind01 FROM p0008-ind01 NEXT p0008-ind02 .

        IF gv_ind01 EQ 'I' "FOR INDIRECT EVALUATION
          IF gv_lga01 EQ '1000'.
            gs_ptbindbw-indbw =  gv_ind01.
            gs_ptbindbw-lgart =  gv_lga01.
            APPEND gs_ptbindbw.

            CLEAR gs_ptbindbw.
            CALL FUNCTION 'RP_FILL_WAGE_TYPE_TABLE_EXT'
              EXPORTING
*               APPLI  = 'E'
                begda  pn-endda "'00000101'
                endda  pn-endda "'99991231'
                infty  '0008'
*               OBJPS  = '  '
*               TCLAS  = 'A'
                pernr  pernr-pernr
*               SEQNR  = '   '
*               SUBTY  = '0   '
*               DLSPL  = 'X'
*               MSGFLG = ''
*               NORDCT = ''
*               CONV_CURR                          = 'X'
*               FLAG_NO_DB_READ                    =
              TABLES
                pp0001 p0001
                pp0007 p0007
                pp0008 p0008
                ppbwla gs_ptbindbw
*               PP0014 =
*               PP0015 =
*               PP0052 =
*               PP0230 =
*               PP0267 =
*  EXCEPTIONS
*               ERROR_AT_INDIRECT_EVALUATION       = 1
*               OTHERS = 2
              .
            IF sy-subrc 0.
              READ TABLE gs_ptbindbw INTO gs_ptbindbw WITH KEY lgart '1000'.
              IF sy-subrc EQ 0.
                gv_basic gs_ptbindbw-betrg .
                EXIT.
              ENDIF .
            ENDIF.
*
          ENDIF.
        ENDIF.

      ENDDO.

    ENDIF.

No comments:

Post a Comment