Skip to Content

MAIN

************************************************************************
* Object Name : REPORT  ZHR_8235_ASG2_1. *
* Author/Company Name : Krishnakant Joshi / *
* Transport Request *
* Creation Date * 01/29/2013
************************************************************************
* Description: *  Get Employee Manager
************************************************************************
* Dependencies *
************************************************************************
* Modification History *
************************************************************************
* Date Programmer Client Ref No. Description Correction *
************************************************************************
REPORT ZHR_8235_ASG2_1 .
*&**********************************************************************
*&    INCLUDE
*&**********************************************************************
INCLUDE : ZHR_8235_ASG2_1_TOP,    “Global Types and Data
ZHR_8235_ASG2_1_SCREEN,
“Screen Design
ZHR_8235_ASG2_1_FORM.  
“Subroutines
*&**********************************************************************
*&    INITIALIZATION
*&**********************************************************************
INITIALIZATION.
V_REPID = SY-REPID.
*&**********************************************************************
*     AT SELECTION-SCREEN OUTPUT.
*&**********************************************************************
AT SELECTION-SCREEN OUTPUT.
PERFORM POPULATE_STATUS.
*&**********************************************************************
*&    AT SELECTION-SCREEN
*&**********************************************************************
AT SELECTION-SCREEN.
PERFORM VALIDATATION. “Validate Screen
*&**********************************************************************
*&    START-OF-SELECTION
*&**********************************************************************
START-
OF-SELECTION.
PERFORM GETDATA.“Populate internal tables
*&**********************************************************************
*&    END-OF-SELECTION
*&**********************************************************************
ENDOF-SELECTION.
IF I_FINAL IS NOT INITIAL.
PERFORM  BUILD_FIELDCATALOG.
PERFORM  SET_LAYOUT.
PERFORM  DISPLAY_ALV_REPORT.
ELSE.
MESSAGE TEXT010 TYPE C_I DISPLAY LIKE C_E.
ENDIF.

 
  

TOP

*&———————————————————————*
*&  Include           ZHR_8235_ASG2_1_TOP
*&———————————————————————*
TYPE-POOLS: SLIS,
VRM.
*&**********************************************************************
*&   TYPES
*&**********************************************************************
TYPES :
*&  Actions
BEGIN OF T_PA0000,
PERNR          
TYPE PERNR-PERNR,   “Employee Number
ENDDA          
TYPE ENDDA,   “End Date
BEGDA          
TYPE BEGDA,   “Start Date
MASSN          
TYPE MASSN,   “Action Type
MASSG          
TYPE MASSG,   “Reason for Action
END OF   T_PA0000,
*&  Org. Assignment
BEGIN OF T_PA0001,
PERNR          
TYPE PERNR-PERNR,   “Employee Number
ENDDA          
TYPE ENDDA,   “End Date
BEGDA          
TYPE BEGDA,   “Start Date
WERKS          
TYPE PERSA,   “Personnel Area
KOSTL          
TYPE KOSTL,   “Cost center
ORGEH          
TYPE ORGEH,   “Organization Unit
STELL          
TYPE STELL,   “Job
PLANS          
TYPE PLANS,   “Position
END OF   T_PA0001,
*&  Personal Data
BEGIN OF T_PA0002,
PERNR          
TYPE PERNR-PERNR,    “Employee Number
ENDDA          
TYPE ENDDA,    “End Date
BEGDA          
TYPE BEGDA,    “Start Date
VORNA          
TYPE PAD_VORNA,“First name
NACHN          
TYPE PAD_NACHN,“Last name
END OF   T_PA0002,
*&  Personnel Action Texts
BEGIN OF T_T529T,
MASSN          
TYPE  MASSN,   “Action Type
MNTXT          
TYPE  MNTXT,   “Action Text
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,   “Reason Text
END OF   T_T530T,
*&  Final Table
BEGIN OF T_FINAL,
PERNR          
TYPE  PERNR-PERNR, “Employee number
BEGDA          
TYPE  BEGDA,       “Start Date
MNTXT          
TYPE  MNTXT,   “Action Text
MGTXT          
TYPE  MGTXT,   “Reason Text
STELL          
TYPE  STELL,   “Job
KOSTL          
TYPE  KOSTL,   “Cost center
VORNA          
TYPE  PAD_VORNA,“First name
NACHN          
TYPE  PAD_NACHN,“Last name
MGRID          
TYPE  HROBJID,  “Manager Id
MGRNAME        
TYPE  CHAR80,   “Manager Name
ORGEH          
TYPE  ORGEH,   “Organization Unit
ORGTEXT        
TYPE  CHAR40,  “Org. Text
END OF   T_FINAL,
*&  HRP1001
BEGIN OF T_HRP1001,
OBJID          
TYPE  OBJEKTID,
BEGDA          
TYPE  BEGDATUM,
ENDDA          
TYPE  ENDDATUM,
SEQNR          
TYPE  SEQNR,
SOBID          
TYPE  SOBID,
END OF T_HRP1001,
BEGIN OF T_T527X,
ORGEH          
TYPE ORGEH,
ENDDA          
TYPE ENDDA,
BEGDA          
TYPE BEGDA,
ORGTX          
TYPE ORGTX,
END OF T_T527X.

