Skip to Content

Salary Comparison Report by creating Dynamic Internal Table

This report will show the data of given date ranges.

The report is created using dynamic internal table creation.

The Main Program

***********************************************************************
* Description:This program will read the payroll results and display  *
* them on ALV report.It will also compare the salary data               *
*  between the provided date ranges                                                   *
***********************************************************************
REPORT  zhrpy01.
***********************************************************************
* INCLUDES                                                                                             *
***********************************************************************
“—Include for all types and data
INCLUDE zhrpy01_top.
“—Include for selection screen
INCLUDE zhrpy01_screen.
“—Include for class and methods
INCLUDE zhrpy01_class.
“—Include for PBO
INCLUDE zhrpy01_pbo.
“—Include for PAI
INCLUDE zhrpy01_pai.
*&——————————————————————–*
*& INITIALIZATION
*&——————————————————————–*
INITIALIZATION.
“–initialize default data
CREATE OBJECT o_sal_comp.
*&——————————————————————–*
*& AT SELECTION SCREEN
*&——————————————————————–*
AT SELECTION-SCREEN.
IF o_sal_comp IS NOT BOUND.
CREATE OBJECT o_sal_comp.
ENDIF.
*—Validate screen
o_sal_comp
->m_validate_screen( ).
*&——————————————————————–*
*& START OF SELECTION
*&——————————————————————–*
START-OF-SELECTION.
*&——————————————————————–*
*& Build field catalog first and than  create dynamic table
*&——————————————————————–*
o_sal_comp
->m_build_field_catalog( ).
CLEAR it_saldata.
*&——————————————————————–*
*& GET PERNR
*&——————————————————————–*
GET pernr.
UNASSIGN <x_empdata>
.
APPEND INITIAL LINE TO it_empdata ASSIGNING <x_empdata>.
IF <x_empdata> IS ASSIGNED.
*&——————————————————————–*
* Get Action details
rp
providefromlast p0000 space s_datelow s_datehigh.
IF pnpswfound = c_1 AND p0000stat2 = c_3.

*&——————————————————————–*
* Get organnization details
rp
providefromlast p0001 space s_datelow s_datehigh.
IF pnpswfound = c_1.
*&—PERNR
<x_empdata>
pernr = p0001pernr.
*&—Employee Name
<x_empdata>
ename = p0001ename.
*&—Cost Center
<x_empdata>
kostl = p0001kostl.
*&—Department
<x_empdata>
zzdept1 = p0001zzdept1.
*&—Section
<x_empdata>
btrtl = p0001btrtl.
*&—Grade
<x_empdata>
persk = p0001persk.
*&—SBU
<x_empdata>
zzsbu1 = p0001zzsbu1.
*&—Segment
<x_empdata>
zzseg1 = p0001zzseg1.
*&—Payroll Area
<x_empdata>
abkrs = p0001abkrs.
ENDIF.
*&——————————————————————–*
* Get Bank details
rp
providefromlast p0009 space s_datelow s_datehigh.
IF pnpswfound = c_1.
*&—Bank Key
<x_empdata>
bankl = p0009bankl.
*&—Account Number
<x_empdata>
bankn = p0009bankn.
ENDIF.
*&——————————————————————–*
* Get Dates
rp
providefromlast p0041 space s_datelow s_datehigh.
IF pnpswfound = c_1.
CLEAR :gv_dar,gv_dat.
*&———————————————————————*
*& Do loop to check for hire date or original hire date
DO 12 TIMES VARYING gv_dar FROM p0041dar01 NEXT
p0041
dar02
VARYING gv_dat
FROM p0041dat01 NEXT
p0041
dat02.
*&———————————————————————*
*& Check for Original date
IF gv_dar = c_92.
<x_empdata>
jdate = gv_dat.
*&———————————————————————*
*& Check for hire date
ELSEIF gv_dar = c_95.
<x_empdata>
rdate = gv_dat.
ENDIF.
CLEAR: gv_dar, gv_dat.
ENDDO.
ENDIF.
ENDIF.
*&———————————————————————*
*& Get Salary Details
*&———————————————————————*

*& Reading of the Payresult for all the Periods
CLEAR: it_rgdir,it_rgdir_tmp,gv_relid,gv_type, gv_typename,
ref_payresult
, gv_molga, gv_type_1,gv_tadir.

*&———————————————————————*
* Get Sequence numbers
CALL FUNCTION ‘CU_READ_RGDIR’
EXPORTING
persnr         
= pernrpernr
TABLES
in_rgdir       
= it_rgdir
EXCEPTIONS
no_record_found
= 1
OTHERS          = 2.
IF sysubrc = 0.
*&———————————————————————*
*PYXX_GET_RELID_FROM_PERNR
CALL FUNCTION ‘PYXX_GET_RELID_FROM_PERNR’
EXPORTING
employee                   
= pernrpernr
IMPORTING
relid                      
= gv_relid
molga                      
= gv_molga
EXCEPTIONS
error_reading_infotype_0001
= 1
error_reading_molga        
= 2
error_reading_relid        
= 3
OTHERS                      = 4.
IF sysubrc NE 0.
ENDIF.
*&———————————————————————*
*Verify the relid
SELECT SINGLE typename
FROM t52relid
INTO gv_type
WHERE relid EQ gv_relid
AND tabname = ‘PCL2’.
IF sysubrc NE 0.
gv_relid
= ‘IN’.
gv_type
= ‘PAYIN_RESULT’.
ENDIF.
gv_typename
= gv_type.
CREATE DATA ref_payresult TYPE (gv_typename).
ASSIGN ref_payresult->* TO <x_payresult>.
*      SRTZA–Status Of records.
*      SRTZA = ‘A’ –Current Result.
*      DELETE it_rgdir WHERE srtza NE ‘A’.
* PAYTY –> Payment Type ( Regular or Bonus)
* PAYTY =  SPACE –‘Regular Payroll’.
* PAYTY = ‘B’   –> ‘Bonus’.
*&———————————————————————*
*Get Payroll Result
IF it_rgdir IS NOT INITIAL.
it_rgdir_tmp
= it_rgdir.
SORT it_rgdir_tmp BY seqnr DESCENDING.
LOOP AT it_monthrange ASSIGNING <x_monthrange> WHERE type  = c_s.
LOOP AT it_rgdir_tmp INTO wa_rgdir WHERE abkrs IN pnpabkrs
AND srtza = ‘A’
AND fpbeg <= <x_monthrange>endda
AND fpend >= <x_monthrange>begda .
CALL FUNCTION ‘PYXX_READ_PAYROLL_RESULT’
EXPORTING
clusterid                   
= gv_relid
employeenumber              
= pernrpernr
sequencenumber              
= wa_rgdirseqnr
CHANGING
payroll_result              
= <x_payresult>
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.
IF sysubrc EQ 0.
ASSIGN COMPONENT ‘INTER-RT’
OF STRUCTURE <x_payresult> TO <x_rt>.
LOOP AT <x_rt> INTO wa_rt.
UNASSIGN <x_saldata>
.
APPEND INITIAL LINE TO it_saldata ASSIGNING <x_saldata>.
IF <x_saldata> IS ASSIGNED.
<x_saldata>
pernr = pernrpernr.
<x_saldata>
lgart = wa_rtlgart.
<x_saldata>
betrg = wa_rtbetrg.
<x_saldata>
pabrj = <x_monthrange>pabrj.
<x_saldata>
pabrp = <x_monthrange>pabrp.
<x_saldata>
begda = <x_monthrange>begda.
<x_saldata>
endda = <x_monthrange>endda.
<x_saldata>
payty = wa_rgdirpayty.
CONCATENATE c_s <x_monthrange>monthnm <x_monthrange>begda+0(4)
INTO <x_saldata>month.
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDLOOP.
*&———————————————————————*
*If Comparison to be made
IF s_cdate IS NOT INITIAL.
LOOP AT it_monthrange ASSIGNING <x_monthrange> WHERE type  = c_c.
CLEAR : wa_rgdir,wa_rt,<x_rt>,<x_payresult>.

