Skip to Content

MAIN

************************************************************************
* Object Name : REPORT  ZHCM_ASMNT1. *
* Author/Company Name : Krishnakant Joshi*
* Transport Request *
* Creation Date * 01/17/2012
************************************************************************
* Description: *  Report to Get Employees Hiring Details
************************************************************************
* Dependencies *
************************************************************************
* Modification History *
************************************************************************
* Date Programmer Client Ref No. Description Correction *
************************************************************************
REPORT  zhcm_asmnt1.
*&**********************************************************************
*&    INCLUDE
*&**********************************************************************
INCLUDE : zhcm_asmnt1_top,    “Global Types and Data
zhcm_asmnt1_screen,
“Screen Design
zhcm_asmnt1_class, 
“Class
zhcm_asmnt1_pbo,   
“PBO
zhcm_asmnt1_pai.   
“PAI

*&**********************************************************************
*&    INITIALIZATION
*&**********************************************************************
INITIALIZATION.
*& Create object
CREATE OBJECT o_empdata.
*&**********************************************************************
*&    AT SELECTION-SCREEN
*&**********************************************************************
AT SELECTION-SCREEN.
o_empdata->validation( ).
*&**********************************************************************
*&    START-OF-SELECTION
*&**********************************************************************
START-
OF-SELECTION.
o_empdata->get_data( ).
“Populate internal tables
*&**********************************************************************
*&    END-OF-SELECTION
*&**********************************************************************
ENDOF-SELECTION.
IF i_final IS NOT INITIAL.
o_empdata->display_alv( ).
“Populate internal tables
ELSE.
MESSAGE text002 TYPE c_i.
Leave LIST-PROCESSING.
ENDIF.

 
 

TOP:

*&———————————————————————*
*&  Include           ZHCM_ASMNT1_TOP
*&———————————————————————*
CLASS cl_empdata DEFINITION DEFERRED.
*&**********************************************************************
*&   TYPES
*&**********************************************************************
TYPES :
*&  Actions
BEGIN OF t_pa0000,
pernr    
TYPE persno,
endda    
TYPE endda,
begda    
TYPE begda,
massn    
TYPE massn,   “Action Type
massg    
TYPE massg,   “Reason for Action
END OF   t_pa0000,
*&  Org. Assignment
BEGIN OF t_pa0001,
pernr    
TYPE persno,
endda    
TYPE endda,
begda    
TYPE begda,
werks    
TYPE persa,   “Personnel Area
kostl    
TYPE kostl,   “Cost center
orgeh    
TYPE orgeh,   “Organization Unit
stell    
TYPE stell,   “Job
END OF   t_pa0001,
*&  Personal Dat
BEGIN OF t_pa0002,
pernr    
TYPE persno,
endda    
TYPE endda,
begda    
TYPE begda,
vorna    
TYPE pad_vorna,“First name
nachn    
TYPE pad_nachn,“Last name
gesch    
TYPE gesch,   “Gender Key
gbdep    
TYPE gbdep,   “State
gbdat    
TYPE gbdat,   “DOB
END OF   t_pa0002,
*&  Address
BEGIN OF t_pa0006,
pernr    
TYPE persno,
endda    
TYPE endda,
begda    
TYPE begda,
pstlz    
TYPE pstlz_hr,“Postal Code
END OF   t_pa0006,
*&  Basic Pay
BEGIN OF t_pa0008,
pernr    
TYPE persno,
endda    
TYPE endda,
begda    
TYPE begda,
ansal    
TYPE ansal,   “Annual Salary
END OF   t_pa0008,
*&  Date Specifications
BEGIN OF t_pa0041,
pernr    
TYPE  persno,
endda    
TYPE  endda,
begda    
TYPE  begda,
dar01    
TYPE  datar,
dat01    
TYPE  dardt,
dar02    
TYPE  datar,
dat02     
TYPE  dardt,
dar03     
TYPE   datar,
dat03     
TYPE   dardt,
dar04     
TYPE   datar,
dat04     
TYPE   dardt,
dar05     
TYPE   datar,
dat05     
TYPE   dardt,
dar06     
TYPE   datar,
dat06     
TYPE   dardt,
dar07     
TYPE   datar,
dat07     
TYPE   dardt,
dar08     
TYPE   datar,
dat08    
TYPE  dardt,
dar09     
TYPE   datar,
dat09     
TYPE   dardt,
dar10    
TYPE  datar,
dat10    
TYPE  dardt,
dar11    
TYPE  datar,
dat11    
TYPE  dardt,
dar12     
TYPE   datar,
dat12     
TYPE   dardt,
END OF   t_pa0041,
BEGIN OF t_pa0041d,
pernr    
TYPE  persno,
endda    
TYPE  endda,
begda    
TYPE  begda,
dar01    
TYPE  datar,
dat01    
TYPE  dardt,
END OF   t_pa0041d,
*& Date text
BEGIN OF t_t548t,
datar    
TYPE  datar,
dtext     
TYPE datax,
END OF   t_t548t,
*&  Communication
begin of t_pa0105,
pernr    
type persno,
endda    
type endda,
begda    
type begda,
usrty    
type usrty,   “Communication Type
usrid_long 
type comm_id_long,“Long Identification/Number
end of   t_pa0105,
*& Personnel Action Texts
begin of t_t529t,
massn    
type  massn,  “Action Type
mntxt    
type  mntxt,  “Name of Action Type
end of   t_t529t,
*      & Reason for Action Texts
begin of t_t530t,
massn    
type  massn,  “Action Type
massg    
type  massg,  “Reason for Action
mgtxt    
type  mgtxt,  “Name of reason for action
end of   t_t530t,
*      & Job Titles
begin of t_t513s,
stell    
type  stell,  “Job
stltx    
type  stltx,  “Job Title
begda    
type  begda,  “Start Date
endda    
type  endda,  “End Date
end of   t_t513s,
*      & Final table
begin of t_final,
pernr    
type pernr_d,
begda    
type begda,
mntxt    
type mntxt,
mgtxt    
type mgtxt,
vorna    
type pad_vorna,
nachn    
type pad_nachn,
gesch    
type char20,
gbdep    
type gbdep,
pstlz    
type pstlz_hr,
werks    
type persa,
stltx    
type stltx,
orgeh    
type orgeh,
kostl    
type kostl,
gbdat    
type gbdat,
usrid_long 
type comm_id_long,
dtext    
type datax,
dat01    
type dardt,
ansal    
type ansal,
end of t_final.

