tables:hrp1000,
hrp1001,
pa0002,
pa0008,
pa0025,
pa0380.
data:begin of it_pa0002 occurs 0,
pernr like pa0002-pernr,
begda like pa0002-begda,
endda like pa0002-endda,
vorna like pa0002-vorna,
nachn like pa0002-nachn,
end of it_pa0002.
data:begin of it_pa0008 occurs 0,
pernr like pa0008-pernr,
begda like pa0008-begda,
endda like pa0008-endda,
ansal like pa0008-ansal,
preas like pa0008-preas,
end of it_pa0008.
data:begin of it_pa0025 occurs 0,
pernr like pa0025-pernr,
pkt01 like pa0025-pkt01,
end of it_pa0025.
data:begin of it_pa0380 occurs 0,
pernr like pa0380-pernr,
pct01 like pa0380-pct01,
bet01 like pa0380-bet01,
end of it_pa0380.
data:begin of it_final occurs 0,
pernr like pa0002-pernr,
cname like pa0002-cname,
name like pa0002-cname,
ansal like pa0008-ansal,
ansal1 like pa0008-ansal,
pkt01 like pa0025-pkt01,
pct01 like pa0380-pct01,
bet01 like pa0380-bet01,
dat01 like pa0041-dat01,
finyr like T7PM9-finyr,
pm_rating(50),
end of it_final.
data:v_name like pa0002-cname,
v_hiredate like pa0041-dat01.
*---selection screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETER: p_finyr LIKE t7pm9-finyr .
SELECT-OPTIONS: s_date FOR hrp1000-begda NO-EXTENSION MODIF ID dat.
SELECT-OPTIONS:s_pernr for pa0002-pernr .
SELECTION-SCREEN END OF BLOCK b1.
*----start of selection
start-of-selection.
perform get_data.
perform prosses_data.
perform display_data.
*&---------------------------------------------------------------------*
*& Form get_performance_rating
*----------------------------------------------------------------------*
form get_performance_rating .
* local internal tables
DATA: lt_appraisee TYPE hap_t_hrsobid,
lt_appraisal_id TYPE hap_t_appraisal_id,
lt_body_columns TYPE hap_t_body_columns,
lt_body_elements TYPE hap_t_body_elements,
lt_body_cells TYPE hap_t_body_cells.
* local structures
DATA: ls_key_objects TYPE hrwpc_s_keyobjec,
ls_column_content TYPE hrwpc_s_keycolcont,
ls_period TYPE hrwpc_s_ep_period,
ls_appraisee TYPE hrsobid,
ls_sel_with_or_without TYPE hap_s_sel_with_or_without,
ls_appraisal_id TYPE hap_s_appraisal_id,
ls_body_column TYPE hap_s_body_columns,
ls_body_element TYPE hap_s_body_elements,
ls_body_cell TYPE hap_s_body_cells,
ls_sel_dates TYPE hap_s_sel_dates,
ls_status TYPE hap_s_sel_status,
ls_and_or TYPE hap_s_sel_option_and_or,
ls_return TYPE bal_s_msg.
* local variables
DATA: l_subrc TYPE sy-subrc,
l_otype TYPE otype,
l_content TYPE hrwpc_s_keycolcont-content.
* local constant
CONSTANTS: lc_col_sortable TYPE hrwpc_s_coltype-coltype
VALUE 'SORTABLE'.
* fill appraisees table
ls_key_objects-plvar = '01'.
ls_key_objects-otype = 'P'.
ls_key_objects-objid = it_pa0002-pernr.
ls_appraisee-plvar = ls_key_objects-plvar.
ls_appraisee-otype = ls_key_objects-otype.
ls_appraisee-sobid = ls_key_objects-objid.
APPEND ls_appraisee TO lt_appraisee.
* Update Document with_or_without structure (ls_sel_with_or_without)
MOVE 'X' TO ls_sel_with_or_without-sel_display_existing. "Document ID
* Update status structure (ls_status)
MOVE 'X' TO ls_status-ap_status_5. "Completed Appraisal
ls_period-begda = s_date-low.
ls_period-endda = s_date-high.
MOVE ls_period-begda TO ls_sel_dates-validity_from_date.
MOVE ls_period-endda TO ls_sel_dates-validity_to_date.
* Search appraisal ID based on appraisee, date and status
CALL FUNCTION 'HRHAP_DOCUMENT_GET_LIST'
EXPORTING
plan_version = ls_key_objects-plvar
t_appraisees = lt_appraisee
s_sel_with_or_without = ls_sel_with_or_without
s_sel_dates = ls_sel_dates
s_sel_status = ls_status
IMPORTING
t_appraisal_id = lt_appraisal_id
s_return = ls_return.
* Appraisal found
IF not ls_return IS INITIAL.
* read appraisal detail
READ TABLE lt_appraisal_id INDEX 1 INTO ls_appraisal_id.
CALL FUNCTION 'HRHAP_DOCUMENT_GET_DETAIL'
EXPORTING
plan_version = ls_key_objects-plvar
s_appraisal_id = ls_appraisal_id
IMPORTING
t_body_columns = lt_body_columns
t_body_elements = lt_body_elements
t_body_cells = lt_body_cells
s_return = ls_return.
CHECK ls_return IS INITIAL.
* take the first row from body element table and 'ZFIN - Manager
* Override Rating' or 'FAPP - Final Appraisal' from body columns
* table to read the performance ranting from body cell table
EXPORTING
plan_version = ls_key_objects-plvar
s_appraisal_id = ls_appraisal_id
IMPORTING
t_body_columns = lt_body_columns
t_body_elements = lt_body_elements
t_body_cells = lt_body_cells
s_return = ls_return.
CHECK ls_return IS INITIAL.
* take the first row from body element table and 'ZFIN - Manager
* Override Rating' or 'FAPP - Final Appraisal' from body columns
* table to read the performance ranting from body cell table
READ TABLE lt_body_elements INDEX 1 INTO ls_body_element.
READ TABLE lt_body_columns WITH KEY column_id = 'ZFIN'
INTO ls_body_column.
IF sy-subrc <> 0.
READ TABLE lt_body_columns WITH KEY column_id = 'ZFIN'
INTO ls_body_column.
IF sy-subrc <> 0.
* IF Manager Override Rating is not available, Use the
* Final Appraisal Rating
READ TABLE lt_body_columns WITH KEY column_id = 'FAPP'
INTO ls_body_column.
ENDIF.
READ TABLE lt_body_cells WITH KEY
row_iid = ls_body_element-row_iid
column_iid = ls_body_column-column_iid
INTO ls_body_cell.
CHECK sy-subrc = 0.
l_content = ls_body_cell-value_text.
it_final-pm_rating = l_content.
ENDIF.
endform. " get_performance_rating
*&---------------------------------------------------------------------*
*& Form get_hiredate
*----------------------------------------------------------------------*
form get_hiredate .
CLEAR v_hiredate.
select dat01
from pa0041
into v_hiredate
where pernr = it_pa0002-pernr
and begda = it_pa0002-begda
and endda = it_pa0002-endda
and dar01 = '81' . " hire date
endselect .
endform. " get_hiredate
*&---------------------------------------------------------------------*
*& Form get_data
*----------------------------------------------------------------------*
form get_data .
select pernr
begda
endda
vorna
nachn
from pa0002
into table it_pa0002
where pernr in s_pernr.
if sy-subrc = 0.
select pernr
begda
endda
ansal
preas
from pa0008
into table it_pa0008
for all entries in it_pa0002
where pernr = it_pa0002-pernr.
if sy-subrc = 0.
sort it_pa0008 by pernr begda descending.
delete adjacent duplicates from it_pa0008 comparing pernr.
endif.
select pernr
pkt01
from pa0025
into table it_pa0025
for all entries in it_pa0002
where pernr = it_pa0002-pernr.
if sy-subrc = 0.
sort it_pa0025 by pernr .
delete adjacent duplicates from it_pa0025 comparing pernr.
endif.
select pernr
pct01
bet01
from pa0380
into table it_pa0380
for all entries in it_pa0002
where pernr = it_pa0002-pernr.
if sy-subrc = 0.
sort it_pa0380 by pernr.
delete adjacent duplicates from it_pa0380 comparing pernr.
endif.
endif.
endform. " get_data
*&---------------------------------------------------------------------*
*& Form prosses_data
*----------------------------------------------------------------------*
form prosses_data .
loop at it_pa0002.
it_final-pernr = it_pa0002-pernr.
concatenate it_pa0002-vorna it_pa0002-nachn into v_name.
it_final-cname = v_name.
read table it_pa0008 with key pernr = it_pa0002-pernr binary search.
if sy-subrc = 0.
it_final-ansal = it_pa0008-ansal.
endif.
loop at IT_PA0008 where pernr = it_pa0002-pernr
and endda < ansal1 =" it_pa0008-ansal." pernr =" it_pa0002-pernr" subrc =" 0." pkt01 =" it_pa0025-pkt01." pernr =" it_pa0002-pernr" subrc =" 0." pct01 =" it_pa0380-pct01." bet01 =" it_pa0380-bet01." dat01 =" v_hiredate." finyr =" p_finyr.">
ALSO READ:
- Fetch HR Data Or Records From HR Database Tables.
- Using Macros In HR ABAP Report Program.
- Get The List Of Employees With Experience.
- BADI HRECM00_BDG0001 - Upload Initial Budgets From Excel Sheet.
- Get Employee Picture In Selection Screen.
.....Back To Sub-Index On HR ABAP.
.....Back To MAIN INDEX.
* Final Appraisal Rating
READ TABLE lt_body_columns WITH KEY column_id = 'FAPP'
INTO ls_body_column.
ENDIF.
READ TABLE lt_body_cells WITH KEY
row_iid = ls_body_element-row_iid
column_iid = ls_body_column-column_iid
INTO ls_body_cell.
CHECK sy-subrc = 0.
l_content = ls_body_cell-value_text.
it_final-pm_rating = l_content.
ENDIF.
endform. " get_performance_rating
*&---------------------------------------------------------------------*
*& Form get_hiredate
*----------------------------------------------------------------------*
form get_hiredate .
CLEAR v_hiredate.
select dat01
from pa0041
into v_hiredate
where pernr = it_pa0002-pernr
and begda = it_pa0002-begda
and endda = it_pa0002-endda
and dar01 = '81' . " hire date
endselect .
endform. " get_hiredate
*&---------------------------------------------------------------------*
*& Form get_data
*----------------------------------------------------------------------*
form get_data .
select pernr
begda
endda
vorna
nachn
from pa0002
into table it_pa0002
where pernr in s_pernr.
if sy-subrc = 0.
select pernr
begda
endda
ansal
preas
from pa0008
into table it_pa0008
for all entries in it_pa0002
where pernr = it_pa0002-pernr.
if sy-subrc = 0.
sort it_pa0008 by pernr begda descending.
delete adjacent duplicates from it_pa0008 comparing pernr.
endif.
select pernr
pkt01
from pa0025
into table it_pa0025
for all entries in it_pa0002
where pernr = it_pa0002-pernr.
if sy-subrc = 0.
sort it_pa0025 by pernr .
delete adjacent duplicates from it_pa0025 comparing pernr.
endif.
select pernr
pct01
bet01
from pa0380
into table it_pa0380
for all entries in it_pa0002
where pernr = it_pa0002-pernr.
if sy-subrc = 0.
sort it_pa0380 by pernr.
delete adjacent duplicates from it_pa0380 comparing pernr.
endif.
endif.
endform. " get_data
*&---------------------------------------------------------------------*
*& Form prosses_data
*----------------------------------------------------------------------*
form prosses_data .
loop at it_pa0002.
it_final-pernr = it_pa0002-pernr.
concatenate it_pa0002-vorna it_pa0002-nachn into v_name.
it_final-cname = v_name.
read table it_pa0008 with key pernr = it_pa0002-pernr binary search.
if sy-subrc = 0.
it_final-ansal = it_pa0008-ansal.
endif.
loop at IT_PA0008 where pernr = it_pa0002-pernr
and endda < ansal1 =" it_pa0008-ansal." pernr =" it_pa0002-pernr" subrc =" 0." pkt01 =" it_pa0025-pkt01." pernr =" it_pa0002-pernr" subrc =" 0." pct01 =" it_pa0380-pct01." bet01 =" it_pa0380-bet01." dat01 =" v_hiredate." finyr =" p_finyr.">
ALSO READ:
- Fetch HR Data Or Records From HR Database Tables.
- Using Macros In HR ABAP Report Program.
- Get The List Of Employees With Experience.
- BADI HRECM00_BDG0001 - Upload Initial Budgets From Excel Sheet.
- Get Employee Picture In Selection Screen.
.....Back To Sub-Index On HR ABAP.
.....Back To MAIN INDEX.
No comments:
Post a Comment