LOOP AT it_rgdir_tmp INTO wa_rgdir WHERE abkrs IN pnpabkrs
AND srtza = ‘A’
AND fpbeg <= <x_monthrange>endda
AND fpend >= <x_monthrange>begda .
CALL FUNCTION ‘PYXX_READ_PAYROLL_RESULT’
EXPORTING
clusterid                   
= gv_relid
employeenumber              
= pernrpernr
sequencenumber              
= wa_rgdirseqnr
CHANGING
payroll_result              
= <x_payresult>
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.
IF sysubrc EQ 0.
UNASSIGN <x_rt>
.
ASSIGN COMPONENT ‘INTER-RT’
OF STRUCTURE <x_payresult> TO <x_rt>.
LOOP AT <x_rt> INTO wa_rt.
UNASSIGN <x_saldata>
.
APPEND INITIAL LINE TO it_saldata ASSIGNING <x_saldata>.
IF <x_saldata> IS ASSIGNED.
<x_saldata>
pernr = pernrpernr.
<x_saldata>
lgart = wa_rtlgart.
<x_saldata>
betrg = wa_rtbetrg.
<x_saldata>
pabrj = <x_monthrange>pabrj.
<x_saldata>
pabrp = <x_monthrange>pabrp.
<x_saldata>
begda = <x_monthrange>begda.
<x_saldata>
endda = <x_monthrange>endda.
<x_saldata>
payty = wa_rgdirpayty.
CONCATENATE c_c <x_monthrange>monthnm <x_monthrange>begda+0(4)
INTO <x_saldata>month.

ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
*&——————————————————————–*
*& END OF SELECTION
*&——————————————————————–*
END-OF-SELECTION.
IF it_saldata  IS NOT INITIAL.
CLEAR: it_wagedata.
o_sal_comp
->m_get_wage_data( ).
o_sal_comp
->m_populate_final_table( ).
IF <x_final> IS ASSIGNED.
o_sal_comp
->m_display_data( ).
ELSE.
MESSAGE text054  TYPE c_e.
ENDIF.
ENDIF.

The top Include

*&———————————————————————*

*&  Include           ZHRPY01_TOP

*&———————————————————————*

CLASS cl_salary_comparison DEFINITION DEFERRED.

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

*Tables                                                                *

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

TABLES:

pernr, pcl1, pcl2, pc260, pc261, pc207,t549a,t52ek,t52ep.

INFOTYPES:

0000, 0001,0041,0009.

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

*Objects                                                               *

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

DATA :

o_sal_comp   TYPE REF TO cl_salary_comparison           ,

o_cc         TYPE REF TO cl_gui_custom_container        ,

o_split      TYPE REF TO cl_gui_easy_splitter_container ,

o_top_cntnr  TYPE REF TO cl_gui_container               ,

o_btm_cntnr  TYPE REF TO cl_gui_container               ,

o_doc        TYPE REF TO cl_dd_document                 , “Document

o_alv        TYPE REF TO cl_gui_alv_grid                .

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

*Constants                                                             *

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

CONSTANTS : c_e       TYPE  VALUE  ‘E’  ,

             c_i       TYPE  VALUE  ‘I’  ,

             c_c       TYPE  VALUE  ‘C’  ,

             c_s       TYPE  VALUE  ‘S’  ,

             c_x       TYPE  VALUE  ‘X’  ,

             c_1       TYPE  VALUE  ‘1’  ,

             c_2       TYPE  VALUE  ‘2’  ,

             c_3       TYPE  VALUE  ‘3’  ,

             c_92(2)   TYPE  VALUE  ’92’ ,

             c_95(2)   TYPE  VALUE  ’95’ ,

             c_40(2)   TYPE  VALUE  ’40’ ,

             c_char(4) TYPE  VALUE  ‘STRG’,

             c_curr(4) TYPE  VALUE  ‘CURR’,

             c_dats(4) TYPE  VALUE  ‘DATS’.

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

*Global Data                                                           *

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

DATA gv_colpos     TYPE  VALUE  1     ,

         gv_dar        TYPE datar            ,

         gv_dat        TYPE dardt            ,

         gv_relid      TYPE t500lrelid      ,

         gv_type       TYPE t52relidtypename,

         gv_typename   TYPE hrpclx_type      ,

         ref_payresult TYPE REF TO data      ,

         gv_molga      TYPE molga            ,

         gv_type_1     TYPE tadirobj_name   ,

         gv_tadir      TYPE tadirobj_name   .

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

*Types                                                                 *

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

TYPES:

*&———————————————————————*

* Employee Data

*&———————————————————————*

BEGIN OF ty_empdata           ,

   pernr    TYPE pernr_d       ,    “Employee Number

   ename    TYPE emnam         ,    “Employee Name

   jdate    TYPE sydatum      ,    “Joining Date

   rdate    TYPE sydatum      ,    “Resignation Date

   kostl    TYPE kostl         ,    “Cost center

   zzdept1  TYPE zzdept1       ,    “Department

   btrtl    TYPE btrtl         ,    “Section

   persk    TYPE persk         ,    “Employee Sub Group

   zzsbu1   TYPE zzsbu1        ,    “SBU

   zzseg1   TYPE zzseg1        ,    “Segment

   abkrs    TYPE abkrs         ,    “Payroll Area

   bankl    TYPE bankk         ,    “Bank Key

   bankn    TYPE bankn         ,    “Account Number

   stat2    TYPE stat2         ,    “Employee Status