*&**********************************************************************
*&   DATA
*&**********************************************************************
DATA : V_PERNR          TYPE  PERNR-PERNR,   “Employee Number
V_DATE          
TYPE  BEGDA,   “Selection Date
V_COLPOS        
TYPE I VALUE  1.
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_T529T         
TYPE STANDARD TABLE OF T_T529T,
I_T530T         
TYPE STANDARD TABLE OF T_T530T,
I_HRP1001       
TYPE STANDARD TABLE OF T_HRP1001,
I_0002          
TYPE STANDARD TABLE OF T_PA0002,
I_FINAL         
TYPE STANDARD TABLE OF T_FINAL,
I_T527X         
TYPE STANDARD TABLE OF T_T527X.
DATA: I_FIELDCATALOG    TYPE TABLE OF SLIS_FIELDCAT_ALV,
W_FIELDCATALOG   
TYPE SLIS_FIELDCAT_ALV,
V_REPID          
LIKE SY-REPID,
V_GRIDTITLE      
TYPE LVC_TITLE,
W_LAYOUT         
TYPE SLIS_LAYOUT_ALV.
DATA: v_name            TYPE vrm_id,
i_list           
TYPE vrm_values,
w_value          
LIKE LINE OF i_list,
V_CHECK          
TYPE I.
FIELD-SYMBOLS : <X_HRP1001> TYPE  T_HRP1001,
<X_0002>   
TYPE T_PA0002.
*&**********************************************************************
*&   CONSTANTS
*&**********************************************************************
CONSTANTS : C_E         TYPE C          VALUE ‘E’, “Constant For E
C_I        
TYPE C          VALUE ‘I’, “Constant For I
C_X        
TYPE C          VALUE ‘X’, “Constant For X
C_1        
TYPE C          VALUE ‘1’, “Constant For 1
C_2        
TYPE C          VALUE ‘2’, “Constant For 2
C_3        
TYPE C          VALUE ‘3’, “Constant For 3
C_0        
TYPE C          VALUE ‘0’, “Constant For 0
C_P_STAT2  
TYPE CHAR07     VALUE ‘P_STAT2’,“Stat2 Param
C_STARTDATE
TYPE CHAR10     VALUE ‘18000101’,“Start Date
C_ENDDATE  
TYPE CHAR10     VALUE ‘99991231’,“End Date
C_99999999 
TYPE CHAR08     VALUE ‘99999999’,
C_01       
TYPE PLOG-PLVAR VALUE ’01’,
C_S        
TYPE PLOG-OTYPE VALUE ‘S’,
C_P        
TYPE PLOG-OTYPE VALUE ‘P’,
C_O        
TYPE PLOG-OTYPE VALUE ‘O’,
C_A002     
TYPE PLOG-SUBTY VALUE ‘A002’,
C_A003     
TYPE PLOG-SUBTY VALUE ‘A003’,
C_A008     
TYPE PLOG-SUBTY VALUE ‘A008’,
C_B012     
TYPE PLOG-SUBTY VALUE ‘B012’,
C_1001     
TYPE PLOG-INFTY VALUE ‘1001’,
C_VACANT   
TYPE CHAR6      VALUE ‘VACANT’,
C_01010001 
TYPE CHAR08     VALUE ‘01010001’.

 
  

SCREEN

