ABAP--HR的工资计算样例代码

此ABAP报告展示了如何处理和显示员工的个人数据、工资数据、教育数据、前任雇主数据、工作历史和绩效评估数据。它涉及多个表格的交互,包括PA0001到PA0025等,用于获取和展示不同类型的员工信息。
摘要由CSDN通过智能技术生成

report zporgr0030 line-size 193 message-id zndc.

***********************************************************************
* Database Tables
***********************************************************************
tables: pernr, " Logical PNP
t001p, " Personnel Subarea
t005t, " Country Descriptions
t500p, " Personnel Area
t501, " Employee Group
t503k, " Employee Subgroup
csks, " Cost Centers
cskt, " Cost Center Texts
t513c, " Job (Previous) Texts
t513s, " Job Titles
t517t, " Edn Est.Text
t518b, " Discipline Text
t519t, " Certificate Text
t528t, " Positions Texts
t538t, " Unit Text
pa0003. " Payroll Status
infotypes:
0000, " Actions
0001, " Organizational Assignment
0002, " Personal Data
0007, " Planned working time
0008, " Payroll Data
0022, " Education Data
0023, " Previous Employer data
0025, " Performance Appraisal Data
0041, " Date Spcifications
2001. " Absences

***********************************************************************
* Declaration of Internal Tables
***********************************************************************
* Internal Table for Personal Data
data: begin of pers_tab occurs 0,
pernr like pa0001-pernr, " Personal Number
ename like pa0001-ename, " Employee Name
trfgr like pa0008-trfgr, " Grade
natio like pa0002-natio, " Nationality
hdate like pa0041-dat01, " Hire Date
gbdat like pa0002-gbdat, " Birth Date
plans like pa0001-plans, " Position
werks like pa0001-werks, " Pers.Area
kostl like pa0001-kostl, " Cost Center
ctext(40), " Cost Center Text
ptext(25), " Position Text
ntext(15), " Nation Text
name1(23), " Location
end of pers_tab.

* Internal Table for Payroll Data
data: begin of pay_tab occurs 0,
pernr like pa0008-pernr, " Personal Number
waers like pbwla-waers, " Grade
basic like pa0008-bet01, " Basic Pay
hra_allow like pa0008-bet01, " Housing Allowance
sup_allow like pa0008-bet01, " Supp. Allowance
soc_allow like pa0008-bet01, " Social Allowance
chl_allow like pa0008-bet01, " Child Allowance
fix_allow like pa0008-bet01, " Fixed Overtime
ra_allow like pa0008-bet01, " RA Allowance
per_allow like pa0008-bet01, " Perform. Allowance
pen_allow like pa0008-bet01, " Pension Allowance
oth_allow like pa0008-bet01, " Other Allowances
tot_allow like pa0008-bet01, " Total Allowances
end of pay_tab.

* Internal Table for Educational Data
data: begin of edn_tab occurs 0,
pernr like pa0022-pernr, " Personal Number
ausbi like pa0022-ausbi, " Discipline Name
slart like pa0022-slart, " Edn Establishment
insti like pa0022-insti, " Institute
sland like pa0022-sland, " Country
slabs like pa0022-slabs, " Certificate
anzkl like pa0022-anzkl, " Duration
anzeh like pa0022-anzeh, " Unit for Duration
atext like t518b-atext, " Discipline Text
stext like t517t-stext, " Edn Est.Text
landx like t005t-landx, " Country Text
ctext like t519t-stext, " Certificate Text
etext like t538t-etext, " Unit Text
end of edn_tab.

* Internal Table for Previous Employment Data
data: begin of pemp_tab occurs 0,
pernr like pa0023-pernr, " Personal Number
arbgb like pa0023-arbgb, " Previous Employer
begda like pa0023-begda, " Start Date
endda like pa0023-endda, " End Date
taete like pa0023-taete, " Last Position
land1 like pa0023-land1, " Country
stltx like t513s-stltx, " Position Text
landx like t005t-landx, " Country Text
end of pemp_tab.

* Internal Table for Job History Data
data: begin of job_tab occurs 0,
pernr like pa0001-pernr, " Personal Number
begda like pa0001-begda, " Promotion Date
plans like pa0001-plans, " Position
stell like pa0001-stell, " Job Key
stltx like t513s-stltx, " Job Text
ptext like t528t-plstx, " Position Text
end of job_tab.

* Internal Table for Performance Appraisal Data
data: begin of app_tab occurs 0,
pernr like pa0001-pernr, " Personal Number
year(4) type c, " Current Year
appr(35) type c, " C Y Appraisal
* year1(4) type c, " Last Year
* appr1(35) type c, " Last Year Appraisal
* year2(4) type c,
* appr2(35) type c,
* year3(4) type c,
* appr3(35) type c,
* year4(4) type c,
* appr4(35) type c,
end of app_tab.

