Skip to Content
0
Former Member
Feb 01, 2011 at 03:13 AM

Get the retro wage type and amount

66 Views

Hi Expert,

In my case, I would like to get the retro wage type only for the IN period. But I am not able to do so.

If I run the below code, all the wage type even through it is not retro will also store in the <payresult> table (e.g. wage type 1004 will appear twice). And there is no way for me to identify this is a retro item or a normal item. Please help

Below is the code I use to get the wage type data:

CALL FUNCTION 'PYXX_GET_RELID_FROM_PERNR'
      EXPORTING
        employee                    = P_PERNR
      IMPORTING
        relid                       = lv_relid
        molga                       = lv_molga
      EXCEPTIONS
        error_reading_infotype_0001 = 1
        error_reading_molga         = 2
        error_reading_relid         = 3
        OTHERS                      = 4.
    IF sy-subrc NE 0.
    ENDIF.

    SELECT SINGLE typename
                   FROM t52relid
                   INTO lv_type
                  WHERE relid EQ lv_relid
                    AND tabname = 'PCL2'.

    IF sy-subrc NE 0.
      lv_relid = 'IN'.
      lv_type = 'PAYIN_RESULT'.
    ENDIF.
    lv_typename = lv_type.
    CREATE DATA ref_payresult TYPE (lv_typename).
    ASSIGN ref_payresult->* TO <payresult>.
    DELETE it_rgdir WHERE srtza NE 'A'.
    LOOP AT it_rgdir INTO fs_rgdir WHERE payty = ''
      AND INPER = zCurrPayrollPeriod. "In Period
      "AND fpbeg GE p_start "For period
      "AND fpend LE p_end. "For Period
      APPEND fs_rgdir TO i_rgdir.
    ENDLOOP.                       " LOOP AT it_rgdir
    SORT i_rgdir BY seqnr DESCENDING.

Thanks,

WF