Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Getting the payroll

Former Member
0 Kudos

Hi Gurus,

In general to fetch the payroll data we are using FM like

CU_READ_PAYROLL....

Is ther any other way to fetch the payroll I heard there is one more way.

Pls help me.

1 ACCEPTED SOLUTION

GauthamV
Active Contributor
0 Kudos

hi,

use this program.

HINCALC0.

7 REPLIES 7

GauthamV
Active Contributor
0 Kudos

hi,

use this program.

HINCALC0.

Former Member
0 Kudos

Is there any like Import and Export othet than FM's,programs

Former Member
0 Kudos

You can use Event

GET PAYROLL.

in LDB PNP

for more details:

go to Tcode SE36, enter PNP and see documentation

Edited by: Amit Gupta on Oct 15, 2008 9:40 AM

0 Kudos

Other than this way There is a way like IMPORT and EXPORT

directly can any body help me regarding this issue

PLsss.. help me.

0 Kudos

>

> Other than this way There is a way like IMPORT and EXPORT

> directly can any body help me regarding this issue

> PLsss.. help me.

Hi Siva Kumar,

There are so many ways we can fetch the payroll results

1.Import and Export parameter

2.Macros

3.Function modules

so you can use any one the options

tell me which option you want to use

here is the sample code to fecth data using macros

FORM get_payroll_results .

* get payroll processed results

  refresh itab_emp_details.
  clear   itab_emp_details.

  clear   rgdir.
  refresh rgdir.

  cd-key-pernr = pernr-pernr.
  rp-imp-c2-cu.
 if rp-imp-cd-subrc <> 0.
    move itab_empdetails-pernr to error_tab-pernr.
    move 'Cluster result not available'(004)
            to  error_tab-remarks.
    append error_tab.
*    write : / 'Result Not Available ', itab_empdetails-pernr.
*    reject.
 endif.

  check rp-imp-cd-subrc = 0.
  clear rx-key.

  rx-key-pernr = pernr-pernr.

  clear : w_absdays,w_workdays.

* Fill internal tables from cluster results to be displayed
  loop at rgdir
  where fpper = w_fpper
  and   inper = w_fpper
  and   void is initial
  and   abkrs in pnpabkrs.

    rx-key-seqno = rgdir-seqnr.
    rx-key-pernr = pernr-pernr.

    rp-imp-c2-in.

*  Successful import of cluster results
*  RETURN CODE FROM IMPORT.
    if rp-imp-in-subrc <> 0.
      continue.
    endif.

    loop at abc
    where atype = 'U'.
         w_absdays = w_absdays + abc-a.
    endloop.

*   get attendance days
    loop at wpbp.
         w_workdays = w_workdays + wpbp-asoll.
    endloop.

*   working days
    w_workdays = w_workdays - w_absdays.

    clear itab_emp_details.

    loop at rt WHERE LGART IN WAGETYPE.
         move : pernr-pernr   to itab_emp_details-pernr,
                format_name   to itab_emp_details-ename,
                pnpbegda+0(4) to itab_emp_details-year,
                pnpbegda+4(2) to itab_emp_details-month,
                '00'          to itab_emp_details-slctrl.

         write w_workdays  to itab_emp_details-attnd.

         write pernr-pernr to itab_emp_details-pernr1.

*        get descriptions for pa / psa / esg / py area
         perform get_org_description.

         append itab_emp_details.
         clear  itab_emp_details.

         exit.
    endloop.

*   sort rt in wage type order
    sort rt by lgart.

    loop at rt WHERE LGART IN WAGETYPE.  "selected wage types

         clear : w_lgart.
         w_lgart = rt-lgart.

*        move employee name and other details
         perform move_base_data_ern.

    endloop.

  endloop.

* consolidate into final table
  clear itab_empdetails.
  loop at itab_emp_details.
       move-corresponding itab_emp_details to itab_empdetails.
       append itab_empdetails.
       clear  itab_empdetails.
  endloop.