* Internal Table for Performance Appraisal Data
data: begin of app1_tab occurs 0,
year(4) type c, " Year
appr(35) type c, " Appraisal
end of app1_tab.

* Internal Table to get the Payroll Amounts
data wage_tab like pbwla occurs 0 with header line.

* Internal table for retreiving Employee Appraisals
data app_in_tab like hrsobid occurs 0 with header line .
data app_out_tab like hrpe_profa occurs 0 with header line .

***********************************************************************
* Declaration of Variables
***********************************************************************
data : v_year(4) type c,
v_ayear(4) type c,
v_cyear(4) type c,
v_year1(4) type c,
v_year2(4) type c,
v_year3(4) type c,
v_year4(4) type c,
v_year5(4) type c,
v_year6(4) type c,
v_mon(2) type c,
v_date2 like sy-datum,
v_date3 like sy-datum,
v_date like sy-datum,
v_date1 like sy-datum.

***********************************************************************
* Declaration of Constants
***********************************************************************
constants : c_x type c value 'X', " Sign
c_pernr(8) type n value '00000000', " Pernr
c_p like hrp1007-otype value 'P', " Object Type
c_01 like hrp1001-plvar value '01', " Version
c_val1(2) type c value '31', " Date Type
c_val2(2) type c value '12', " Date Type
c_val like p0041-dar01 value '01', " Date Type
c_1 like pernr-persg value '1', " Emp Group
c_type like hrp1001-otype value 'S', " Object Type
c_date1 like sy-datum value '18000101', " Date
c_date2 like sy-datum value '99991231', " Date
c_lga01 like pa0008-lga01 value '0101', " Wage Type
c_lga02 like pa0008-lga01 value '0102', " Wage Type
c_lga03 like pa0008-lga01 value '0103', " Wage Type
c_lga04 like pa0008-lga01 value '0105', " Wage Type
c_lga05 like pa0008-lga01 value '0109', " Wage Type
c_lga06 like pa0008-lga01 value '0110', " Wage Type
c_lga07 like pa0008-lga01 value '0114', " Wage Type
c_lga08 like pa0008-lga01 value '0116', " Wage Type
c_lga09 like pa0008-lga01 value '0267', " Wage Type
c_kokrs like cskt-kokrs value '1000'. " Controlling Area

***********************************************************************
* Selection Screen
***********************************************************************
selection-screen begin of block b1 with frame title text-003.

selection-screen begin of line.
selection-screen comment 1(33) text-060.
parameters: r_all radiobutton group rb1.
selection-screen end of line.

selection-screen begin of line.
selection-screen comment 1(33) text-020.
parameters: r_per radiobutton group rb1.
selection-screen end of line.

selection-screen begin of line.
selection-screen comment 1(33) text-021.
parameters: r_pay radiobutton group rb1.
selection-screen end of line.

selection-screen begin of line.
selection-screen comment 1(33) text-022.
parameters: r_edn radiobutton group rb1.
selection-screen end of line.

selection-screen begin of line.
selection-screen comment 1(33) text-023.
parameters: r_pemp radiobutton group rb1.
selection-screen end of line.

selection-screen begin of line.
selection-screen comment 1(33) text-024.
parameters: r_job radiobutton group rb1.
selection-screen end of line.

selection-screen begin of line.
selection-screen comment 1(33) text-025.
parameters: r_app radiobutton group rb1.
selection-screen end of line.

selection-screen end of block b1.

***********************************************************************
* At selection-screen
***********************************************************************
at selection-screen.
* Validate the Selection Screen fields
  perform validate_screen.

***********************************************************************
* Start-of-Selection
***********************************************************************
start-of-selection.
* Selection of Period
  perform get_period.

* Get PERNR from LDB
get pernr.
  if pernr-persg eq c_1 or pernr-pernr ne c_pernr.
    if r_all eq c_x.
* Get the Personal data from PA0001,PA0002, PA0008, PA0041
      perform get_pers_data.

* Get the Payroll data from PA0008
      perform get_pay_data.

* Get the Education data from PA0022
      perform get_edn_data.

* Get the Previous Employment data from PA0023
      perform get_pemp_data.

* Get the Job History data
      perform get_job_data.

* Get the Performance Appraisal data
      perform get_app_data.

    elseif r_per eq c_x.
* Get the Personal data from PA0001,PA0002, PA0008, PA0041
      perform get_pers_data.

    elseif r_pay eq c_x.
* Get the Payroll data from PA0008
      perform get_pay_data.

    elseif r_edn eq c_x.
* Get the Education data from PA0022
      perform get_edn_data.

    elseif r_pemp eq c_x.
* Get the Previous Employment data from PA0023
      perform get_pemp_data.

    elseif r_job eq c_x.
* Get the Job History data
      perform get_job_data.

    elseif r_app eq c_x.
* Get the Performance Appraisal data
      perform get_app_data.
    endif.
  endif.

***********************************************************************
* Top-of-page
***********************************************************************
top-of-page.
* Write the Report a

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值