Application Development and Automation 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: 
Read only

bonus

Former Member
0 Likes
520

How to displays employee bonus details with formatted output.

Please provide the step by step procedure.

vamsi

1 REPLY 1
Read only

Former Member
0 Likes
468

Hi,

This is also similar to the Pay Roll report. Sampl report is here;

Modify the Wage type for BONUS by looking into table T511 and process accordingly.

report zhrrept_payroll_report

no standard page heading

line-size 130 line-count 65

message-id zhr_msg.

*************Report Name : Payroll GOSI Report*********************

***************Description : This Report is to display the HR *

  • Payroll GOSI Details for the selected *

  • Period

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

  • Table Declarations

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

tables : pa0001, " HR Master Record: Infotype 0001 (Org. Assignment)

pa0002, " HR Master Record: Infotype 0002 (Personal Data)

pa0078, " HR Master Record: Infotype 0078 (Loan Payments)

pa0003, " HR Master Record: Infotype 0003 (Payroll Status)

pcl1, " HR Cluster I

pcl2, " HR Cluster II

t500p, " Personnel Areas

t001, " Company Codes

t001p. " Personnel Area/Subarea

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

  • Standard Includes

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

include : rpc2cd00, " Cluster CD data definition

rpc2rxx0, " Cluster RX data definition

rpc2rx00, " Cluster RX data definition internat. part

rpppxd00, " Data definition buffer PCL1/PCL2

rpppxd10, " Common part buffer PCL1/PCL2

rpppxm00. " Buffer handling routine

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

  • Declaration of Data and Internal Tables

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

  • Internal Table for Employee code,Name and Cost Center data

data : begin of itab_pernr occurs 0,

pernr like pernr-pernr,

werks like pa0001-werks,

btrtl like pa0001-btrtl,

kostl like pa0001-kostl,

end of itab_pernr.

  • Internal Tables for Payments and Deductions

data : begin of it_data1 occurs 0,

pernr like pernr-pernr, " Personnel Number

name(40) type c, " Employee Name

kostl like pa0001-kostl, " Cost Center

basic like pa0078-betrg, " Basic

hra like pa0078-betrg, " GOSI HRA

gtotl like pa0078-betrg, " GOSI Total salary

empcg like pa0078-betrg, " Employee Contribution

emplr like pa0078-betrg, " Employer Contribution

totnt like pa0078-betrg, " Total GOSI

end of it_data1.

  • Variables for Cluster processing

data : get_pernr_flag type i,

calcmolga like t500l-molga value '99',

calc_currency like t001-waers value 'DEM',

save_calc_currency like t001-waers,

count_top type i,

stand like pc260-srtza.

  • Program Variables

data : v_name(50) type c,

v_sno type i,

v_month(9) type c,

v_text1(14) type c,

v_month_t(3) type c,

v_count type i value 1,

ws_temp_month(2) type n,

ws_fbeg like sy-datum,

ws_fend like sy-datum,

ws_temp like pa0078-betrg,

ws_fend1 like sy-datum,

ws_fbeg1 like sy-datum.

  • Constants for Payments and Deductions

constants : cn_1000(4) type c value '1000', " Reference Basic

cn_3000(4) type c value '3000', " GOSI HRA

cn_3001(4) type c value '3001', " GOSI Salary

cn_3010(4) type c value '3010', " Employee Contribution

cn_3011(4) type c value '3011', " Employer Contribution

  • Other Constants

cn_01(2) type n value '01',

cn_31(2) type n value '31',

cn_100(3) type n value '100'.

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

  • Select-Options

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

selection-screen : skip,

begin of block 2 with frame title text-a02.

select-options: s_pernr for pa0001-pernr.

selection-screen skip.

parameters : p_month(2) type n obligatory,

p_year(4) type n obligatory,

p_werks like t500p-persa obligatory default 'AM02',

p_bukrs like pa0001-bukrs obligatory default '1100'.

selection-screen end of block 2.

*********Initialization*********************************************

initialization.

  • Previous month and current year for default input

p_month = sy-datum+4(2).

add -1 to p_month.

p_year = sy-datum(4).

*******At Selection Screen******************************************

at selection-screen.

  • Checking for the input values of selection screen.

perform screen_check.

**********Top of Page***********************************************

top-of-page.

  • Writing Headings of the Report.

perform header.

********Start of Selection******************************************

start-of-selection.

  • Selecting Data from Tables

