Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9164

Re: How can I get Payroll results when I run the Payroll in Simulation mode

$
0
0

This is what we do to get payroll simulation result. This is for Canada but I'm pretty sure that I could work for other country.

 

   REPORT  zcb_test_simulation.

TYPE-POOLS: hrpay.
TABLES: pcl1"IMPORT/EXPORT
        pcl2"IMPORT/EXPORT

DATA: molga(2)              TYPE c.
DATA: buffer                TYPE hrpay_buffer.
DATA: rgdir_line            LIKE pc261.

DATA: sim_pernr             LIKE pay_sim_pernr OCCURS 0 WITH HEADER LINE.

INCLUDE rpc2cd09.
INCLUDE rpc2rx02.
INCLUDE rpppxd00.
INCLUDE rpppxd10.
INCLUDE rpppxm00.
INCLUDE rpc2rkk0.
INCLUDE rpc2rx29.
INCLUDE rpc2rx39.
INCLUDE rpcxrkk0.

PARAMETERS: p_area    TYPE t549a-abkrs,
            p_period  TYPE t549q-pabrp,
            p_year    TYPE t549q-pabrj,
            p_pernr   TYPE persno,
            p_var     TYPE vari-variant,
            p_prog    TYPE trdir-name DEFAULT 'RPCALCK0' NO-DISPLAY.

START-OF-SELECTION.

  sim_pernr-pernr       = p_pernr.
  APPEND sim_pernr.

  CALL FUNCTION 'HR_PAYROLL'
    EXPORTING
     payroll_area               = p_area
     payroll_period             = p_period
     payroll_year               = p_year
     selection_variant          = p_var
     program_name               = p_prog
*     TST_ON                     = 'X'
    TABLES
      employee_numbers          = sim_pernr
     buffer                     = tbuff
     buffer_directory           = buffer_dir
     delete_pclx                = del_pclx_tab
   EXCEPTIONS
     program_not_exist          = 1
     variant_not_exist          = 2
     missing_parameter          = 3
     wrong_parameter            = 4
     wrong_country_group        = 5
     OTHERS                     = 6
            .
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

  buffer-tbuff[]        = tbuff[].
  buffer-buffer_dir[]   = buffer_dir[].
  buffer-del_pclx_tab[] = del_pclx_tab[].

  CALL FUNCTION 'CU_READ_RGDIR'
    EXPORTING
      persnr          = sim_pernr-pernr
      buffer          = buffer
    IMPORTING
      molga           = molga
    TABLES
      in_rgdir        = rgdir
    EXCEPTIONS
      no_record_found = 1
      OTHERS          = 2.

  CALL FUNCTION 'CD_READ_LAST_RESULT_IN_RGDIR'
    IMPORTING
      ptx_rgdir_nv = rgdir_line
    TABLES
      pt_rgdir     = rgdir.

  rx-key-pernr = sim_pernr-pernr.
  rx-key-seqno = rgdir_line-seqnr.
  rp-imp-c2-rk.

  IF rp-imp-rk-subrc = 0.
    READ TABLE rgdir INDEX 1.
    WRITE: / 'fpper:', rgdir-fpper, 'inper:', rgdir-inper, 'srtza:', rgdir-srtza.
    WRITE: /.
    LOOP AT rt.
      WRITE: / rt-lgart, rt-betpe, rt-anzhl, rt-betrg.
    ENDLOOP.
  ENDIF.


Viewing all articles
Browse latest Browse all 9164

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>