*&———————————————————————*
*&  Include           ZHR_8235_ASG2_1_SCREEN
*&———————————————————————*
*&———————————————————————*
*&  Include           ZHCM_ASMNT2_SCREEN
*&———————————————————————*
************************************************************************
*& Selection screen
************************************************************************
SELECTION-
SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT000.
SELECT-OPTIONS : S_PERNR FOR V_PERNR, “Employee Number
S_SELDTE
FOR V_DATE. “Run date
PARAMETERS: P_STAT2 AS LISTBOX VISIBLE LENGTH 10 OBLIGATORY.
SELECTION-
SCREEN END OF BLOCK B1.

 
  

FORM

*&———————————————————————*
*&  Include           ZHR_8235_ASG2_1_FORM
*&———————————————————————*
*&———————————————————————*
*&      Form  GETDATA
*&———————————————————————*
*       Populate internal tables
*———————————————————————-*
FORM GETDATA .
DATA: LV_MGRID TYPE HROBJID,
LV_MGRNAME
TYPE CHAR80,
LV_POS
TYPE PLANS.
FIELD-SYMBOLS : <LX_PA0001> TYPE T_PA0001,
<LX_PA0000>
TYPE T_PA0000,
<LX_PA0002>
TYPE T_PA0002,
<LX_T530T>
TYPE  T_T530T,
<LX_T529T>
TYPE  T_T529T,
<LX_T527X>
TYPE  T_T527X.
DATA :LW_FINAL TYPE  T_FINAL.
*———————————————————————-*
* Get Action Data
PERFORM GET_PA0000.
*———————————————————————-*
* Initial check
IF I_PA0000 IS NOT INITIAL.
*———————————————————————-*
* Get Texts
PERFORM GET_TEXTS.
*———————————————————————-*
* Loop for populating final table
UNASSIGN <LX_PA0000>.
LOOP AT I_PA0000 ASSIGNING <LX_PA0000>.
* Clear work area
CLEAR LW_FINAL.
LW_FINAL-PERNR = <LX_PA0000>-PERNR.
LW_FINAL-BEGDA = <LX_PA0000>-BEGDA.
*———————————————————————-*
* Read Org DATA
UNASSIGN <LX_PA0001>.
READ TABLE I_PA0001 ASSIGNING <LX_PA0001>
WITH KEY PERNR = <LX_PA0000>-PERNR
BINARY SEARCH.
IF <LX_PA0001> IS ASSIGNED.
LW_FINAL-STELL = <LX_PA0001>-STELL.
LW_FINAL-KOSTL = <LX_PA0001>-KOSTL.
LW_FINAL-ORGEH = <LX_PA0001>-ORGEH.
LV_POS = <LX_PA0001>-PLANS.
*———————————————————————-*
*Get organization Text
UNASSIGN <LX_T527X>.
READ TABLE I_T527X ASSIGNING <LX_T527X>
WITH KEY ORGEH = <LX_PA0001>-ORGEH
BINARY SEARCH.
IF <LX_T527X> IS ASSIGNED.
LW_FINAL-ORGTEXT = <LX_T527X>-ORGTX.
ENDIF.
ENDIF.
*———————————————————————-*
* Read action Text
IF <LX_PA0000>-MASSN IS NOT INITIAL.
UNASSIGN <LX_T529T>.
READ TABLE I_T529T ASSIGNING <LX_T529T>
WITH KEY MASSN = <LX_PA0000>-MASSN
BINARY SEARCH.
IF <LX_T529T> IS ASSIGNED.
LW_FINAL-MNTXT = <LX_T529T>-MNTXT.
ENDIF.
ENDIF.
*———————————————————————-*
* Read Action reason text
UNASSIGN <LX_T530T>.
READ TABLE I_T530T  ASSIGNING <LX_T530T>
WITH KEY MASSN = <LX_PA0000>-MASSN
MASSG = <LX_PA0000>-MASSG
BINARY SEARCH.
IF <LX_T530T> IS ASSIGNED.
LW_FINAL-MGTXT = <LX_T530T>-MGTXT.
ENDIF.
*———————————————————————-*
* Read personal data
UNASSIGN <LX_PA0002>.
READ TABLE I_PA0002 ASSIGNING <LX_PA0002>
WITH KEY PERNR = <LX_PA0000>-PERNR
BINARY SEARCH.
IF <LX_PA0002> IS ASSIGNED.
LW_FINAL-VORNA = <LX_PA0002>-VORNA.
LW_FINAL-NACHN = <LX_PA0002>-NACHN.
ENDIF.
IF LV_POS <> C_99999999.
*———————————————————————-*
* Get Line supervisor details
PERFORM GET_LINESUPERVISOR USING     LV_POS
CHANGING  LV_MGRID
LV_MGRNAME.
IF LV_MGRID IS INITIAL.
*———————————————————————-*
* Get Manager Details
PERFORM GET_MANAGER USING    LV_POS
CHANGING LV_MGRID
LV_MGRNAME.
ENDIF.
ELSE.
LV_MGRNAME = C_VACANT.
ENDIF.
LW_FINAL-MGRID = LV_MGRID.
LW_FINAL-MGRNAME = LV_MGRNAME.
*———————————————————————-*
* Add row to final table
APPEND LW_FINAL TO I_FINAL.
CLEAR: LV_MGRID,LV_MGRNAME,LV_POS.
ENDLOOP.
UNASSIGN <LX_PA0000>.
ENDIF.
ENDFORM.                     ” GETDATA
*&———————————————————————*
*&      Form  GET_PA0000
*&———————————————————————*
*       Get data from TABLE PA0000
*———————————————————————-*
FORM GET_PA0000 .
SELECT PERNR ENDDA BEGDA MASSN MASSG
FROM PA0000
INTO TABLE I_PA0000
WHERE PERNR IN S_PERNR
AND ENDDA >= S_SELDTE-LOW
AND BEGDA <= S_SELDTE-HIGH
AND STAT2 = P_STAT2.
IF SY-SUBRC = 0.
*———————————————————————-*
*Sort table I_PA0000
SORT I_PA0000 BY PERNR ENDDA DESCENDING
BEGDA
DESCENDING.
*———————————————————————-*
*Get latest records from I_PA0000
DELETE ADJACENT DUPLICATES FROM I_PA0000 COMPARING PERNR.
*———————————————————————-*
*Get data from PA00001
PERFORM GET_PA0001.
*———————————————————————-*
*Get data from PA00002
PERFORM GET_PA0002.
ENDIF.
ENDFORM.                    ” GET_PA0000
*&———————————————————————*
*&      Form  GET_PA0001
*&———————————————————————*
*       Get data from TABLE PA0001
*———————————————————————-*
FORM GET_PA0001 .
CLEAR I_PA0001.
IF I_PA0000 IS NOT INITIAL.
SELECT PERNR ENDDA BEGDA WERKS KOSTL ORGEH STELL PLANS
FROM PA0001
INTO TABLE I_PA0001
FOR ALL ENTRIES IN I_PA0000
WHERE PERNR = I_PA0000-PERNR
AND ENDDA >= S_SELDTE-LOW
AND BEGDA <= S_SELDTE-HIGH.
IF SY-SUBRC = 0.
*———————————————————————-*
*Sort table I_PA0001
SORT I_PA0001 BY PERNR ENDDA DESCENDING
BEGDA
DESCENDING.
*———————————————————————-*
*Get latest records from I_PA0001
DELETE ADJACENT DUPLICATES FROM I_PA0001 COMPARING PERNR.
ENDIF.
ENDIF.
ENDFORM.                    ” GET_PA0001
*&———————————————————————*
*&      Form  GET_TEXTS
*&———————————————————————*
*       text
*———————————————————————-*
FORM GET_TEXTS .
DATA : LI_PA0000 TYPE STANDARD TABLE OF T_PA0000,“Temporaty Table
LI_PA0001
TYPE STANDARD TABLE OF T_PA0001.“Temporaty Table
CLEAR: I_T529T,I_T530T,I_T527X.
IF I_PA0000 IS NOT INITIAL.
*&———————————————————————
*& Action Texts
LI_PA0000 = I_PA0000.
*———————————————————————-*
*Sort temporaty table
SORT LI_PA0000 BY MASSN.
*———————————————————————-*
*Delete duplicates
DELETE ADJACENT DUPLICATES FROM LI_PA0000 COMPARING MASSN.
SELECT MASSN MNTXT
INTO TABLE I_T529T
FROM T529T
FOR ALL ENTRIES IN LI_PA0000
WHERE  SPRSL = SY-LANGU
AND  MASSN = LI_PA0000-MASSN.
IF SY-SUBRC = 0.
SORT I_T529T  BY MASSN.
ENDIF.
*&———————————————————————
*& Reason for Action Texts
CLEAR LI_PA0000.
LI_PA0000 = I_PA0000.
*———————————————————————-*
*Sort temporaty table
SORT LI_PA0000 BY MASSN MASSG.
*———————————————————————-*
*Delete duplicates
DELETE ADJACENT DUPLICATES FROM LI_PA0000 COMPARING MASSN MASSG.
SELECT MASSN MASSG MGTXT
INTO TABLE I_T530T
FROM T530T
FOR ALL ENTRIES IN LI_PA0000
WHERE SPRSL = SY-LANGU
AND MASSN = LI_PA0000-MASSN
AND MASSG = LI_PA0000-MASSG.
IF SY-SUBRC = 0.
SORT I_T530T  BY MASSN MASSG.
ENDIF.
ENDIF.
*&———————————————————————
*& Organization Text
IF I_PA0001 IS NOT INITIAL.
LI_PA0001 = I_PA0001.
*———————————————————————-*
*Sort temporaty table
SORT LI_PA0001 BY ORGEH.
*———————————————————————-*
*Delete duplicate records from temporary table to get ORG text
DELETE ADJACENT DUPLICATES FROM LI_PA0001 COMPARING ORGEH.
SELECT ORGEH ENDDA BEGDA ORGTX
FROM T527X
INTO TABLE I_T527X
FOR ALL ENTRIES IN LI_PA0001
WHERE SPRSL = SY-LANGU
AND ORGEH = LI_PA0001-ORGEH
AND ENDDA >= S_SELDTE-LOW
AND BEGDA <= S_SELDTE-HIGH.
IF SY-SUBRC  = 0.
*&———————————————————————
*& Sort and delete duplicate records internal table to get the
*& latest records
SORT I_T527X BY ORGEH ENDDA BEGDA DESCENDING.
DELETE ADJACENT DUPLICATES FROM I_T527X COMPARING ORGEH.
ENDIF.
ENDIF.
ENDFORM.                    ” GET_TEXTS
*&———————————————————————*
*&      Form  GET_PA0002
*&———————————————————————*
*       Get Personal data
*———————————————————————-*
FORM GET_PA0002 .
IF I_PA0000 IS NOT INITIAL.
CLEAR I_PA0002.
SELECT PERNR ENDDA BEGDA VORNA NACHN
INTO TABLE I_PA0002
FROM PA0002
FOR ALL ENTRIES IN I_PA0000
WHERE PERNR = I_PA0000-PERNR
AND ENDDA >= S_SELDTE-LOW
AND BEGDA <= S_SELDTE-HIGH.
IF SY-SUBRC = 0.
*———————————————————————-*
*Sort table I_PA0002
SORT I_PA0002 BY PERNR ENDDA DESCENDING
BEGDA
DESCENDING.
*———————————————————————-*
*Get latest records from I_PA0002
DELETE ADJACENT DUPLICATES FROM I_PA0002 COMPARING PERNR.
ENDIF.
ENDIF.
ENDFORM.                    ” GET_PA0002
*&———————————————————————*
*&      Form  GET_MANAGER
*&———————————————————————*
*       Get manager details
*———————————————————————-*
*      –>P_PLANS    Position
*      <–P_MGRID    Manager Id
*      <–P_MGRNAME  Manager Name
*———————————————————————-*
FORM GET_MANAGER  USING    P_PLANS    TYPE PLANS
CHANGING P_MGRID    TYPE HROBJID
P_MGRNAME 
TYPE CHAR80.
DATA: LV_OBJID TYPE HROBJID.
CLEAR P_MGRID.
*———————————————————————-*
*Get org unit.
PERFORM GET_INFTY USING    C_01
C_S
P_PLANS
C_1001
C_A003
C_O.
IF  I_HRP1001 IS NOT INITIAL.
READ TABLE I_HRP1001 ASSIGNING <X_HRP1001> INDEX 1.
IF <X_HRP1001> IS ASSIGNED.
CLEAR LV_OBJID.
LV_OBJID =  <X_HRP1001>-SOBID.
*———————————————————————-*
*Get manager position for org unit
PERFORM GET_INFTY USING    C_01
C_O
LV_OBJID
C_1001
C_B012
C_S.
IF  I_HRP1001 IS NOT INITIAL.
READ TABLE I_HRP1001 ASSIGNING <X_HRP1001> INDEX 1.
IF <X_HRP1001>  IS ASSIGNED.
*———————————————————————-*
*Get manager’s Name
P_MGRID = <X_HRP1001>-SOBID.
PERFORM GET_MANAGERNAME CHANGING P_MGRID P_MGRNAME.
ENDIF.
ELSE.
*———————————————————————-*
*Get Upper level
P_MGRNAME = C_VACANT.
ENDIF.
ELSE.
P_MGRNAME = C_VACANT.
ENDIF.
ELSE.
P_MGRNAME = C_VACANT.
ENDIF.
ENDFORM.                    ” GET_MANAGER
*&———————————————————————*
*&      Form  CALL_INFTY
*&———————————————————————*
*       text
*———————————————————————-*
*      –>P_PLVAR  Plan Version
*      –>P_OTYPE  Object type
*      –>P_OBJID  Object Id
*      –>P_INFTY  Info type
*      –>P_SUBTY  Sub Type
*      –>P_SCLAS  Related object type
*———————————————————————-*
FORM GET_INFTY USING      P_PLVAR TYPE PLOG-PLVAR
P_OTYPE
TYPE PLOG-OTYPE
P_OBJID
TYPE PLOG-OBJID
P_INFTY
TYPE PLOG-INFTY
P_SUBTY
TYPE PLOG-SUBTY
P_SCLAS
TYPE PLOG-OTYPE.