*&**********************************************************************
*&   Data
*&**********************************************************************
DATA : i_pa0000 TYPE STANDARD TABLE OF t_pa0000,
i_pa0001
TYPE STANDARD TABLE OF t_pa0001,
i_pa0002
TYPE STANDARD TABLE OF t_pa0002,
i_pa0006
TYPE STANDARD TABLE OF t_pa0006,
i_pa0008
TYPE STANDARD TABLE OF t_pa0008,
i_pa0041
TYPE STANDARD TABLE OF t_pa0041,
i_pa0041d
TYPE STANDARD TABLE OF t_pa0041d,
i_pa0105
TYPE STANDARD TABLE OF t_pa0105,
i_t529t 
TYPE STANDARD TABLE OF t_t529t,
i_t530t 
TYPE STANDARD TABLE OF t_t530t,
i_t513s 
TYPE STANDARD TABLE OF t_t513s,
i_final 
TYPE STANDARD TABLE OF t_final,
i_t548t 
TYPE STANDARD TABLE OF t_t548t,
w_final
TYPE t_final.

*&———————————————————————*
*& Local data for prosessing
DATA : w_pa0000 TYPE t_pa0000,
w_t529t 
TYPE t_t529t,
w_t530t 
TYPE t_t530t,
w_pa0001
TYPE t_pa0001,
w_t513s 
TYPE t_t513s,
w_pa0002
TYPE t_pa0002,
w_pa0006
TYPE t_pa0006,
w_pa0008
TYPE t_pa0008,
w_pa0105
TYPE t_pa0105,
w_t548t 
TYPE t_t548t.

