tables like KONV or BSEG. Payroll processing is different from other ABAP. See an
example report code, how to handle the RT cluster. Only after cluster imports it has to be
used.
report zovertime line-size 252 line-count 60(1) no standard page heading message-id
zndc.
***********************************************************************
* Database Tables & Infotypes
***********************************************************************
tables: pcl1, " HR Cluster1 pcl2, " HR Cluster1 pa0003, " Master data - Payroll Status
cskt, " Cost Center Texts t528t, " Positions Texts t513s, " Job Titles pernr, " Logical PNP
t001p, " Personnel Subarea t500p, " Personnel Area t501, " Employee Group t503k, "
Employee Subgroup csks. " Cost Center 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.
***********************************************************************
* Declaration of Internal Tables
***********************************************************************
* Internal Table for Output Data
data: begin of rep_tab occurs 0,
kostl like pa0001-kostl, " Cost Center
pernr like pa0001-pernr, " Personal Number
ename like pa0001-ename, " Employee Name
ctext like cskt-ltext, " Cost Center Text
ptext like t528t-plstx, " Position Text
ot1 type p decimals 2, " Jan OT Amount
ot2 type p decimals 2, " Feb OT Amount
ot3 type p decimals 2, " Mar OT Amount
ot4 type p decimals 2, " Apr OT Amount
ot5 type p decimals 2, " May OT Amount
ot6 type p decimals 2, " Jun OT Amount
ot7 type p decimals 2, " Jul OT Amount
ot8 type p decimals 2, " Aug OT Amount
ot9 type p decimals 2, " Sep OT Amount
ot10 type p decimals 2, " Oct OT Amount
ot11 type p decimals 2, " Nov OT Amount
ot12 type p decimals 2, " Dec OT Amount
perform validate_screen.
*****************************************************************
* *Start-of-Selection
*****************************************************************
* start-of-selection.
*Selection of Period
perform get_period.
*Get PERNR from LDB
get pernr.
*Get the Master data from infotype 0001
perform get_master_data.
*****************************************************************
* * Top-of-page
*****************************************************************
* top-of-page.
*Write the Report and Column Headings
perform top_of_page.
*****************************************************************
* * End-of-Page
*****************************************************************
* end-of-page.
write /1(252) sy-uline.
*****************************************************************
* * End-of-Selection
*****************************************************************
* end-of-selection.
*Display the Output Report.
perform display_report.
*****************************************************************
* * Form-Routines
*****************************************************************
******
*&---------------------------------------------------------------------*
*& Form validate_screen
*&---------------------------------------------------------------------*
*Validation of selection Screen fields
*----------------------------------------------------------------------*
form validate_screen.
*Validation of Cost Center
clear csks.
if not pnpkostl[] is initial.
select single kostl into csks-kostl from csks where kostl in pnpkostl.
if sy-subrc 0.
message e999 with 'Invalid Cost Center'(003).
endif.
endif.
if sy-subrc 0.
message e999 with 'Incorrect Employee Sub Group Entered'(039).
endif.
endif.
endform.
"validate_screen
*&--------------------------------------------------------------------*
*& Form get_period
*&--------------------------------------------------------------------*
*Get the Correct Period based on Selection screen selection
*---------------------------------------------------------------------*
form get_period.
clear: v_year,v_mon, v_date, v_date1.
v_year = sy-datum+0(4).
v_mon = sy-datum+4(2).
if pnptimr1 = c_x. " Current Date
pnpbegda = sy-datum.
pnpendda = sy-datum.
elseif pnptimr2 = c_x. " Current Month
concatenate v_year v_mon c_val into v_date.
concatenate v_year v_mon c_val1 into v_date1.
pnpbegda = v_date.
pnpendda = v_date1.
elseif pnptimr3 = c_x. " Current Year
concatenate v_year c_val c_val into v_date.
concatenate v_year c_val2 c_val1 into v_date1.
pnpbegda = v_date. pnpendda = v_date1.
elseif pnptimr4 = c_x. " Upto Today
pnpbegda = c_date1. pnpendda = sy-datum.
elseif pnptimr5 = c_x. " From Today
pnpbegda = sy-datum.
pnpendda = c_date2.
else. if ( pnpbegda is initial and pnpendda is initial ).
pnpbegda = c_date1.
pnpendda = c_date2.
elseif pnpbegda is initial and not pnpendda is initial.
pnpbegda = c_date1.
pnpendda = pnpendda.
elseif not ( pnpbegda is initial and pnpendda is initial ).
pnpbegda = pnpbegda.
pnpendda = pnpendda.
endif.
endif.
endform.
"get_period
*&--------------------------------------------------------------------*
*---------------------------------------------------------------------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
*&--------------------------------------------------------------------*
*& Form top_of_page
*&--------------------------------------------------------------------*
*Write the Report and Column Headings
*---------------------------------------------------------------------*
form top_of_page.
format color col_heading on.
write: /1(252) 'NATIONAL DRILLING COMPANY'(010) centered,
l/1(252) 'Overtime Payments Details'(011) centered. format color off.
if pnptimr1 = c_x. " Current Date
write: /2 'Period From :'(036),
sy-datum, 'To:'(006), sy-datum.
elseif pnptimr2 = c_x. " Current Month
write: /2 'Period From :'(036),
v_date, 'To:'(006), v_date1.
elseif pnptimr3 = c_x. " Current Year
write: /2 'Period From :'(036),
v_date, 'To:'(006), v_date1.
elseif pnptimr4 = c_x. " Upto Today
write: /2 'Period From :'(036),
c_date1, 'To:'(006), sy-datum.
elseif pnptimr5 = c_x. " From Today
write: /2 'Period From :'(036),
sy-datum, 'To:'(006), c_date2.
else. if ( pnpbegda is initial and pnpendda is initial ).
write: /2 'Period From :'(036),
c_date1, 'To:'(006), c_date2.
elseif pnpbegda is initial and not pnpendda is initial.
235 sy-vline,
236(16) 'Total'(017) centered,
252 sy-vline.
write:/1 sy-vline,
10 sy-vline,
41 sy-vline,
67 sy-vline,
68(13) 'JANUARY'(024) centered,
81 sy-vline,
82(13) 'FEBRUARY'(025) centered,
95 sy-vline,
96(13) 'MARCH'(026) centered,
109 sy-vline,
110(13) 'APRIL'(027) centered,
123 sy-vline,
124(13) 'MAY'(028) centered,
137 sy-vline,
138(13) 'JUNE'(029) centered,
151 sy-vline,
152(13) 'JULY'(030) centered,
165 sy-vline,
166(13) 'AUGUST'(031) centered,
179 sy-vline,180(13) 'SEPTEMBER'(032) centered,
193 sy-vline,194(13) 'OCTOBER'(033) centered,
207 sy-vline,208(13) 'NOVEMBER'(034) centered,
221 sy-vline,222(13) 'DECEMBER'(035) centered,
235 sy-vline,252 sy-vline. format color off.
write /1(252) sy-uline.
endform. "top_of_page
*&--------------------------------------------------------------------*
*& Form Display_report
*&--------------------------------------------------------------------*
*Write the Report Output
*---------------------------------------------------------------------*
form display_report.
clear v_no.
describe table rep_tab lines v_no.
if v_no = 0.
message i999 with 'No Data found for the entered Selection'(015).
endif.
loop at rep_tab. format color 3.
at new kostl.
read table rep_tab index sy-tabix.
write:/1 sy-vline, 2(12) 'Cost Center:'(009),
14(10) rep_tab-kostl,
25(30) rep_tab-ctext,
67 sy-vline,
68(13) rep_tab-ot1 no-zero,
81 sy-vline, 82(13) rep_tab-ot2 no-zero,
95 sy-vline, 96(13) rep_tab-ot3 no-zero,
109 sy-vline,110(13) rep_tab-ot4 no-zero,
123 sy-vline,124(13) rep_tab-ot5 no-zero,
137 sy-vline,138(13) rep_tab-ot6 no-zero,
151 sy-vline,152(13) rep_tab-ot7 no-zero,
165 sy-vline,166(13) rep_tab-ot8 no-zero,
179 sy-vline,180(13) rep_tab-ot9 no-zero,
193 sy-vline,194(13) rep_tab-ot10 no-zero,
207 sy-vline,208(13) rep_tab-ot11 no-zero,
221 sy-vline,222(13) rep_tab-ot12 no-zero,
235 sy-vline,236(16) rep_tab-ott no-zero,
252 sy-vline.
write /1(252) sy-uline.
endat. format color off.
endloop.
endform. "display_report Regards