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: 

Payroll Results of Last month

Former Member
0 Kudos

Hello

I want to access the payroll results of last month as I want to use that "Basic Pay" only, because the Basic pay in table PA0008 is not Nsync with the basic pay seen in master data screen PA30. I can use the LDB PNP but I want to avoid the usual screen it always gives to the user for entering Payroll Period and Personnel numbers, has anyone used something like this.

Thank you

Bhavna

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Bhavna,

1. use this code (just copy paste)

use ur own values for

mypernr, fpper, basic wage type (1000 in our case)

2.

REPORT abc.

*----- Data

DATA : myseqnr LIKE hrpy_rgdir-seqnr.

DATA: py_result TYPE payin_result.

DATA : mypernr LIKE p0001-pernr.

DATA : wpbp LIKE TABLE OF pc205 WITH HEADER LINE.

DATA : myrt LIKE TABLE OF pc207 WITH HEADER LINE.

*------- Read Directory

SELECT SINGLE seqnr INTO myseqnr

FROM hrpy_rgdir

WHERE pernr = mypernr

AND fpper = '200601'

AND srtza = 'A'.

CHECK sy-subrc = 0.

*----


Read Results

CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'

EXPORTING

clusterid = 'IN'

employeenumber = mypernr

sequencenumber = myseqnr

CHANGING

payroll_result = py_result

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.

ENDIF.

myrt[] = py_result-inter-rt .

*----


READ TABLE myrt WITH KEY lgart = '1000'.

regards,

amit m.

4 REPLIES 4

Former Member
0 Kudos

Hi Bhavna,

1. use this code (just copy paste)

use ur own values for

mypernr, fpper, basic wage type (1000 in our case)

2.

REPORT abc.

*----- Data

DATA : myseqnr LIKE hrpy_rgdir-seqnr.

DATA: py_result TYPE payin_result.

DATA : mypernr LIKE p0001-pernr.

DATA : wpbp LIKE TABLE OF pc205 WITH HEADER LINE.

DATA : myrt LIKE TABLE OF pc207 WITH HEADER LINE.

*------- Read Directory

SELECT SINGLE seqnr INTO myseqnr

FROM hrpy_rgdir

WHERE pernr = mypernr

AND fpper = '200601'

AND srtza = 'A'.

CHECK sy-subrc = 0.

*----


Read Results

CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'

EXPORTING

clusterid = 'IN'

employeenumber = mypernr

sequencenumber = myseqnr

CHANGING

payroll_result = py_result

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.

ENDIF.

myrt[] = py_result-inter-rt .

*----


READ TABLE myrt WITH KEY lgart = '1000'.

regards,

amit m.

0 Kudos

Thanks for the prompt reply Amit, even I thought of the function but the only problem is in case of 500 employees calling a function 500 hundred times will create a performance issue, so I want something like an internal table to access the basic pay of all employees at once.

Bhavna

0 Kudos

Hi Bhavna,

1. Ur idea/concept is very good.

2. BUT

3. SAP provides the payroll results (thru FM)

only

1 by one (for each employee)

4. This is the ONLY WAY !

5. There is no other way for

getting payroll results.

6. Even if u use MACROS

u will get it

ONLY FOR 1 EMPLOYEE (AT A TIME)

6. Don't worry about performance.

Its fast.

and theres no other way out !

regards,

amit m.

0 Kudos

Hi,

You can use <b>HRPY_RGDIR</b> table (payroll results )to read the payroll results of the last month.

hope this will solve your problem.

regards

vijay