END   OF ty_empdata           ,

*&———————————————————————*

*Salary Data

*&———————————————————————*

BEGIN OF ty_saldata           ,

   pernr    TYPE pernr_d       ,    “Employee Number

   lgart    TYPE lgart         ,    “Wage type

   pabrj     TYPE pabrj         ,

   pabrp     TYPE pabrp         ,

   payty    type c             ,

   begda     TYPE begda         ,

   endda     TYPE endda         ,

   betrg    TYPE maxbt         ,    “amount

   expct    TYPE sydatum      ,    “Expense Category

   month(20) type c            ,

END   OF ty_saldata           ,

*&———————————————————————*

*Wage Type Symbolic Account

*&———————————————————————*

BEGIN OF ty_wagedata          ,

   lgart    TYPE lgart         ,    “Wage type

   symko    TYPE p_komok40     ,    “Symbolic Account

END   OF ty_wagedata          ,

*&———————————————————————*

*Wage Type GL Account

*&———————————————————————*

BEGIN OF ty_gldata            ,

   symko    TYPE p_komok40     ,    “Symbolic Account

   konth    TYPE saknr         ,    “GL Account number

END   OF ty_gldata            ,

*&———————————————————————*

*Month Range

*&———————————————————————*

BEGIN OF ty_monthrange        ,

   type     TYPE c             ,    “type

   month(2) TYPE c             ,    “Month No

   monthnm  TYPE t247ltx      ,    “Name

   year(4TYPE c             ,    “year

   permo     TYPE permo         ,

   pabrj     TYPE pabrj         ,

   pabrp     TYPE pabrp         ,

   begda     TYPE begda         ,

   endda     TYPE endda         ,

END   OF ty_monthrange        ,

*&———————————————————————*

*Wage Type Text

*&———————————————————————*

BEGIN OF ty_wagetypetext      ,

   LGART    TYPE LGART         ,

   LGTXT    TYPE LGTXT         ,

END   OF ty_wagetypetext      ,

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

*Field symbols                                                         *

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

FIELD-SYMBOLS:

  <x_empdata>          TYPE ty_empdata                     ,

  <x_saldata>          TYPE ty_saldata                     ,

  <x_csaldata>         TYPE ty_saldata                     ,

  <x_wagedata>         TYPE ty_wagedata                    ,

  <x_gldata>           TYPE ty_gldata                      ,

  <x_monthrange>       TYPE ty_monthrange                  ,

  <x_final>            TYPE STANDARD TABLE                 ,

  <x_wfinal>                                               ,

  <x_field>                                                ,

  <x_payresult>        TYPE ANY                            ,

  <x_rt>               TYPE hrpay99_rt                     ,

  <x_wagetypetext>     TYPE ty_wagetypetext                .

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

*Global tables                                                         *

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

DATA:

it_empdata        TYPE STANDARD TABLE OF ty_empdata       ,

it_saldata        TYPE STANDARD TABLE OF ty_saldata       ,

it_wagedata       TYPE STANDARD TABLE OF ty_wagedata      ,

it_gldata         TYPE STANDARD TABLE OF ty_gldata        ,

it_csaldata       TYPE STANDARD TABLE OF ty_saldata       ,

it_rgdir          TYPE STANDARD TABLE OF pc261            ,

it_rgdir_tmp      TYPE STANDARD TABLE OF pc261            ,

it_monthrange     TYPE STANDARD TABLE OF ty_monthrange    ,

it_fieldcatalog   TYPE lvc_t_fcat                         ,

it_wagetypetext   type STANDARD TABLE OF ty_wagetypetext  .

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

*Global Work Area                                                      *

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

DATA:

wa_rt             TYPE pc207             ,

wa_rgdir          TYPE pc261             ,

wa_fieldcatalog   TYPE lvc_s_fcat        ,

wa_layout         TYPE lvc_s_layo        .

The Selection Screen

*&———————————————————————*

*&  Include           ZHRPY01_SCREEN

*&———————————————————————*

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

*& Selection screen

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

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text000.

SELECT-OPTIONS : s_date  FOR sydatum   , “Date Range

                  s_cdate FOR sydatum   . “Compare date

SELECTION-SCREEN END OF BLOCK b1.


The Class Include

*&———————————————————————*

*&  Include           ZHRPY01_CLASS

*&———————————————————————*

*———————————————————————-*

*       CLASS cl_salary_comparison DEFINITION

*———————————————————————-*

*       Class Definition to define methods

*———————————————————————-*

CLASS cl_salary_comparison DEFINITION FINAL.

   PUBLIC SECTION.

*———————————————————————-*

*  DATA

*———————————————————————-*

*———————————————————————-*

* METHODS

*———————————————————————-*

     METHODS:

*—Method to validate screen inputs

     m_validate_screen                   ,

*—Method to build field catalog

     m_build_field_catalog               ,

*—Method to get the GL accoung for wage type

     m_get_wage_data                     ,

*—Method to populate final table

     m_populate_final_table              ,

*—Method to display data

     m_display_data                      ,

*—Method to display alv

     m_display_alv                       .

   PRIVATE SECTION.

     METHODS:

*—Method to build field catalog

     m_create_dynmc_table                ,

*—Method to build field catalog

     m_set_layout                        ,

*—Method to prepare top of page

     m_prepare_topofpage                 ,

*—Method to set field catalog

     m_set_field_catalog

     IMPORTING p_field   TYPE lvc_fname

               p_seltext TYPE lvc_txt

               p_dosum   TYPE lvc_dosum

               p_datatype TYPE datatype_d.

ENDCLASS.                    “cl_Salary_comparison DEFINITION

*———————————————————————-*

*       CLASS cl_salary_comparison IMPLEMENTATION

*———————————————————————-*

*       Class implementation to implement methods

*———————————————————————-*

CLASS cl_salary_comparison IMPLEMENTATION.

*———————————————————————-*

*       CLASS m_validate_screen

*———————————————————————-*

*       To Validate screen

*———————————————————————-*

   METHOD  m_validate_screen.

*—Validate the Date

     IF s_date IS INITIAL.

       MESSAGE text002 TYPE c_e.

     ENDIF.

     IF s_datelow IS NOT INITIAL AND s_datehigh IS INITIAL.

       MESSAGE text003 TYPE c_e.

     ENDIF.

     IF s_datelow IS INITIAL AND s_datehigh IS NOT INITIAL.

       MESSAGE text003 TYPE c_e.

     ENDIF.

*—Validate the comparison Date

     IF s_cdatelow IS NOT INITIAL AND s_cdatehigh IS INITIAL.

       MESSAGE text003 TYPE c_e.

     ENDIF.

     IF s_cdatelow IS INITIAL AND s_cdatehigh IS NOT INITIAL.

       MESSAGE text003 TYPE c_e.

     ENDIF.

   ENDMETHOD.                    “m_validate_screen

*———————————————————————-*

*       Method m_display_data

*———————————————————————-*

*       To display data

*———————————————————————-*

   METHOD m_display_data.

     m_set_layout( ).

     CALL SCREEN 100.

   ENDMETHOD.                    “m_display_data

*———————————————————————-*

*       Method m_set_layout_catalog

*———————————————————————-*

*       To set field catalogs

*———————————————————————-*

   METHOD m_set_layout.

     wa_layoutzebra = c_x.

     wa_layoutnumc_total = c_x.

     wa_layoutcwidth_opt = c_x.

   ENDMETHOD.                    “m_set_layout_catalog

*———————————————————————-*

*       Method m_build_field_catalog

*———————————————————————-*

*       To build field catalogs

*———————————————————————-*

   METHOD  m_build_field_catalog.

     DATA:it_t549q TYPE STANDARD TABLE OF t549q                .

     FIELD-SYMBOLS: <lx_t549q> LIKE LINE OF it_t549q           ,

                    <x_monthrange> LIKE LINE OF  it_monthrange .

     DATA:lv_month   TYPE t247ltx                             ,

          lv_month1  TYPE t247ltx                             ,

          lv_field   TYPE lvc_fname                            ,

          lv_seltext TYPE lvc_txt                              .

     CLEAR it_fieldcatalog.

*—PERNR

     CALL METHOD m_set_field_catalog

       EXPORTING

         p_field    = text005

         p_seltext  = text006

         p_dosum    = space

         p_datatype = c_char.

*—Name

     CALL METHOD m_set_field_catalog

       EXPORTING

         p_field    = text007

         p_seltext  = text008

         p_dosum    = space

         p_datatype = c_char.

*—Joining Date

     CALL METHOD m_set_field_catalog

       EXPORTING

         p_field    = text009

         p_seltext  = text010

         p_dosum    = space

         p_datatype = c_dats.

*—Resignation Date

     CALL METHOD m_set_field_catalog

       EXPORTING

         p_field    = text011

         p_seltext  = text012

         p_dosum    = space

         p_datatype = c_dats.

*—Cost Center

     CALL METHOD m_set_field_catalog

       EXPORTING

         p_field    = text013

         p_seltext  = text014

         p_dosum    = space

         p_datatype = c_char.

*—Department

     CALL METHOD m_set_field_catalog

       EXPORTING

         p_field    = text015

         p_seltext  = text016

         p_dosum    = space

         p_datatype = c_char.

*—Section

     CALL METHOD m_set_field_catalog

       EXPORTING

         p_field    = text017

         p_seltext  = text018

         p_dosum    = space

         p_datatype = c_char.

*—Grade

     CALL METHOD m_set_field_catalog

       EXPORTING

         p_field    = text019

         p_seltext  = text020

         p_dosum    = space

         p_datatype = c_char.

*—SBU

     CALL METHOD m_set_field_catalog

       EXPORTING

         p_field    = text021

         p_seltext  = text022

         p_dosum    = space

         p_datatype = c_char.

*—Segment

     CALL METHOD m_set_field_catalog

       EXPORTING

         p_field    = text023

         p_seltext  = text024

         p_dosum    = space

         p_datatype = c_char.

*—Payroll Area

     CALL METHOD m_set_field_catalog

       EXPORTING

         p_field    = text025

         p_seltext  = text026

         p_dosum    = space

         p_datatype = c_char.

*—Bank Key

     CALL METHOD m_set_field_catalog

       EXPORTING

         p_field    = text027

         p_seltext  = text028

         p_dosum    = space

         p_datatype = c_char.

*—Account Number

     CALL METHOD m_set_field_catalog

       EXPORTING

         p_field    = text029

         p_seltext  = text030

         p_dosum    = space

         p_datatype = c_char.

*—Wage Type

     CALL METHOD m_set_field_catalog

       EXPORTING

         p_field    = text046

         p_seltext  = text047

         p_dosum    = space

         p_datatype = c_char.

*—Wage Type Text

     CALL METHOD m_set_field_catalog

       EXPORTING

         p_field    = text055

         p_seltext  = text056

         p_dosum    = space

         p_datatype = c_char.

*—Symbolic Account

     CALL METHOD m_set_field_catalog

       EXPORTING

         p_field    = text048

         p_seltext  = text049

         p_dosum    = space

         p_datatype = c_char.

*—GL Account

     CALL METHOD m_set_field_catalog

       EXPORTING

         p_field    = text050

         p_seltext  = text051

         p_dosum    = space

         p_datatype = c_char.

*—Expense Category

     CALL METHOD m_set_field_catalog

       EXPORTING

         p_field    = text052

         p_seltext  = text053

         p_dosum    = space

         p_datatype = c_char.

*———————————————————————-*

*Dynamic Columns

     CLEAR it_monthrange.

     CALL FUNCTION ‘HR_PAYROLL_PERIODS_GET’

       EXPORTING

         get_begda             = s_datelow

        get_endda             s_datehigh

*       GET_PERMO             = RPTIME_PERIOD

*     IMPORTING

*       GET_PABRJ             =

*       GET_PABRP             =

      TABLES

        get_periods           = it_t549q

      EXCEPTIONS

        no_period_found       = 1

        no_valid_permo        = 2

        OTHERS                = 3

               .

     IF sysubrc <> 0.

       MESSAGE text031 TYPE c_e.

     ELSE.

       LOOP AT it_t549q ASSIGNING <lx_t549q>.

         CLEAR lv_month.

         CALL FUNCTION ‘ISP_GET_MONTH_NAME’

           EXPORTING

            date               = <lx_t549q>begda

             language           = sylangu

*           MONTH_NUMBER       = ’00’

          IMPORTING

            langu_back         = sylangu

            longtext           = lv_month

*           SHORTTEXT          =

          EXCEPTIONS

            calendar_id        = 1

            date_error         = 2

            not_found          = 3

            wrong_input        = 4

            OTHERS             = 5.

         IF sysubrc <> 0.

           MESSAGE text032 TYPE c_e.

         ELSE.

           TRANSLATE lv_month TO UPPER CASE.

           UNASSIGN <x_monthrange>.

           APPEND INITIAL LINE TO it_monthrange ASSIGNING  <x_monthrange>.

           IF <x_monthrange> IS ASSIGNED.

             <x_monthrange>type   = c_s.“s IS USED FOR DATE RANGE MONTHS

             <x_monthrange>month  = <lx_t549q>begda+4(2).

             <x_monthrange>monthnm  = lv_month.

             <x_monthrange>year  = <lx_t549q>begda+0(4).

             <x_monthrange>permo  = <lx_t549q>permo.

             <x_monthrange>pabrj  = <lx_t549q>pabrj.

             <x_monthrange>pabrp  = <lx_t549q>pabrp.

             <x_monthrange>begda  = <lx_t549q>begda.

             <x_monthrange>endda  = <lx_t549q>endda .

             CLEAR lv_field.

             CONCATENATE c_s lv_month <lx_t549q>begda+0(4) INTO lv_field.

             CLEAR lv_seltext.

             CONCATENATE lv_month <lx_t549q>begda+0(4) INTO lv_seltext  SEPARATED BY ‘-‘.

             CALL METHOD m_set_field_catalog

               EXPORTING

                 p_field    = lv_field

                 p_seltext  = lv_seltext

                 p_dosum    = c_x

                 p_datatype = c_curr.

           ENDIF.

         ENDIF.

       ENDLOOP.

     ENDIF.

*———————————————————————-*

*If comparison to be made

     IF s_cdate IS NOT INITIAL.

       CLEAR it_t549q.

       CALL FUNCTION ‘HR_PAYROLL_PERIODS_GET’

       EXPORTING

         get_begda             = s_cdatelow

        get_endda             s_cdatehigh

*       GET_PERMO             = RPTIME_PERIOD

*     IMPORTING

*       GET_PABRJ             =

*       GET_PABRP             =

      TABLES

        get_periods           = it_t549q

      EXCEPTIONS

        no_period_found       = 1

        no_valid_permo        = 2

        OTHERS                = 3.

       IF sysubrc <> 0.

         MESSAGE text031 TYPE c_e.

       ELSE.

         LOOP AT it_t549q ASSIGNING <lx_t549q>.

           CLEAR: lv_month1,lv_month.

           CALL FUNCTION ‘ISP_GET_MONTH_NAME’

             EXPORTING

              date               = <lx_t549q>begda

               language           = sylangu

*           MONTH_NUMBER       = ’00’

            IMPORTING

              langu_back         = sylangu

              longtext           = lv_month

*           SHORTTEXT          =

            EXCEPTIONS

              calendar_id        = 1

              date_error         = 2

              not_found          = 3

              wrong_input        = 4

              OTHERS             = 5.

           IF sysubrc <> 0.

             MESSAGE text032 TYPE c_e.

           ELSE.

             TRANSLATE lv_month TO UPPER CASE.

             UNASSIGN <x_monthrange>.

             APPEND INITIAL LINE TO it_monthrange ASSIGNING  <x_monthrange>.

             IF <x_monthrange> IS ASSIGNED.

               <x_monthrange>type   = c_c.“c IS USED FOR DATE RANGE MONTHS

               <x_monthrange>month  = <lx_t549q>begda+4(2).

               <x_monthrange>monthnm  = lv_month.

               <x_monthrange>year  = <lx_t549q>begda+0(4).

               <x_monthrange>permo  = <lx_t549q>permo.

               <x_monthrange>pabrj  = <lx_t549q>pabrj.

               <x_monthrange>pabrp  = <lx_t549q>pabrp.

               <x_monthrange>begda  = <lx_t549q>begda.

               <x_monthrange>endda  = <lx_t549q>endda .

               CLEAR lv_field.

               CONCATENATE c_c lv_month <lx_t549q>begda+0(4) INTO lv_field.

               CLEAR lv_seltext.

               CONCATENATE  lv_month <lx_t549q>begda+0(4) INTO lv_seltext  SEPARATED BY ‘-‘.

               CALL METHOD m_set_field_catalog

                 EXPORTING

                   p_field    = lv_field

                   p_seltext  = lv_seltext

                   p_dosum    = c_x

                   p_datatype = c_curr.

             ENDIF.

           ENDIF.

         ENDLOOP.

       ENDIF.

     ENDIF.

*– Actual Paid

     CALL METHOD m_set_field_catalog

       EXPORTING

         p_field    = text035

         p_seltext  = text036

         p_dosum    = c_x

         p_datatype = c_curr.

*Create dynamic table

     m_create_dynmc_table( ).

*&———————————————————————*

* Create dynamic work area and assign to FS

     DATA :lr_line  TYPE REF TO data.

     CREATE DATA lr_line LIKE LINE OF <x_final>.

     ASSIGN lr_line->* TO <x_wfinal>.

   ENDMETHOD.                    “m_build_field_catalog

*———————————————————————-*

*       Method m_set_field_catalog

*———————————————————————-*

*       To set field catalogs

*———————————————————————-*

   METHOD  m_set_field_catalog.

*———————————————————————-*

*Populate fieldcatalog for Dynamic table

     CLEAR  wa_fieldcatalog.

     wa_fieldcatalogfieldname   = p_field.     “Field Name

     wa_fieldcatalogseltext     = p_seltext.   “Text

     wa_fieldcatalogcoltext     = p_seltext.

     wa_fieldcatalogdo_sum      = p_dosum.

     wa_fieldcatalogcol_pos     = gv_colpos.    “Column position

     wa_fieldcatalogdatatype    = p_datatype.

     APPEND wa_fieldcatalog TO it_fieldcatalog.

**———————————————————————-*

**Populate ALV fieldcatalogs

*    CLEAR  wa_fieldcat.

*    wa_fieldcat-fieldname   = p_field.

*    wa_fieldcat-seltext_m   = p_seltext.

*    wa_fieldcat-col_pos     = gv_colpos.

*    APPEND wa_fieldcat TO it_fieldcat.

*    gv_colpos = gv_colpos + 1.

   ENDMETHOD.                    “m_set_field_catalog

*———————————————————————-*

*       Method m_set_layout_catalog

*———————————————————————-*

*       To set field catalogs

*———————————————————————-*

   METHOD m_create_dynmc_table.

     DATA: lt_final TYPE REF TO data.

     CALL METHOD cl_alv_table_create=>create_dynamic_table

       EXPORTING

         it_fieldcatalog = it_fieldcatalog

       IMPORTING

         ep_table        = lt_final.

*———————————————————————-*

*& Assign retrived structure to a field symbol

     UNASSIGN <x_final>.

     ASSIGN lt_final->* TO <x_final>.

     CLEAR: wa_fieldcatalog.

   ENDMETHOD.                    “m_create_dynmc_table

*———————————————————————-*

*       Method m_get_wage_data

*———————————————————————-*

*       To get wage type data

*———————————————————————-*

   METHOD m_get_wage_data.

     DATA : lt_temp  TYPE STANDARD TABLE OF ty_saldata ,

            lt_temp1 TYPE STANDARD TABLE OF ty_wagedata,

            lt_return_tab TYPE STANDARD TABLE OF bapiret2,

            lw_return_tab LIKE LINE OF lt_return_tab,

            lw_t52ek TYPE t52ek,

            lw_t52ep TYPE t52ep,

            lv_process TYPE ktosl,

            lv_gl_act TYPE acct_det_bfgl_account.

     FIELD-SYMBOLS: <lx_temp1> TYPE ty_wagedata,

                    <lx_gldata> TYPE ty_gldata.

     CLEARit_wagedata,it_gldata.

*———————————————————————-*

* Copy table of salary details into temp table to get unique wage types

     lt_temp = it_saldata.

     SORT lt_temp BY lgart ASCENDING.

*———————————————————————-*

* Delete duplicate wagetypes

     DELETE ADJACENT DUPLICATES FROM lt_temp COMPARING lgart.

*———————————————————————-*

* Get budgeted data

     CLEAR it_budgetdata.

     SELECT pernr frdat todat fyear lgart betrg

       FROM zbudget_upload

       INTO TABLE it_budgetdata

       FOR ALL ENTRIES IN lt_temp

       WHERE pernr = lt_temppernr

       AND   frdat <= s_datehigh

       AND   todat  >= s_datelow

       AND   lgart = lt_templgart.

     IF sysubrc = 0.

       SORT it_budgetdata BY pernr lgart ASCENDING.

     ENDIF.

*———————————————————————-*

* Get Wage type texts

     CLEAR it_wagetypetext.

     SELECT lgart lgtxt

       FROM t512t

       INTO TABLE it_wagetypetext

       FOR ALL ENTRIES IN lt_temp

       WHERE sprsl = sylangu AND

             molga = c_40     AND

             lgart = lt_templgart.

     IF sysubrc = 0.

       SORT it_wagetypetext BY lgart ASCENDING.

     ENDIF.

*———————————————————————-*

* Get symbolic account for filtered wagetypes

     SELECT lgart symko

       FROM t52el

       INTO TABLE it_wagedata

       FOR ALL ENTRIES IN lt_temp

       WHERE molga = c_40          AND

             lgart = lt_templgart AND

             seqno > 0             AND

             endda >= sydatum.

*          AND

*            sign = ‘-‘              .

     IF sysubrc = 0.

*———————————————————————-*

* Below code is written to get the GL Account for symbolic accounts

*———————————————————————-*

* Copy the data of wage types ( Symbolic account ) into temp table

       lt_temp1 = it_wagedata.

       SORT lt_temp1 BY symko ASCENDING.

*———————————————————————-*

* Delete duplicate symbolic accounts

       DELETE ADJACENT DUPLICATES FROM lt_temp1 COMPARING symko.

*———————————————————————-*

* Loop the temp table to get the GL account

       LOOP AT lt_temp1 ASSIGNING <lx_temp1>.

*———————————————————————-*

* Retrive the account assignment type

         SELECT SINGLE *

           FROM t52ek

           INTO lw_t52ek

           WHERE symko = <lx_temp1>symko.

         IF sysubrc EQ 0.

*———————————————————————-*

* Retrive the account process

           SELECT SINGLE *

             FROM t52ep

             INTO lw_t52ep

             WHERE koart = lw_t52ekkoart.

           IF sysubrc EQ 0.

             CLEAR: lv_process,lt_return_tab.

             CONCATENATE ‘HR’ lw_t52epkttyp INTO lv_process.

*———————————————————————-*

* Call the function module with below stated parameters and get the

* GL account associated with Symbolic account

             CALL FUNCTION ‘HRPP_FI_ACCT_DET_HR’

               EXPORTING

                 companycode       = ‘DFPL’

                 process           = lv_process

                 symb_acct         = <lx_temp1>symko

                 eg_acct_det       =

                 add_modif         =

               IMPORTING

                 gl_account_debit  = lv_gl_act

*                gl_account_credit = account_table-account_credit

               TABLES

                 return_tab        = lt_return_tab.

*———————————————————————-*

* Check the return table for error

             IF lt_return_tab IS NOT INITIAL.

               READ TABLE lt_return_tab INTO lw_return_tab

               WITH KEY type = c_e.

               IF sysubrc = 0.

                 MESSAGE text043 TYPE c_e.

               ELSE.

                 UNASSIGN <lx_gldata>.

                 APPEND INITIAL LINE TO it_gldata ASSIGNING <lx_gldata>.

                 IF <lx_gldata> IS ASSIGNED.

                   <lx_gldata>symko = <lx_temp1>symko.

                   <lx_gldata>konth = lv_gl_act.

                 ENDIF.

               ENDIF.

             ELSE.

               UNASSIGN <lx_gldata>.

               APPEND INITIAL LINE TO it_gldata ASSIGNING <lx_gldata>.

               IF <lx_gldata> IS ASSIGNED.

                 <lx_gldata>symko = <lx_temp1>symko.

                 <lx_gldata>konth = lv_gl_act.

               ENDIF.

             ENDIF.

           ENDIF.

         ENDIF.

       ENDLOOP.

     ENDIF.

   ENDMETHOD.                    “m_get_wage_data

*———————————————————————-*

*       m_populate_final_table

*———————————————————————-*

*       To populate the final table to process

*———————————————————————-*

   METHOD m_populate_final_table.

     DATA : lv_date(10TYPE c,

            lv_month(25) TYPE c,

            lv_type      TYPE c,

            lv_budgeted(15TYPE p DECIMALS 2,

            lv_actual(15)    TYPE p DECIMALS 2,

            lv_percent(5)    TYPE p DECIMALS 2.

*——————————————————————–*

     SORT it_saldata BY pernr lgart pabrj pabrp payty month ASCENDING betrg DESCENDING.

*    DELETE ADJACENT DUPLICATES FROM it_saldata COMPARING pernr lgart pabrj pabrp month.

     SORT it_csaldata BY pernr lgart pabrj pabrp ASCENDING.

     SORT it_empdata BY pernr ASCENDING.

     SORT it_wagedata BY lgart ASCENDING.

     SORT it_gldata BY symko ASCENDING.

     SORT it_monthrange BY pabrj pabrp ASCENDING.

*——————————————————————–*

     LOOP AT it_saldata ASSIGNING <x_saldata>.

       AT NEW lgart.

         APPEND INITIAL LINE TO <x_final> ASSIGNING <x_wfinal>.

       ENDAT.

*——————————————————————–*

       IF <x_wfinal> IS ASSIGNED.

         READ TABLE it_empdata ASSIGNING <x_empdata>

         WITH KEY pernr = <x_saldata>pernr

         BINARY SEARCH.

         IF <x_empdata> IS ASSIGNED.

*pernr

*——————————————————————–*

           UNASSIGN <x_field>.

           ASSIGN COMPONENT  text005

               OF STRUCTURE <x_wfinal> TO <x_field>.

           IF <x_field> IS ASSIGNED.

             <x_field> = <x_saldata>pernr.

           ENDIF.

*empname

*——————————————————————–*

           UNASSIGN <x_field>.

           ASSIGN COMPONENT  text007

               OF STRUCTURE <x_wfinal> TO <x_field>.

           IF <x_field> IS ASSIGNED.

             <x_field> = <x_empdata>ename.

           ENDIF.

*Joinind date

*——————————————————————–*

           IF <x_empdata>jdate IS NOT INITIAL.

             UNASSIGN <x_field>.

             ASSIGN COMPONENT  text009

                 OF STRUCTURE <x_wfinal> TO <x_field>.

             IF <x_field> IS ASSIGNED.

               <x_field> = <x_empdata>jdate.

             ENDIF.

           ENDIF.

*Resignation Date

*——————————————————————–*

           IF  <x_empdata>rdate IS NOT INITIAL.

             UNASSIGN <x_field>.

             ASSIGN COMPONENT  text011

                 OF STRUCTURE <x_wfinal> TO <x_field>.

             IF <x_field> IS ASSIGNED.

               <x_field> = <x_empdata>rdate.

             ENDIF.

           ENDIF.

*Cost Center

*——————————————————————–*

           UNASSIGN <x_field>.

           ASSIGN COMPONENT  text013

               OF STRUCTURE <x_wfinal> TO <x_field>.

           IF <x_field> IS ASSIGNED.

             <x_field> = <x_empdata>kostl.

           ENDIF.

*Department

*——————————————————————–*

           UNASSIGN <x_field>.

           ASSIGN COMPONENT  text015

               OF STRUCTURE <x_wfinal> TO <x_field>.

           IF <x_field> IS ASSIGNED.

             <x_field> = <x_empdata>zzdept1.

           ENDIF.

*Section

*——————————————————————–*

           UNASSIGN <x_field>.

           ASSIGN COMPONENT  text017

               OF STRUCTURE <x_wfinal> TO <x_field>.

           IF <x_field> IS ASSIGNED.

             <x_field> = <x_empdata>btrtl.

           ENDIF.

*Grade

*——————————————————————–*

           UNASSIGN <x_field>.

           ASSIGN COMPONENT  text019

               OF STRUCTURE <x_wfinal> TO <x_field>.

           IF <x_field> IS ASSIGNED.

             <x_field> = <x_empdata>persk.

           ENDIF.

*SBU

*——————————————————————–*

           UNASSIGN <x_field>.

           ASSIGN COMPONENT  text021

               OF STRUCTURE <x_wfinal> TO <x_field>.

           IF <x_field> IS ASSIGNED.

             <x_field> = <x_empdata>zzsbu1.

           ENDIF.

*Segment

*——————————————————————–*

           UNASSIGN <x_field>.

           ASSIGN COMPONENT  text023

               OF STRUCTURE <x_wfinal> TO <x_field>.

           IF <x_field> IS ASSIGNED.

             <x_field> = <x_empdata>zzseg1.

           ENDIF.

*Payroll area

*——————————————————————–*

           UNASSIGN <x_field>.

           ASSIGN COMPONENT  text025

               OF STRUCTURE <x_wfinal> TO <x_field>.

           IF <x_field> IS ASSIGNED.

             <x_field> = <x_empdata>abkrs.

           ENDIF.

*Baank Key

*——————————————————————–*

           UNASSIGN <x_field>.

           ASSIGN COMPONENT  text027

               OF STRUCTURE <x_wfinal> TO <x_field>.

           IF <x_field> IS ASSIGNED.

             <x_field> = <x_empdata>bankl.

           ENDIF.

*Account Number

*——————————————————————–*

           UNASSIGN <x_field>.

           ASSIGN COMPONENT  text029

               OF STRUCTURE <x_wfinal> TO <x_field>.

           IF <x_field> IS ASSIGNED.

             <x_field> = <x_empdata>bankn.

           ENDIF.

*Wage Type

*——————————————————————–*

           UNASSIGN <x_field>.

           ASSIGN COMPONENT  text046

               OF STRUCTURE <x_wfinal> TO <x_field>.

           IF <x_field> IS ASSIGNED.

             <x_field> = <x_saldata>lgart.

*Wage type text

             UNASSIGN <x_wagetypetext> .

             READ TABLE it_wagetypetext ASSIGNING <x_wagetypetext>

             WITH KEY lgart = <x_saldata>lgart

             BINARY SEARCH.

             IF <x_wagetypetext> IS ASSIGNED.

               UNASSIGN <x_field>.

               ASSIGN COMPONENT  text055

                   OF STRUCTURE <x_wfinal> TO <x_field>.

               IF <x_field> IS ASSIGNED.

                 <x_field> = <x_wagetypetext>lgtxt.

               ENDIF.

             ENDIF.

             UNASSIGN <x_wagedata> .

             READ TABLE it_wagedata ASSIGNING <x_wagedata>

             WITH KEY lgart = <x_saldata>lgart

             BINARY SEARCH.

*Symbolic account

             IF <x_wagedata> IS ASSIGNED.

               UNASSIGN <x_field>.

               ASSIGN COMPONENT  text048

                   OF STRUCTURE <x_wfinal> TO <x_field>.

               IF <x_field> IS ASSIGNED.

                 <x_field> = <x_wagedata>symko.

                 UNASSIGN <x_gldata>.

                 READ TABLE it_gldata ASSIGNING <x_gldata>

                 WITH KEY symko = <x_wagedata>symko

                 BINARY SEARCH.

*GL account

*——————————————————————–*

                 IF  <x_gldata> IS  ASSIGNED.

                   UNASSIGN <x_field>.

                   ASSIGN COMPONENT  text050

                       OF STRUCTURE <x_wfinal> TO <x_field>.

                   IF <x_field> IS ASSIGNED.

                     <x_field> = <x_gldata>konth.

                   ENDIF.

                 ENDIF.

*——————————————————————–*

               ENDIF.

             ENDIF.

 

           ENDIF.

*Wage Type value

           UNASSIGN <x_monthrange>.

           READ TABLE it_monthrange ASSIGNING <x_monthrange>

           WITH KEY pabrj = <x_saldata>pabrj

                    pabrp = <x_saldata>pabrp

                    type  = <x_saldata>month+0(1).

           IF <x_monthrange> IS ASSIGNED.

             CLEAR lv_type.

             lv_type = <x_monthrange>type.

             IF lv_type = c_s.

               CONCATENATE c_s <x_monthrange>monthnm <x_monthrange>year

             INTO lv_month.

             ELSE.

               CONCATENATE c_c <x_monthrange>monthnm <x_monthrange>year

               INTO lv_month.

             ENDIF.

             CONDENSE lv_month.

             UNASSIGN <x_field>.

             ASSIGN COMPONENT  lv_month

                 OF STRUCTURE <x_wfinal> TO <x_field>.

             IF <x_field> IS ASSIGNED.

               IF <x_saldata>payty = .

                 <x_field> <x_saldata>betrg.

               ELSE.

                 <x_field> = <x_field> + <x_saldata>betrg.

               ENDIF.

             ENDIF.

           ENDIF.

*——————————————————————–*

*Actual Paid

           IF lv_type = c_s.

             UNASSIGN <x_field>.

             ASSIGN COMPONENT  text035

                 OF STRUCTURE <x_wfinal> TO <x_field>.

             IF <x_field> IS ASSIGNED.

               <x_field> = <x_field> + <x_saldata>betrg.

             ENDIF.

           ENDIF.

*——————————————————————–*

         ENDIF.

       ENDIF.

     ENDLOOP.

   ENDMETHOD.                    “m_populate_final_table

   METHOD m_display_alv.

     IF <x_final> IS ASSIGNED.

       IF o_alv IS NOT BOUND.

         “Create object for first container

         CREATE OBJECT o_cc

           EXPORTING

             container_name              = ‘CC_SALDATA’

           EXCEPTIONS

             cntl_error                  = 1

             cntl_system_error           = 2

             create_error                = 3

             lifetime_error              = 4

             lifetime_dynpro_dynpro_link = 5

             OTHERS                      = 6.

         IF sysubrc <> 0.

           MESSAGE ID symsgid TYPE symsgty NUMBER symsgno

                      WITH symsgv1 symsgv2 symsgv3 symsgv4.

         ELSE.

*———————————————————————-*

*Create object for first ALV grid

*———————————————————————-*

           CREATE OBJECT o_split                       “split container obj

             EXPORTING

               parent            = o_cc

               sash_position     = 20

               with_border       = 1

             EXCEPTIONS

               cntl_error        = 1

               cntl_system_error = 2

               OTHERS            = 3.

           IF sysubrc <> 0.

             MESSAGE ID symsgid TYPE symsgty NUMBER symsgno

                        WITH symsgv1 symsgv2 symsgv3 symsgv4.

           ENDIF.

           o_top_cntnr = o_split->top_left_container .

           o_btm_cntnr = o_split->bottom_right_container .

           CREATE OBJECT o_doc

             EXPORTING

               style = ‘ALV_GRID’.

           o_sal_comp->m_prepare_topofpage( ).

           CREATE OBJECT o_alv

             EXPORTING

               i_parent          = o_btm_cntnr

             EXCEPTIONS

               error_cntl_create = 1

               error_cntl_init   = 2

               error_cntl_link   = 3

               error_dp_create   = 4

               OTHERS            = 5.

           IF sysubrc <> 0.

             MESSAGE ID symsgid TYPE symsgty NUMBER symsgno

                        WITH symsgv1 symsgv2 symsgv3 symsgv4.

           ELSE.

             CALL METHOD o_alv->list_processing_events

               EXPORTING

                 i_event_name = ‘TOP_OF_PAGE’

                 i_dyndoc_id  = o_doc.

             “Display ALV grid

             CALL METHOD o_alv->set_table_for_first_display

               EXPORTING

                 is_layout                     = wa_layout

               CHANGING

                 it_fieldcatalog               = it_fieldcatalog

                 it_outtab                     = <x_final>

               EXCEPTIONS

                 invalid_parameter_combination = 1

                 program_error                 = 2

                 too_many_lines                = 3

                 OTHERS                        = 4.

             IF sysubrc <> 0.

               MESSAGE ID symsgid TYPE symsgty NUMBER symsgno

                          WITH symsgv1 symsgv2 symsgv3 symsgv4.

             ENDIF.

           ENDIF.

         ENDIF.

       ELSE.

         o_alv->refresh_table_display( ).

       ENDIF.

     ELSE.

       MESSAGE text054 TYPE c_e.

     ENDIF.

   ENDMETHOD.                    “m_display_alv

   METHOD m_prepare_topofpage.

     DATA : lv_daterange TYPE sdydo_text_element.

*&———————————————————————*

*&   Report Title

     CALL METHOD o_doc->add_text

       EXPORTING

         text         = text044

         sap_fontsize = cl_dd_area=>medium

         sap_emphasis = cl_dd_area=>strong.

     CALL METHOD o_doc->new_line.

*&———————————————————————*

*&   Date Range

     CONCATENATE text045 ` ` s_datelow+4(2) ‘.’

                 s_datelow+6(2) ‘.’ s_datelow+0(4) ‘To’ s_datehigh+4(2) ‘.’

                 s_datehigh+6(2) ‘.’ s_datehigh+0(4)

                 INTO lv_daterange SEPARATED BY space.

     CALL METHOD o_doc->add_text

       EXPORTING

         text         = lv_daterange

         sap_fontsize = cl_dd_area=>medium

         sap_emphasis = cl_dd_area=>strong.

     CALL METHOD o_doc->new_line.

     CALL METHOD o_doc->display_document

       EXPORTING

         parent             = o_top_cntnr

       EXCEPTIONS

         html_display_error = 1

         OTHERS             = 2.

     IF sysubrc <> 0.

       MESSAGE ID symsgid TYPE symsgty NUMBER symsgno

                  WITH symsgv1 symsgv2 symsgv3 symsgv4.

     ENDIF.

   ENDMETHOD.                    “m_prepare_topofpage

ENDCLASS.                    “cl_salary_comparison IMPLEMENTATION


The PBO Include

*&———————————————————————*

*&  Include           ZHRPY01_PBO

*&———————————————————————*

*&———————————————————————*

*&      Module  STATUS_0100  OUTPUT

*&———————————————————————*

*       Status at screen 100

*———————————————————————-*

module STATUS_0100 output.

   SET PF-STATUS ‘Z_SALCOMP’.

*  SET TITLEBAR ‘xxx’.

endmodule.                 ” STATUS_0100  OUTPUT

*&———————————————————————*

*&      Module  DISPLAY_ALV  OUTPUT

*&———————————————————————*

*       Display ALV grid

*———————————————————————-*

module DISPLAY_ALV output.

o_sal_comp->m_display_alv( ).

endmodule.                 ” DISPLAY_ALV  OUTPUT

The PAI Include

*&———————————————————————*

*&  Include           ZHRPY01_PAI

*&———————————————————————*

*&———————————————————————*

*&      Module  USER_COMMAND_0100  INPUT

*&———————————————————————*

*       User command on screen 100

*———————————————————————-*

MODULE user_command_0100 INPUT.

   CASE syucomm .

     WHEN ‘BACK’ OR ‘RW’ OR ‘%EX’ .

       LEAVE SCREEN .

   ENDCASE .

ENDMODULE.                 ” USER_COMMAND_0100  INPUT


Be the first to leave a comment
You must be Logged on to comment or reply to a post.