DATA : v_pernr TYPE persno, “Employee Number
v_date  
TYPE begda, “Run Date
i_fieldcat
TYPE lvc_t_fcat,
w_fieldcat
TYPE lvc_s_fcat,
v_colpos
TYPE i VALUE 1,
v_dar
TYPE datar,
v_dat
TYPE dardt.
*&**********************************************************************
*&   Objects
*&**********************************************************************
DATA : o_empdata    TYPE REF TO cl_empdata,
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 c VALUE ‘E’,
c_1
TYPE c VALUE ‘1’,
c_2
TYPE c VALUE ‘2’,
c_i
TYPE c VALUE ‘I’.

FIELD-SYMBOLS <lx_data> TYPE t_pa0041.

 
 

SCREEN

*&———————————————————————*
*&  Include           ZHCM_ASMNT1_SCREEN
*&———————————————————————*
************************************************************************
*& Selection screen
************************************************************************
SELECTION-
SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text000.
SELECT-OPTIONS : s_pernr for v_pernr, “Employee Number
s_rundte
for v_date.   “Run date
SELECTION-
SCREEN END OF BLOCK b1.

 
 

CLASS

*&———————————————————————*
*&  Include           ZHCM_ASMNT1_CLASS
*&———————————————————————*
*&**********************************************************************
*&   CLASS CL_EMPDATA DEFINITATION
*&**********************************************************************
CLASS cl_empdata DEFINITION.
PUBLIC SECTION.
METHODS : validation,   “Screen validation
get_data,    
“Fetch Data
merge_data,  
“Populate final table to display
set_fieldcat
IMPORTING fieldname TYPE lvc_fname
seltext  
TYPE lvc_txt
coltext  
TYPE lvc_txtcol
outputlen
TYPE lvc_outlen
EXPORTING w_fieldcatr TYPE lvc_s_fcat,
populate_finaldata,
prepare_topofpage,
build_fieldcatalog,
“Build field catalogs
display_alv. 
“Display dta
ENDCLASS.                   “CL_EMPDATA
*&**********************************************************************
*&   CLASS CL_EMPDATA IMPLEMENTATION
*&**********************************************************************
CLASS cl_empdata IMPLEMENTATION.
*&———————————————————————*
*&   METHOD validation
*&   Method to validate screen inputs
*&———————————————————————*
METHOD  validation.
DATA: lv_pernr TYPE persno,
lv_check
TYPE i.
*& Validate employee number
IF s_pernr IS NOT INITIAL.
SELECT SINGLE pernr
FROM pa0000
INTO lv_pernr
WHERE pernr IN s_pernr AND stat2 = 3.
IF sy-subrc <> 0.
MESSAGE text042 TYPE c_e.
ENDIF.
ENDIF.
*& Validate run date
IF s_rundte IS NOT INITIAL.
lv_check = s_rundte-low.
IF lv_check = 0.
MESSAGE text043 TYPE c_e.
ENDIF.
CLEAR lv_check.
lv_check = s_rundte-high.
IF lv_check = 0.
MESSAGE text043 TYPE c_e.
ENDIF.
ELSE.
s_rundte-low =
‘00010101’.
s_rundte-high =
‘99991231’.
ENDIF.
ENDMETHOD.                “Validation
*&———————————————————————*
*&   METHOD get_data
*&   Method to fetch data
*&———————————————————————*
METHOD  get_data.
DATA : li_pa0000 TYPE STANDARD TABLE OF t_pa0000,
li_pa0001
TYPE STANDARD TABLE OF t_pa0001.
*&———————————————————————*
*& Select Action data
SELECT pernr endda begda massn massg
INTO TABLE i_pa0000
FROM pa0000
WHERE endda >= s_rundte-low
AND begda <= s_rundte-high
AND pernr IN s_pernr AND stat2 = 3.
IF sy-subrc = 0.
*& Assign data of i_pa0000 to temp table
li_pa0000 = i_pa0000.
*& Sort table
SORT li_pa0000 BY massn.
*& Delete duplicate Action type from Actions
DELETE ADJACENT DUPLICATES FROM li_pa0000 COMPARING massn.
*&———————————————————————
*& Action Texts
SELECT massn mntxt
INTO TABLE i_t529t
FROM t529t
FOR ALL ENTRIES IN li_pa0000
WHERE massn = li_pa0000-massn AND sprsl = sy-langu.
*& Clear temp table
CLEAR li_pa0000.
*& Assign data of i_pa0000 to temp table
li_pa0000 = i_pa0000.
*& Sort table
SORT li_pa0000 BY massn massg.
*& Delete duplicate Action reasons keys from Actions
DELETE ADJACENT DUPLICATES FROM li_pa0000 COMPARING massn massg.
*&———————————————————————