perform get_data.

********End of Selection*********************************************

end-of-selection.

  • Writing data to output of the Report

perform write_data_out.

&----


*& Form SCREEN_CHECK

&----


  • Checking for the input values of selection screen.

----


form screen_check.

  • Validation of Personnel Number

clear pa0003.

select pernr from pa0003 up to 1 rows

into pa0003-pernr

where pernr in s_pernr.

endselect.

if sy-subrc ne 0.

message i001.

endif.

  • Validation of Company Code

clear t001.

select bukrs from t001 up to 1 rows

into t001-bukrs

where bukrs = p_bukrs.

endselect.

if sy-subrc ne 0.

message i002.

endif.

  • Validation of personnel Area

clear t500p.

select persa from t500p up to 1 rows

into t500p-persa

where persa = p_werks.

endselect.

if sy-subrc ne 0.

message i003.

endif.

endform. "SCREEN_CHECK

&----


*& Form HEADER

&----


  • Writing Headings of the Report

----


form header.

perform convert_month using p_month(2) v_month.

v_text1 = v_month.

concatenate v_text1 p_year into v_text1 separated by space.

skip 2.

write: /40 'PAYROLL GOSI REPORT FOR THE MONTH'(001),v_text1.

skip.

write:/1(127) sy-uline.

format color col_heading.

write:/1(127) sy-uline.

write:/ sy-vline, 2(3) 'SNo'(002),

5 sy-vline, 6(8) 'Emp.No'(003) centered,

14 sy-vline, 15(10) 'CostCenter'(004),

25 sy-vline, 26(40) 'Name of the Employee'(005) centered,

66 sy-vline, 67(9) 'Ref.Basic'(006) centered,

76 sy-vline, 77(9) 'GOSI HRA'(007),

86 sy-vline, 87(9) 'GOSI Sal.'(008) centered,

96 sy-vline, 97(9) 'Emp.Contr'(009),

106 sy-vline, 107(9) 'EmplrCntr'(010) centered,

116 sy-vline, 117(10) 'Total'(011),

127 sy-vline.

format color off.

write:/1(127) sy-uline.

endform. " HEADER

----


*& Form GET_DATA

&----


  • Selecting Data from Tables

----


form get_data.

set margin 5.

  • Hardcode for cluster processing purpose

save_calc_currency = calc_currency. "XUJP30K062848

get_pernr_flag = 0.

count_top = 0.

  • Selection based on Company Code, Department and Division.

select pernr werks btrtl kostl

into table itab_pernr from pa0001

where pernr in s_pernr

and bukrs eq p_bukrs

and werks eq p_werks.

  • Once only input for Division text select purpose

  • READ TABLE ITAB_PERNR INDEX 1.

  • WS_BTRTL = ITAB_PERNR-BTRTL.

  • Process input month and year into period start and period end

perform process_period.

  • Start of coding for Import Cluster Data

call function 'RP_GET_CURRENCY'

exporting

molga = calcmolga

importing

waers = calc_currency

exceptions

others.

if sy-subrc ne 0.

calc_currency = save_calc_currency.

endif.

  • Coding to obtain cluster CD and cluster BT

loop at itab_pernr.

  • Acquire employee name

perform get_emp_name.

cd-key-pernr = itab_pernr-pernr.

  • Acquire cluster CD

perform import_cluster.

get_pernr_flag = 1.

check : ocd-version-molga eq calcmolga.

loop at rgdir.

rx-key-pernr = itab_pernr-pernr.

unpack rgdir-seqnr to rx-key-seqno.

check : rgdir-srtza eq stand or stand eq space.

check : ws_fbeg le rgdir-fpend or ws_fbeg1 le rgdir-fpend.

check : ws_fend ge rgdir-fpbeg or ws_fend1 ge rgdir-fpbeg.

perform import_bt.

  • Filter cluster to grab required wagetypes for amounts and quantity

perform filter_data.

endloop.

endloop.

endform.

----


*& Form PROCESS_PERIOD

&----


  • Obtain start of month and end of month for cluster selection

----


form process_period.

ws_fbeg(4) = p_year.

ws_fbeg+4(2) = p_month.

ws_fbeg+6(2) = cn_01.

ws_fend = ws_fbeg.

ws_fend+6(2) = cn_31.

  • Acquire Prev period start and end

ws_temp_month = p_month.

add -1 to ws_temp_month.

ws_fend1 = ws_fend.