CLEAR I_HRP1001.
SELECT  OBJID BEGDA ENDDA SEQNR SOBID
FROM HRP1001
INTO TABLE I_HRP1001
WHERE   OTYPE = P_OTYPE AND
OBJID = P_OBJID
AND
PLVAR = P_PLVAR
AND
INFTY = P_INFTY
AND
SUBTY = P_SUBTY
AND
SCLAS = P_SCLAS.
IF SY-SUBRC = 0.
SORT I_HRP1001 BY ENDDA DESCENDING BEGDA DESCENDING.
ENDIF.
ENDFORM.                    ” CALL_INFTY
*&———————————————————————*
*&      Form  BUILD_FIELDCATALOG
*&———————————————————————*
*       Form to build fieldcatalogs for ALV
*———————————————————————-*
FORM BUILD_FIELDCATALOG .
* SET Field Catalog
PERFORM SET_FIELDCATALOG USINGTEXT011 TEXT012,
TEXT013 TEXT014,
TEXT015 TEXT016,
TEXT017 TEXT018,
TEXT019 TEXT020,
TEXT021 TEXT022,
TEXT023 TEXT024,
TEXT025 TEXT026,
TEXT027 TEXT028,
TEXT029 TEXT030,
TEXT031 TEXT032,
TEXT033 TEXT034.
ENDFORM.                    ” BUILD_FIELDCATALOG
*———————————————————————-*
* Form set_fieldcatalog *
*———————————————————————-*
* This form is used to set field catalog
*———————————————————————-*
*      –>p_field    Field name
*      –>p_seltext  Field Header text
*———————————————————————-*
FORM SET_FIELDCATALOG  USING P_FIELD TYPE SLIS_FIELDNAME
P_SELTEXT
TYPE SCRTEXT_M .
CLEAR  W_FIELDCATALOG.
W_FIELDCATALOG-FIELDNAME   = P_FIELD.
W_FIELDCATALOG-SELTEXT_M   = P_SELTEXT.
W_FIELDCATALOG-COL_POS     = V_COLPOS.
APPEND W_FIELDCATALOG TO I_FIELDCATALOG.
V_COLPOS = V_COLPOS +
1.
ENDFORM.                    ” set_fieldcatalog
*&———————————————————————*
*&      Form  SET_LAYOUT
*&———————————————————————*
*       text
*———————————————————————-*
FORM SET_LAYOUT .
W_LAYOUT-NO_HOTSPOT = C_X.
W_LAYOUT-ZEBRA  = C_X.
W_LAYOUT-COLWIDTH_OPTIMIZE = C_X.
ENDFORM.                    ” SET_LAYOUT
*&———————————————————————*
*&      Form  DISPLAY_ALV_REPORT
*&———————————————————————*
*       ALV display
*———————————————————————-*
FORM DISPLAY_ALV_REPORT .
V_GRIDTITLE =
TEXT042.
* ALV GRID DISPLAY Function Module call———————————
CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’
EXPORTING
I_CALLBACK_PROGRAM     = V_REPID
I_CALLBACK_TOP_OF_PAGE =
‘TOP_OF_PAGE’
IT_FIELDCAT            = I_FIELDCATALOG
IS_LAYOUT              = W_LAYOUT
I_GRID_TITLE           = V_GRIDTITLE
TABLES
T_OUTTAB               = I_FINAL
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.                    ” DISPLAY_ALV_REPORT
*———————————————————————-*
* top_of_page *
*———————————————————————-*
* This form is used to set top of page
*———————————————————————-*
FORM TOP_OF_PAGE.
DATA : LI_HEADER    TYPE TABLE OF SLIS_LISTHEADER,
LW_HEADER   
TYPE SLIS_LISTHEADER,
LV_COUNT    
TYPE I,
LV_DATE     
TYPE CHAR10,
LV_SELDTE_L 
TYPE CHAR20,
LV_SELDTE_H 
TYPE CHAR20,
LV_SELDTE   
TYPE CHAR40.
*No of records
DESCRIBE TABLE I_FINAL LINES LV_COUNT.
WRITE LV_COUNT TO LW_HEADER-INFO.
LW_HEADER-
KEY = TEXT035.
LW_HEADER-TYP = C_S.
APPEND LW_HEADER TO LI_HEADER.
*Run of records
CLEAR LW_HEADER.
WRITE: SY-DATUM TO LV_DATE USING EDIT MASK ‘__/__/____’.
LW_HEADER-
KEY = TEXT036.
LW_HEADER-INFO = LV_DATE.
LW_HEADER-TYP = C_S.
APPEND LW_HEADER TO LI_HEADER.
CLEAR LW_HEADER.
*Selection dates
CONCATENATE TEXT040 ‘:’ S_SELDTE-LOW+4(2) ‘/’
S_SELDTE-LOW+
6(2) ‘/’ S_SELDTE-LOW+0(4)
INTO LV_SELDTE_L.
CONCATENATE  TEXT041 ‘:’ S_SELDTE-HIGH+4(2) ‘/’
S_SELDTE-HIGH+
6(2) ‘/’ S_SELDTE-HIGH+0(4)
INTO LV_SELDTE_H .
CONCATENATE LV_SELDTE_L LV_SELDTE_H
INTO LV_SELDTE SEPARATED BY SPACE.
LW_HEADER-
KEY = TEXT037.
LW_HEADER-INFO = LV_SELDTE.
LW_HEADER-TYP = C_S.
APPEND LW_HEADER TO LI_HEADER.
CALL FUNCTION ‘REUSE_ALV_COMMENTARY_WRITE’
EXPORTING
IT_LIST_COMMENTARY = LI_HEADER.
ENDFORM.                    “TOP_OF_PAGE
*&———————————————————————*
*&      Form  GET_LINESUPERVISOR
*&———————————————————————*
*       Get line supervisor
*———————————————————————-*
*      –>P_PLANS   Plan Versio
*      <–P_MGRID   Manager Id
*      <–P_MGRNAME Manager Name
*———————————————————————-*
FORM GET_LINESUPERVISOR   USING    P_PLANS    TYPE PLANS
CHANGING P_MGRID    TYPE HROBJID
P_MGRNAME 
TYPE CHAR80.
*———————————————————————-*
*Get Line Supervisor.
PERFORM GET_INFTY USING    C_01
C_S
P_PLANS
C_1001
C_A002
C_S.
IF  I_HRP1001 IS NOT INITIAL.
*———————————————————————-*
*Sort Table
SORT I_HRP1001 BY ENDDA BEGDA DESCENDING.
*———————————————————————-*
*Read Latest record
READ TABLE I_HRP1001 ASSIGNING <X_HRP1001> INDEX 1.
IF <X_HRP1001> IS ASSIGNED.
P_MGRID = <X_HRP1001>-SOBID.
PERFORM GET_MANAGERNAME CHANGING P_MGRID P_MGRNAME.
ENDIF.
ENDIF.
ENDFORM.                    ” GET_LINESUPERVISOR
*&———————————————————————*
*&      Form  GET_MANAGERNAME
*&———————————————————————*
*       text
*———————————————————————-*
*      –>P_MGRID    Manager Position Id
*      <–P_MGRNAME  Manager Name
*———————————————————————-*
FORM GET_MANAGERNAME  CHANGING    P_MGRID TYPE HROBJID
P_MGRNAME
TYPE CHAR80.
*———————————————————————-*
*Get manager PERNR
PERFORM GET_INFTY USING C_01
C_S
P_MGRID
C_1001
C_A008
C_P.
IF  I_HRP1001 IS NOT INITIAL.
SORT I_HRP1001 BY ENDDA BEGDA DESCENDING.
UNASSIGN <X_HRP1001>.
READ TABLE I_HRP1001 ASSIGNING <X_HRP1001> INDEX 1.
IF <X_HRP1001> IS ASSIGNED.
CLEAR: P_MGRID, I_0002.
P_MGRID = <X_HRP1001>-SOBID.
*Get PERNR Details
SELECT PERNR ENDDA BEGDA VORNA NACHN
FROM PA0002
INTO TABLE I_0002
WHERE PERNR = P_MGRID
AND ENDDA >= S_SELDTE-LOW
AND BEGDA <= S_SELDTE-HIGH.
IF I_0002 IS NOT INITIAL.
*———————————————————————-*
*Sort Table
SORT I_0002 BY ENDDA BEGDA DESCENDING.
*———————————————————————-*
*Read Latest record
UNASSIGN <X_0002>.
READ TABLE I_0002 ASSIGNING <X_0002> INDEX 1.
*———————————————————————-*
*Conctenate first and last name
IF <X_0002> IS ASSIGNED.
CONCATENATE <X_0002>-VORNA <X_0002>-NACHN
INTO P_MGRNAME
SEPARATED BY SPACE.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFORM.                    ” GET_MANAGERNAME
*&———————————————————————*
*&      Form  POPULATE_STATUS
*&———————————————————————*
*       text
*———————————————————————-*
FORM POPULATE_STATUS .
CLEAR: V_NAME,
I_LIST,
W_VALUE.
V_NAME =
TEXT005.
W_VALUE-
KEY = C_0 .
W_VALUE-
TEXT = TEXT001.
APPEND W_VALUE TO I_LIST.
CLEAR: W_VALUE.
W_VALUE-
KEY = C_1.
W_VALUE-
TEXT = TEXT002.
APPEND W_VALUE TO I_LIST.
CLEAR: W_VALUE.
W_VALUE-
KEY = C_2.
W_VALUE-
TEXT = TEXT003.
APPEND W_VALUE TO I_LIST.
CLEAR: W_VALUE.
W_VALUE-
KEY = C_3.
W_VALUE-
TEXT = TEXT004.
APPEND W_VALUE TO I_LIST.
CLEAR: W_VALUE.
V_NAME = C_P_STAT2.
CALL FUNCTION ‘VRM_SET_VALUES’
EXPORTING
ID     = V_NAME
VALUES = I_LIST.
P_STAT2 =
3.
ENDFORM.                    ” POPULATE_STATUS
*&———————————————————————*
*&      Form  VALIDATATION
*&———————————————————————*
*       text
*———————————————————————-*
FORM VALIDATATION .
DATA: LV_PERNR TYPE PERNR-PERNR.
*& Validate employee number
IF S_PERNR IS NOT INITIAL.
SELECT SINGLE PERNR
FROM PA0000
INTO LV_PERNR
WHERE PERNR IN S_PERNR.
IF SY-SUBRC <> 0.
MESSAGE TEXT006 TYPE C_E.
ENDIF.
ENDIF.
*& Validate selection date low
IF S_SELDTE IS NOT INITIAL.
IF S_SELDTE-LOW IS NOT INITIAL.
*& If a date is invalid and we assign it an integer result will be zero
*& Esle,Number of days from ‘00010101’.
V_CHECK = S_SELDTE-LOW.
IF V_CHECK = 0.
MESSAGE TEXT007 TYPE C_E.
ENDIF.
ELSEIF S_SELDTE-LOW IS INITIAL AND S_SELDTE-HIGH IS NOT INITIAL.
MESSAGE TEXT043 TYPE C_E.
ENDIF.
IF S_SELDTE-HIGH IS NOT INITIAL.
*& If a date is invalid and we assign it an integer result will be zero
*& Esle,Number of days from ‘00010101’.
V_CHECK = S_SELDTE-HIGH.
IF V_CHECK = 0.
MESSAGE TEXT007 TYPE C_E.
ENDIF.
ELSEIF S_SELDTE-LOW IS NOT INITIAL AND S_SELDTE-HIGH IS INITIAL.
MESSAGE TEXT044 TYPE C_E.
ENDIF.
ELSE.
S_SELDTE-LOW = C_STARTDATE.
S_SELDTE-HIGH = C_ENDDATE.
ENDIF.
ENDFORM.                    ” VALIDATATION

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