*& Reason for Action Texts
SELECT massn massg mgtxt
INTO TABLE i_t530t
FROM t530t
FOR ALL ENTRIES IN li_pa0000
WHERE massn = li_pa0000-massn
AND massg = li_pa0000-massg
AND sprsl = sy-langu.
*&———————————————————————
*& Clear temp table
CLEAR li_pa0000.
*& Assign data of i_pa0000 to temp table
li_pa0000 = i_pa0000.
*& Sort table
SORT li_pa0000 BY pernr.
*& Delete duplicate Action reasons keys from Actions
DELETE ADJACENT DUPLICATES FROM li_pa0000 COMPARING pernr.

*& Select organizational assignment
SELECT  pernr endda begda
werks kostl orgeh stell
INTO TABLE i_pa0001
FROM pa0001
FOR ALL ENTRIES IN li_pa0000
WHERE pernr = li_pa0000-pernr AND endda >= s_rundte-low
AND begda <= s_rundte-high.

IF sy-subrc = 0.
*& Assign data of i_pa0001 to temp table
li_pa0001 = i_pa0001.
*& Sort table
SORT li_pa0001 BY stell.
*& Delete duplicate job from organizational assignment
DELETE ADJACENT DUPLICATES FROM li_pa0001 COMPARING stell.
*&———————————————————————

*& Get jobitle text
SELECT stell stltx endda begda
FROM t513s
INTO TABLE i_t513s
FOR ALL ENTRIES IN li_pa0001
WHERE stell = li_pa0001-stell
AND sprsl = sy-langu.
ENDIF.
*&———————————————————————*
*& Select Personal Data
SELECT  pernr endda begda
vorna nachn gesch gbdep gbdat
INTO TABLE i_pa0002
FROM pa0002
FOR ALL ENTRIES IN li_pa0000
WHERE pernr = li_pa0000-pernr AND endda >= s_rundte-low
AND begda <= s_rundte-high.
*&———————————————————————*
*& Select Address
SELECT  pernr endda begda
pstlz
INTO TABLE i_pa0006
FROM pa0006
FOR ALL ENTRIES IN li_pa0000
WHERE pernr = li_pa0000-pernr AND endda >= s_rundte-low
AND begda <= s_rundte-high.
*&———————————————————————*
*& Basic Pay
SELECT  pernr endda begda
ansal
INTO TABLE i_pa0008
FROM pa0008
FOR ALL ENTRIES IN li_pa0000
WHERE pernr = li_pa0000-pernr AND endda >= s_rundte-low
AND begda <= s_rundte-high.
*&———————————————————————*
*& Date Specifications
SELECT  pernr endda begda
dar01 dat01 dar02 dat02 dar03 dat03 dar04
dat04 dar05 dat05 dar06 dat06 dar07 dat07
dar08 dat08 dar09 dat09 dar10 dat10 dar11
dat11 dar12 dat12
INTO TABLE i_pa0041
FROM pa0041
FOR ALL ENTRIES IN li_pa0000
WHERE pernr = li_pa0000-pernr AND endda >= s_rundte-low
AND begda <= s_rundte-high.
*&———————————————————————*
*&  Communication
SELECT pernr endda begda
usrty usrid_long
INTO TABLE i_pa0105
FROM pa0105
FOR ALL ENTRIES IN li_pa0000
WHERE  pernr = li_pa0000-pernr
AND subty = ‘0010’ AND endda >= s_rundte-low
AND begda <= s_rundte-high.
o_empdata->merge_data( ).

ELSE.
MESSAGE text002 TYPE c_e.
ENDIF.
ENDMETHOD.                “Get_data
*&———————————————————————*
*&   METHOD merge_data
*&   Method to populate final table to display
*&———————————————————————*
METHOD  merge_data.
*&———————————————————————*
*& Loop date specification table for getting hire date or original hire
*& date