ws_fend1+4(2) = ws_temp_month.

ws_fbeg1 = ws_fbeg.

ws_fbeg1+4(2) = ws_temp_month.

endform.

*----


form import_cluster.

*----


sy-subrc = 0.

rp-imp-c2-cd.

if sy-subrc eq 0.

if cd-version-number ne ocd-version-number.

  • WRITE: / 'Personalnummer:'(E00), RX-KEY-PERNR.

  • WRITE: / TEXT-E01, 'CD', TEXT-E02.

  • WRITE: / TEXT-E03,

  • OCD-VERSION-NUMMER.

  • WRITE: / TEXT-E04,

  • CD-VERSION-NUMMER.

  • SY-SUBRC = 8.

endif.

else.

  • WRITE: / TEXT-E00, RX-KEY-PERNR.

  • WRITE: / 'Cluster CD nicht gefunden'(E05).

endif. " SY-SUBRC EQ 0

endform.

*----


form get_emp_name.

*----


  • Obtain first and last name and concatenate into v_name.

select single * from pa0002 where pernr eq itab_pernr-pernr.

concatenate pa0002-vorna pa0002-nachn into v_name separated by space.

it_data1-name = v_name.

endform.

*----


form filter_data.

*----


  • Filtering codes for WageTypes

  • Filtered value is added to it_data1, it_data2 and it_data3 per

  • each required value. Select for BETRG(curr), BETPE(unit) via

  • LGART(wagetype).

loop at rt.

clear ws_temp.

case rt-lgart.

  • GOSI Values

when cn_1000.

it_data1-basic = rt-betrg.

when cn_3000.

it_data1-hra = rt-betrg.

when cn_3001.

it_data1-gtotl = rt-betrg.

when cn_3010.

it_data1-empcg = rt-betrg.

when cn_3011.

it_data1-emplr = rt-betrg.

endcase.

endloop.

it_data1-pernr = itab_pernr-pernr.

it_data1-kostl = itab_pernr-kostl.

append: it_data1.

clear: it_data1.

endform.

*----


form import_bt.

*----


rp-init-buffer.

rp-imp-c2-rx.

if rp-imp-rx-subrc eq 0.

if rx-version-number ne orx-version-number.

stop.

sy-subrc = 4.

else.

sy-subrc = 0.

endif.

else.

sy-subrc = 8.

write : / 'Inconsistencies between cluster directory '(021),

'and directory for PAYROLL RESULTS'(022).

write: / 'No payroll results found for data in cluster directory'(035).

write : / 'Please contact hotline to solve the current problem'(036).

endif.

endform.

*&----


*& Form write_data_out

*&----


  • Writing data to output of the Report

*----


form write_data_out.

sort it_data1 by pernr.

loop at it_data1.

v_sno = v_sno + 1.

format color col_normal.

write:/ sy-vline, 2(3) v_sno,

5 sy-vline, 6(8) it_data1-pernr,

14 sy-vline, 15(10) it_data1-kostl,

25 sy-vline, 26(40) it_data1-name,

66 sy-vline, 67(9) it_data1-basic,

76 sy-vline, 77(9) it_data1-hra,

86 sy-vline, 87(9) it_data1-gtotl,

96 sy-vline, 97(9) it_data1-empcg,

106 sy-vline, 107(9) it_data1-emplr.

it_data1-totnt = it_data1-empcg + it_data1-emplr.

write:116 sy-vline, 117(10) it_data1-totnt,

127 sy-vline.

format color off.

endloop.

clear v_sno.

write:/1(127) sy-uline.

endform. "WRITE_DATA_OUT

&----


*& Form CONVERT_MONTH

&----


  • Fetching Month Text

----


form convert_month using v_mth v_month_text.

case v_mth.

when '01'.

v_month_text = 'January'(023).

when '02'.

v_month_text = 'February'(024).

when '03'.

v_month_text = 'March'(025).

when '04'.

v_month_text = 'April'(026).

when '05'.

v_month_text = 'May'(027).

when '06'.

v_month_text = 'June'(028).

when '07'.

v_month_text = 'July'(029).

when '08'.

v_month_text = 'August'(030).

when '09'.

v_month_text = 'September'(031).

when '10'.

v_month_text = 'October'(032).

when '11'.

v_month_text = 'November'(033).

when '12'.

v_month_text = 'December'(034).

endcase.

endform. " CONVERT_MONTH

Regards,

Anji