* This program displays a grade-wise summary of salaries paid.
REPORT z_hr_py_net_salary NO STANDARD PAGE HEADING
LINE-SIZE 155
LINE-COUNT 65.
TABLES : pernr, " Standard Selections for HR Master Data Reporting
pcl1, " HR Cluster 1
pcl2. " HR Cluster 2
INFOTYPES : 0001, " Infotype 0001 (Org. Assignment)
0009. " Infotype 0009 (Bank Details)
INCLUDE : rpc2cd09, " Cluster Directory data definition
rpc2ca00, " Cluster CA Data-Definition
rpc2rx09, " Constants definition Payroll results
" country independent
rpppxd00, " Data definition buffer PCL1/PCL2
rpppxd10, " Common part buffer PCL1/PCL2
rpppxm00. " Buffer handling routine
* For Export and Import of Payroll Results
DATA: it_rgdir LIKE pc261 OCCURS 0 WITH HEADER LINE, " Cluster DIr.
gs_result TYPE pay99_result, " Str for payroll result:Intl.
gs_rt LIKE LINE OF gs_result-inter-rt. " RT Table
* Internal table to hold data
DATA : BEGIN OF it_data OCCURS 0,
werks TYPE p0001-werks, " Personnel Area
persk TYPE p0001-persk, " EE subgroup
emp(5) TYPE i, " Total no. of employees
gross LIKE pc207-betrg, " Amount from '/101'
pf LIKE pc207-betrg, " Amount from '/3F1'
vpf LIKE pc207-betrg, " Amount from '/3F2'
pfar LIKE pc207-betrg, " Amount from '/ZF5',
prtx LIKE pc207-betrg, " Amount from '/3P1'
esic LIKE pc207-betrg, " Amount from '/3E1'
inctx LIKE pc207-betrg, " Amount from '/460'
netsal LIKE pc207-betrg, " Amount from '/559'
END OF it_data.
* Internal table to hold final data
DATA : BEGIN OF it_final OCCURS 0,
row_num(5) TYPE n, " Row Number
werks(20), " Personnel Area Text
persk(20), " EE subgroup Text
emp(5) TYPE i, " Total no. of employees
gross LIKE pc207-betrg, " Amount from '/101'
pf LIKE pc207-betrg, " Amount from '/3F1'
vpf LIKE pc207-betrg, " Amount from '/3F2'
pfar LIKE pc207-betrg, " Amount from '/ZF5',
prtx LIKE pc207-betrg, " Amount from '/3P1'
esic LIKE pc207-betrg, " Amount from '/3E1'
inctx LIKE pc207-betrg, " Amount from '/460'
netsal LIKE pc207-betrg, " Amount from '/559'
END OF it_final.
* Internal table for Employee Subgroup text
DATA: it_t503t LIKE t503t OCCURS 0 WITH HEADER LINE.
* Internal table for Personnel Area text
DATA: BEGIN OF it_t500p OCCURS 0,
persa TYPE t500p-persa, " Personnel Area
name1 TYPE t500p-name1, " PA text
END OF it_t500p.
*--- TYPE POOLS( FOR ALV REPORTING )
TYPE-POOLS: slis.
DATA : it_fieldcat TYPE slis_t_fieldcat_alv, " Fieldcat
it_events TYPE slis_t_event, " Events
it_sort TYPE slis_t_sortinfo_alv, " Sorting
it_list_top_of_page TYPE slis_t_listheader, " Top Of Page
gs_variant LIKE disvariant, " To store Variant
v_repid LIKE sy-repid, " Program name
it_sp_group TYPE slis_t_sp_group_alv, " Grouping
gs_event TYPE slis_alv_event, " Events
gs_layout TYPE slis_layout_alv, " Layout
it_extab TYPE slis_t_extab, " FC Exclusion
it_list_top_of_list TYPE slis_t_listheader, " Top-of-list
v_count(5) TYPE n.
* Constants
CONSTANTS: c_relid LIKE pcl2-relid VALUE 'IN', " Area identification
* wage types
c_101(4) TYPE c VALUE '/101', " Gross salary
c_3f1(4) TYPE c VALUE '/3F1', " Provident Fund
c_3f2(4) TYPE c VALUE '/3F2', " Voluntary PF
c_3p1(4) TYPE c VALUE '/3P1', " Professional tax
c_zf5(4) TYPE c VALUE '/ZF5', " PF & VPF arrears
c_3e1(4) TYPE c VALUE '/3E1', " ESIC
c_460(4) TYPE c VALUE '/460', " Income Tax
c_559(4) TYPE c VALUE '/559', " Bank Transfer
c_560(4) TYPE c VALUE '/560', " Net Salary
* payment method
c_pm(1) TYPE c VALUE 'T'.
CONSTANTS: c_x(1) TYPE c VALUE 'X',
c_molga(2) TYPE c VALUE '40', " Country key
c_mastek(4) TYPE c VALUE 'MLTD', " Company
c_0(1) TYPE n VALUE '0',
c_1(1) TYPE c VALUE '1', " Emp Group
c_2(1) TYPE c VALUE '2',
c_lt01(4) TYPE c VALUE 'LT01', " Location
c_lt02(4) TYPE c VALUE 'LT02',
c_co(2) TYPE c VALUE 'CO',
c_h(1) TYPE c VALUE 'H',
* Payroll period - Months
c_01(2) TYPE c VALUE '01',
c_02(2) TYPE c VALUE '02',
c_03(2) TYPE c VALUE '03',
c_04(2) TYPE c VALUE '04',
c_05(2) TYPE c VALUE '05',
c_06(2) TYPE c VALUE '06',
c_07(2) TYPE c VALUE '07',
c_08(2) TYPE c VALUE '08',
c_09(2) TYPE c VALUE '09',
c_10(2) TYPE c VALUE '10',
c_11(2) TYPE c VALUE '11',
c_12(2) TYPE c VALUE '12',
c_up(4) TYPE c VALUE '&OUP',
c_dwn(4) TYPE c VALUE '&ODN',
c_flt(4) TYPE c VALUE '&ILT'.
*----------------------------------------------------------------------*
* Selection-screen
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-028.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
SELECTION-SCREEN COMMENT 1(13) text-029
FOR FIELD chk_off.
PARAMETER : chk_off AS CHECKBOX. " Off cycle only
SELECTION-SCREEN POSITION 25.
SELECTION-SCREEN COMMENT 20(12) text-030
FOR FIELD p_pytdt.
PARAMETER: p_pytdt TYPE sy-datum. " Payment date
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b1.
*----------------------------------------------------------------------*
* Initialization
*----------------------------------------------------------------------*
INITIALIZATION.
* default values
pnpxabkr = c_01. "Payroll area 01:Monthly
pnpabkrs-low = c_01. "Payroll area 01:Monthly
APPEND pnpabkrs.
pnpbukrs-low = c_mastek. "Company Code MLTD
APPEND pnpbukrs.
* Assign report id to list display
v_repid = sy-repid.
*----------------------------------------------------------------------*
* At selection screen
*----------------------------------------------------------------------*
AT SELECTION-SCREEN.
* Validate selections
PERFORM validate_fields.
*----------------------------------------------------------------------*
* Start of Selection
*----------------------------------------------------------------------*
START-OF-SELECTION.
* Get text
PERFORM get_text.
GET pernr.
* Fetch Org Assignment details
PERFORM get_emp_details.
* get payment method
PERFORM payment_method.
* get amounts from RT ( Results table )
PERFORM get_data_rt.
***********************************************************************
* END-OF-SELECTION
***********************************************************************
END-OF-SELECTION.
* Sort final internal table
PERFORM sort_itab.
* Populating the field catalog
PERFORM fieldcat_init USING it_fieldcat[].
*-Calling the Function Module
PERFORM sort_build USING it_sort[].
* Populating the Header data
PERFORM list_head_buid USING it_list_top_of_list[].
*.Populating Events data
PERFORM get_events.
* List display
PERFORM alv_display TABLES it_final.
*&---------------------------------------------------------------------*
*& Form get_emp_details
*&---------------------------------------------------------------------*
* Fetch Personnel Area, EE group & EE subgroup
*----------------------------------------------------------------------*
FORM get_emp_details .
CLEAR it_data.
rp-provide-from-last p0001 space pn-begda pn-endda.
* process only for Employee Group 1 & 2
IF p0001-persg = c_1 OR "1:Active Employee
p0001-persg = c_2. "2:Consultant
ELSE.
REJECT.
ENDIF.
* process only for Employee Subgroup 'CO' in Employee Group 2
IF p0001-persg = c_2.
IF p0001-persk = c_co. "CO:Consultant
ELSE.
REJECT.
ENDIF.
ENDIF.
* assign count, personal area & employee subgroup
it_data-emp = v_count + 1.
it_data-werks = p0001-werks.
it_data-persk = p0001-persk.
ENDFORM. " get_emp_details
*&---------------------------------------------------------------------*
*& Form get_data_rt
*&---------------------------------------------------------------------*
* Populate waget type amounts to internal table
*----------------------------------------------------------------------*
FORM get_data_rt .
cd-key-pernr = pernr-pernr.
rp-init-buffer. " initialize buffer
rp-imp-c2-cd. " import cluster Directory
IF chk_off IS INITIAL.
* regular payroll runs
PERFORM fetch_regular_data.
ELSE.
PERFORM fetch_offcycle_data.
ENDIF.
IF NOT rgdir-seqnr IS INITIAL.
* read payroll result
CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
EXPORTING
clusterid = c_relid
employeenumber = pernr-pernr
sequencenumber = rgdir-seqnr
read_only_international = c_x
CHANGING
payroll_result = gs_result.
* Read RT
LOOP AT gs_result-inter-rt INTO gs_rt.
CASE gs_rt-lgart.
* Gross salary
WHEN c_101. "/101
it_data-gross = gs_rt-betrg.
* Provident Fund
WHEN c_3f1. "/3F1
it_data-pf = it_data-pf + gs_rt-betrg.
* Voluntary Provident Fund
WHEN c_3f2. "/3F2
it_data-vpf = it_data-vpf + gs_rt-betrg.
* PF & VPF arrears
WHEN c_zf5. "/ZF5
it_data-pfar = gs_rt-betrg.
* Professional tax
WHEN c_3p1. "/3P1
it_data-prtx = it_data-prtx + gs_rt-betrg.
* ESIC
WHEN c_3e1. "/3E1
it_data-esic = it_data-esic + gs_rt-betrg.
* Income tax
WHEN c_460. "/460
it_data-inctx = gs_rt-betrg.
ENDCASE.
* Net salary
IF p0009-zlsch = c_pm. "T
IF gs_rt-lgart = c_559. "/559:Bank Transfer Wage Type
it_data-netsal = gs_rt-betrg.
ENDIF.
ELSE.
IF gs_rt-lgart = c_560. "/560:Net Salary Wage Type
it_data-netsal = gs_rt-betrg.
ENDIF.
ENDIF.
ENDLOOP.
COLLECT it_data.
CLEAR it_data.
ENDIF.
ENDFORM. " get_data_rt
*&---------------------------------------------------------------------*
*& Form Payment_method
*&---------------------------------------------------------------------*
* get payment method from IT0009
*----------------------------------------------------------------------*
FORM payment_method.
rp-provide-from-last p0009 space pn-begda pn-endda.
ENDFORM. " Payment_method
*&---------------------------------------------------------------------*
*& Form sort_itab
*&---------------------------------------------------------------------*
* Sort data internal table
*----------------------------------------------------------------------*
FORM sort_itab.
DATA: l_count(5) TYPE i.
SORT it_data BY werks persk.
LOOP AT it_data.
CLEAR: it_t500p,it_t503t.
l_count = l_count + 1.
AT NEW werks.
CLEAR it_t500p.
READ TABLE it_t500p WITH KEY persa = it_data-werks BINARY SEARCH.
IF sy-subrc = 0.
it_final-row_num = l_count.
it_final-werks = it_data-werks.
it_final-persk = 'Mastek Ltd'(001).
it_final-emp = space.
it_final-gross = space.
it_final-pf = space.
it_final-vpf = space.
it_final-pfar = space.
it_final-prtx = space.
it_final-esic = space.
it_final-inctx = space.
it_final-netsal = space.
APPEND it_final.
CLEAR it_final.
l_count = l_count + 1.
it_final-row_num = l_count.
it_final-werks = it_data-werks.
it_final-persk = it_t500p-name1.
it_final-emp = space.
it_final-gross = space.
it_final-pf = space.
it_final-vpf = space.
it_final-pfar = space.
it_final-prtx = space.
it_final-esic = space.
it_final-inctx = space.
it_final-netsal = space.
APPEND it_final.
CLEAR it_final.
ENDIF.
ENDAT.
AT NEW persk.
READ TABLE it_t503t WITH KEY persk = it_data-persk BINARY SEARCH.
IF sy-subrc = 0.
it_final-persk = it_t503t-ptext.
ENDIF.
ENDAT.
IF NOT it_t503t-ptext IS INITIAL.
l_count = l_count + 1.
it_final-row_num = l_count.
it_final-werks = it_data-werks.
it_final-emp = it_data-emp.
it_final-gross = it_data-gross.
it_final-pf = it_data-pf.
it_final-vpf = it_data-vpf.
it_final-pfar = it_data-pfar.
it_final-prtx = it_data-prtx.
it_final-esic = it_data-esic.
it_final-inctx = it_data-inctx.
it_final-netsal = it_data-netsal.
APPEND it_final.
CLEAR it_final.
ENDIF.
ENDLOOP.
ENDFORM. " sort_itab
*&---------------------------------------------------------------------*
*& Form get_text
*&---------------------------------------------------------------------*
* Get text for Personnel Areas & Employee Subgroups
*----------------------------------------------------------------------*
FORM get_text.
*Personnel area
SELECT persa
name1
FROM t500p
INTO TABLE it_t500p
WHERE molga = c_molga "40:India
AND bukrs = c_mastek. "MLTD
SORT it_t500p BY persa.
*Employee Subgroups
SELECT * FROM t503t
INTO TABLE it_t503t
WHERE sprsl = sy-langu.
SORT it_t503t BY persk.
ENDFORM. " get_text
*&---------------------------------------------------------------------*
*& Form fieldcat_init
*&---------------------------------------------------------------------*
* Fill field catalog
*----------------------------------------------------------------------*
FORM fieldcat_init USING gt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv,
v_pos TYPE i VALUE 1.
PERFORM list_header USING v_pos 'WERKS' 'WERKS' ' ' ' '.
PERFORM list_header USING v_pos 'PERSK' 'PERSK' ' ' ' '.
PERFORM list_header USING v_pos 'EMP' 'EMP' ' ' ' '.
PERFORM list_header USING v_pos 'GROSS' 'GROSS' ' ' ' '.
PERFORM list_header USING v_pos 'PF' 'PF' ' ' ' '.
PERFORM list_header USING v_pos 'VPF' 'VPF' ' ' ' '.
PERFORM list_header USING v_pos 'PFAR' 'PFAR' ' ' ' '.
PERFORM list_header USING v_pos 'PRTX' 'PRTX' ' ' ' '.
PERFORM list_header USING v_pos 'ESIC' 'ESIC' ' ' ' '.
PERFORM list_header USING v_pos 'INCTX' 'INCTX' ' ' ' '.
PERFORM list_header USING v_pos 'NETSAL' 'NETSAL' ' ' ' '.
ENDFORM. " fieldcat_init
*&---------------------------------------------------------------------*
*& Form list_header
*&---------------------------------------------------------------------*
* List Header for ALV
*----------------------------------------------------------------------*
FORM list_header USING v_pos TYPE i
fieldname TYPE slis_fieldcat_alv-fieldname
ref_fieldname TYPE slis_fieldcat_alv-ref_fieldname
tabname TYPE slis_fieldcat_alv-tabname
key TYPE slis_fieldcat_alv-key.
DATA : ls_fieldcat TYPE slis_fieldcat_alv.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = v_pos.
ls_fieldcat-fieldname = fieldname.
ls_fieldcat-ref_fieldname = ref_fieldname.
ls_fieldcat-ref_tabname = tabname.
ls_fieldcat-key = key.
IF fieldname = 'ROW_NUM'.
ls_fieldcat-no_out = c_x.
ENDIF.
IF fieldname = 'WERKS'.
ls_fieldcat-tech = c_x.
ENDIF.
IF fieldname = 'PERSK'.
ls_fieldcat-seltext_s = 'DETAIL'(017).
ls_fieldcat-seltext_m = 'DETAIL'(017).
ls_fieldcat-seltext_l = 'DETAIL'(017).
ls_fieldcat-ddic_outputlen = '15'.
ls_fieldcat-fix_column = c_x.
ENDIF.
IF fieldname = 'EMP'.
ls_fieldcat-seltext_s = 'TOTAL EMP.'(018).
ls_fieldcat-seltext_m = 'TOTAL EMP.'(018).
ls_fieldcat-seltext_l = 'TOTAL EMP.'(018).
ls_fieldcat-ddic_outputlen = '10'.
ls_fieldcat-do_sum = c_x.
ls_fieldcat-no_zero = c_x.
ENDIF.
IF fieldname = 'GROSS'.
ls_fieldcat-seltext_s = 'GROSS SALARY'(019).
ls_fieldcat-seltext_m = 'GROSS SALARY'(019).
ls_fieldcat-seltext_l = 'GROSS SALARY'(019).
ls_fieldcat-ddic_outputlen = '15'.
ls_fieldcat-do_sum = c_x.
ls_fieldcat-no_zero = c_x.
ENDIF.
IF fieldname = 'PF'.
ls_fieldcat-seltext_s = 'P.F.'(020).
ls_fieldcat-seltext_m = 'P.F.'(020).
ls_fieldcat-seltext_l = 'P.F.'(020).
ls_fieldcat-ddic_outputlen = '15'.
ls_fieldcat-do_sum = c_x.
ls_fieldcat-no_zero = c_x.
ENDIF.
IF fieldname = 'VPF'.
ls_fieldcat-seltext_s = 'V.P.F.'(021).
ls_fieldcat-seltext_m = 'V.P.F.'(021).
ls_fieldcat-seltext_l = 'V.P.F.'(021).
ls_fieldcat-ddic_outputlen = '15'.
ls_fieldcat-do_sum = c_x.
ls_fieldcat-no_zero = c_x.
ENDIF.
IF fieldname = 'PFAR'.
ls_fieldcat-seltext_s = 'PF/VPF Arrears'(033).
ls_fieldcat-seltext_m = 'PF/VPF Arrears'(033).
ls_fieldcat-seltext_l = 'PF/VPF Arrears'(033).
ls_fieldcat-ddic_outputlen = '15'.
ls_fieldcat-do_sum = c_x.
ls_fieldcat-no_zero = c_x.
ENDIF.
IF fieldname = 'PRTX'.
ls_fieldcat-seltext_s = 'PROF. TAX'(022).
ls_fieldcat-seltext_m = 'PROF. TAX'(022).
ls_fieldcat-seltext_l = 'PROF. TAX'(022).
ls_fieldcat-ddic_outputlen = '15'.
ls_fieldcat-do_sum = c_x.
ls_fieldcat-no_zero = c_x.
ENDIF.
IF fieldname = 'ESIC'.
ls_fieldcat-seltext_s = 'E.S.I.C.'(023).
ls_fieldcat-seltext_m = 'E.S.I.C.'(023).
ls_fieldcat-seltext_l = 'E.S.I.C.'(023).
ls_fieldcat-ddic_outputlen = '15'.
ls_fieldcat-do_sum = c_x.
ls_fieldcat-no_zero = c_x.
ENDIF.
IF fieldname = 'INCTX'.
ls_fieldcat-seltext_s = 'INCOME TAX'(024).
ls_fieldcat-seltext_m = 'INCOME TAX'(024).
ls_fieldcat-seltext_l = 'INCOME TAX'(024).
ls_fieldcat-ddic_outputlen = '15'.
ls_fieldcat-do_sum = c_x.
ls_fieldcat-no_zero = c_x.
ENDIF.
IF fieldname = 'NETSAL'.
ls_fieldcat-seltext_s = 'NET SALARY'(025).
ls_fieldcat-seltext_m = 'NET SALARY'(025).
ls_fieldcat-seltext_l = 'NET SALARY'(025).
ls_fieldcat-ddic_outputlen = '15'.
ls_fieldcat-do_sum = c_x.
ls_fieldcat-no_zero = c_x.
ENDIF.
APPEND ls_fieldcat TO it_fieldcat.
v_pos = v_pos + 1.
ENDFORM. " list_header
*&---------------------------------------------------------------------*
*& Form get_events
*&---------------------------------------------------------------------*
* Subroutine to get events list
* ------------------------------------------------------------------*
FORM get_events.
*---To get Events list
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_events.
READ TABLE it_events WITH KEY name = slis_ev_top_of_list
INTO gs_event.
IF sy-subrc = 0.
MOVE 'TOP_OF_LIST' TO gs_event-form.
APPEND gs_event TO it_events.
ENDIF.
ENDFORM. " get_events
*&---------------------------------------------------------------------*
*& Form alv_display
*&---------------------------------------------------------------------*
* Display list
*----------------------------------------------------------------------*
FORM alv_display TABLES i_itab STRUCTURE it_final.
* Layout settings( to display text in totals row )
gs_layout-totals_text = 'Grand Total'(026).
gs_layout-subtotals_text = 'Total'(027).
gs_layout-numc_sum = c_x.
* to exclude sort buttons
APPEND c_up TO it_extab. " '&OUP'
APPEND c_dwn TO it_extab. " '&ODN'
APPEND c_flt TO it_extab. " '&ILT'
*---Output of a simple list (single-line)
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_interface_check = ' '
i_callback_program = v_repid
is_layout = gs_layout
it_fieldcat = it_fieldcat[]
it_excluding = it_extab[]
it_special_groups = it_sp_group[]
it_sort = it_sort[]
is_variant = gs_variant
it_events = it_events[]
TABLES
t_outtab = i_itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " alv_display
*---------------------------------------------------------------------*
* FORM TOP_OF_LIST *
*---------------------------------------------------------------------*
* Description: This form is to call the Function Module *
* 'REUSE_ALV_COMMENTARY_WRITE' *
*---------------------------------------------------------------------*
FORM top_of_list.
*---List body comment block output
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_list_top_of_list.
ENDFORM. "top_of_page
*&---------------------------------------------------------------------*
*& Form list_head_buid
*&---------------------------------------------------------------------*
* Populate list header
*----------------------------------------------------------------------*
FORM list_head_buid USING lt_top_of_list
TYPE slis_t_listheader.
DATA: ls_line TYPE slis_listheader,
lv_month(12),
lv_year(4),
lv_period(25),
lv_offdt(10).
* Company
ls_line-typ = c_h. " H
ls_line-key = ' '.
ls_line-info = 'MASTEK LTD.'(002).
APPEND ls_line TO lt_top_of_list.
CLEAR ls_line.
* Title of list
ls_line-typ = c_h. " H
ls_line-key = ' '.
ls_line-info = 'NET SALARY REPORT'(003).
APPEND ls_line TO lt_top_of_list.
CLEAR ls_line.
* if current period is selected,assign current month & year to
* other month & year for display in output
IF pnptimr9 = c_x.
pnppabrp = pnpdispp. " Current month
pnppabrj = pnpdispj. " Current Year
ENDIF.
* to display period in words
IF chk_off IS INITIAL.
CASE pnppabrp.
WHEN c_01. " 01
lv_month = 'APRIL'(004).
WHEN c_02. " 02
lv_month = 'MAY'(005).
WHEN c_03. " 03
lv_month = 'JUNE'(006).
WHEN c_04. " 04
lv_month = 'JULY'(007).
WHEN c_05. " 05
lv_month = 'AUGUST'(008).
WHEN c_06. " 06
lv_month = 'SEPTEMBER'(009).
WHEN c_07. " 07
lv_month = 'OCTOBER'(010).
WHEN c_08. " 08
lv_month = 'NOVEMBER'(011).
WHEN c_09. " 09
lv_month = 'DECEMBER'(012).
WHEN c_10. " 10
lv_month = 'JANUARY'(013).
WHEN c_11. " 11
lv_month = 'FEBRUARY'(014).
WHEN c_12. "12
lv_month = 'MARCH'(015).
ENDCASE.
lv_year = pnppabrj.
CONCATENATE 'SALARY FOR'(016) lv_month '-' lv_year INTO lv_period
SEPARATED BY space.
ELSE.
WRITE p_pytdt TO lv_offdt.
CONCATENATE 'Off-Cycle on:'(032) lv_offdt INTO lv_period
SEPARATED BY space.
ENDIF.
ls_line-typ = c_h.
ls_line-key = ' '.
ls_line-info = lv_period.
APPEND ls_line TO lt_top_of_list.
CLEAR ls_line.
ENDFORM. " list_head_buid
*&---------------------------------------------------------------------*
*& Form sort_build
*&---------------------------------------------------------------------*
* sort for display
*----------------------------------------------------------------------*
FORM sort_build USING p_sort TYPE slis_t_sortinfo_alv.
DATA: ls_sort LIKE LINE OF it_sort.
ls_sort-fieldname = 'WERKS'.
ls_sort-spos = c_1.
ls_sort-up = c_x.
ls_sort-obligatory = c_x.
ls_sort-subtot = c_x.
APPEND ls_sort TO p_sort.
ENDFORM. " sort_build
*&---------------------------------------------------------------------*
*& Form validate_fields
*&---------------------------------------------------------------------*
* If off-cycle is checked then payment date is mandatory
*----------------------------------------------------------------------*
FORM validate_fields.
IF chk_off IS NOT INITIAL.
IF p_pytdt IS INITIAL.
MESSAGE e034(zb) WITH text-031.
ENDIF.
ENDIF.
ENDFORM. " validate_fields
*&---------------------------------------------------------------------*
*& Form fetch_regular_data
*&---------------------------------------------------------------------*
* If off-cycle is not checked, get data of regular payroll runs
* ( do not consider retro & off-cycle )
*----------------------------------------------------------------------*
FORM fetch_regular_data.
CLEAR rgdir.
LOOP AT rgdir WHERE ipend <= pn-endda AND ipend >= pn-begda
AND void IS INITIAL
AND reversal IS INITIAL
AND ocrsn IS INITIAL
AND inocr IS INITIAL.
* original results => forperiod = inperiod
IF rgdir-fpper = rgdir-inper.
* assign emp no. & seq no. to rx-key
rx-key-pernr = pernr-pernr.
rx-key-seqno = rgdir-seqnr.
ENDIF.
ENDLOOP.
ENDFORM. " fetch_regular_data
*&---------------------------------------------------------------------*
*& Form fetch_offcycle_data
*&---------------------------------------------------------------------*
* If off-cycle is checked, get data of off-cycle runs only
*----------------------------------------------------------------------*
FORM fetch_offcycle_data.
CLEAR rgdir.
LOOP AT rgdir WHERE ipend <= pn-endda AND ipend >= pn-begda
AND void IS INITIAL
AND reversal IS INITIAL
AND ocrsn IS NOT INITIAL
AND paydt = p_pytdt.
* assign emp no. & seq no. to rx-key
rx-key-pernr = pernr-pernr.
rx-key-seqno = rgdir-seqnr.
ENDLOOP.
ENDFORM. " fetch_offcycle_data
ALSO READ:
- Cumulative Amount Report in HR ABAP.
- Use Of Time Macro rp-read-all-time-ity in HR ABAP.
- Cumulative List Of Absences For Company Code, Personnel Area & Personnel Subarea.
- Employee Data Using Function Module In HR ABAP.
- BDC For The Action Transfer Of Location In HR ABAP.
.....Back To Index On HR ABAP.
.....Back To MAIN INDEX.