SELECT datar dtext
FROM t548t
INTO TABLE i_t548t
WHERE sprsl = sy-langu and datar = ‘U1’ OR datar = ’16’.

SORT i_pa0041  BY pernr endda DESCENDING.
SORT i_pa0000  BY pernr endda DESCENDING.
SORT i_pa0001  BY pernr endda DESCENDING.
SORT i_pa0002  BY pernr endda DESCENDING.
SORT i_pa0006  BY pernr endda DESCENDING.
SORT i_pa0008  BY pernr endda DESCENDING.
SORT i_pa0105  BY pernr endda DESCENDING.
SORT i_t529t   BY massn.
SORT i_t513s   BY stell endda DESCENDING.

LOOP AT i_pa0041 ASSIGNING <lx_data>  .
CLEAR: w_final.
*&———————————————————————*
*& Do loop to check for hire date or original hire date
DO 12 TIMES VARYING v_dar FROM <lx_data>-dar01 NEXT
<lx_data>-dar02
VARYING v_dat
FROM <lx_data>-dat01 NEXT
<lx_data>-dat02.
*&———————————————————————*
*& Check for Original date
IF v_dar = ’16’.
w_final-dat01 = v_dat.
w_final-dtext = v_dar.
*&———————————————————————*
*& Check for hire date
ELSEIF v_dar = ‘U1’.
w_final-dat01 = v_dat.
w_final-dtext = v_dar.
EXIT.
ENDIF.
CLEAR: v_dar,  v_dat.
ENDDO.
IF w_final-dat01 IS NOT INITIAL.
o_empdata->populate_finaldata( ).
ENDIF.
ENDLOOP.
ENDMETHOD.                  “Merge_data

METHOD  populate_finaldata.
CLEAR w_t548t.
*&———————————————————————*
*& Populate date text
READ TABLE i_t548t INTO  w_t548t
WITH KEY datar = w_final-dtext.
IF sy-subrc = 0.
w_final-dtext = w_t548t-dtext.
“Date text
ENDIF.
*&———————————————————————*
*& Populate Employee number, start date
CLEAR w_pa0000.
READ TABLE i_pa0000 INTO w_pa0000
WITH KEY pernr = <lx_data>-pernr
BINARY SEARCH.
IF sy-subrc = 0.
w_final-pernr = w_pa0000-pernr.
“Employee number
w_final-begda = w_pa0000-begda.
“Start date
*&———————————————————————*
*& Populate Action text
CLEAR w_t529t.
READ TABLE i_t529t INTO w_t529t
WITH KEY massn = w_pa0000-massn
BINARY SEARCH.
IF sy-subrc = 0.
w_final-mntxt = w_t529t-mntxt.
“Action text
ENDIF.
IF w_pa0000-massg IS NOT INITIAL.
CLEAR w_t530t.
*&———————————————————————*
*& Populate Action reason text
READ TABLE i_t530t INTO w_t530t
WITH KEY massn = w_pa0000-massn
massg = w_pa0000-massg
BINARY SEARCH.
IF sy-subrc = 0.
w_final-mgtxt = w_t530t-mgtxt.
“Action reason text
ENDIF.
ENDIF.
ENDIF.
*&———————————————————————*
*& Populate Organizational Assignments
CLEAR w_pa0001.
READ TABLE i_pa0001 INTO w_pa0001
WITH KEY pernr = <lx_data>-pernr
BINARY SEARCH.
IF sy-subrc = 0.
w_final-werks = w_pa0001-werks.
w_final-orgeh = w_pa0001-orgeh.
w_final-kostl = w_pa0001-kostl.
*&———————————————————————*
*& Populate job text
CLEAR w_t513s.
READ TABLE i_t513s INTO w_t513s
WITH KEY stell = w_pa0001-stell
BINARY SEARCH.
IF sy-subrc = 0.
w_final-stltx = w_t513s-stltx.
ENDIF.
ENDIF.
*&———————————————————————*
*& Populate Personnel details
CLEAR  w_pa0002.
READ TABLE i_pa0002 INTO w_pa0002
WITH KEY pernr = <lx_data>-pernr
BINARY SEARCH.
IF sy-subrc = 0.
w_final-vorna = w_pa0002-vorna.
“First name
w_final-nachn = w_pa0002-nachn.
“Last name
CASE w_pa0002-gesch. “Gender
WHEN c_1.
w_final-gesch =
text039.
WHEN c_2.
w_final-gesch =
text040.
WHEN OTHERS.
w_final-gesch =
text041.
ENDCASE.
w_final-gbdep = w_pa0002-gbdep.
w_final-gbdat = w_pa0002-gbdat.
ENDIF.
*&———————————————————————*
*& Populate postal address
CLEAR w_pa0006.
READ TABLE i_pa0006 INTO w_pa0006
WITH KEY pernr = <lx_data>-pernr
BINARY SEARCH.
IF sy-subrc = 0.
w_final-pstlz = w_pa0006-pstlz.
ENDIF.
*&———————————————————————*
*& Populate Basic pay data  – annual salary
CLEAR w_pa0008.
READ TABLE i_pa0008 INTO w_pa0008
WITH KEY pernr = <lx_data>-pernr
BINARY SEARCH.
IF sy-subrc = 0.
w_final-ansal = w_pa0008-ansal.
“Annual salary
ENDIF.
*&———————————————————————*
*& Populate Email id
CLEAR w_pa0105.
READ TABLE i_pa0105 INTO w_pa0105
WITH KEY pernr = <lx_data>-pernr
BINARY SEARCH.
IF sy-subrc = 0.
w_final-usrid_long = w_pa0105-usrid_long.
“Email
ENDIF.
*&———————————————————————*
*& Append work area to final table
APPEND w_final TO i_final.

