03-30-2006 9:37 PM
Hi folks ,
I writing a payroll program , I Know therere several way to write payroll program . Did any one of you ever use GET payroll even ? As I am about to use that but I have been told that get payroll has some problem . Can any body explain what is that ?
As I wrote a sample code after defining LDb PNP .
GET pernr.
WRITE: / icon_red_light AS ICON, 'Currently working on:', pernr-pernr.
GET pernr LATE.
WRITE: / icon_green_light as icon,'Found', g_result_counter,
icon_yellow_light as icon ,'results for #', pernr-pernr.
ULINE.
GET payroll.
*copytodate PAYROLL. (This macro is not available in our system , do I need to include it in table : TRMAC )
g_result_counter = g_result_counter + 1.
WRITE: / 'Seq No. = ', payroll-evp-seqnr ,
'In period =', payroll-inter-versc-inper,
'For period =', payroll-inter-versc-fpper,
'Pay date =', payroll-inter-versc-paydt.
Ill appreciate your help .
Cheers
Usman
03-30-2006 9:44 PM
Usman you can also use classes to read payroll without using GET Payroll event !!!
<b>check out ( OSS note # 699276 )</b>
The logical database GET PAYROLL has now been replaced with the class CL_HRPAY99_PRR_4_REPORTING. "PRR" is "Payroll Result Reader". It is succeeded by CL_HRPAY99_PRR_4_PNP_REPS and CL_HRPAY99_PRR_4_PNPCE_REPS, for use in programs with the logical database PNP or PNPCE (multiple payroll).
These two classes are further succeeded by three classes that allow free period selection, individual day selection, or settlement run selection. Only these may be instantiated to read payroll results. They are:
CL_HRPAY99_PRR_4_PNP_TISPAN
CL_HRPAY99_PRR_4_PNP_SNGDAY
CL_HRPAY99_PRR_4_PNP_PAYPER
CL_HRPAY99_PRR_4_PNPCE_TISPAN
CL_HRPAY99_PRR_4_PNPCE_SNGDAY
CL_HRPAY99_PRR_4_PNPCE_PAYPER
To simplify the class instantiation, the method GET_INSTANCE is available as an alternative. If you have multiple payroll, use CL_HRPAY99_PRR_4_PNPCE_REPS->GET_INSTANCE; otherwise use CL_HRPAY99_PRR_4_PNP_REPS->GET_INSTANCE; a suitable point for this call is the event START-OF-SELECTION.
These new classes allow simple access to the payroll results, are CE-compatible, are expandable (class succession) and can take into account a variety of selection criteria.
The structure H99_PAYROLL_RESULT_READER contains all selection criteria that you may need in your programs, with altered texts and documentation. You can use these in the selection screens in your reports, for example.
Prerequisites
Child classes of the classes CL_HR_PAY_RESULT and, if you have multiple payroll, also CL_HR_PAY_RESULT_PERSON, must be available for your country version. These daughter classes are called CL_HR_PAY_RESULT_** where ** is the ISO code indicator for your country. The German version is called CL_HR_PAY_RESULT_DE, for example; the American version is called CL_HR_PAY_RESULT_US and the American version for multiple payroll is called CL_HR_PAY_RESULT_PERSON_US.
Examples of use
If you have multiple payroll:
data go_prr type ref to CL_HRPAY99_PRR_4_PNPCE_REPS.
data gt_person_pr type H99_HR_PAY_RESULT_PERSON_TAB.
data gt_peras_pr type H99_HR_PAY_RESULT_TAB.
field-symbols <person_pr> type ref to CL_HR_PAY_RESULT_PERSON.
field-symbols <peras_pr> type ref to CL_HR_PAY_RESULT.
data go_person_pr type ref to CL_HR_PAY_RESULT_PERSON_**.
data go_peras_pr type ref to CL_HR_PAY_RESULT_**.
START-OF-SELECTION.
call method CL_HRPAY99_PRR_4_PNPCE_REPS=>GET_INSTANCE
exporting (...)
importing ex_prr = go_prr
exceptions INVALID_ENTRIES = 4.
GET PERSON.
call method go_prr->GET_P_P_PAYR_RESULTS_ALLIN1
exporting im_person = person
importing EX_PERSON_PAYROLL_RESULTS = gt_person_pr
EX_PERAS_PAYROLL_RESULTS = gt_peras_pr
exceptions (...).
The person results are now in table gt_person_pr
and the contract results in table gt_peras_pr
loop at gt_person_pr assigning <person_pr>.
go_person_pr ?= <person_pr>.
Here do what you have to do with each result
endloop.
loop at gt_peras_pr assigning <peras_pr>.
go_peras_pr ?= <peras_pr>.
Here do what you have to do with each result
endloop.
If you do not have multiple payroll:
data go_prr type ref to CL_HRPAY99_PRR_4_PNP_REPS.
data gt_pernr_pr type H99_HR_PAY_RESULT_TAB.
data go_pernr_pr type ref to CL_HR_PAY_RESULT_**.
field-symbols <pernr_pr> type ref to CL_HR_PAY_RESULT.
START-OF-SELECTION.
call method CL_HRPAY99_PRR_4_PNP_REPS=>GET_INSTANCE
exporting (...)
importing ex_prr = go_prr
exceptions INVALID_ENTRIES = 4.
GET PERNR.
call method go_prr->GET_PERNR_PAYR_RESULTS_ALLIN1
exporting im_pernr = pernr-pernr
importing EX_PERNR_PAYROLL_RESULTS = gt_pernr_pr
exceptions (...).
The results are now in table gt_pernr_pr
loop at gt_pernr_pr assigning <pernr_pr>.
go_pernr_pr ?= <pernr_pr>.
Here do what you have to do with each result
endloop.
Hope this`ll give you some idea
Thanks
Message was edited by: Saquib Khan
03-30-2006 9:41 PM
You can check my weblog -:)
<a href="/people/alvaro.tejadagalindo/blog/2006/02/19/how-to-deal-with-hr-payroll-reports to deal with HR Payroll reports</a>
Greetings,
Blag.
03-30-2006 9:44 PM
Usman you can also use classes to read payroll without using GET Payroll event !!!
<b>check out ( OSS note # 699276 )</b>
The logical database GET PAYROLL has now been replaced with the class CL_HRPAY99_PRR_4_REPORTING. "PRR" is "Payroll Result Reader". It is succeeded by CL_HRPAY99_PRR_4_PNP_REPS and CL_HRPAY99_PRR_4_PNPCE_REPS, for use in programs with the logical database PNP or PNPCE (multiple payroll).
These two classes are further succeeded by three classes that allow free period selection, individual day selection, or settlement run selection. Only these may be instantiated to read payroll results. They are:
CL_HRPAY99_PRR_4_PNP_TISPAN
CL_HRPAY99_PRR_4_PNP_SNGDAY
CL_HRPAY99_PRR_4_PNP_PAYPER
CL_HRPAY99_PRR_4_PNPCE_TISPAN
CL_HRPAY99_PRR_4_PNPCE_SNGDAY
CL_HRPAY99_PRR_4_PNPCE_PAYPER
To simplify the class instantiation, the method GET_INSTANCE is available as an alternative. If you have multiple payroll, use CL_HRPAY99_PRR_4_PNPCE_REPS->GET_INSTANCE; otherwise use CL_HRPAY99_PRR_4_PNP_REPS->GET_INSTANCE; a suitable point for this call is the event START-OF-SELECTION.
These new classes allow simple access to the payroll results, are CE-compatible, are expandable (class succession) and can take into account a variety of selection criteria.
The structure H99_PAYROLL_RESULT_READER contains all selection criteria that you may need in your programs, with altered texts and documentation. You can use these in the selection screens in your reports, for example.
Prerequisites
Child classes of the classes CL_HR_PAY_RESULT and, if you have multiple payroll, also CL_HR_PAY_RESULT_PERSON, must be available for your country version. These daughter classes are called CL_HR_PAY_RESULT_** where ** is the ISO code indicator for your country. The German version is called CL_HR_PAY_RESULT_DE, for example; the American version is called CL_HR_PAY_RESULT_US and the American version for multiple payroll is called CL_HR_PAY_RESULT_PERSON_US.
Examples of use
If you have multiple payroll:
data go_prr type ref to CL_HRPAY99_PRR_4_PNPCE_REPS.
data gt_person_pr type H99_HR_PAY_RESULT_PERSON_TAB.
data gt_peras_pr type H99_HR_PAY_RESULT_TAB.
field-symbols <person_pr> type ref to CL_HR_PAY_RESULT_PERSON.
field-symbols <peras_pr> type ref to CL_HR_PAY_RESULT.
data go_person_pr type ref to CL_HR_PAY_RESULT_PERSON_**.
data go_peras_pr type ref to CL_HR_PAY_RESULT_**.
START-OF-SELECTION.
call method CL_HRPAY99_PRR_4_PNPCE_REPS=>GET_INSTANCE
exporting (...)
importing ex_prr = go_prr
exceptions INVALID_ENTRIES = 4.
GET PERSON.
call method go_prr->GET_P_P_PAYR_RESULTS_ALLIN1
exporting im_person = person
importing EX_PERSON_PAYROLL_RESULTS = gt_person_pr
EX_PERAS_PAYROLL_RESULTS = gt_peras_pr
exceptions (...).
The person results are now in table gt_person_pr
and the contract results in table gt_peras_pr
loop at gt_person_pr assigning <person_pr>.
go_person_pr ?= <person_pr>.
Here do what you have to do with each result
endloop.
loop at gt_peras_pr assigning <peras_pr>.
go_peras_pr ?= <peras_pr>.
Here do what you have to do with each result
endloop.
If you do not have multiple payroll:
data go_prr type ref to CL_HRPAY99_PRR_4_PNP_REPS.
data gt_pernr_pr type H99_HR_PAY_RESULT_TAB.
data go_pernr_pr type ref to CL_HR_PAY_RESULT_**.
field-symbols <pernr_pr> type ref to CL_HR_PAY_RESULT.
START-OF-SELECTION.
call method CL_HRPAY99_PRR_4_PNP_REPS=>GET_INSTANCE
exporting (...)
importing ex_prr = go_prr
exceptions INVALID_ENTRIES = 4.
GET PERNR.
call method go_prr->GET_PERNR_PAYR_RESULTS_ALLIN1
exporting im_pernr = pernr-pernr
importing EX_PERNR_PAYROLL_RESULTS = gt_pernr_pr
exceptions (...).
The results are now in table gt_pernr_pr
loop at gt_pernr_pr assigning <pernr_pr>.
go_pernr_pr ?= <pernr_pr>.
Here do what you have to do with each result
endloop.
Hope this`ll give you some idea
Thanks
Message was edited by: Saquib Khan
03-31-2006 12:43 AM
Any other thought and you guys did not mantion what`re the drawbacks of using GET Payroll Event ?
Cheers
Usman
03-31-2006 3:39 AM
Hi Usman,
The one disadvantage of using the GET PAYROLL event that I can think of is the Complex Structure PAYROLL. In the old school using the RP-IMP-C2-RX macros, the RT,CRT etc ineternal tables could be easily read or looped at.. whereas with the GET PAYROLL event, you will have to refer to the complex structure ie something like..
<i>loop at payroll-inter-rt into ...</i>
It is probably better to use the methods in the classes suggested by Saquib..
Regards,
Suresh Datti
03-31-2006 6:18 AM
Hi usman,
1.
To get payroll results for
one employee for one month(payroll period),
we can use the standard SAP Function module.
2. use this code (just copy paste)
use ur own values for
mypernr, fpper, basic wage type (1000 in our case)
3.
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.