ENDFORM.                    " get_payroll_results

0 Kudos

Hi Aeda,

thnaks for your replay, I want IMPORT and EXPORT

parameters method can you please give me the piece of code.

Thnq very much.

0 Kudos

Hi,

You have declare some of the include

here is the sample code check it out it may help you

***********************************************************************

  • Database Tables & Infotypes

***********************************************************************

tables:pcl1, " HR Cluster1

pcl2, " HR Cluster1

pa0003, " Master data - Payroll Status

pernr. " Logical PNP

infotypes: 0000,

0001.

*include rpclst00.

include rpc2rx00.

include rpc2rxx0.

include rpc2cd00.

*include rpc2ps00.

*include rpc2pt00.

*include rpcfvp00.

*include rpcfdc10.

*include rpcfdc00.

include rpppxd00.

include rpppxd10.

this is the sample code how to use import and export parameters

*&--------------------------------------------------------------------*
*&      Form  get_ot_data                                             *
*&--------------------------------------------------------------------*
* Get the Overtime Payment Data                                       * 
*----------------------------------------------------------------------*
form get_ot_data.
 cd-key = pernr-pernr.
 rp-imp-c2-cd.

 sort rgdir by seqnr.
*To get sequence number for the payroll period
 loop at rgdir where void     is initial
                   and reversal is initial
                   and outofseq is initial
                   and srtza    eq 'A'.
   if rgdir-fpper+0(4) = p_year.

*To consider offcycle run data
     if not rgdir-ocrsn is initial.
       v_seqnr = rgdir-seqnr.
       exit.
     endif.
     v_seqnr = rgdir-seqnr.
   endif.
   if not v_seqnr is initial.
     perform import_rx.
   endif.
   perform process_wagetypes.
 endloop.
endform.                 "get_ot_data

include rpppxm00.

*&--------------------------------------------------------------------*
*&      Form  Import_rx
*&--------------------------------------------------------------------*
* Import the RX data from Clusters
*---------------------------------------------------------------------*
form import_rx.
 rx-key-pernr = cd-key-pernr.
 rx-key-seqno = v_seqnr.
 rp-init-buffer.
 rp-imp-c2-rx.
endform.                    " Import_rx

*&--------------------------------------------------------------------*
*&      Form  Process_wagetypes
*&--------------------------------------------------------------------*
* Calculate the Overtime Amount based on Wage types
*---------------------------------------------------------------------*
form process_wagetypes.
 loop at rt.
   if  rt-lgart = c_lgart1 or rt-lgart = c_lgart2.
     if rgdir-fpper+0(4) = p_year.
       v_mon = rgdir-fpper+4(2).
       case v_mon .
         when c_1.
           rep_tab-ot1 = rep_tab-ot1 + rt-betrg.
         when c_2.
           rep_tab-ot2 = rep_tab-ot2 + rt-betrg.
         when c_3.
           rep_tab-ot3 = rep_tab-ot3 + rt-betrg.
         when c_4.
           rep_tab-ot4 = rep_tab-ot4 + rt-betrg.
         when c_5.
           rep_tab-ot5 = rep_tab-ot5 + rt-betrg.
         when c_6.
           rep_tab-ot6 = rep_tab-ot6 + rt-betrg.
         when c_7.
           rep_tab-ot7 = rep_tab-ot7 + rt-betrg.
         when c_8.
           rep_tab-ot8 = rep_tab-ot8 + rt-betrg.
         when c_9.
           rep_tab-ot9 = rep_tab-ot9 + rt-betrg.
         when c_10.
           rep_tab-ot10 = rep_tab-ot10 + rt-betrg.
         when c_11.
           rep_tab-ot11 = rep_tab-ot11 + rt-betrg.
         when c_12.
           rep_tab-ot12 = rep_tab-ot12 + rt-betrg.
       endcase.
     endif.
   endif.
 endloop.
endform.          "process_wagetypes

thanks

Regards

Narsim Aeda