ENDMETHOD.                  “Populate_finaldata

*&———————————————————————*
*&   METHOD build_fieldcatalog
*&   Method to build field catalogs
*&———————————————————————*
METHOD  build_fieldcatalog.
CLEAR : w_fieldcat,i_fieldcat.
CALL METHOD o_empdata->set_fieldcat
EXPORTING
fieldname   =
text021
seltext     =
text003
coltext     =
text003
outputlen   =
’10’
IMPORTING
w_fieldcatr = w_fieldcat.
APPEND w_fieldcat TO i_fieldcat.
CLEAR : w_fieldcat.

CALL METHOD o_empdata->set_fieldcat
EXPORTING
fieldname   =
text022
seltext     =
text020
coltext     =
text020
outputlen   =
’10’
IMPORTING
w_fieldcatr = w_fieldcat.
APPEND w_fieldcat TO i_fieldcat.
CLEAR : w_fieldcat.

CALL METHOD o_empdata->set_fieldcat
EXPORTING
fieldname   =
text023
seltext     =
text004
coltext     =
text004
outputlen   =
’10’
IMPORTING
w_fieldcatr = w_fieldcat.
APPEND w_fieldcat TO i_fieldcat.
CLEAR : w_fieldcat.

CALL METHOD o_empdata->set_fieldcat
EXPORTING
fieldname   =
text024
seltext     =
text005
coltext     =
text005
outputlen   =
’10’
IMPORTING
w_fieldcatr = w_fieldcat.
APPEND w_fieldcat TO i_fieldcat.
CLEAR : w_fieldcat.

CALL METHOD o_empdata->set_fieldcat
EXPORTING
fieldname   =
text025
seltext     =
text006
coltext     =
text006
outputlen   =
’10’
IMPORTING
w_fieldcatr = w_fieldcat.
APPEND w_fieldcat TO i_fieldcat.
CLEAR : w_fieldcat.

CALL METHOD o_empdata->set_fieldcat
EXPORTING
fieldname   =
text026
seltext     =
text007
coltext     =
text007
outputlen   =
’10’
IMPORTING
w_fieldcatr = w_fieldcat.
APPEND w_fieldcat TO i_fieldcat.
CLEAR : w_fieldcat.

CALL METHOD o_empdata->set_fieldcat
EXPORTING
fieldname   =
text027
seltext     =
text008
coltext     =
text008
outputlen   =
’10’
IMPORTING
w_fieldcatr = w_fieldcat.
APPEND w_fieldcat TO i_fieldcat.
CLEAR : w_fieldcat.

