Skip to Content

MAIN

************************************************************************
* Object Name : REPORT  ZHCM_ASMNT1PNP. *
* Author/Company Name : Krishnakant Joshi / *
* Transport Request *
* Creation Date * 01/21/2013
************************************************************************
* Description: *  Employee hiring details
************************************************************************
* Dependencies *
************************************************************************
* Modification History *
************************************************************************
* Date Programmer Client Ref No. Description Correction *
************************************************************************
REPORT  zhcm_asmnt1pnp.
*&**********************************************************************
*&    INCLUDE
*&**********************************************************************
INCLUDE : zhcm_asmnt1pnp_top,    “Global Types and Data
zhcm_asmnt1pnp_form.  
“Subroutines
*&**********************************************************************
*&    INITIALIZATION.
*&**********************************************************************
INITIALIZATION.
v_repid = sy-repid.
*&**********************************************************************
*&    AT SELECTION-SCREEN
*&**********************************************************************
AT SELECTION-SCREEN.
*&**********************************************************************
*&    START-OF-SELECTION
*&**********************************************************************
START-
OF-SELECTION.
PERFORM get_texts.
SORT: i_t513s BY stell,
i_t530t
BY massn massg,
i_t529t
BY massn.
*&**********************************************************************
*&    GET PERNR.
*&**********************************************************************
GET pernr.
DATA : w_final TYPE t_final,
v_dar
TYPE datar,
v_dat
TYPE dardt.
*&———————————————————————*
*& Local data for prosessing
DATA : w_t529t  TYPE t_t529t,
w_t530t 
TYPE t_t530t,
w_t513s 
TYPE t_t513s,
w_t548t 
TYPE t_t548t,
lw_p0000
TYPE p0000.
*&———————————————————————
*& Get Date specifications
rp-
providefromlast p0041 space pn-begda pn-endda.
IF pnp-sw-found = c_1.
*&———————————————————————*
*& Do loop to check for hire date or original hire date
DO 12 TIMES VARYING v_dar FROM p0041-dar01 NEXT
p0041-dar02
VARYING v_dat
FROM p0041-dat01 NEXT
p0041-dat02.
*&———————————————————————*
*& Check for Original date
IF v_dar = c_16.
w_final-dat01 = v_dat.
w_final-dtext = v_dar.
*&———————————————————————*
*& Check for hire date
ELSEIF v_dar = c_u1.
w_final-dat01 = v_dat.
w_final-dtext = v_dar.
EXIT.
ENDIF.
CLEAR: v_dar, v_dat.
ENDDO.
IF w_final-dat01 IS INITIAL.
REJECT.
ENDIF.
ENDIF.
*&———————————————————————
*& Get action data
rp-
providefromlast p0000 space pn-begda pn-endda.
IF pnp-sw-found = c_1.
DELETE p0000[] WHERE stat2 <> 3.
IF p0000[] IS NOT INITIAL.
SORT p0000 BY endda DESCENDING.
READ TABLE p0000 INTO lw_p0000 INDEX 1.
w_final-pernr = lw_p0000-pernr.
“Employee number
w_final-begda = lw_p0000-begda.
“Start date
READ TABLE i_t529t INTO w_t529t
WITH KEY massn = lw_p0000-massn
BINARY SEARCH.
IF sy-subrc = 0.
w_final-mntxt = w_t529t-mntxt.
“Action text
ENDIF.
IF lw_p0000-massg IS NOT INITIAL AND lw_p0000-massn  IS NOT INITIAL.
CLEAR w_t530t.
*&———————————————————————*
*& Populate Action reason text
READ TABLE i_t530t INTO w_t530t
WITH KEY massn = lw_p0000-massn
massg = lw_p0000-massg
BINARY SEARCH.
IF sy-subrc = 0.
w_final-mgtxt = w_t530t-mgtxt.
“Action reason text
ENDIF.
ENDIF.
ENDIF.
ENDIF.
*&———————————————————————
*& Get organizational assignments
rp-
providefromlast p0001 space pn-begda pn-endda.
IF pnp-sw-found = c_1.
w_final-werks = p0001-werks.
w_final-orgeh = p0001-orgeh.
w_final-kostl = p0001-kostl.
*&———————————————————————*
*& Populate job text
CLEAR w_t513s.
READ TABLE i_t513s INTO w_t513s
WITH KEY stell = p0001-stell
BINARY SEARCH.
IF sy-subrc = 0.
w_final-stltx = w_t513s-stltx.
ENDIF.
ENDIF.
*&———————————————————————
*& Get Personal data
rp-
providefromlast p0002 space pn-begda pn-endda.
IF pnp-sw-found = c_1.
w_final-vorna = p0002-vorna.
“First name
w_final-nachn = p0002-nachn.
“Last name
CASE p0002-gesch. “Gender
WHEN c_1.
w_final-gesch =
text037.
WHEN c_2.
w_final-gesch =
text038.
WHEN OTHERS.
w_final-gesch =
text039.
ENDCASE.
w_final-gbdep = p0002-gbdep.
w_final-gbdat = p0002-gbdat.
ENDIF.
*&———————————————————————
*& Get Address details
rp-
providefromlast p0006 c_1 pn-begda pn-endda.
IF pnp-sw-found = c_1.
w_final-pstlz = p0006-pstlz.
ENDIF.
*&———————————————————————
*& Get Basic Pay details
rp-
providefromlast p0008 space pn-begda pn-endda.
IF pnp-sw-found = c_1.
w_final-ansal = p0008-ansal.
“Annual salary
ENDIF.
*&———————————————————————
*& Get Email details
rp-
providefromlast p0105 c_0010 pn-begda pn-endda.
IF pnp-sw-found = c_1.
w_final-usrid_long = p0105-usrid_long.
“Email
ENDIF.
*&———————————————————————
*& Append work area
IF w_final-dat01 IS NOT INITIAL.
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.
APPEND w_final TO i_final.
CLEAR w_final.
ENDIF.
*&**********************************************************************
*&    END-OF-SELECTION
*&**********************************************************************
ENDOF-SELECTION.
IF i_final IS NOT INITIAL.
PERFORM  build_fieldcatalog.
PERFORM  set_layout.
PERFORM  display_alv_report.
ELSE.
MESSAGE text046  TYPE c_i.
ENDIF.

 
 

