TYPE-POOLS: slis .
TABLES: pa0000,
pa0001,
sscrfields,
t569v,
t549a,
t549q,
zguesthouse.
TYPES: BEGIN OF ty_pa0000,
pernr TYPE pa0000-pernr,
begda TYPE pa0000-begda,
endda TYPE pa0000-endda,
massn TYPE pa0000-massn,
stat2 TYPE p0000-stat2,
END OF ty_pa0000.
TYPES: BEGIN OF ty_pa0001,
pernr LIKE pa0001-pernr,
begda LIKE pa0001-begda,
endda LIKE pa0001-endda,
werks LIKE pa0001-werks,
persg LIKE pa0001-persg,
persk LIKE pa0001-persk,
btrtl LIKE pa0001-btrtl,
END OF ty_pa0001.
TYPES: BEGIN OF ty_pa0002,
pernr TYPE pa0002-pernr,
begda TYPE pa0002-begda,
endda TYPE pa0002-endda,
vorna TYPE pa0002-vorna,
nachn TYPE pa0002-nachn,
END OF ty_pa0002.
TYPES : BEGIN OF ty_guest,
pernr type pa0002-pernr,
begda type pa0002-begda,
endda type pa0002-endda,
accom type pa0008-accom,
bet02 type zguesthouse-bet02,
END OF ty_guest.
TYPES: BEGIN OF ty_pa0014.
INCLUDE STRUCTURE p0014.
TYPES: END OF ty_pa0014.
TYPES: BEGIN OF ty_pa0041.
INCLUDE STRUCTURE p0041.
TYPES: END OF ty_pa0041.
TYPES: BEGIN OF ty_pa2001.
INCLUDE STRUCTURE p2001.
TYPES: END OF ty_pa2001.
TYPES: BEGIN OF ty_pa0008.
INCLUDE STRUCTURE p0008.
TYPES: END OF ty_pa0008.
DATA: BEGIN OF wagetypes,
lga LIKE p0008-lga01,
bet LIKE p0008-bet01,
END OF wagetypes.
DATA: BEGIN OF dates,
dar LIKE p0041-dar01,
dat LIKE p0041-dat01,
END OF dates.
DATA: return LIKE bapireturn1.
TYPES: BEGIN OF ty_final,
pernr TYPE pa0000-pernr,
begda TYPE pa0000-begda,
endda TYPE pa0000-endda,
vorna TYPE pa0002-vorna,
nachn TYPE pa0002-nachn,
bsal TYPE pa0008-bet01,
stat TYPE char20,
syears TYPE i,
smonths TYPE i,
sdays TYPE i,
text TYPE char50,
nperiod TYPE i,
bendays TYPE p DECIMALS 2,
amount TYPE pa0008-bet01,
amount1 TYPE pa0008-bet01,
eosbasic TYPE pa0008-bet01,
eoshra TYPE pa0008-bet01,
eostra TYPE pa0008-bet01,
eostel TYPE pa0008-bet01,
notice_pay TYPE pa0008-bet01,
eosprov TYPE pa0008-bet01,
eosrev TYPE pa0008-bet01,
END OF ty_final.
TYPES: BEGIN OF ty_prop_values.
INCLUDE STRUCTURE pprop.
TYPES: END OF ty_prop_values.
TYPES: BEGIN OF ty_mod_values.
INCLUDE STRUCTURE pskey.
TYPES: END OF ty_mod_values.
DATA: it_prop_values TYPE TABLE OF ty_prop_values WITH HEADER LINE,
it_mod_values TYPE TABLE OF ty_mod_values WITH HEADER LINE,
it_return TYPE bapireturn .
DATA: lfs_0008 LIKE p0008,
v_bet01 LIKE p0008-bet01,
v_bet02 LIKE p0008-bet01,
v_bet03 LIKE p0008-bet01,
v_permo TYPE t549a-permo,
v_guest TYPE pa0008-bet01.
DATA: it_pa0000 TYPE STANDARD TABLE OF ty_pa0000 WITH HEADER LINE,
it_pa0001 TYPE STANDARD TABLE OF ty_pa0001 WITH HEADER LINE,
it_pa0002 TYPE STANDARD TABLE OF ty_pa0002 WITH HEADER LINE,
it_pa0008 TYPE STANDARD TABLE OF ty_pa0008 WITH HEADER LINE,
it_pa0041 TYPE STANDARD TABLE OF ty_pa0041 WITH HEADER LINE,
it_pa0014 TYPE STANDARD TABLE OF ty_pa0014 WITH HEADER LINE,
it_pa2001 TYPE STANDARD TABLE OF ty_pa2001 WITH HEADER LINE,
it_guest TYPE STANDARD TABLE OF ty_guest WITH HEADER LINE,
it_final TYPE STANDARD TABLE OF ty_final WITH HEADER LINE,
it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
it_top_of_page TYPE slis_t_listheader,
it_layout TYPE slis_layout_alv,
it_events TYPE slis_t_event,
wa_events TYPE slis_alv_event,
it_list TYPE slis_t_listheader WITH HEADER LINE,
wa_pa0015 TYPE p0015.
DATA: it_rgdir TYPE TABLE OF pc261 WITH HEADER LINE,
it_result TYPE pay99_result ,
wa_itrgdir TYPE pc261,
wa_rt TYPE pc207,
wa_crt TYPE pc208,
w_molga TYPE t500l-molga,
w_seqnr TYPE cdseq,
w_relid TYPE relid_pcl2,
wagetype TYPE char15.
DATA: v_years TYPE i,
v_months TYPE i,
v_days TYPE i,
v_date TYPE sy-datum,
v_addi_bdays TYPE i,
v_addi_bdays1 TYPE i,
v_addi_bdays2 TYPE i,
v_count TYPE i.
DATA: no_of_days TYPE i,
v_odate TYPE sy-datum,
v_ndate TYPE sy-datum,
v_months_all TYPE i.
DATA : s_basic TYPE char2,
s_hra TYPE char2,
s_tra TYPE char2,
s_tel TYPE char2.
DATA : w_basic type pa0008-bet01,
w_hra type pa0008-bet02,
w_tra type pa0008-bet03,
w_tel type pa0008-bet04.
CONSTANTS: v_bdays TYPE i VALUE '15'.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS:p_abkrs TYPE pa0001-abkrs .
PARAMETERS: p_pabrp TYPE t569v-pabrp,
p_pabrj TYPE t569v-pabrj,
p_begda TYPE pa0001-begda,
p_endda TYPE pa0001-endda.
PARAMETERS: r7 RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND aaa,
r8 RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b1 .
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-002.
SELECT-OPTIONS: s_pernr FOR pa0000-pernr,
s_werks FOR pa0001-werks,
s_btrtl FOR pa0001-btrtl,
s_persg FOR pa0001-persg,
s_persk FOR pa0001-persk.
*PARAMETERS: p_date LIKE pa0000-begda DEFAULT sy-datum.
SELECTION-SCREEN END OF BLOCK b3 .
SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-004.
PARAMETERS: r4 RADIOBUTTON GROUP r2 USER-COMMAND uc1 DEFAULT 'X',"Resignation
r3 RADIOBUTTON GROUP r2. "Termination
SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE text-005.
PARAMETERS: r5 RADIOBUTTON GROUP r3 MODIF ID aaa, "With notice period
r6 RADIOBUTTON GROUP r3 MODIF ID aaa. "Without notice period
SELECTION-SCREEN END OF BLOCK b5 .
SELECTION-SCREEN END OF BLOCK b4 .
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-003.
PARAMETERS: r1 RADIOBUTTON GROUP r1,
r2 RADIOBUTTON GROUP r1.
SELECTION-SCREEN END OF BLOCK b2 .
SELECTION-SCREEN BEGIN OF BLOCK b6 WITH FRAME TITLE text-006.
PARAMETERS: BASIC LIKE s_basic,
HRA LIKE s_hra,
Tra LIKE s_tra,
Tel LIKE s_tel.
SELECTION-SCREEN END OF BLOCK b6 .
AT SELECTION-SCREEN OUTPUT.
IF r4 = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'AAA'.
screen-active = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF r7 = 'X'.
PERFORM get_data_from_current_period.
LOOP AT SCREEN.
IF screen-name = 'P_PABRP'
OR screen-name = 'P_PABRJ'
OR screen-name = 'P_BEGDA'
OR screen-name = 'P_ENDDA'.
screen-input = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSEIF r8 = 'X'.
PERFORM get_data_from_period.
LOOP AT SCREEN.
IF screen-name = 'P_BEGDA'
OR screen-name = 'P_ENDDA'.
screen-input = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
START-OF-SELECTION.
PERFORM get_data.
END-OF-SELECTION.
PERFORM process_data.
PERFORM build_fieldcat.
PERFORM display_alv.
*&----------------------------------------------------------------------*
*& Form GET_DATA
*----------------------------------------------------------------------*
FORM get_data .
IF r3 = 'X'.
SELECT pernr
begda
endda
massn
stat2
FROM pa0000
INTO TABLE it_pa0000
WHERE pernr IN s_pernr
AND begda LE p_endda
AND endda GE p_begda
AND massn EQ 'Z6'.
IF sy-subrc = 0.
SORT it_pa0000 BY pernr begda.
DELETE it_pa0000[] WHERE begda LT p_begda.
ENDIF.
ELSE.
SELECT pernr
begda
endda
massn
stat2
FROM pa0000
INTO TABLE it_pa0000
WHERE pernr IN s_pernr
AND begda LE p_endda
AND endda GE p_begda
AND massn EQ 'Z7'.
IF sy-subrc = 0.
SORT it_pa0000 BY pernr begda.
DELETE it_pa0000[] WHERE begda LT p_begda.
ENDIF.
.
ENDIF.
IF NOT it_pa0000[] IS INITIAL.
SELECT *
FROM pa0041
INTO CORRESPONDING FIELDS OF TABLE it_pa0041
FOR ALL ENTRIES IN it_pa0000
WHERE pernr = it_pa0000-pernr
AND begda LE sy-datum
AND endda GE sy-datum.
SELECT pernr
begda
endda
werks
persg
persk
btrtl
FROM pa0001
INTO TABLE it_pa0001
FOR ALL ENTRIES IN it_pa0000
WHERE pernr = it_pa0000-pernr
AND werks IN s_werks
AND btrtl IN s_btrtl
AND persg IN s_persg
AND persk IN s_persk
AND abkrs = p_abkrs
AND begda LE sy-datum
AND endda GE sy-datum.
DELETE ADJACENT DUPLICATES FROM it_pa0001 COMPARING pernr.
SELECT pernr
begda
endda
vorna
nachn
FROM pa0002
INTO TABLE it_pa0002
FOR ALL ENTRIES IN it_pa0000
WHERE pernr = it_pa0000-pernr
AND begda LE sy-datum
AND endda GE sy-datum.
SELECT * FROM pa0014
INTO CORRESPONDING FIELDS OF TABLE it_pa0014
FOR ALL ENTRIES IN it_pa0000
where pernr = it_pa0000-pernr
and lgart = '2120'.
IF NOT it_pa0002[] IS INITIAL.
SORT it_pa0002 BY pernr.
ENDIF.
SELECT * FROM pa0008
INTO CORRESPONDING FIELDS OF TABLE it_pa0008
FOR ALL ENTRIES IN it_pa0000
WHERE pernr = it_pa0000-pernr
AND begda LE it_pa0000-begda
AND endda GE sy-datum.
IF sy-subrc = 0.
SORT it_pa0008 BY pernr ASCENDING begda DESCENDING.
ENDIF.
SELECT * FROM zguesthouse
INTO CORRESPONDING FIELDS OF TABLE it_guest
FOR ALL ENTRIES IN it_pa0000
WHERE pernr = it_pa0000-pernr
AND begda LE it_pa0000-begda
AND endda GE sy-datum.
SELECT * FROM pa2001
INTO CORRESPONDING FIELDS OF TABLE it_pa2001
FOR ALL ENTRIES IN it_pa0000
WHERE pernr = it_pa0000-pernr
AND subty = '5100'
OR subty = '5110'
AND begda LE sy-datum
AND endda GE sy-datum.
IF sy-subrc = 0.
SORT it_pa2001 BY pernr.
ENDIF.
ENDIF.
ENDFORM. " GET_DATA
*&---------------------------------------------------------------------*
*& Form PROCESS_DATA
*----------------------------------------------------------------------*
FORM process_data .
DATA: v_pernr LIKE bapihritbase-employeenum,
absence TYPE TABLE OF bapihrquota WITH HEADER LINE,
cumulated TYPE TABLE OF bapihrquotacv WITH HEADER LINE,
v_amt TYPE pa0008-bet01,
v_amt1 TYPE pa0008-bet01,
v_quota TYPE char13,
v_dummy TYPE char3,
v_updays TYPE i,
v_updays1 TYPE i.
LOOP AT it_pa0001.
READ TABLE it_pa0000 WITH KEY pernr = it_pa0001-pernr.
IF sy-subrc = 0.
it_final-pernr = it_pa0000-pernr.
CASE: it_pa0000-stat2.
WHEN '0'.
it_final-stat = 'Withdrawn'.
WHEN '1'.
it_final-stat = 'Inactive'.
WHEN '2'.
it_final-stat = 'Retiree'.
WHEN '3'.
it_final-stat = 'Active'.
ENDCASE.
ENDIF.
READ TABLE it_pa0002 WITH KEY pernr = it_pa0001-pernr.
IF sy-subrc = 0.
it_final-vorna = it_pa0002-vorna.
it_final-nachn = it_pa0002-nachn.
ENDIF.
READ TABLE it_pa0041 WITH KEY pernr = it_pa0000-pernr.
IF sy-subrc = 0.
DO 12 TIMES VARYING dates-dar FROM it_pa0041-dar01 NEXT it_pa0041-dar02
VARYING dates-dat FROM it_pa0041-dat01 NEXT it_pa0041-dat02.
CHECK dates-dar IS NOT INITIAL.
IF dates-dar = '01'.
it_final-begda = dates-dat.
ENDIF.
ENDDO.
ENDIF.
IF it_final-begda IS NOT INITIAL.
CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'
EXPORTING
beg_da = it_final-begda
end_da = it_pa0000-begda
IMPORTING
no_day = v_days
no_month = v_months
no_year = v_years
EXCEPTIONS
dateint_error = 1
OTHERS = 2.
CALL FUNCTION 'MONTHS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_bis = it_pa0000-begda
i_datum_von = it_final-begda
* I_KZ_INCL_BIS = ' '
IMPORTING
E_MONATE = v_months_all.
it_final-syears = v_years.
it_final-smonths = v_months.
it_final-sdays = v_days.
ENDIF.
READ TABLE it_pa0008 WITH KEY pernr = it_pa0001-pernr.
IF sy-subrc = 0.
CLEAR : lfs_0008.
MOVE-CORRESPONDING it_pa0008 TO lfs_0008.
DO 40 TIMES VARYING wagetypes-lga FROM lfs_0008-lga01 NEXT lfs_0008-lga02
VARYING wagetypes-bet FROM lfs_0008-bet01 NEXT lfs_0008-bet02.
CHECK wagetypes-lga IS NOT INITIAL.
CASE wagetypes-lga.
WHEN '1000'. " Basic pay
v_bet01 = wagetypes-bet.
it_final-bsal = wagetypes-bet.
WHEN '1010'.
v_bet01 = v_bet01 + wagetypes-bet.
ENDCASE.
ENDDO.
ENDIF.
CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'
EXPORTING
begda = it_final-begda
endda = it_pa0000-begda
IMPORTING
days = no_of_days.
LOOP AT it_pa2001 WHERE pernr = it_pa0001-pernr..
v_updays = v_updays + it_pa2001-abwtg.
ENDLOOP.
IF r4 = 'X'. "Resignation process
IF v_years LT 2.
it_final-amount = 0.
ELSEIF v_years GE 2 AND v_years LT 5.
it_final-amount = v_bet01 * ( 1 / 3 ) * ( 1 / 2 ) * ( no_of_days - v_updays ) / 365.
ELSEIF v_years GE 5 AND v_years LT 10.
no_of_days = no_of_days - 1825.
v_amt = v_bet01 * ( 1 / 3 ) * ( 1 / 2 ) * ( 1825 ) / 365 .
v_amt1 = v_bet01 * ( 2 / 3 ) * ( no_of_days - v_updays ) / 365 .
it_final-amount = v_amt + v_amt1.
ELSEIF v_years GE 10.
no_of_days = no_of_days - 3650.
v_amt = v_bet01 * ( 2 / 3 ) * ( 3650 ) / 365 .
it_final-amount = v_amt + v_bet01 * ( no_of_days - v_updays ) / 365 .
ENDIF.
it_final-text = 'Resignation'.
it_final-amount1 = it_final-bsal * 2 .
ELSEIF r3 = 'X'. " Termination Process
IF v_years LT 5.
it_final-amount = v_bet01 * ( 1 / 2 ) * ( no_of_days - v_updays ) / 365.
ELSEIF v_years GT 5 AND v_years LT 10.
no_of_days = no_of_days - 1825.
v_amt = v_bet01 * ( 1 / 2 ) * ( 1825 ) / 365.
v_amt1 = v_bet01 * ( no_of_days - v_updays ) / 365.
it_final-amount = v_amt + v_amt1.
ELSEIF v_years GT 10.
no_of_days = no_of_days - 3650.
v_amt = v_bet01 * ( 1 / 2 ) * ( 1825 ) / 365.
v_amt1 = v_bet01 * ( 1825 ) / 365.
it_final-amount = v_amt + v_amt1 + ( v_bet01 * ( no_of_days - v_updays ) / 365 ).
ENDIF.
IF r5 = 'X'.
it_final-text = 'Terminated with Notice Period'.
it_final-amount1 = it_final-bsal * 2 .
ELSE.
it_final-text = 'Terminated with out Notice Period'.
ENDIF.
ENDIF.
READ TABLE it_pa0008 with key pernr = it_pa0001-pernr.
it_final-eosbasic = it_pa0008-bet01 * basic.
it_final-eoshra = it_pa0008-bet02 * hra.
it_final-eostra = it_pa0008-bet03 * tra.
it_final-eostel = it_pa0008-bet04 * tel.
READ TABLE it_pa0014 WITH KEY pernr = it_pa0001-pernr.
it_final-eosprov = ( v_months_all + 1 ) * it_pa0014-betrg.
it_final-notice_pay = it_final-amount + it_final-eosbasic + it_final-eoshra + it_final-eostra + it_final-eostel .
it_final-nperiod = '60'.
PERFORM get_rt_data.
it_final-eosrev = it_final-eosprov - it_final-amount.
APPEND it_final.
CLEAR it_final.
CLEAR: v_years, v_addi_bdays, v_months, v_days, v_count.
ENDLOOP.
ENDFORM. " PROCESS_DATA
*&---------------------------------------------------------------------*
*& Form BUILD_FIELDCAT
*----------------------------------------------------------------------*
FORM build_fieldcat .
it_layout-colwidth_optimize = 'X'.
wa_fieldcat-fieldname = 'PERNR'.
wa_fieldcat-seltext_m = 'Personnel Number'.
wa_fieldcat-just = 'C'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'BEGDA'.
wa_fieldcat-seltext_m = 'Joining Date'.
wa_fieldcat-just = 'C'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'VORNA'.
wa_fieldcat-seltext_m = 'First Name'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'NACHN'.
wa_fieldcat-seltext_m = 'Last Name'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'STAT'.
wa_fieldcat-seltext_l = 'Employment Status'.
wa_fieldcat-just = 'C'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'SYEARS'.
wa_fieldcat-seltext_m = 'No of Service Years'.
wa_fieldcat-just = 'C'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'SMONTHS'.
wa_fieldcat-seltext_m = 'No of Service Months'.
wa_fieldcat-just = 'C'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'SDAYS'.
wa_fieldcat-seltext_m = 'No of Service Days'.
wa_fieldcat-just = 'C'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'TEXT'.
wa_fieldcat-seltext_m = 'Leaving Status'.
wa_fieldcat-just = 'L'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'NPERIOD'.
wa_fieldcat-seltext_m = 'Notice Period in Days'.
wa_fieldcat-just = 'C'.
wa_fieldcat-no_out = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'BSAL'.
wa_fieldcat-seltext_m = 'Basic Pay'.
wa_fieldcat-just = 'C'.
wa_fieldcat-no_out = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'AMOUNT1'.
wa_fieldcat-seltext_m = 'Notice Period Amount'.
wa_fieldcat-just = 'C'.
wa_fieldcat-no_out = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'EOSPROV'.
wa_fieldcat-seltext_m = 'EOS Provision'.
wa_fieldcat-just = 'C'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'AMOUNT'.
wa_fieldcat-seltext_m = 'Final Benifit Amount'.
wa_fieldcat-just = 'C'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'EOSBASIC'.
wa_fieldcat-seltext_m = 'Extra Basic'.
wa_fieldcat-just = 'C'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname ='EOSHRA'.
wa_fieldcat-seltext_m = 'Extra HRA'.
wa_fieldcat-just = 'C'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'EOSTRA'.
wa_fieldcat-seltext_m = 'Extra TA'.
wa_fieldcat-just = 'C'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'EOSTEL'.
wa_fieldcat-seltext_m = 'Extra Tel Allowance'.
wa_fieldcat-just = 'C'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'EOSREV'.
wa_fieldcat-seltext_m = 'EOS Prov Reversal'.
wa_fieldcat-just = 'C'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. " BUILD_FIELDCAT
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV
*----------------------------------------------------------------------*
FORM display_alv .
it_layout-zebra = 'X'.
it_layout-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_top_of_page = 'TOP_OF_PAGE'
is_layout = it_layout
it_fieldcat = it_fieldcat
it_events = it_events
TABLES
t_outtab = it_final.
ENDFORM. " DISPLAY_ALV
*&---------------------------------------------------------------------*
*& Form top_of_page
*----------------------------------------------------------------------*
FORM top_of_page .
PERFORM write_header.
*--- Get the comments on the top of page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_list[].
ENDFORM. " top_of_page
*&---------------------------------------------------------------------*
*& Form write_header
*----------------------------------------------------------------------*
FORM write_header .
REFRESH it_list.
CLEAR it_list.
CLEAR it_list.
it_list-typ = 'H'.
it_list-key = space.
it_list-info = 'End of Service Benifit Report'.
APPEND it_list TO it_list.
****** REPORT PROGRAM NAME AND CLIENT ****************
it_list-typ = 'S'.
it_list-key = space.
CONCATENATE 'Report...:' sy-repid INTO it_list-info SEPARATED BY space.
APPEND it_list TO it_list.
****** USER NAME *************************************
CLEAR it_list.
it_list-typ = 'S'.
it_list-key = space.
CONCATENATE 'User.....:' sy-uname INTO it_list-info SEPARATED BY space.
APPEND it_list TO it_list.
***…** DATE / TIME STAMP *****************************
CLEAR it_list.
it_list-typ = 'S'.
it_list-key = space.
CONCATENATE 'Date/Time:' ' ' sy-datum+6(2) '/' sy-datum+4(2) '/' sy-datum+0(4)
' ' '/' ' ' sy-uzeit+0(2) ':' sy-uzeit+2(2) ':' sy-uzeit+4(2)
INTO it_list-info.
APPEND it_list TO it_list.
clear it_list.
it_list-typ = 'S'.
it_list-key = space.
concatenate 'Payroll Area:' p_abkrs into it_list-info separated by space.
append it_list to it_list.
it_list-typ = 'S'.
it_list-key = space.
concatenate 'Payroll Period:' p_begda+4(2) '.' p_begda+6(2) '.' p_begda+0(4) ' ' '-' ' '
p_endda+4(2) '.' p_endda+6(2) '.' p_endda+0(4) into it_list-info.
append it_list to it_list.
ENDFORM. " write_header
*&---------------------------------------------------------------------*
*& Form GET_DATA_FROM_CURRENT_PERIOD
*&---------------------------------------------------------------------*
FORM get_data_from_current_period .
SELECT SINGLE * FROM t569v
WHERE abkrs = p_abkrs
AND vwsaz = '01'.
IF sy-subrc = 0.
p_pabrp = t569v-pabrp.
p_pabrj = t569v-pabrj.
ENDIF.
SELECT SINGLE * FROM t549a
WHERE abkrs = p_abkrs.
IF sy-subrc = 0.
v_permo = t549a-permo.
ELSE.
IF r2 = 'X'.
MESSAGE e000 WITH 'Enter a valid Payroll Period'.
ENDIF.
ENDIF.
SELECT SINGLE * FROM t549q WHERE permo = v_permo
AND pabrj = t569v-pabrj
AND pabrp = t569v-pabrp.
IF sy-subrc = 0.
p_begda = t549q-begda.
p_endda = t549q-endda.
ENDIF.
ENDFORM. " GET_DATA_FROM_CURRENT_PERIOD
*&---------------------------------------------------------------------*
*& Form GET_DATA_FROM_PERIOD
*----------------------------------------------------------------------*
FORM get_data_from_period .
SELECT SINGLE * FROM t549a WHERE abkrs = p_abkrs.
v_permo = t549a-permo.
SELECT SINGLE * FROM t549q WHERE permo = v_permo
AND pabrj = p_pabrj
AND pabrp = p_pabrp.
IF sy-subrc = 0.
p_begda = t549q-begda.
p_endda = t549q-endda.
ENDIF.
ENDFORM. " GET_DATA_FROM_PERIOD
*&---------------------------------------------------------------------*
*& Form GET_RT_DATA
*----------------------------------------------------------------------*
FORM get_rt_data .
DATA: l_pernr LIKE pa0001-pernr.
CALL FUNCTION 'CU_READ_RGDIR'
EXPORTING
persnr = it_final-pernr
IMPORTING
molga = w_molga
TABLES
in_rgdir = it_rgdir
EXCEPTIONS
no_record_found = 1
OTHERS = 2.
IF NOT w_molga IS INITIAL.
CALL FUNCTION 'CD_READ_LAST'
EXPORTING
begin_date = p_begda
end_date = p_endda
IMPORTING
out_seqnr = w_seqnr
TABLES
rgdir = it_rgdir
EXCEPTIONS
no_record_found = 1
OTHERS = 2.
ENDIF.
SORT it_rgdir BY fpend DESCENDING.
READ TABLE it_rgdir INTO wa_itrgdir WITH KEY fpbeg = p_begda
fpend = p_endda.
IF sy-subrc = 0.
w_seqnr = wa_itrgdir-seqnr.
ENDIF.
SELECT SINGLE
relid
FROM t500l
INTO w_relid
WHERE molga = w_molga.
l_pernr = it_final-pernr .
CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
EXPORTING
clusterid = w_relid
employeenumber = l_pernr " it_final-pernr
sequencenumber = w_seqnr
read_only_international = 'X'
CHANGING
payroll_result = it_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.
LOOP AT it_result-inter-crt INTO wa_crt.
wagetype = wa_crt-lgart.
CASE wagetype.
WHEN '2120'.
it_final-eosprov = wa_crt-betrg .
ENDCASE.
ENDLOOP.
ENDFORM. " GET_RT_DATA
ALSO READ:
- Use Of BAPI HR_MAINTAIN_MASTERDATA For Updating HR DATA.
- Upload The Over Time Report In HR ABAP.
- Displaying Off-Cycle Report In HR ABAP.
- Loans Detail Report In HR ABAP.
- Gosi Calculation Report In HR ABAP.
.....Back To Sub-Index On HR ABAP.
.....Back To MAIN INDEX.
No comments:
Post a Comment