CALL METHOD o_empdata->set_fieldcat
EXPORTING
fieldname   =
text028
seltext     =
text009
coltext     =
text009
outputlen   =
’10’
IMPORTING
w_fieldcatr = w_fieldcat.
APPEND w_fieldcat TO i_fieldcat.
CLEAR : w_fieldcat.

CALL METHOD o_empdata->set_fieldcat
EXPORTING
fieldname   =
text029
seltext     =
text010
coltext     =
text010
outputlen   =
’10’
IMPORTING
w_fieldcatr = w_fieldcat.
APPEND w_fieldcat TO i_fieldcat.
CLEAR : w_fieldcat.

CALL METHOD o_empdata->set_fieldcat
EXPORTING
fieldname   =
text030
seltext     =
text011
coltext     =
text011
outputlen   =
’10’
IMPORTING
w_fieldcatr = w_fieldcat.
APPEND w_fieldcat TO i_fieldcat.
CLEAR : w_fieldcat.

CALL METHOD o_empdata->set_fieldcat
EXPORTING
fieldname   =
text031
seltext     =
text012
coltext     =
text013
outputlen   =
’10’
IMPORTING
w_fieldcatr = w_fieldcat.
APPEND w_fieldcat TO i_fieldcat.
CLEAR : w_fieldcat.

CALL METHOD o_empdata->set_fieldcat
EXPORTING
fieldname   =
text032
seltext     =
text013
coltext     =
text013
outputlen   =
’10’
IMPORTING
w_fieldcatr = w_fieldcat.
APPEND w_fieldcat TO i_fieldcat.
CLEAR : w_fieldcat.

CALL METHOD o_empdata->set_fieldcat
EXPORTING
fieldname   =
text033
seltext     =
text014
coltext     =
text014
outputlen   =
’10’
IMPORTING
w_fieldcatr = w_fieldcat.
APPEND w_fieldcat TO i_fieldcat.
CLEAR : w_fieldcat.

CALL METHOD o_empdata->set_fieldcat
EXPORTING
fieldname   =
text033
seltext     =
text014
coltext     =
text014
outputlen   =
’10’
IMPORTING
w_fieldcatr = w_fieldcat.
APPEND w_fieldcat TO i_fieldcat.
CLEAR : w_fieldcat.

CALL METHOD o_empdata->set_fieldcat
EXPORTING
fieldname   =
text034
seltext     =
text015
coltext     =
text015
outputlen   =
’10’
IMPORTING
w_fieldcatr = w_fieldcat.
APPEND w_fieldcat TO i_fieldcat.
CLEAR : w_fieldcat.

CALL METHOD o_empdata->set_fieldcat
EXPORTING
fieldname   =
text035
seltext     =
text016
coltext     =
text016
outputlen   =
’10’
IMPORTING
w_fieldcatr = w_fieldcat.
APPEND w_fieldcat TO i_fieldcat.
CLEAR : w_fieldcat.

CALL METHOD o_empdata->set_fieldcat
EXPORTING
fieldname   =
text036
seltext     =
text017
coltext     =
text017
outputlen   =
’10’
IMPORTING
w_fieldcatr = w_fieldcat.
APPEND w_fieldcat TO i_fieldcat.
CLEAR : w_fieldcat.

CALL METHOD o_empdata->set_fieldcat
EXPORTING
fieldname   =
text037
seltext     =
text018
coltext     =
text018
outputlen   =
’10’
IMPORTING
w_fieldcatr = w_fieldcat.
APPEND w_fieldcat TO i_fieldcat.
CLEAR : w_fieldcat.

CALL METHOD o_empdata->set_fieldcat
EXPORTING
fieldname   =
text038
seltext     =
text019
coltext     =
text019
outputlen   =
’10’
IMPORTING
w_fieldcatr = w_fieldcat.
APPEND w_fieldcat TO i_fieldcat.
CLEAR : w_fieldcat.

ENDMETHOD.                “Build_fieldcatalog
*&———————————————————————*
*&   METHOD prepare_topofpage
*&   Method to report header
*&———————————————————————*
METHOD prepare_topofpage.

DATA: lv_count TYPE char255,
lv_count1
TYPE string,
lv_rundte
TYPE char255,
lv_rundte_l
TYPE char20,
lv_rundte_h
TYPE char20.

DESCRIBE TABLE i_final.
lv_count1 = sy-tfill.