TOP

*&———————————————————————*
*&  Include           ZHCM_ASMNT1PNP_TOP
*&———————————————————————*

TYPE-POOLS: slis.
TABLES: pernr.
INFOTYPES: 0000, 0001, 0002, 0006, 0008, 0041, 0105.
*&———————————————————————*
TYPES:
*&———————————————————————*
*&     Date text
BEGIN OF t_t548t,
datar    
TYPE  datar,
dtext    
TYPE datax,
END OF   t_t548t,
*&———————————————————————*
*&     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,
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_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.
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_colpos TYPE i VALUE  1.
*&**********************************************************************
*&   Constants
*&**********************************************************************
CONSTANTS : c_x TYPE c VALUE ‘X’,
c_h
TYPE c VALUE ‘H’,
c_i
TYPE c VALUE ‘I’,
c_s
TYPE c VALUE ‘S’,
c_1
TYPE c VALUE ‘1’,
c_2
TYPE c VALUE ‘2’,
c_u1
TYPE char02 VALUE ‘U1’,
c_16
TYPE char02 VALUE ’16’,
c_0010
TYPE char04 VALUE ‘0010’.

 
 

FORM

*&———————————————————————*
*&  Include           ZHCM_ASMNT1PNP_FORM
*&———————————————————————*
*———————————————————————-*
* Form build_fieldcatalog *
*———————————————————————-*
* This form is used set field catalog
*———————————————————————-*
FORM build_fieldcatalog .
* SET Field Catalog
PERFORM set_fieldcatalog USINGtext019 text001,
text020 text018,
text021 text002,
text022 text003,
text023 text004,
text024 text005,
text025 text006,
text026 text007,
text027 text008,
text028 text009,
text029 text010,
text030 text011,
text031 text012,
text032 text013,
text033 text014,
text034 text015,
text035 text016,
text036 text017.
ENDFORM.                    ” BUILD_FIELDCATALOG
*———————————————————————-*
* Form display_alv_report *
*———————————————————————-*
* This form is used to display report
*———————————————————————-*
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

*———————————————————————-*
* Form set_fieldcatalog *
*———————————————————————-*
* This form is used to set field catalog
*———————————————————————-*
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.
w_fieldcatalog-do_sum      = c_x.
APPEND w_fieldcatalog TO i_fieldcatalog.
v_colpos = v_colpos +
1.
ENDFORM.                    ” set_fieldcatalog
*———————————————————————-*
* Form set_layout *
*———————————————————————-*
* This form is used to set report layout
*———————————————————————-*
FORM set_layout.
w_layout-no_hotspot = c_x.
w_layout-zebra  = c_x.
w_layout-colwidth_optimize = c_x.
ENDFORM.                    “set_layout

*———————————————————————-*
* 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.
lw_header-info =
text042.
lw_header-
key = text045.
lw_header-typ = c_h.
APPEND lw_header TO li_header.
CLEAR lw_header.
DESCRIBE TABLE i_final LINES lv_count.
WRITE lv_count TO lw_header-info.
“lw_header-info = lv_date.
lw_header-
key = text043.
lw_header-typ = c_s.
APPEND lw_header TO li_header.
CLEAR lw_header.
WRITE: sy-datum TO lv_date USING EDIT MASK ‘__/__/____’.
lw_header-info = lv_date.
lw_header-
key = text044.
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_TEXTS
*&———————————————————————*
*       text
*———————————————————————-*
*  –>  p1        text
*  <–  p2        text
*———————————————————————-*
FORM get_texts .
*&———————————————————————*
*& Get Date text
SELECT datar dtext
FROM t548t
INTO TABLE i_t548t
WHERE sprsl = sy-langu AND ( datar = c_u1 OR datar = c_16 ).
*&———————————————————————*
*& Get Job title
SELECT stell stltx endda begda
FROM t513s
INTO TABLE i_t513s
WHERE sprsl = sy-langu.
*&———————————————————————
*& Action Texts
SELECT massn mntxt
INTO TABLE i_t529t
FROM t529t
WHERE  sprsl = sy-langu.
*&———————————————————————
*& Reason for Action Texts
SELECT massn massg mgtxt
INTO TABLE i_t530t
FROM t530t
WHERE sprsl = sy-langu.
ENDFORM.                    ” GET_TEXTS

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