CONCATENATE text045 ‘:’ lv_count1 INTO lv_count.

IF s_rundte-low IS NOT INITIAL.

CONCATENATE text047  s_rundte-low+4(2) ‘.’
s_rundte-low+
6(2) ‘.’ s_rundte-low+0(4)
INTO lv_rundte_l.
ENDIF.

IF s_rundte-high IS NOT INITIAL.
CONCATENATE  text048 s_rundte-high+4(2) ‘.’
s_rundte-high+
6(2) ‘.’ s_rundte-high+0(4)
INTO lv_rundte_h .
ENDIF.

CONCATENATE text046 lv_rundte_l  lv_rundte_h
INTO lv_rundte.
*&———————————————————————*
*&   Employee’s Hiring Details
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.
*&———————————————————————*
*&   Number of records
CALL METHOD o_doc->add_text
EXPORTING
text         = lv_count
sap_fontsize = cl_dd_area=>medium
sap_emphasis = cl_dd_area=>strong.
CALL METHOD o_doc->new_line.
*&———————————————————————*
*&   Run Date
CALL METHOD o_doc->add_text
EXPORTING
text         = lv_rundte
sap_fontsize = cl_dd_area=>medium
sap_emphasis = cl_dd_area=>strong.
CALL METHOD o_doc->display_document
EXPORTING
parent             = o_top_cntnr
EXCEPTIONS
html_display_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.
ENDMETHOD.                    “prepare_topofpage

*&———————————————————————*
*&   METHOD set_fieldcat
*&   Method to set_fieldcat
*&———————————————————————*
METHOD set_fieldcat.
CLEAR: w_fieldcat.
w_fieldcatr-fieldname = fieldname.
w_fieldcatr-col_pos = v_colpos.
w_fieldcatr-outputlen = outputlen.
w_fieldcatr-coltext = coltext.
w_fieldcatr-seltext = seltext.
v_colpos = v_colpos +
1.
ENDMETHOD.                    “set_fieldcat

*&———————————————————————*
*&   METHOD display_alv
*&   Method to display ALV grid
*&———————————————————————*
METHOD  display_alv.
o_empdata->build_fieldcatalog( ).
CALL SCREEN 100.
ENDMETHOD.                “Display_alv
ENDCLASS.                   “CL_EMPDATA

 
 

PAI

*&———————————————————————*
*&  Include           ZHCM_ASMNT1_PAI
*&———————————————————————*
*&———————————————————————*
*&      Module  USER_COMMAND_0100  INPUT
*&———————————————————————*
*       text
*———————————————————————-*
module USER_COMMAND_0100 input.
CASE sy-ucomm .
WHEN ‘BACK’ OR ‘RW’ OR ‘%EX’ .
LEAVE PROGRAM .
ENDCASE .
endmodule.                 ” USER_COMMAND_0100  INPUT

 
 

PBO

*&———————————————————————*
*&  Include           ZHCM_ASMNT1_PBO
*&———————————————————————*
*&———————————————————————*
*&      Module  STATUS_0100  OUTPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE status_0100 OUTPUT.
SET PF-STATUS ‘EMP_DATA’.
*  SET TITLEBAR ‘xxx’.

ENDMODULE.                 ” STATUS_0100  OUTPUT
*&———————————————————————*
*&      Module  DSPLY_EMPDATA  OUTPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE dsply_empdata OUTPUT.
*———————————————————————-*
*Check for object of first grid
*———————————————————————-*

IF o_alv IS INITIAL.
“Create object for first container
CREATE OBJECT o_cc
EXPORTING
container_name              =
‘CC_EMPDATA’
EXCEPTIONS
cntl_error                  =
1
cntl_system_error           =
2
create_error                =
3
lifetime_error              =
4
lifetime_dynpro_dynpro_link =
5
OTHERS                      = 6.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
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 sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
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_empdata->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 sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
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
CHANGING
it_fieldcatalog               = i_fieldcat
it_outtab                     = i_final
EXCEPTIONS
invalid_parameter_combination =
1
program_error                 =
2
too_many_lines                =
3
OTHERS                        = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDMODULE.                 ” DSPLY_EMPDATA  OUTPUT

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply