REPORT zhrcss_ghrms_emp_master.
*REPORT zhrcss_ghrms_emp_master.
*&---------------------------------------------------------------------*
*& Include ZHRCSS_GHRMS_REPORT_TOP
*&---------------------------------------------------------------------*
TABLES : pernr , t500p , t001p,t578w .
INFOTYPES : 0000, 0001, 0002, 0006, 0008, 0016, 0021, 0027,
0028, 0041, 0105, 0185, 0804, 9011, 9013.
TYPES : BEGIN OF ty_final,
emp_num TYPE pernr_d,
title TYPE pa0002-titel,
first_name TYPE pa0002-vorna,
last_name TYPE pa0002-nachn,
calling_name TYPE pa0002-rufnm,
perm_country TYPE pa0006-land1,
prsnt_country TYPE pa0006-land1,
office_email TYPE pa0105-usrid_long,
emer_contact_person_relation TYPE pa0021-favor,
orgn_l1 TYPE p0001-orgeh,
sbu TYPE p0001-orgeh,
entity_name TYPE t500p-name1,
entity_branch TYPE t001p-btext,
org_country TYPE t005t-landx,
org_city TYPE t500p-ort01,
* office
grade TYPE pa0008-trfgr,
designation TYPE stext,
ldap_login_name TYPE pa0105-usrid_long,
domain_name TYPE char20,
birth_date TYPE pa0002-gbdat,
gender TYPE char10,
blood_group TYPE pa0028-wtf01,
religion TYPE pa0002-konfe,
* caste TYPE
marital_status TYPE char10,
wedding_date TYPE pa0002-famdt,
joining_date TYPE pa0041-dat01,
* group_joining_date
confirmation_date TYPE pa0000-begda,
probation_desc TYPE char20, "pa0016 - PRBZT PRBEH
employment_type TYPE pa0001-persk,
emp_status TYPE pa0000-stat2,
nationality TYPE t005t-landx,
* Emp_manager_id TYPE
* Emp_manager_name
emp_manager_mail_id TYPE pa0105-usrid_long,
lwd TYPE pa0000-begda,
exit_reason TYPE mgtxt,
driving_license TYPE pa0185-ictyp,
aadhar_id TYPE pa0185-ictyp,
cost_center TYPE pa0027-kst01,
cost_center_text TYPE ktext,
END OF ty_final .
DATA : gt_hrp1001 TYPE TABLE OF hrp1001,
gs_hrp1001 TYPE hrp1001,
gs_hrp10012 TYPE hrp1001,
gt_hrp1000 TYPE TABLE OF hrp1000,
gs_hrp1000 TYPE hrp1000,
gs_pa0001 TYPE pa0001,
gs_t578w TYPE t578w,sep_emp TYPE hrp1001-sobid,gs_pa0041 TYPE pa0041.
TYPES : BEGIN OF ty_fin ,
emp_num TYPE string,
title TYPE string,
first_name TYPE string,
last_name TYPE string,
calling_name TYPE string,
END OF ty_fin .
************ added by chellam - 30.06.2015
TYPES : BEGIN OF ty_final_v1,
emp_num TYPE string,
title TYPE string,
first_name TYPE string,
last_name TYPE string,
calling_name TYPE string,
perm_country TYPE string,
prsnt_country TYPE string,
office_email TYPE string,
emer_contact_person_relation TYPE string,
orgn_l1 TYPE string,
sbu TYPE string,
entity_name TYPE string,
entity_branch TYPE string,
org_country TYPE string,
org_city TYPE string,
office TYPE string,
grade TYPE string,
designation TYPE string,
ldap_login_name TYPE string,
domain_name TYPE string,
birth_date TYPE string,
gender TYPE string,
blood_group TYPE string,
religion TYPE string,
caste TYPE string,
marital_status TYPE string,
wedding_date TYPE string,
joining_date TYPE string,
group_joining_date TYPE string,
confirmation_date TYPE string,
probation_desc TYPE string,
employment_type TYPE string,
emp_status TYPE string,
nationality TYPE string,
emp_manager_id TYPE string,
emp_manager_name TYPE string,
emp_manager_mail_id TYPE string,
********** NEWLY ADDED FIELDS
perm_addr_line1 TYPE string,
perm_addr_line2 TYPE string,
perm_addr_line3 TYPE string,
perm_addr_landmark TYPE string,
perm_city_name TYPE string,
perm_state_name TYPE string,
perm_country_code TYPE string,
perm_postal_code TYPE string,
prsnt_addr_line1 TYPE string,
prsnt_addr_line2 TYPE string,
prsnt_addr_line3 TYPE string,
prsnt_addr_landmark TYPE string,
prsnt_city_name TYPE string,
prsnt_state_name TYPE string,
prsnt_country_code TYPE string,
prsnt_postal_code TYPE string,
personal_mobile_num TYPE string,
office_mobile_num TYPE string,
personal_email TYPE string,
pan_id TYPE string,
rrf_id TYPE string,
src_hire TYPE string,
lwd TYPE string,
exit_reason TYPE string,
driving_license TYPE string,
aadhar_id TYPE string,
cost_center TYPE string,
cost_center_text TYPE string,
END OF ty_final_v1.
DATA : gt_final_v1 TYPE TABLE OF ty_final_v1,
gs_final_v1 TYPE ty_final_v1.
************ end of added by chellam - 30.06.2015
DATA : gt_final TYPE TABLE OF ty_final_v1,
gs_final TYPE ty_final_v1,
* gs_fin TYPE zhr_emp_table,
* gt_emp TYPE TABLE OF zhr_emp_table,
* gs_emp TYPE zhr_emp_table,
flg TYPE char1.
DATA : lv_plans TYPE pa0001-plans .
DATA : it_hrp1001 TYPE TABLE OF hrp1001 WITH HEADER LINE .
DATA : lv_date TYPE char10.
DATA : gt_fcat TYPE slis_t_fieldcat_alv,wa_hrp1001 TYPE hrp1001,
gs_fcat TYPE slis_fieldcat_alv,
gt_layout TYPE slis_layout_alv.
DATA : gv_l1 TYPE string,
gv_l2 TYPE string,
gv_l3 TYPE string,
gv_l4 TYPE string,
gv_date TYPE d.
DATA : gt_str TYPE TABLE OF objec WITH HEADER LINE .
DATA : gt_t500p TYPE TABLE OF t500p,
gs_t500p TYPE t500p,
gt_t001p TYPE TABLE OF t001p,
gs_t001p TYPE t001p,
gt_t005t TYPE TABLE OF t005t,
gs_t005t TYPE t005t,
gt_t503t TYPE TABLE OF t503t,
gs_t503t TYPE t503t,lv_cttyp TYPE cttyp,conf_dt TYPE begda .
DATA : gv_position TYPE stext,
gv_orgeh TYPE pa0001-orgeh,
gv_plans TYPE pa0001-plans,
gv_persa TYPE pa0001-werks,
gv_cost TYPE pa0027-kst01,
gv_cost_txt TYPE ktext,
gv_cost_per TYPE pkprz,
gv_cost_per1 TYPE string,
lv_domain TYPE char20,
lv_domain_new TYPE char20.
DATA: gt_t522t TYPE t522t OCCURS 0 WITH HEADER LINE,
gt_t578x TYPE t578x OCCURS 0 WITH HEADER LINE,
gt_t516t TYPE t516t OCCURS 0 WITH HEADER LINE.
* AT SELECTION-SCREEN .
SELECT * FROM t500p INTO CORRESPONDING FIELDS OF TABLE gt_t500p WHERE molga EQ '40' .
SELECT * FROM t001p INTO CORRESPONDING FIELDS OF TABLE gt_t001p WHERE molga EQ '40' .
SELECT * FROM t005t INTO CORRESPONDING FIELDS OF TABLE gt_t005t WHERE spras EQ 'EN' .
SELECT * FROM t522t INTO CORRESPONDING FIELDS OF TABLE gt_t522t WHERE sprsl EQ 'E' .
SELECT * FROM t516t INTO CORRESPONDING FIELDS OF TABLE gt_t516t WHERE sprsl EQ 'E' .
SELECT * FROM t503t INTO CORRESPONDING FIELDS OF TABLE gt_t503t WHERE sprsl EQ sy-langu .
SELECT * FROM t578x INTO CORRESPONDING FIELDS OF TABLE gt_t578x.
GET pernr .
****************** CHECKING FOR Z1 AND ZZ ACTION EMPLOYEES ALONE
*PROVIDE * FROM p0000 BETWEEN pn-begda AND pn-endda .
*
* IF p0000-massn EQ 'Z1' OR p0000-massn EQ 'ZZ' OR p0000-massn EQ 'ZM' OR p0000-massn EQ 'Z3' OR p0000-massn EQ 'ZA' OR p0000-massn EQ 'Z2' .
*
*
* ELSE .
* REJECT.
* ENDIF .
*ENDPROVIDE .
******************
CLEAR: flg,wa_hrp1001.
SORT p0001[] BY aedtm DESCENDING .
rp_provide_from_last p0001 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0001-aedtm >= pn-begda AND p0001-aedtm <= pn-endda .
IF p0001-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
*****manager change check
SELECT SINGLE * FROM hrp1001 INTO wa_hrp1001 WHERE otype EQ 'S'
AND objid EQ p0001-plans
AND plvar EQ '01'
AND subty EQ 'A002'
AND endda EQ '99991231'
AND aedtm >= pn-begda
AND aedtm <= pn-endda.
IF wa_hrp1001 IS NOT INITIAL .
IF wa_hrp1001-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
SORT p0002[] BY aedtm DESCENDING .
rp_provide_from_last p0002 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0002-aedtm >= pn-begda AND p0002-aedtm <= pn-endda .
IF p0002-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0006[] BY aedtm DESCENDING .
rp_provide_from_last p0006 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0006-aedtm >= pn-begda AND p0006-aedtm <= pn-endda .
IF p0006-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
*SORT p0008[] BY aedtm DESCENDING .
*rp_provide_from_last p0008 space pn-begda pn-endda .
*IF pnp-sw-found EQ 1 .
* IF p0008-aedtm >= pn-begda AND p0008-aedtm <= pn-endda .
* flg = 'X'.
* ENDIF .
*ENDIF .
**********************added code for log report change at infotype level ,
DATA : st_log TYPE hreic_s_logkey,
gt_tab TYPE TABLE OF pldoc_key,
gs_tab TYPE pldoc_key,
gs_det TYPE pldoc_key,
gt_status TYPE TABLE OF hrinftylog_fields,
gs_status TYPE hrinftylog_fields,
gt_temp_before TYPE TABLE OF prelp WITH HEADER LINE,
gt_temp_after TYPE TABLE OF prelp WITH HEADER LINE.
CLEAR : st_log , gt_tab[], gs_status, gs_det,gt_status[],gs_tab,gt_temp_before[],gt_temp_after[].
st_log-enddate = sy-datum .
st_log-startdate = sy-datum.
st_log-pernr = pernr-pernr .
CALL FUNCTION 'HREIC_GET_LOGGED_INFTY_CHANGES'
EXPORTING
is_log_key = st_log
IMPORTING
et_infty_modif = gt_tab.
*CLEAR : GS_DET .
IF gt_tab[] IS NOT INITIAL .
READ TABLE gt_tab INTO gs_tab WITH KEY bdate = sy-datum
infty = '0008'.
IF sy-subrc EQ 0 .
gs_det-relid = gs_tab-relid .
gs_det-tclas = gs_tab-tclas .
gs_det-pernr = gs_tab-pernr .
gs_det-infty = gs_tab-infty .
gs_det-bdate = gs_tab-bdate .
gs_det-btime = gs_tab-btime .
gs_det-seqnr = gs_tab-seqnr .
CALL FUNCTION 'HR_INFOTYPE_LOG_GET_DETAIL'
EXPORTING
logged_infotype = gs_det
auth_check = 'X'
* USE_ARCHIVE = ' '
* IMPORTING
* SUBRC =
TABLES
infty_tab_before = gt_temp_before
infty_tab_after = gt_temp_after
fields = gt_status.
READ TABLE gt_status INTO gs_status WITH KEY fname = 'TRFGR' .
IF sy-subrc EQ 0.
flg = 'X' .
ENDIF .
ENDIF .
ENDIF .
**********************
SORT p0028[] BY aedtm DESCENDING .
rp_provide_from_last p0028 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0028-aedtm >= pn-begda AND p0028-aedtm <= pn-endda .
IF p0028-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0027[] BY aedtm DESCENDING .
rp_provide_from_last p0027 '01' pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0027-aedtm >= pn-begda AND p0027-aedtm <= pn-endda .
IF p0027-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0041[] BY aedtm DESCENDING .
rp_provide_from_last p0041 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0041-aedtm >= pn-begda AND p0041-aedtm <= pn-endda .
IF p0041-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0000[] BY aedtm DESCENDING .
rp_provide_from_last p0000 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0000-aedtm >= pn-begda AND p0000-aedtm <= pn-endda .
IF p0000-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
*IF p0000-stat2 EQ '0'. " Chella 07.12.2016
* REJECT .
*ENDIF .
SORT p0185[] BY aedtm DESCENDING .
rp_provide_from_last p0185 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0185-aedtm >= pn-begda AND p0185-aedtm <= pn-endda .
IF p0185-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0105[] BY aedtm DESCENDING .
rp_provide_from_last p0105 '0010' pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0105-aedtm >= pn-begda AND p0105-aedtm <= pn-endda .
IF p0105-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0021[] BY aedtm DESCENDING .
rp_provide_from_last p0021 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0021-aedtm >= pn-begda AND p0021-aedtm <= pn-endda .
IF p0021-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
****Chella
*IF flg = 'X'.
* IF wa_hrp1001-uname = 'CUTOVERHR'
* AND p0000-uname = 'CUTOVERHR'
* AND p0001-uname = 'CUTOVERHR'
* AND p0002-uname = 'CUTOVERHR'
* AND p0006-uname = 'CUTOVERHR'
* AND p0028-uname = 'CUTOVERHR'
* AND p0041-uname = 'CUTOVERHR'
* AND p0185-uname = 'CUTOVERHR'
* AND p0105-uname = 'CUTOVERHR'
* AND p0021-uname = 'CUTOVERHR'.
* CLEAR flg.
* ENDIF .
*ENDIF.
***chella
IF flg = 'X'.
DATA: gt_pa0001 TYPE TABLE OF pa0001,
gs_pa0001 TYPE pa0001,
leading_pos TYPE hrobject OCCURS 0 WITH HEADER LINE,
gs_pa0105 TYPE pa0105,
sobid TYPE hrsobid-sobid.
gs_final-emp_num = pernr-pernr .
rp_provide_from_last p0000 space pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-emp_status = p0000-stat2 .
IF p0000-massn = 'Z3'.
CLEAR gv_date.
gs_final-lwd = gv_date = p0000-begda - 1.
SELECT SINGLE mgtxt FROM t530t INTO gs_final-exit_reason
WHERE sprsl = 'E' AND massn = p0000-massn
AND massg = p0000-massg.
IF sy-subrc NE 0 .
CLEAR gs_final-exit_reason.
ENDIF.
ENDIF.
ENDIF.
rp_provide_from_last p0027 '01' pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
DO 25 TIMES VARYING gv_cost FROM p0027-kst01 NEXT p0027-kst02
VARYING gv_cost_per FROM p0027-kpr01 NEXT p0027-kpr02.
IF gv_cost IS NOT INITIAL.
CLEAR gv_cost_txt.
SELECT SINGLE ktext FROM cskt INTO gv_cost_txt
WHERE spras = 'E'
AND kostl = gv_cost AND datbi >= sy-datum.
IF gs_final-cost_center_text IS INITIAL.
gs_final-cost_center_text = gv_cost_txt.
ELSE.
CONCATENATE gs_final-cost_center_text '##!' gv_cost_txt INTO gs_final-cost_center_text.
ENDIF.
gv_cost_per1 = gv_cost_per.
IF gs_final-cost_center IS INITIAL.
CONCATENATE gv_cost '&!#' gv_cost_per1 INTO gs_final-cost_center.
ELSE.
CONCATENATE gs_final-cost_center '##!' gv_cost_per1 INTO gs_final-cost_center.
ENDIF.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-cost_center WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-cost_center_text WITH space.
*** rp_provide_from_last p0000 'Z5' pn-begda pn-endda . " EMAIL
*** IF pnp-sw-found EQ 1 .
*** gs_final-probation_desc = 'Confirmed' .
*** gs_final-confirmation_date = p0000-begda .
*** ELSE .
*** gs_final-probation_desc = 'Probation' .
*** ENDIF.
**** ENDIF .
* READ TABLE gt_t005t INTO gs_t005t WITH KEY land1 = p0002-natio .
* IF sy-subrc EQ 0 .
***********************************PROBATION
CLEAR : lv_cttyp , conf_dt .
rp_provide_from_last p0016 space pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
lv_cttyp = p0016-cttyp .
ENDIF.
IF lv_cttyp EQ '10' .
gs_final-probation_desc = lv_cttyp .
ELSEIF lv_cttyp EQ '11' .
gs_final-probation_desc = lv_cttyp .
* SELECT SINGLE BEGDA FROM PA0000 INTO CONF_DT WHERE MASSN EQ 'Z5'.
READ TABLE p0000[] INTO p0000 WITH KEY massn = 'Z5'.
gs_final-confirmation_date = p0000-begda.
* SELECT SINGLE BEGDA FROM PA0000 INTO gs_final-confirmation_date WHERE MASSN EQ 'Z5'.
ENDIF .
rp_provide_from_last p0002 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
* READ TABLE gt_t522t WITH KEY anred = p0002-anred.
* IF sy-subrc = 0.
* gs_final-title = gt_t522t-atext .
* ENDIF.
gs_final-title = p0002-anred .
gs_final-first_name = p0002-vorna .
gs_final-last_name = p0002-nachn .
gs_final-calling_name = p0002-rufnm .
gs_final-birth_date = p0002-gbdat .
IF p0002-gesch EQ '1' .
gs_final-gender = 'Male'.
ELSEIF p0002-gesch EQ '2' .
gs_final-gender = 'Female'.
ELSEIF p0002-gesch EQ '3' .
gs_final-gender = 'Transgender'.
ENDIF .
* READ TABLE gt_t516t INTO gt_t516t WITH KEY konfe = p0002-konfe .
* IF sy-subrc EQ 0 .
* gs_final-religion = gt_t516t-ktext .
* ENDIF .
gs_final-religion = p0002-konfe .
IF p0002-famst EQ 0 .
gs_final-marital_status = 'Single'.
ELSEIF p0002-famst EQ 1 .
gs_final-marital_status = 'Married'.
ENDIF .
IF p0002-famdt NE '00000000'.
gs_final-wedding_date = p0002-famdt .
ENDIF .
IF p0002-natio IS NOT INITIAL .
gs_final-nationality = p0002-natio .
READ TABLE gt_t005t INTO gs_t005t WITH KEY land1 = p0002-natio .
IF sy-subrc EQ 0 .
* gs_final-nationality = gs_t005t-landx .
* gs_final-nationality = p0002-natio .
ENDIF .
ENDIF .
ENDIF .
CLEAR : gs_t005t .
rp_provide_from_last p0006 '1' pn-begda pn-endda . "PERMANENT ADDR
IF pnp-sw-found EQ 1 .
gs_final-perm_addr_line1 = p0006-name2 .
gs_final-perm_addr_line2 = p0006-stras .
gs_final-perm_addr_line3 = p0006-locat .
gs_final-perm_city_name = p0006-ort01 .
SELECT SINGLE bezei FROM t005u INTO gs_final-perm_state_name WHERE land1 EQ p0006-land1 AND bland EQ p0006-state AND spras EQ 'EN'.
* gs_final-perm_state_name = p0006-state .
gs_final-perm_country_code = p0006-land1 .
gs_final-perm_postal_code = p0006-pstlz .
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_city_name WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_state_name WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_country_code WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_postal_code WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_addr_line1 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_addr_line2 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_addr_line3 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN p0006-hsnmr WITH space.
CONCATENATE p0006-hsnmr ' ' gs_final-perm_addr_line2 INTO gs_final-perm_addr_line2 SEPARATED BY space . .
* gs_final-perm_addr_landmark =
* gs_final-prsnt_addr_line1 = p0006-name2 .
*
* gs_final-prsnt_addr_line2 = p0006-stras.
* gs_final-prsnt_addr_line3 = p0006-locat.
** GS_FINAL-PRSNT_ADDR_LANDMARK.
* gs_final-prsnt_city_name = p0006-ort01.
* gs_final-prsnt_state_name = p0006-state.
* gs_final-prsnt_country_code = p0006-land1.
* gs_final-prsnt_postal_code = p0006-pstlz.
READ TABLE gt_t005t INTO gs_t005t WITH KEY land1 = p0006-land1 .
IF sy-subrc EQ 0 .
* gs_final-perm_country = gs_t005t-landx . "p0006-land1 .
gs_final-perm_country = p0006-land1 .
ENDIF .
ENDIF .
CLEAR : gs_t005t.
rp_provide_from_last p0006 '2' pn-begda pn-endda . "TEMPORARY ADDR
IF pnp-sw-found EQ 1 .
gs_final-prsnt_addr_line1 = p0006-name2 .
gs_final-prsnt_addr_line2 = p0006-stras.
gs_final-prsnt_addr_line3 = p0006-locat.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_addr_line1 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_addr_line2 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_addr_line3 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN p0006-hsnmr WITH space.
* GS_FINAL-PRSNT_ADDR_LANDMARK.
CONCATENATE p0006-hsnmr ' ' gs_final-prsnt_addr_line2 INTO gs_final-prsnt_addr_line2 SEPARATED BY space .
*
gs_final-prsnt_city_name = p0006-ort01.
SELECT SINGLE bezei FROM t005u INTO gs_final-prsnt_state_name WHERE land1 EQ p0006-land1 AND bland EQ p0006-state AND spras EQ 'EN'.
* gs_final-prsnt_state_name = p0006-state.
gs_final-prsnt_country_code = p0006-land1.
gs_final-prsnt_postal_code = p0006-pstlz.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_city_name WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_city_name WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_country_code WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_postal_code WITH space.
READ TABLE gt_t005t INTO gs_t005t WITH KEY land1 = p0006-land1 .
IF sy-subrc EQ 0 .
* gs_final-prsnt_country = gs_t005t-landx."p0006-land1 .
gs_final-prsnt_country = p0006-land1 .
ENDIF .
ENDIF .
CLEAR : gs_t005t.
rp_provide_from_last p0105 '0010' pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
* IF p0105-usrty = '0010' .
gs_final-office_email = p0105-usrid_long .
* ENDIF.
ENDIF .
rp_provide_from_last p0105 'CELL' pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-personal_mobile_num = p0105-usrid .
ENDIF .
rp_provide_from_last p0105 'MAIL' pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-personal_email = p0105-usrid .
ENDIF .
rp_provide_from_last p0105 'MPHN' pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-office_mobile_num = p0105-usrid .
ENDIF .
rp_provide_from_last p0185 '02' pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-pan_id = p0185-icnum .
ENDIF .
rp_provide_from_last p0185 '06' pn-begda pn-endda . " Aadhar Card No.
IF pnp-sw-found EQ 1 .
gs_final-aadhar_id = p0185-icnum .
ENDIF .
rp_provide_from_last p0185 'Z3' pn-begda pn-endda . " Driving License
IF pnp-sw-found EQ 1 .
gs_final-driving_license = p0185-icnum .
ENDIF .
rp_provide_from_last p9013 space pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-rrf_id = p9013-rrf .
gs_final-src_hire = p9013-source .
ENDIF .
rp_provide_from_last p0804 space pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-blood_group = p0804-bgrup .
ENDIF .
********************
IF gs_final-office_email IS NOT INITIAL .
gs_final-ldap_login_name = gs_final-office_email .
SPLIT gs_final-office_email AT '@' INTO lv_domain lv_domain_new.
CONCATENATE '@' lv_domain_new INTO gs_final-domain_name .
CONDENSE gs_final-domain_name .
ENDIF .
CLEAR : gv_orgeh , gv_persa ,gv_plans.
rp_provide_from_last p0001 space pn-begda pn-endda . "organisational unit text
IF pnp-sw-found EQ 1 .
gv_orgeh = p0001-orgeh .
gv_plans = p0001-plans .
gv_persa = p0001-werks .
gs_final-orgn_l1 = gv_orgeh . " org unit
gs_final-entity_name = p0001-werks.
gs_final-entity_branch = p0001-btrtl .
gs_final-office = p0001-btrtl.
gs_final-employment_type = p0001-persk .
* CLEAR: gs_t503t.
* READ TABLE gt_t503t INTO gs_t503t WITH KEY persk = p0001-persk .
* IF sy-subrc = 0.
* gs_final-employment_type = gs_t503t-ptext.
* ENDIF.
ENDIF .
CLEAR : lv_plans .
REFRESH : it_hrp1001[] .
sobid = p0001-plans.
CALL FUNCTION 'RH_GET_LEADING_POSITION'
EXPORTING
plvar = '01'
otype = 'S'
sobid = sobid
date = sy-datum
auth = 'X'
* BUFFER_MODE = ' '
* CONSIDER_VAC_POS = ' '
TABLES
leading_pos = leading_pos
EXCEPTIONS
no_lead_pos_found = 1
OTHERS = 2.
READ TABLE leading_pos INDEX 1.
IF leading_pos-objid NE '00000000'.
SELECT SINGLE * FROM pa0001 INTO gs_pa0001 WHERE plans = leading_pos-objid
* AND begda <= pn-endda "Chella
* AND endda >= pn-begda.
AND endda = '99991231'. "Chella 28.06.2016
IF gs_pa0001 IS NOT INITIAL.
gs_final-emp_manager_id = gs_pa0001-pernr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = gs_final-emp_manager_id
IMPORTING
output = gs_final-emp_manager_id.
IF wa_hrp1001-begda NE '00000000' .
* CLEAR : gs_final-emp_manager_id .
CONCATENATE gs_final-emp_manager_id '$' wa_hrp1001-begda+0(4) '-' wa_hrp1001-begda+4(2) '-' wa_hrp1001-begda+6(2) INTO gs_final-emp_manager_id .
CONDENSE gs_final-emp_manager_id NO-GAPS .
ELSE .
CLEAR : it_hrp1001 .
SELECT SINGLE plans FROM pa0001 INTO lv_plans WHERE pernr EQ pernr-pernr AND endda EQ '99991231' .
IF lv_plans IS NOT INITIAL .
SELECT * FROM hrp1001 INTO CORRESPONDING FIELDS OF TABLE it_hrp1001 WHERE otype EQ 'S' AND objid EQ lv_plans .
READ TABLE it_hrp1001 WITH KEY rsign = 'A' relat = '002' endda = '99991231'.
IF sy-subrc EQ 0 .
.
CONCATENATE gs_final-emp_manager_id '$' it_hrp1001-begda+0(4) '-' it_hrp1001-begda+4(2) '-' it_hrp1001-begda+6(2) INTO gs_final-emp_manager_id .
CONDENSE gs_final-emp_manager_id NO-GAPS .
ENDIF .
ENDIF .
ENDIF .
gs_final-emp_manager_name = gs_pa0001-ename.
ENDIF.
SELECT SINGLE * FROM pa0105 INTO gs_pa0105 WHERE pernr = gs_pa0001-pernr
AND subty = '0010'
AND begda <= pn-endda
AND endda >= pn-begda.
IF gs_pa0105 IS NOT INITIAL. .
gs_final-emp_manager_mail_id = gs_pa0105-usrid_long .
ENDIF .
ENDIF .
CLEAR: gs_pa0105, gs_pa0001, leading_pos, sobid.
*
* CLEAR: gs_pa0105, gs_pa0001, leading_pos, sobid.
CLEAR : gs_pa0001 ,gs_hrp10012,gs_hrp1001.
***************
rp_provide_from_last p0021 space pn-begda pn-endda . "
IF pnp-sw-found EQ 1 ."FAMSA
* SELECT SINGLE stext FROM t591s INTO gs_final-emer_contact_person_relation WHERE sprsl EQ 'EN' AND infty EQ '0021' AND subty = p0021-famsa
.
gs_final-emer_contact_person_relation = p0021-famsa .
ENDIF .
CLEAR : gs_t001p , gs_t500p .
READ TABLE gt_t001p INTO gs_t001p WITH KEY werks = p0001-werks
btrtl = p0001-btrtl .
IF sy-subrc EQ 0 .
* gs_final-entity_branch = gs_t001p-btext .
ENDIF .
CLEAR : gs_t001p.
READ TABLE gt_t001p INTO gs_t001p WITH KEY btrtl = p0001-btrtl .
IF sy-subrc EQ 0 .
* gs_final-office = gs_t001p-btext ." for office name
ENDIF .
READ TABLE gt_t500p INTO gs_t500p WITH KEY persa = p0001-werks .
IF sy-subrc EQ 0 .
* gs_final-entity_name = gs_t500p-name1 .
READ TABLE gt_t005t INTO gs_t005t WITH KEY land1 = gs_t500p-land1 .
IF sy-subrc EQ 0 .
* gs_final-org_country = gs_t005t-landx.
gs_final-org_country = gs_t500p-land1 .
ENDIF .
gs_final-org_city = gs_t500p-ort01.
ENDIF.
** ENDIF
****org unit ***
* DATA : lv_sobid TYPE string .
* SELECT * FROM hrp1001 INTO TABLE gt_hrp1001 WHERE otype = 'O'
* AND plvar = '01'
* AND begda <= pn-endda AND endda >= pn-begda.
* SELECT * FROM hrp1000 INTO TABLE gt_hrp1000 WHERE otype = 'O'
* AND plvar = '01'.
** AND begda <= pn-endda AND endda >= pn-begda.
* IF gv_orgeh IS NOT INITIAL .
* READ TABLE gt_hrp1001 INTO gs_hrp1001 WITH KEY otype = 'O' objid = gv_orgeh
* sclas = 'O' subty = 'A002'.
* IF sy-subrc EQ 0 .
* READ TABLE gt_hrp1000 INTO gs_hrp1000 WITH KEY otype = 'O' objid = gv_orgeh .
* IF sy-subrc EQ 0 .
* gs_final-orgn_l1 = gs_hrp1000-stext .
* ENDIF .
* CLEAR : lv_sobid.
*
* lv_sobid = gs_hrp1001-sobid .
* READ TABLE gt_hrp1000 INTO gs_hrp1000 WITH KEY otype = 'O' objid = lv_sobid .
* IF sy-subrc EQ 0 .
* gs_final-sbu = gs_hrp1000-stext. "l2 org text
* gs_hrp1001-sobid = gs_hrp1000-stext .
* ENDIF .
*
* CONCATENATE gs_final-orgn_l1 '#' gs_hrp1001-sobid INTO gs_final-orgn_l1 .
** =
* READ TABLE gt_hrp1001 INTO gs_hrp1001 WITH KEY otype = 'O' objid = lv_sobid"gs_hrp1001-sobid
* sclas = 'O' subty = 'A002'.
* IF sy-subrc EQ 0 .
* CLEAR : lv_sobid .
* lv_sobid = gs_hrp1001-sobid .
* READ TABLE gt_hrp1000 INTO gs_hrp1000 WITH KEY otype = 'O' objid = lv_sobid .
* IF sy-subrc EQ 0 .
* gs_hrp1001-sobid = gs_hrp1000-stext .
* ENDIF .
* CONCATENATE gs_final-orgn_l1 '#' gs_hrp1001-sobid INTO gs_final-orgn_l1 .
* READ TABLE gt_hrp1001 INTO gs_hrp1001 WITH KEY otype = 'O' objid = lv_sobid"gs_hrp1001-sobid
* sclas = 'O' subty = 'A002'.
* IF sy-subrc EQ 0 .
*
* CLEAR : lv_sobid .
* lv_sobid = gs_hrp1001-sobid .
* READ TABLE gt_hrp1000 INTO gs_hrp1000 WITH KEY otype = 'O' objid = lv_sobid .
* IF sy-subrc EQ 0 .
* gs_hrp1001-sobid = gs_hrp1000-stext .
* ENDIF .
*
* CONCATENATE gs_final-orgn_l1 '#' gs_hrp1001-sobid INTO gs_final-orgn_l1 .
*
* ELSE .
* CONCATENATE gs_final-orgn_l1 '#' 'Null' INTO gs_final-orgn_l1 .
* ENDIF .
*
* ELSE .
* CONCATENATE gs_final-orgn_l1 '#' 'Null#Null' INTO gs_final-orgn_l1 .
* ENDIF .
* ELSE .
* CONCATENATE gs_final-orgn_l1 '#' 'Null#Null#Null' INTO gs_final-orgn_l1 .
* ENDIF .
*
* ELSE.
* CLEAR : gs_final-orgn_l1 .
* gs_final-orgn_l1 = 'Null#Null#Null#Null'.
* ENDIF .
CLEAR :gs_hrp1001 ,gv_position.
************* GETING ORGN LEVEL FROM 9011 INFTY .
* CLEAR : gs_final-orgn_l1 .
* CLEAR : gv_l1 , gv_l2 , gv_l3 , gv_l4 .
* rp_provide_from_last p9011 space pn-begda pn-endda . "
* IF pnp-sw-found EQ 1 .
* gv_l1 = p9011-orgn_l1 .
* gv_l2 = p9011-orgn_l2 .
* gv_l3 = p9011-orgn_l3 .
* gv_l4 = p9011-orgn_l4 .
* ENDIF .
* IF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL AND gv_l3 IS NOT INITIAL AND gv_l4 IS NOT INITIAL ).
* CONCATENATE gv_l1 gv_l2 gv_l3 gv_l4 INTO gs_final-orgn_l1 SEPARATED BY '#'.
* ELSEIF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL AND gv_l3 IS NOT INITIAL ).
* CONCATENATE gv_l1 gv_l2 gv_l3 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
* ELSEIF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL ).
* CONCATENATE gv_l1 gv_l2 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
* ELSEIF ( gv_l1 IS NOT INITIAL ).
* CONCATENATE gv_l1 'null' 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
* ELSEIF ( gv_l1 IS INITIAL AND gv_l2 IS INITIAL AND gv_l3 IS INITIAL AND gv_l4 IS INITIAL ) .
* CONCATENATE 'null' 'null' 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
* ENDIF .
*********************TO GET ORGN L1
CLEAR : gs_final-orgn_l1 .
CLEAR : gv_l1 , gv_l2 , gv_l3 , gv_l4 .
FREE : gt_str[] .
CALL FUNCTION 'RH_PM_GET_STRUCTURE'
EXPORTING
plvar = '01'
otype = 'O'
objid = p0001-orgeh
begda = pn-begda
endda = '99991231'
status = '1'
wegid = 'O-O'
* 77AW_INT = ' '
authy = 'X'
* DEPTH = 0
* CHECK_OBJECT = ' '
* PROGRESS_INDICATOR = ' '
* SVECT =
activ = 'X'
* BUFFER_MODE =
TABLES
objec_tab = gt_str
* STRUC_TAB =
* GDSTR_TAB =
EXCEPTIONS
not_found = 1
ppway_not_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
LOOP AT gt_str .
IF sy-tabix EQ 1 .
gv_l4 = gt_str-stext .
ELSEIF sy-tabix EQ 2 .
gv_l3 = gt_str-stext .
ELSEIF sy-tabix EQ 3 .
gv_l2 = gt_str-stext .
ELSEIF sy-tabix EQ 4 .
gv_l1 = gt_str-stext .
ENDIF .
CLEAR : gt_str.
ENDLOOP .
gs_final-sbu = gv_l2 .
IF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL AND gv_l3 IS NOT INITIAL AND gv_l4 IS NOT INITIAL ).
CONCATENATE gv_l1 gv_l2 gv_l3 gv_l4 INTO gs_final-orgn_l1 SEPARATED BY '#'.
ELSEIF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL AND gv_l3 IS NOT INITIAL ).
CONCATENATE gv_l1 gv_l2 gv_l3 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
ELSEIF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL ).
CONCATENATE gv_l1 gv_l2 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
ELSEIF ( gv_l1 IS NOT INITIAL ).
CONCATENATE gv_l1 'null' 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
ELSEIF ( gv_l1 IS INITIAL AND gv_l2 IS INITIAL AND gv_l3 IS INITIAL AND gv_l4 IS INITIAL ) .
CONCATENATE 'null' 'null' 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
ENDIF .
*******
rp_provide_from_last p0008 space pn-begda pn-endda . "
IF pnp-sw-found EQ 1 .
gs_final-grade = p0008-trfgr.
ENDIF .
IF p0001-plans IS NOT INITIAL .
CALL FUNCTION 'HRWPC_RFC_PLANS_TEXT_GET'
EXPORTING
plans = p0001-plans
begda = pn-begda
endda = pn-endda
langu = sy-langu
IMPORTING
plans_text2 = gv_position.
gs_final-designation = gv_position.
ENDIF.
*** PROVIDE * FROM p0041 BETWEEN pn-begda AND pn-endda.
*** IF p0041-dar01 = 'Z1'.
*** gs_final-joining_date = p0041-dat01.
*** ENDIF.
*** IF p0041-dar01 = 'Z9'.
*** gs_final-group_joining_date = p0041-dat01.
*** ENDIF.
*** ENDPROVIDE.
*******************FOR GROUP JOINING DATE
CLEAR : gs_hrp1001,gs_pa0041 .
DATA: gv_dar01 TYPE p0041-dar01,
gv_dat01 TYPE p0041-dat01,lv_clas TYPE hrp1001-sclas.
CLEAR : lv_clas .
* SELECT SINGLE sclas FROM hrp1001 INTO lv_clas WHERE otype EQ 'P' AND objid EQ pernr-pernr AND sclas EQ 'CP' .
* IF lv_clas IS NOT INITIAL .
* SELECT SINGLE * FROM hrp1001 INTO gs_hrp1001 WHERE otype EQ 'P' AND objid EQ pernr-pernr .
* IF gs_hrp1001-sclas EQ 'CP' .
* IF sy-subrc EQ 0 .
* SELECT SINGLE sobid FROM hrp1001 INTO sep_emp WHERE otype EQ gs_hrp1001-sclas AND objid EQ gs_hrp1001-sobid AND sclas EQ 'P'.
* ENDIF.
* ENDIF.
* ENDIF.
DATA : lv_cnt TYPE i.
CLEAR : wa_hrp1001,lv_cnt .
CLEAR sep_emp.
SELECT SINGLE * FROM hrp1001 INTO wa_hrp1001 WHERE objid EQ pernr-pernr AND otype EQ 'P' AND sclas EQ 'CP'.
IF sy-subrc EQ 0 .
SELECT COUNT(*) FROM hrp1001 INTO lv_cnt WHERE otype EQ 'CP' AND objid EQ wa_hrp1001-sobid .
IF lv_cnt > 1 .
SELECT SINGLE sobid FROM hrp1001 INTO sep_emp WHERE otype EQ 'CP' AND objid EQ wa_hrp1001-sobid AND sclas EQ 'P' .
ENDIF .
ENDIF .
IF sep_emp IS NOT INITIAL .
SELECT SINGLE * FROM pa0041 INTO gs_pa0041 WHERE pernr = sep_emp . "AND ENDDA EQ '9991231'.
DO 4 TIMES
VARYING gv_dar01 FROM gs_pa0041-dar01 NEXT gs_pa0041-dar02
VARYING gv_dat01 FROM gs_pa0041-dat01 NEXT gs_pa0041-dat02.
IF gv_dar01 = 'Z9'.
gs_final-group_joining_date = gv_dat01.
ENDIF.
ENDDO.
ENDIF .
************************************
CLEAR : gv_dar01, gv_dat01 .
DO 4 TIMES
VARYING gv_dar01 FROM p0041-dar01 NEXT p0041-dar02
VARYING gv_dat01 FROM p0041-dat01 NEXT p0041-dat02.
IF gv_dar01 = 'Z1' OR gv_dar01 = 'ZM'.
gs_final-joining_date = gv_dat01.
ENDIF.
IF gv_dar01 = 'Z9'.
IF sep_emp IS INITIAL .
gs_final-group_joining_date = gv_dat01.
ELSE .
ENDIF .
ENDIF.
ENDDO.
*SOBID = P0001-PLANS.
*CALL FUNCTION 'RH_GET_LEADING_POSITION'
* EXPORTING
* plvar = '01'
* otype = 'S'
* sobid = SOBID
* DATE = SY-DATUM
* AUTH = 'X'
** BUFFER_MODE = ' '
** CONSIDER_VAC_POS = ' '
* TABLES
* leading_pos = LEADING_POS
* EXCEPTIONS
* NO_LEAD_POS_FOUND = 1
* OTHERS = 2
* .
*
*READ TABLE LEADING_POS INDEX 1.
*
*select SINGLE * from PA0001 into gs_PA0001 where PLANS = LEADING_POS-OBJID
* AND BEGDA <= PN-ENDDA
* AND ENDDA >= PN-BEGDA.
*
*IF gs_PA0001 IS NOT INITIAL.
* gs_final-emp_manager_id = GS_PA0001-PERNR.
* gs_final-emp_manager_name = GS_PA0001-ENAME.
*ENDIF.
* MOVE-CORRESPONDING gs_final TO gs_fin .
* INSERT INTO zhr_emp_table VALUES gs_fin.
* REFRESH gt_emp[] .
* SELECT * FROM zhr_emp_table INTO TABLE gt_emp WHERE emp_num = gs_final-emp_num .
* IF gt_emp[] IS NOT INITIAL .
* READ TABLE gt_emp INTO gs_emp INDEX 1 .
* IF gs_emp = gs_fin .
* reject .
* ENDIF .
* ENDIF .
* BREAK-POINT .
*** rp_provide_from_last p0028 '0010' pn-begda pn-endda .
*** IF pnp-sw-found EQ 1 .
*** gs_final-blood_group = p0028-wtf01 .
*** ENDIF .
* rp_provide_from_last p0028 '0001' pn-begda pn-endda .
* IF pnp-sw-found EQ 1 .
**** IF p0028-sbj08 EQ '08' .
**** gs_final-blood_group = p0028-wtf08 .
**** ENDIF .
* DATA: gv_sbj01 TYPE p0028-sbj01,
* gv_wtf01 TYPE p0028-wtf01.
* DO 15 TIMES
* VARYING gv_sbj01 FROM p0028-sbj01 NEXT p0028-sbj02
* VARYING gv_wtf01 FROM p0028-wtf01 NEXT p0028-wtf02.
*
* IF gv_sbj01 = '08'.
* SELECT SINGLE * FROM t578w INTO gs_t578w WHERE subty = '0001' AND sbjkt = '08' AND wtfld = gv_wtf01.
* IF sy-subrc EQ 0 .
* gs_final-blood_group = gs_t578w-stext .
* EXIT.
* ENDIF .
* ENDIF .
* CLEAR : gs_t578w.
* ENDDO.
* ENDIF .
* IF p0028-wtf08 IS NOT INITIAL .
* SELECT SINGLE * FROM t578w INTO gs_t578w WHERE subty = '0001' AND sbjkt = '08' AND wtfld = p0028-wtf08 .
* IF sy-subrc EQ 0 .
* CLEAR : gs_final-blood_group .
* gs_final-blood_group = gs_t578w-stext .
* ENDIF .
* ENDIF .
* CLEAR : gs_t578w.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = gs_final-emp_num
IMPORTING
output = gs_final-emp_num.
********* added by chellam - 06.07.2015
IF gs_final-emp_num IS INITIAL.
gs_final-emp_num = 'null'.
ENDIF.
IF gs_final-title IS INITIAL.
gs_final-title = 'null'.
ENDIF.
IF gs_final-first_name IS INITIAL.
gs_final-first_name = 'null'.
ENDIF.
IF gs_final-last_name IS INITIAL.
gs_final-last_name = 'null'.
ENDIF.
IF gs_final-calling_name IS INITIAL.
gs_final-calling_name = 'null'.
ENDIF.
IF gs_final-perm_country IS INITIAL.
gs_final-perm_country = 'null'.
ENDIF.
IF gs_final-prsnt_country IS INITIAL.
gs_final-prsnt_country = 'null'.
ENDIF.
IF gs_final-office_email IS INITIAL.
gs_final-office_email = 'null'.
ENDIF.
IF gs_final-emer_contact_person_relation IS INITIAL.
gs_final-emer_contact_person_relation = 'null'.
ENDIF.
IF gs_final-orgn_l1 IS INITIAL.
gs_final-orgn_l1 = 'null'.
ENDIF.
IF gs_final-sbu IS INITIAL.
gs_final-sbu = 'null'.
ENDIF.
IF gs_final-entity_name IS INITIAL.
gs_final-entity_name = 'null'.
ENDIF.
IF gs_final-entity_branch IS INITIAL.
gs_final-entity_branch = 'null'.
ENDIF.
IF gs_final-org_country IS INITIAL.
gs_final-org_country = 'null'.
ENDIF.
IF gs_final-org_city IS INITIAL.
gs_final-org_city = 'null'.
ENDIF.
IF gs_final-office IS INITIAL .
gs_final-office = 'null'.
ENDIF .
IF gs_final-grade IS INITIAL.
gs_final-grade = 'null'.
ENDIF.
IF gs_final-designation IS INITIAL.
gs_final-designation = 'null'.
ENDIF.
IF gs_final-ldap_login_name IS INITIAL.
gs_final-ldap_login_name = 'null'.
ENDIF.
IF gs_final-src_hire IS INITIAL.
gs_final-src_hire = 'null'.
ENDIF.
IF gs_final-rrf_id IS INITIAL.
gs_final-rrf_id = 'null'.
ENDIF.
IF gs_final-ldap_login_name IS INITIAL.
gs_final-ldap_login_name = 'null'.
ENDIF.
IF gs_final-domain_name IS INITIAL.
gs_final-domain_name = 'null'.
ENDIF.
IF gs_final-birth_date IS INITIAL.
gs_final-birth_date = 'null'.
ELSE.
CLEAR : lv_date.
IF gs_final-birth_date NE '00000000'.
lv_date = gs_final-birth_date.
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-birth_date = lv_date.
ENDIF.
ENDIF.
IF gs_final-gender IS INITIAL.
gs_final-gender = 'null'.
ENDIF.
IF gs_final-blood_group IS INITIAL.
gs_final-blood_group = 'null'.
ENDIF.
IF gs_final-religion IS INITIAL.
gs_final-religion = 'null'.
ENDIF.
IF gs_final-caste IS INITIAL .
gs_final-caste = 'null'.
ENDIF .
IF gs_final-rrf_id IS INITIAL .
gs_final-rrf_id = 'null'.
ENDIF .
IF gs_final-src_hire IS INITIAL .
gs_final-src_hire = 'null'.
ENDIF .
IF gs_final-marital_status IS INITIAL.
gs_final-marital_status = 'null'.
ENDIF.
IF gs_final-wedding_date IS INITIAL.
gs_final-wedding_date = 'null'.
ELSE.
CLEAR : lv_date.
IF gs_final-wedding_date NE '00000000'.
lv_date = gs_final-wedding_date .
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-wedding_date = lv_date.
ENDIF.
ENDIF.
IF gs_final-joining_date IS INITIAL.
gs_final-joining_date = 'null'.
ELSE.
CLEAR : lv_date.
IF gs_final-joining_date NE '00000000'.
lv_date = gs_final-joining_date .
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-joining_date = lv_date.
ENDIF.
ENDIF.
IF gs_final-group_joining_date IS INITIAL .
gs_final-group_joining_date = 'null'.
ELSE.
CLEAR : lv_date.
IF gs_final-group_joining_date NE '00000000'.
lv_date = gs_final-group_joining_date .
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-group_joining_date = lv_date.
ENDIF .
ENDIF.
IF gs_final-confirmation_date IS INITIAL.
gs_final-confirmation_date = 'null'.
ELSE.
CLEAR : lv_date.
IF gs_final-confirmation_date NE '00000000'.
lv_date = gs_final-confirmation_date.
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-confirmation_date = lv_date.
ENDIF.
ENDIF.
IF gs_final-probation_desc IS INITIAL.
gs_final-probation_desc = 'null'.
ENDIF.
IF gs_final-employment_type IS INITIAL.
gs_final-employment_type = 'null'.
ENDIF.
IF gs_final-emp_status IS INITIAL.
gs_final-emp_status = 'null'.
ENDIF.
IF gs_final-nationality IS INITIAL.
gs_final-nationality = 'null'.
ENDIF.
IF gs_final-emp_manager_id IS INITIAL .
gs_final-emp_manager_id = 'null'.
ENDIF .
IF gs_final-emp_manager_name IS INITIAL .
gs_final-emp_manager_name = 'null'.
ENDIF .
IF gs_final-emp_manager_mail_id IS INITIAL.
gs_final-emp_manager_mail_id = 'null'.
ENDIF.
********* end of added by chellam - 06.07.2015
IF gs_final-perm_addr_line1 IS INITIAL .
gs_final-perm_addr_line1 = 'null'.
ENDIF .
IF gs_final-perm_addr_line2 IS INITIAL .
gs_final-perm_addr_line2 = 'null'.
ENDIF .
IF gs_final-perm_addr_line3 IS INITIAL .
gs_final-perm_addr_line3 = 'null'.
ENDIF .
IF gs_final-perm_addr_landmark IS INITIAL .
gs_final-perm_addr_landmark = 'null'.
ENDIF .
IF gs_final-perm_city_name IS INITIAL .
gs_final-perm_city_name = 'null'.
ENDIF .
IF gs_final-perm_state_name IS INITIAL .
gs_final-perm_state_name = 'null'.
ENDIF .
IF gs_final-perm_country_code IS INITIAL .
gs_final-perm_country_code = 'null'.
ENDIF .
IF gs_final-perm_postal_code IS INITIAL .
gs_final-perm_postal_code = 'null'.
ENDIF .
IF gs_final-prsnt_addr_line1 IS INITIAL .
gs_final-prsnt_addr_line1 = 'null'.
ENDIF .
IF gs_final-prsnt_addr_line2 IS INITIAL .
gs_final-prsnt_addr_line2 = 'null'.
ENDIF .
IF gs_final-prsnt_addr_line3 IS INITIAL .
gs_final-prsnt_addr_line3 = 'null'.
ENDIF .
IF gs_final-prsnt_addr_landmark IS INITIAL .
gs_final-prsnt_addr_landmark = 'null'.
ENDIF .
IF gs_final-prsnt_city_name IS INITIAL .
gs_final-prsnt_city_name = 'null'.
ENDIF .
IF gs_final-prsnt_state_name IS INITIAL .
gs_final-prsnt_state_name = 'null'.
ENDIF .
IF gs_final-prsnt_country_code IS INITIAL .
gs_final-prsnt_country_code = 'null'.
ENDIF .
IF gs_final-prsnt_postal_code IS INITIAL .
gs_final-prsnt_postal_code = 'null'.
ENDIF .
IF gs_final-personal_mobile_num IS INITIAL .
gs_final-personal_mobile_num = 'null'.
ENDIF .
IF gs_final-personal_email IS INITIAL .
gs_final-personal_email = 'null'.
ENDIF .
IF gs_final-pan_id IS INITIAL .
gs_final-pan_id = 'null'.
ENDIF .
IF gs_final-office_mobile_num IS INITIAL .
gs_final-office_mobile_num = 'null'.
ENDIF .
IF gs_final-lwd IS INITIAL .
gs_final-lwd = 'null'.
ELSE.
CLEAR lv_date.
lv_date = gs_final-lwd.
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-lwd = lv_date.
ENDIF .
IF gs_final-exit_reason IS INITIAL .
gs_final-exit_reason = 'null'.
ENDIF .
IF gs_final-driving_license IS INITIAL .
gs_final-driving_license = 'null'.
ENDIF .
IF gs_final-aadhar_id IS INITIAL .
gs_final-aadhar_id = 'null'.
ENDIF .
IF gs_final-cost_center IS INITIAL .
gs_final-cost_center = 'null'.
ENDIF .
IF gs_final-cost_center_text IS INITIAL .
gs_final-cost_center_text = 'null'.
ENDIF .
APPEND gs_final TO gt_final .
CLEAR : gs_final .
ENDIF ."IF FLG = 'X'.
END-OF-SELECTION .
*BREAK-POINT .
*********** added by chellam - 29.06.2015
******* Outbound **************
DATA : cl_os_chrms_empdet_data TYPE REF TO zco_si_emp_master_ob_async.
DATA : output TYPE zmt_emp_master.
DATA : lo_sys_exception TYPE REF TO cx_ai_system_fault. " Reference variables exception class
*IF FLG = 'X'.
CLEAR: gt_final_v1[],gs_final_v1.
IF gt_final[] IS NOT INITIAL .
gt_final_v1[] = gt_final[].
gs_final_v1-emp_num = 'EMP_NUM'.
gs_final_v1-title = 'TITLE'.
gs_final_v1-first_name = 'FIRST_NAME'.
gs_final_v1-last_name = 'LAST_NAME'.
gs_final_v1-calling_name = 'CALLING_NAME'.
gs_final_v1-perm_country = 'PERM_COUNTRY'.
gs_final_v1-prsnt_country = 'PRSNT_COUNTRY'.
gs_final_v1-office_email = 'OFFICE_EMAIL'.
gs_final_v1-emer_contact_person_relation = 'EMER_CONTACT_PERSON_RELATION'.
gs_final_v1-orgn_l1 = 'ORGN_L1'.
gs_final_v1-sbu = 'SBU'.
gs_final_v1-entity_name = 'ENTITY_NAME'.
gs_final_v1-entity_branch = 'ENTITY_BRANCH'.
gs_final_v1-org_country = 'ORG_COUNTRY'.
gs_final_v1-org_city = 'ORG_CITY'.
gs_final_v1-office = 'OFFICE'.
gs_final_v1-grade = 'GRADE'.
gs_final_v1-designation = 'DESIGNATION'.
gs_final_v1-ldap_login_name = 'LDAP_LOGIN_NAME'.
gs_final_v1-domain_name = 'DOMAIN_NAME'.
gs_final_v1-birth_date = 'BIRTH_DATE'.
gs_final_v1-gender = 'GENDER'.
gs_final_v1-blood_group = 'BLOOD_GROUP'.
gs_final_v1-religion = 'RELIGION'.
gs_final_v1-caste = 'CASTE'.
gs_final_v1-marital_status = 'MARITAL_STATUS'.
gs_final_v1-wedding_date = 'WEDDING_DATE'.
gs_final_v1-joining_date = 'JOINING_DATE'.
gs_final_v1-group_joining_date = 'GROUP_JOINING_DATE'.
gs_final_v1-confirmation_date = 'CONFIRMATION_DATE'.
gs_final_v1-probation_desc = 'PROBATION_DESC'.
gs_final_v1-employment_type = 'EMPLOYMENT_TYPE'.
gs_final_v1-emp_status = 'EMP_STATUS'.
gs_final_v1-nationality = 'NATIONALITY'.
gs_final_v1-emp_manager_id = 'EMP_MANAGER_ID'.
gs_final_v1-emp_manager_name = 'EMP_MANAGER_NAME'.
gs_final_v1-emp_manager_mail_id = 'EMP_MANAGER_MAIL_ID'.
gs_final_v1-perm_addr_line1 = 'PERM_ADDR_LINE1' .
gs_final_v1-perm_addr_line2 = 'PERM_ADDR_LINE2'.
gs_final_v1-perm_addr_line3 = 'PERM_ADDR_LINE3'.
gs_final_v1-perm_addr_landmark = 'PERM_ADDR_LANDMARK'.
gs_final_v1-perm_city_name = 'PERM_CITY_NAME' .
gs_final_v1-perm_state_name = 'PERM_STATE_NAME' .
gs_final_v1-perm_country_code = 'PERM_COUNTRY_CODE' .
gs_final_v1-perm_postal_code = 'PERM_POSTAL_CODE' .
gs_final_v1-prsnt_addr_line1 = 'PRSNT_ADDR_LINE1' .
gs_final_v1-prsnt_addr_line2 = 'PRSNT_ADDR_LINE2' .
gs_final_v1-prsnt_addr_line3 = 'PRSNT_ADDR_LINE3' .
gs_final_v1-prsnt_addr_landmark = 'PRSNT_ADDR_LANDMARK' .
gs_final_v1-prsnt_city_name = 'PRSNT_CITY_NAME' .
gs_final_v1-prsnt_state_name = 'PRSNT_STATE_NAME' .
gs_final_v1-prsnt_country_code = 'PRSNT_COUNTRY_CODE' .
gs_final_v1-prsnt_postal_code = 'PRSNT_POSTAL_CODE' .
gs_final_v1-personal_mobile_num = 'PERSONAL_MOBILE_NUM' .
gs_final_v1-office_mobile_num = 'OFFICE_MOBILE_NUM' .
gs_final_v1-personal_email = 'PERSONAL_EMAIL' .
gs_final_v1-pan_id = 'PAN_ID' .
gs_final_v1-rrf_id = 'RRF_ID' .
gs_final_v1-src_hire = 'SRC_HIRE' .
gs_final_v1-lwd = 'LWD'.
gs_final_v1-exit_reason = 'EXIT_REASON'.
gs_final_v1-driving_license = 'DRIVING_LICENSE'.
gs_final_v1-aadhar_id = 'AADHAR_ID'.
gs_final_v1-cost_center = 'COST_CENTER'.
gs_final_v1-cost_center_text = 'COST_CENTER_TEXT'.
INSERT gs_final_v1 INTO gt_final_v1 INDEX 1.
ENDIF .
* LOOP AT gt_final INTO gs_final.
* IF sy-tabix = 1.
*
* INSERT gs_final_v1 INTO gt_final_v1 INDEX 1.
* ELSE.
* gs_final_v1-emp_num = gs_final-emp_num.
* gs_final_v1-title = gs_final-title.
* gs_final_v1-first_name = gs_final-first_name.
* gs_final_v1-last_name = gs_final-last_name.
* gs_final_v1-calling_name = gs_final-calling_name.
* gs_final_v1-perm_country = gs_final-perm_country.
* gs_final_v1-prsnt_country = gs_final-prsnt_country.
* gs_final_v1-office_email = gs_final-office_email.
* gs_final_v1-emer_contact_person_relation = gs_final-emer_contact_person_relation.
* gs_final_v1-orgn_l1 = gs_final-orgn_l1.
* gs_final_v1-sbu = gs_final-sbu.
* gs_final_v1-entity_name = gs_final-entity_name .
* gs_final_v1-entity_branch = gs_final-entity_branch.
* gs_final_v1-org_country = gs_final-org_country .
* gs_final_v1-org_city = gs_final-org_city .
* gs_final_v1-office = gs_final-office .
* gs_final_v1-grade = gs_final-grade.
* gs_final_v1-designation = gs_final-designation.
* gs_final_v1-ldap_login_name = gs_final-ldap_login_name.
* gs_final_v1-domain_name = gs_final-domain_name.
* gs_final_v1-birth_date = gs_final-birth_date.
* gs_final_v1-gender = gs_final-birth_date.
* gs_final_v1-blood_group = gs_final-blood_group .
* gs_final_v1-religion = gs_final-religion .
* gs_final_v1-caste = gs_final-caste .
* gs_final_v1-marital_status = gs_final-marital_status.
* gs_final_v1-wedding_date = gs_final-wedding_date.
* gs_final_v1-joining_date = gs_final-joining_date .
* gs_final_v1-group_joining_date = gs_final-group_joining_date.
* gs_final_v1-confirmation_date = gs_final-confirmation_date.
* gs_final_v1-probation_desc = gs_final-probation_desc.
* gs_final_v1-employment_type = gs_final-employment_type.
* gs_final_v1-emp_status = gs_final-emp_status.
* gs_final_v1-nationality = gs_final-nationality.
* gs_final_v1-emp_manager_id = gs_final-emp_manager_id.
* gs_final_v1-emp_manager_name = gs_final-emp_manager_name.
* gs_final_v1-emp_manager_mail_id = gs_final-emp_manager_mail_id .
*
* APPEND gs_final_v1 TO gt_final_v1.
* ENDIF.
* CLEAR : gs_final_v1,gs_final.
* ENDLOOP.
IF gt_final_v1[] IS NOT INITIAL.
MOVE-CORRESPONDING gt_final_v1 TO output-mt_emp_master-header.
TRY.
CREATE OBJECT cl_os_chrms_empdet_data.
CATCH cx_ai_system_fault.
ENDTRY.
ENDIF.
IF output-mt_emp_master-header IS NOT INITIAL.
TRY.
CALL METHOD cl_os_chrms_empdet_data->si_emp_master_ob_async
EXPORTING
output = output.
CATCH cx_ai_system_fault INTO lo_sys_exception.
ENDTRY.
COMMIT WORK.
ENDIF.
* ENDIF.
*********** end of added by chellam - 29.06.2015
* ENDIF . " FLG = 'X'.
*
*IF GT_FINAL[] IS NOT INITIAL .
* PERFORM FIELDCAT .
* CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
* EXPORTING
* I_CALLBACK_PROGRAM = SY-CPROG
** I_CALLBACK_PF_STATUS_SET = 'FRM_STATUS'
** I_CALLBACK_USER_COMMAND = 'VALIDATE_COMMAND'
** I_CALLBACK_TOP_OF_PAGE = ' '
** I_CALLBACK_HTML_TOP_OF_PAGE = ' '
** I_CALLBACK_HTML_END_OF_LIST = ' '
** I_STRUCTURE_NAME =
** I_BACKGROUND_ID = ' '
** I_GRID_TITLE =
** I_GRID_SETTINGS =
* IS_LAYOUT = GT_LAYOUT
* IT_FIELDCAT = GT_FCAT
** IT_EXCLUDING =
* TABLES
* T_OUTTAB = GT_FINAL
** EXCEPTIONS
** PROGRAM_ERROR = 1
** OTHERS = 2
* .
* ELSE .
* MESSAGE 'DATA DOES NOT EXIST' TYPE 'E' DISPLAY LIKE 'I' .
*
*ENDIF .
**&---------------------------------------------------------------------*
**& FORM FIELDCAT
**&---------------------------------------------------------------------*
** TEXT
**----------------------------------------------------------------------*
** --> P1 TEXT
** <-- P2 TEXT
**----------------------------------------------------------------------*
*FORM FIELDCAT .
*
*
* PERFORM FIELD_CAT USING '1' 'EMP_NUM' 'GT_FINAL' TEXT-001 '8' '' ''.
* PERFORM FIELD_CAT USING '2' 'TITLE' 'GT_FINAL' TEXT-014 '8' '' ''.
* PERFORM FIELD_CAT USING '3' 'FIRST_NAME' 'GT_FINAL' TEXT-002 '8' '' ''.
* PERFORM FIELD_CAT USING '4' 'LAST_NAME' 'GT_FINAL' TEXT-003 '8' '' ''.
* PERFORM FIELD_CAT USING '5' 'CALLING_NAME' 'GT_FINAL' TEXT-004 '8' '' ''.
* PERFORM FIELD_CAT USING '6' 'PERM_COUNTRY' 'GT_FINAL' TEXT-015 '8' '' ''.
* PERFORM FIELD_CAT USING '7' 'PRSNT_COUNTRY' 'GT_FINAL' TEXT-005 '8' '' ''.
* PERFORM FIELD_CAT USING '8' 'OFFICE_EMAIL' 'GT_FINAL' TEXT-006 '8' '' 'X' .
* PERFORM FIELD_CAT USING '9' 'EMER_CONTACT_PERSON_RELATION' 'GT_FINAL' TEXT-007 '8' '' 'X' .
* PERFORM FIELD_CAT USING '10' 'ORGN_L1' 'GT_FINAL' TEXT-068 '8' '' 'X' .
* PERFORM FIELD_CAT USING '11' 'SBU' 'GT_FINAL' TEXT-069 '8' '' 'X' .
* PERFORM FIELD_CAT USING '12' 'ENTITY_NAME' 'GT_FINAL' TEXT-008 '8' '' '' .
* PERFORM FIELD_CAT USING '13' 'ENTITY_BRANCH' 'GT_FINAL' TEXT-009 '8' '' ''.
* PERFORM FIELD_CAT USING '14' 'ORG_COUNTRY' 'GT_FINAL' TEXT-077 '8' '' ''.
* PERFORM FIELD_CAT USING '15' 'ORG_CITY' 'GT_FINAL' TEXT-087 '8' '' ''.
* PERFORM FIELD_CAT USING '16' 'GRADE' 'GT_FINAL' TEXT-067 '8' '' ''.
* PERFORM FIELD_CAT USING '17' 'DESIGNATION' 'GT_FINAL' TEXT-010 '8' '' ''.
* PERFORM FIELD_CAT USING '18' 'LDAP_LOGIN_NAME' 'GT_FINAL' TEXT-026 '8' '' ''.
* PERFORM FIELD_CAT USING '19' 'DOMAIN_NAME' 'GT_FINAL' TEXT-027 '8' '' ''.
* PERFORM FIELD_CAT USING '20' 'BIRTH_DATE' 'GT_FINAL' TEXT-011 '8' '' ''.
* PERFORM FIELD_CAT USING '21' 'GENDER' 'GT_FINAL' TEXT-012 '8' '' ''.
* PERFORM FIELD_CAT USING '22' 'BLOOD_GROUP' 'GT_FINAL' TEXT-013 '8' '' ''.
* PERFORM FIELD_CAT USING '23' 'RELIGION' 'GT_FINAL' TEXT-030 '8' '' ''.
* PERFORM FIELD_CAT USING '24' 'MARITAL_STATUS' 'GT_FINAL' TEXT-029 '15' '' ''.
* PERFORM FIELD_CAT USING '25' 'WEDDING_DATE' 'GT_FINAL' TEXT-070 '15' '' ''.
* PERFORM FIELD_CAT USING '26' 'JOINING_DATE' 'GT_FINAL' TEXT-063 '8' '' ''.
* PERFORM FIELD_CAT USING '27' 'CONFIRMATION_DATE' 'GT_FINAL' TEXT-064 '8' '' ''.
* PERFORM FIELD_CAT USING '28' 'PROBATION_DESC' 'GT_FINAL' TEXT-065 '8' '' ''.
* PERFORM FIELD_CAT USING '29' 'EMPLOYMENT_TYPE' 'GT_FINAL' TEXT-066 '8' '' ''.
* PERFORM FIELD_CAT USING '30' 'EMP_STATUS' 'GT_FINAL' TEXT-017 '8' '' ''.
* PERFORM FIELD_CAT USING '31' 'NATIONALITY' 'GT_FINAL' TEXT-018 '8' '' ''.
* PERFORM FIELD_CAT USING '32' 'EMP_MANAGER_MAIL_ID' 'GT_FINAL' TEXT-019 '8' '' ''.
* PERFORM FIELD_CAT USING '33' 'BLOOD_GROUP' 'GT_FINAL' TEXT-020 '8' '' ''.
*
*ENDFORM.
*
*
*FORM FIELD_CAT USING VALUE(P_0736)
*VALUE(P_0737)
*VALUE(P_0738)
*P_TEXT_001
*VALUE(P_0740)
*VALUE(P_0741)
*VALUE(P_0742).
* GS_FCAT-COL_POS = P_0736.
* GS_FCAT-FIELDNAME = P_0737.
* GS_FCAT-TABNAME = P_0738.
* GS_FCAT-REPTEXT_DDIC = P_TEXT_001.
* GS_FCAT-OUTPUTLEN = P_0740.
* APPEND GS_FCAT TO GT_FCAT.
* CLEAR :GS_FCAT.
* GT_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
*ENDFORM. " FIELD_CATREPORT zhrcss_ghrms_emp_master.
*REPORT zhrcss_ghrms_emp_master.
*&---------------------------------------------------------------------*
*& Include ZHRCSS_GHRMS_REPORT_TOP
*&---------------------------------------------------------------------*
TABLES : pernr , t500p , t001p,t578w .
INFOTYPES : 0000, 0001, 0002, 0006, 0008, 0016, 0021, 0027,
0028, 0041, 0105, 0185, 0804, 9011, 9013.
TYPES : BEGIN OF ty_final,
emp_num TYPE pernr_d,
title TYPE pa0002-titel,
first_name TYPE pa0002-vorna,
last_name TYPE pa0002-nachn,
calling_name TYPE pa0002-rufnm,
perm_country TYPE pa0006-land1,
prsnt_country TYPE pa0006-land1,
office_email TYPE pa0105-usrid_long,
emer_contact_person_relation TYPE pa0021-favor,
orgn_l1 TYPE p0001-orgeh,
sbu TYPE p0001-orgeh,
entity_name TYPE t500p-name1,
entity_branch TYPE t001p-btext,
org_country TYPE t005t-landx,
org_city TYPE t500p-ort01,
* office
grade TYPE pa0008-trfgr,
designation TYPE stext,
ldap_login_name TYPE pa0105-usrid_long,
domain_name TYPE char20,
birth_date TYPE pa0002-gbdat,
gender TYPE char10,
blood_group TYPE pa0028-wtf01,
religion TYPE pa0002-konfe,
* caste TYPE
marital_status TYPE char10,
wedding_date TYPE pa0002-famdt,
joining_date TYPE pa0041-dat01,
* group_joining_date
confirmation_date TYPE pa0000-begda,
probation_desc TYPE char20, "pa0016 - PRBZT PRBEH
employment_type TYPE pa0001-persk,
emp_status TYPE pa0000-stat2,
nationality TYPE t005t-landx,
* Emp_manager_id TYPE
* Emp_manager_name
emp_manager_mail_id TYPE pa0105-usrid_long,
lwd TYPE pa0000-begda,
exit_reason TYPE mgtxt,
driving_license TYPE pa0185-ictyp,
aadhar_id TYPE pa0185-ictyp,
cost_center TYPE pa0027-kst01,
cost_center_text TYPE ktext,
END OF ty_final .
DATA : gt_hrp1001 TYPE TABLE OF hrp1001,
gs_hrp1001 TYPE hrp1001,
gs_hrp10012 TYPE hrp1001,
gt_hrp1000 TYPE TABLE OF hrp1000,
gs_hrp1000 TYPE hrp1000,
gs_pa0001 TYPE pa0001,
gs_t578w TYPE t578w,sep_emp TYPE hrp1001-sobid,gs_pa0041 TYPE pa0041.
TYPES : BEGIN OF ty_fin ,
emp_num TYPE string,
title TYPE string,
first_name TYPE string,
last_name TYPE string,
calling_name TYPE string,
END OF ty_fin .
************ added by chellam - 30.06.2015
TYPES : BEGIN OF ty_final_v1,
emp_num TYPE string,
title TYPE string,
first_name TYPE string,
last_name TYPE string,
calling_name TYPE string,
perm_country TYPE string,
prsnt_country TYPE string,
office_email TYPE string,
emer_contact_person_relation TYPE string,
orgn_l1 TYPE string,
sbu TYPE string,
entity_name TYPE string,
entity_branch TYPE string,
org_country TYPE string,
org_city TYPE string,
office TYPE string,
grade TYPE string,
designation TYPE string,
ldap_login_name TYPE string,
domain_name TYPE string,
birth_date TYPE string,
gender TYPE string,
blood_group TYPE string,
religion TYPE string,
caste TYPE string,
marital_status TYPE string,
wedding_date TYPE string,
joining_date TYPE string,
group_joining_date TYPE string,
confirmation_date TYPE string,
probation_desc TYPE string,
employment_type TYPE string,
emp_status TYPE string,
nationality TYPE string,
emp_manager_id TYPE string,
emp_manager_name TYPE string,
emp_manager_mail_id TYPE string,
********** NEWLY ADDED FIELDS
perm_addr_line1 TYPE string,
perm_addr_line2 TYPE string,
perm_addr_line3 TYPE string,
perm_addr_landmark TYPE string,
perm_city_name TYPE string,
perm_state_name TYPE string,
perm_country_code TYPE string,
perm_postal_code TYPE string,
prsnt_addr_line1 TYPE string,
prsnt_addr_line2 TYPE string,
prsnt_addr_line3 TYPE string,
prsnt_addr_landmark TYPE string,
prsnt_city_name TYPE string,
prsnt_state_name TYPE string,
prsnt_country_code TYPE string,
prsnt_postal_code TYPE string,
personal_mobile_num TYPE string,
office_mobile_num TYPE string,
personal_email TYPE string,
pan_id TYPE string,
rrf_id TYPE string,
src_hire TYPE string,
lwd TYPE string,
exit_reason TYPE string,
driving_license TYPE string,
aadhar_id TYPE string,
cost_center TYPE string,
cost_center_text TYPE string,
END OF ty_final_v1.
DATA : gt_final_v1 TYPE TABLE OF ty_final_v1,
gs_final_v1 TYPE ty_final_v1.
************ end of added by chellam - 30.06.2015
DATA : gt_final TYPE TABLE OF ty_final_v1,
gs_final TYPE ty_final_v1,
* gs_fin TYPE zhr_emp_table,
* gt_emp TYPE TABLE OF zhr_emp_table,
* gs_emp TYPE zhr_emp_table,
flg TYPE char1.
DATA : lv_plans TYPE pa0001-plans .
DATA : it_hrp1001 TYPE TABLE OF hrp1001 WITH HEADER LINE .
DATA : lv_date TYPE char10.
DATA : gt_fcat TYPE slis_t_fieldcat_alv,wa_hrp1001 TYPE hrp1001,
gs_fcat TYPE slis_fieldcat_alv,
gt_layout TYPE slis_layout_alv.
DATA : gv_l1 TYPE string,
gv_l2 TYPE string,
gv_l3 TYPE string,
gv_l4 TYPE string,
gv_date TYPE d.
DATA : gt_str TYPE TABLE OF objec WITH HEADER LINE .
DATA : gt_t500p TYPE TABLE OF t500p,
gs_t500p TYPE t500p,
gt_t001p TYPE TABLE OF t001p,
gs_t001p TYPE t001p,
gt_t005t TYPE TABLE OF t005t,
gs_t005t TYPE t005t,
gt_t503t TYPE TABLE OF t503t,
gs_t503t TYPE t503t,lv_cttyp TYPE cttyp,conf_dt TYPE begda .
DATA : gv_position TYPE stext,
gv_orgeh TYPE pa0001-orgeh,
gv_plans TYPE pa0001-plans,
gv_persa TYPE pa0001-werks,
gv_cost TYPE pa0027-kst01,
gv_cost_txt TYPE ktext,
gv_cost_per TYPE pkprz,
gv_cost_per1 TYPE string,
lv_domain TYPE char20,
lv_domain_new TYPE char20.
DATA: gt_t522t TYPE t522t OCCURS 0 WITH HEADER LINE,
gt_t578x TYPE t578x OCCURS 0 WITH HEADER LINE,
gt_t516t TYPE t516t OCCURS 0 WITH HEADER LINE.
* AT SELECTION-SCREEN .
SELECT * FROM t500p INTO CORRESPONDING FIELDS OF TABLE gt_t500p WHERE molga EQ '40' .
SELECT * FROM t001p INTO CORRESPONDING FIELDS OF TABLE gt_t001p WHERE molga EQ '40' .
SELECT * FROM t005t INTO CORRESPONDING FIELDS OF TABLE gt_t005t WHERE spras EQ 'EN' .
SELECT * FROM t522t INTO CORRESPONDING FIELDS OF TABLE gt_t522t WHERE sprsl EQ 'E' .
SELECT * FROM t516t INTO CORRESPONDING FIELDS OF TABLE gt_t516t WHERE sprsl EQ 'E' .
SELECT * FROM t503t INTO CORRESPONDING FIELDS OF TABLE gt_t503t WHERE sprsl EQ sy-langu .
SELECT * FROM t578x INTO CORRESPONDING FIELDS OF TABLE gt_t578x.
GET pernr .
****************** CHECKING FOR Z1 AND ZZ ACTION EMPLOYEES ALONE
*PROVIDE * FROM p0000 BETWEEN pn-begda AND pn-endda .
*
* IF p0000-massn EQ 'Z1' OR p0000-massn EQ 'ZZ' OR p0000-massn EQ 'ZM' OR p0000-massn EQ 'Z3' OR p0000-massn EQ 'ZA' OR p0000-massn EQ 'Z2' .
*
*
* ELSE .
* REJECT.
* ENDIF .
*ENDPROVIDE .
******************
CLEAR: flg,wa_hrp1001.
SORT p0001[] BY aedtm DESCENDING .
rp_provide_from_last p0001 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0001-aedtm >= pn-begda AND p0001-aedtm <= pn-endda .
IF p0001-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
*****manager change check
SELECT SINGLE * FROM hrp1001 INTO wa_hrp1001 WHERE otype EQ 'S'
AND objid EQ p0001-plans
AND plvar EQ '01'
AND subty EQ 'A002'
AND endda EQ '99991231'
AND aedtm >= pn-begda
AND aedtm <= pn-endda.
IF wa_hrp1001 IS NOT INITIAL .
IF wa_hrp1001-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
SORT p0002[] BY aedtm DESCENDING .
rp_provide_from_last p0002 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0002-aedtm >= pn-begda AND p0002-aedtm <= pn-endda .
IF p0002-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0006[] BY aedtm DESCENDING .
rp_provide_from_last p0006 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0006-aedtm >= pn-begda AND p0006-aedtm <= pn-endda .
IF p0006-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
*SORT p0008[] BY aedtm DESCENDING .
*rp_provide_from_last p0008 space pn-begda pn-endda .
*IF pnp-sw-found EQ 1 .
* IF p0008-aedtm >= pn-begda AND p0008-aedtm <= pn-endda .
* flg = 'X'.
* ENDIF .
*ENDIF .
**********************added code for log report change at infotype level ,
DATA : st_log TYPE hreic_s_logkey,
gt_tab TYPE TABLE OF pldoc_key,
gs_tab TYPE pldoc_key,
gs_det TYPE pldoc_key,
gt_status TYPE TABLE OF hrinftylog_fields,
gs_status TYPE hrinftylog_fields,
gt_temp_before TYPE TABLE OF prelp WITH HEADER LINE,
gt_temp_after TYPE TABLE OF prelp WITH HEADER LINE.
CLEAR : st_log , gt_tab[], gs_status, gs_det,gt_status[],gs_tab,gt_temp_before[],gt_temp_after[].
st_log-enddate = sy-datum .
st_log-startdate = sy-datum.
st_log-pernr = pernr-pernr .
CALL FUNCTION 'HREIC_GET_LOGGED_INFTY_CHANGES'
EXPORTING
is_log_key = st_log
IMPORTING
et_infty_modif = gt_tab.
*CLEAR : GS_DET .
IF gt_tab[] IS NOT INITIAL .
READ TABLE gt_tab INTO gs_tab WITH KEY bdate = sy-datum
infty = '0008'.
IF sy-subrc EQ 0 .
gs_det-relid = gs_tab-relid .
gs_det-tclas = gs_tab-tclas .
gs_det-pernr = gs_tab-pernr .
gs_det-infty = gs_tab-infty .
gs_det-bdate = gs_tab-bdate .
gs_det-btime = gs_tab-btime .
gs_det-seqnr = gs_tab-seqnr .
CALL FUNCTION 'HR_INFOTYPE_LOG_GET_DETAIL'
EXPORTING
logged_infotype = gs_det
auth_check = 'X'
* USE_ARCHIVE = ' '
* IMPORTING
* SUBRC =
TABLES
infty_tab_before = gt_temp_before
infty_tab_after = gt_temp_after
fields = gt_status.
READ TABLE gt_status INTO gs_status WITH KEY fname = 'TRFGR' .
IF sy-subrc EQ 0.
flg = 'X' .
ENDIF .
ENDIF .
ENDIF .
**********************
SORT p0028[] BY aedtm DESCENDING .
rp_provide_from_last p0028 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0028-aedtm >= pn-begda AND p0028-aedtm <= pn-endda .
IF p0028-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0027[] BY aedtm DESCENDING .
rp_provide_from_last p0027 '01' pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0027-aedtm >= pn-begda AND p0027-aedtm <= pn-endda .
IF p0027-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0041[] BY aedtm DESCENDING .
rp_provide_from_last p0041 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0041-aedtm >= pn-begda AND p0041-aedtm <= pn-endda .
IF p0041-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0000[] BY aedtm DESCENDING .
rp_provide_from_last p0000 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0000-aedtm >= pn-begda AND p0000-aedtm <= pn-endda .
IF p0000-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
*IF p0000-stat2 EQ '0'. " Chella 07.12.2016
* REJECT .
*ENDIF .
SORT p0185[] BY aedtm DESCENDING .
rp_provide_from_last p0185 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0185-aedtm >= pn-begda AND p0185-aedtm <= pn-endda .
IF p0185-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0105[] BY aedtm DESCENDING .
rp_provide_from_last p0105 '0010' pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0105-aedtm >= pn-begda AND p0105-aedtm <= pn-endda .
IF p0105-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0021[] BY aedtm DESCENDING .
rp_provide_from_last p0021 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0021-aedtm >= pn-begda AND p0021-aedtm <= pn-endda .
IF p0021-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
****Chella
*IF flg = 'X'.
* IF wa_hrp1001-uname = 'CUTOVERHR'
* AND p0000-uname = 'CUTOVERHR'
* AND p0001-uname = 'CUTOVERHR'
* AND p0002-uname = 'CUTOVERHR'
* AND p0006-uname = 'CUTOVERHR'
* AND p0028-uname = 'CUTOVERHR'
* AND p0041-uname = 'CUTOVERHR'
* AND p0185-uname = 'CUTOVERHR'
* AND p0105-uname = 'CUTOVERHR'
* AND p0021-uname = 'CUTOVERHR'.
* CLEAR flg.
* ENDIF .
*ENDIF.
***chella
IF flg = 'X'.
DATA: gt_pa0001 TYPE TABLE OF pa0001,
gs_pa0001 TYPE pa0001,
leading_pos TYPE hrobject OCCURS 0 WITH HEADER LINE,
gs_pa0105 TYPE pa0105,
sobid TYPE hrsobid-sobid.
gs_final-emp_num = pernr-pernr .
rp_provide_from_last p0000 space pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-emp_status = p0000-stat2 .
IF p0000-massn = 'Z3'.
CLEAR gv_date.
gs_final-lwd = gv_date = p0000-begda - 1.
SELECT SINGLE mgtxt FROM t530t INTO gs_final-exit_reason
WHERE sprsl = 'E' AND massn = p0000-massn
AND massg = p0000-massg.
IF sy-subrc NE 0 .
CLEAR gs_final-exit_reason.
ENDIF.
ENDIF.
ENDIF.
rp_provide_from_last p0027 '01' pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
DO 25 TIMES VARYING gv_cost FROM p0027-kst01 NEXT p0027-kst02
VARYING gv_cost_per FROM p0027-kpr01 NEXT p0027-kpr02.
IF gv_cost IS NOT INITIAL.
CLEAR gv_cost_txt.
SELECT SINGLE ktext FROM cskt INTO gv_cost_txt
WHERE spras = 'E'
AND kostl = gv_cost AND datbi >= sy-datum.
IF gs_final-cost_center_text IS INITIAL.
gs_final-cost_center_text = gv_cost_txt.
ELSE.
CONCATENATE gs_final-cost_center_text '##!' gv_cost_txt INTO gs_final-cost_center_text.
ENDIF.
gv_cost_per1 = gv_cost_per.
IF gs_final-cost_center IS INITIAL.
CONCATENATE gv_cost '&!#' gv_cost_per1 INTO gs_final-cost_center.
ELSE.
CONCATENATE gs_final-cost_center '##!' gv_cost_per1 INTO gs_final-cost_center.
ENDIF.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-cost_center WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-cost_center_text WITH space.
*** rp_provide_from_last p0000 'Z5' pn-begda pn-endda . " EMAIL
*** IF pnp-sw-found EQ 1 .
*** gs_final-probation_desc = 'Confirmed' .
*** gs_final-confirmation_date = p0000-begda .
*** ELSE .
*** gs_final-probation_desc = 'Probation' .
*** ENDIF.
**** ENDIF .
* READ TABLE gt_t005t INTO gs_t005t WITH KEY land1 = p0002-natio .
* IF sy-subrc EQ 0 .
***********************************PROBATION
CLEAR : lv_cttyp , conf_dt .
rp_provide_from_last p0016 space pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
lv_cttyp = p0016-cttyp .
ENDIF.
IF lv_cttyp EQ '10' .
gs_final-probation_desc = lv_cttyp .
ELSEIF lv_cttyp EQ '11' .
gs_final-probation_desc = lv_cttyp .
* SELECT SINGLE BEGDA FROM PA0000 INTO CONF_DT WHERE MASSN EQ 'Z5'.
READ TABLE p0000[] INTO p0000 WITH KEY massn = 'Z5'.
gs_final-confirmation_date = p0000-begda.
* SELECT SINGLE BEGDA FROM PA0000 INTO gs_final-confirmation_date WHERE MASSN EQ 'Z5'.
ENDIF .
rp_provide_from_last p0002 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
* READ TABLE gt_t522t WITH KEY anred = p0002-anred.
* IF sy-subrc = 0.
* gs_final-title = gt_t522t-atext .
* ENDIF.
gs_final-title = p0002-anred .
gs_final-first_name = p0002-vorna .
gs_final-last_name = p0002-nachn .
gs_final-calling_name = p0002-rufnm .
gs_final-birth_date = p0002-gbdat .
IF p0002-gesch EQ '1' .
gs_final-gender = 'Male'.
ELSEIF p0002-gesch EQ '2' .
gs_final-gender = 'Female'.
ELSEIF p0002-gesch EQ '3' .
gs_final-gender = 'Transgender'.
ENDIF .
* READ TABLE gt_t516t INTO gt_t516t WITH KEY konfe = p0002-konfe .
* IF sy-subrc EQ 0 .
* gs_final-religion = gt_t516t-ktext .
* ENDIF .
gs_final-religion = p0002-konfe .
IF p0002-famst EQ 0 .
gs_final-marital_status = 'Single'.
ELSEIF p0002-famst EQ 1 .
gs_final-marital_status = 'Married'.
ENDIF .
IF p0002-famdt NE '00000000'.
gs_final-wedding_date = p0002-famdt .
ENDIF .
IF p0002-natio IS NOT INITIAL .
gs_final-nationality = p0002-natio .
READ TABLE gt_t005t INTO gs_t005t WITH KEY land1 = p0002-natio .
IF sy-subrc EQ 0 .
* gs_final-nationality = gs_t005t-landx .
* gs_final-nationality = p0002-natio .
ENDIF .
ENDIF .
ENDIF .
CLEAR : gs_t005t .
rp_provide_from_last p0006 '1' pn-begda pn-endda . "PERMANENT ADDR
IF pnp-sw-found EQ 1 .
gs_final-perm_addr_line1 = p0006-name2 .
gs_final-perm_addr_line2 = p0006-stras .
gs_final-perm_addr_line3 = p0006-locat .
gs_final-perm_city_name = p0006-ort01 .
SELECT SINGLE bezei FROM t005u INTO gs_final-perm_state_name WHERE land1 EQ p0006-land1 AND bland EQ p0006-state AND spras EQ 'EN'.
* gs_final-perm_state_name = p0006-state .
gs_final-perm_country_code = p0006-land1 .
gs_final-perm_postal_code = p0006-pstlz .
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_city_name WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_state_name WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_country_code WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_postal_code WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_addr_line1 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_addr_line2 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_addr_line3 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN p0006-hsnmr WITH space.
CONCATENATE p0006-hsnmr ' ' gs_final-perm_addr_line2 INTO gs_final-perm_addr_line2 SEPARATED BY space . .
* gs_final-perm_addr_landmark =
* gs_final-prsnt_addr_line1 = p0006-name2 .
*
* gs_final-prsnt_addr_line2 = p0006-stras.
* gs_final-prsnt_addr_line3 = p0006-locat.
** GS_FINAL-PRSNT_ADDR_LANDMARK.
* gs_final-prsnt_city_name = p0006-ort01.
* gs_final-prsnt_state_name = p0006-state.
* gs_final-prsnt_country_code = p0006-land1.
* gs_final-prsnt_postal_code = p0006-pstlz.
READ TABLE gt_t005t INTO gs_t005t WITH KEY land1 = p0006-land1 .
IF sy-subrc EQ 0 .
* gs_final-perm_country = gs_t005t-landx . "p0006-land1 .
gs_final-perm_country = p0006-land1 .
ENDIF .
ENDIF .
CLEAR : gs_t005t.
rp_provide_from_last p0006 '2' pn-begda pn-endda . "TEMPORARY ADDR
IF pnp-sw-found EQ 1 .
gs_final-prsnt_addr_line1 = p0006-name2 .
gs_final-prsnt_addr_line2 = p0006-stras.
gs_final-prsnt_addr_line3 = p0006-locat.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_addr_line1 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_addr_line2 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_addr_line3 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN p0006-hsnmr WITH space.
* GS_FINAL-PRSNT_ADDR_LANDMARK.
CONCATENATE p0006-hsnmr ' ' gs_final-prsnt_addr_line2 INTO gs_final-prsnt_addr_line2 SEPARATED BY space .
*
gs_final-prsnt_city_name = p0006-ort01.
SELECT SINGLE bezei FROM t005u INTO gs_final-prsnt_state_name WHERE land1 EQ p0006-land1 AND bland EQ p0006-state AND spras EQ 'EN'.
* gs_final-prsnt_state_name = p0006-state.
gs_final-prsnt_country_code = p0006-land1.
gs_final-prsnt_postal_code = p0006-pstlz.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_city_name WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_city_name WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_country_code WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_postal_code WITH space.
READ TABLE gt_t005t INTO gs_t005t WITH KEY land1 = p0006-land1 .
IF sy-subrc EQ 0 .
* gs_final-prsnt_country = gs_t005t-landx."p0006-land1 .
gs_final-prsnt_country = p0006-land1 .
ENDIF .
ENDIF .
CLEAR : gs_t005t.
rp_provide_from_last p0105 '0010' pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
* IF p0105-usrty = '0010' .
gs_final-office_email = p0105-usrid_long .
* ENDIF.
ENDIF .
rp_provide_from_last p0105 'CELL' pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-personal_mobile_num = p0105-usrid .
ENDIF .
rp_provide_from_last p0105 'MAIL' pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-personal_email = p0105-usrid .
ENDIF .
rp_provide_from_last p0105 'MPHN' pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-office_mobile_num = p0105-usrid .
ENDIF .
rp_provide_from_last p0185 '02' pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-pan_id = p0185-icnum .
ENDIF .
rp_provide_from_last p0185 '06' pn-begda pn-endda . " Aadhar Card No.
IF pnp-sw-found EQ 1 .
gs_final-aadhar_id = p0185-icnum .
ENDIF .
rp_provide_from_last p0185 'Z3' pn-begda pn-endda . " Driving License
IF pnp-sw-found EQ 1 .
gs_final-driving_license = p0185-icnum .
ENDIF .
rp_provide_from_last p9013 space pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-rrf_id = p9013-rrf .
gs_final-src_hire = p9013-source .
ENDIF .
rp_provide_from_last p0804 space pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-blood_group = p0804-bgrup .
ENDIF .
********************
IF gs_final-office_email IS NOT INITIAL .
gs_final-ldap_login_name = gs_final-office_email .
SPLIT gs_final-office_email AT '@' INTO lv_domain lv_domain_new.
CONCATENATE '@' lv_domain_new INTO gs_final-domain_name .
CONDENSE gs_final-domain_name .
ENDIF .
CLEAR : gv_orgeh , gv_persa ,gv_plans.
rp_provide_from_last p0001 space pn-begda pn-endda . "organisational unit text
IF pnp-sw-found EQ 1 .
gv_orgeh = p0001-orgeh .
gv_plans = p0001-plans .
gv_persa = p0001-werks .
gs_final-orgn_l1 = gv_orgeh . " org unit
gs_final-entity_name = p0001-werks.
gs_final-entity_branch = p0001-btrtl .
gs_final-office = p0001-btrtl.
gs_final-employment_type = p0001-persk .
* CLEAR: gs_t503t.
* READ TABLE gt_t503t INTO gs_t503t WITH KEY persk = p0001-persk .
* IF sy-subrc = 0.
* gs_final-employment_type = gs_t503t-ptext.
* ENDIF.
ENDIF .
CLEAR : lv_plans .
REFRESH : it_hrp1001[] .
sobid = p0001-plans.
CALL FUNCTION 'RH_GET_LEADING_POSITION'
EXPORTING
plvar = '01'
otype = 'S'
sobid = sobid
date = sy-datum
auth = 'X'
* BUFFER_MODE = ' '
* CONSIDER_VAC_POS = ' '
TABLES
leading_pos = leading_pos
EXCEPTIONS
no_lead_pos_found = 1
OTHERS = 2.
READ TABLE leading_pos INDEX 1.
IF leading_pos-objid NE '00000000'.
SELECT SINGLE * FROM pa0001 INTO gs_pa0001 WHERE plans = leading_pos-objid
* AND begda <= pn-endda "Chella
* AND endda >= pn-begda.
AND endda = '99991231'. "Chella 28.06.2016
IF gs_pa0001 IS NOT INITIAL.
gs_final-emp_manager_id = gs_pa0001-pernr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = gs_final-emp_manager_id
IMPORTING
output = gs_final-emp_manager_id.
IF wa_hrp1001-begda NE '00000000' .
* CLEAR : gs_final-emp_manager_id .
CONCATENATE gs_final-emp_manager_id '$' wa_hrp1001-begda+0(4) '-' wa_hrp1001-begda+4(2) '-' wa_hrp1001-begda+6(2) INTO gs_final-emp_manager_id .
CONDENSE gs_final-emp_manager_id NO-GAPS .
ELSE .
CLEAR : it_hrp1001 .
SELECT SINGLE plans FROM pa0001 INTO lv_plans WHERE pernr EQ pernr-pernr AND endda EQ '99991231' .
IF lv_plans IS NOT INITIAL .
SELECT * FROM hrp1001 INTO CORRESPONDING FIELDS OF TABLE it_hrp1001 WHERE otype EQ 'S' AND objid EQ lv_plans .
READ TABLE it_hrp1001 WITH KEY rsign = 'A' relat = '002' endda = '99991231'.
IF sy-subrc EQ 0 .
.
CONCATENATE gs_final-emp_manager_id '$' it_hrp1001-begda+0(4) '-' it_hrp1001-begda+4(2) '-' it_hrp1001-begda+6(2) INTO gs_final-emp_manager_id .
CONDENSE gs_final-emp_manager_id NO-GAPS .
ENDIF .
ENDIF .
ENDIF .
gs_final-emp_manager_name = gs_pa0001-ename.
ENDIF.
SELECT SINGLE * FROM pa0105 INTO gs_pa0105 WHERE pernr = gs_pa0001-pernr
AND subty = '0010'
AND begda <= pn-endda
AND endda >= pn-begda.
IF gs_pa0105 IS NOT INITIAL. .
gs_final-emp_manager_mail_id = gs_pa0105-usrid_long .
ENDIF .
ENDIF .
CLEAR: gs_pa0105, gs_pa0001, leading_pos, sobid.
*
* CLEAR: gs_pa0105, gs_pa0001, leading_pos, sobid.
CLEAR : gs_pa0001 ,gs_hrp10012,gs_hrp1001.
***************
rp_provide_from_last p0021 space pn-begda pn-endda . "
IF pnp-sw-found EQ 1 ."FAMSA
* SELECT SINGLE stext FROM t591s INTO gs_final-emer_contact_person_relation WHERE sprsl EQ 'EN' AND infty EQ '0021' AND subty = p0021-famsa
.
gs_final-emer_contact_person_relation = p0021-famsa .
ENDIF .
CLEAR : gs_t001p , gs_t500p .
READ TABLE gt_t001p INTO gs_t001p WITH KEY werks = p0001-werks
btrtl = p0001-btrtl .
IF sy-subrc EQ 0 .
* gs_final-entity_branch = gs_t001p-btext .
ENDIF .
CLEAR : gs_t001p.
READ TABLE gt_t001p INTO gs_t001p WITH KEY btrtl = p0001-btrtl .
IF sy-subrc EQ 0 .
* gs_final-office = gs_t001p-btext ." for office name
ENDIF .
READ TABLE gt_t500p INTO gs_t500p WITH KEY persa = p0001-werks .
IF sy-subrc EQ 0 .
* gs_final-entity_name = gs_t500p-name1 .
READ TABLE gt_t005t INTO gs_t005t WITH KEY land1 = gs_t500p-land1 .
IF sy-subrc EQ 0 .
* gs_final-org_country = gs_t005t-landx.
gs_final-org_country = gs_t500p-land1 .
ENDIF .
gs_final-org_city = gs_t500p-ort01.
ENDIF.
** ENDIF
****org unit ***
* DATA : lv_sobid TYPE string .
* SELECT * FROM hrp1001 INTO TABLE gt_hrp1001 WHERE otype = 'O'
* AND plvar = '01'
* AND begda <= pn-endda AND endda >= pn-begda.
* SELECT * FROM hrp1000 INTO TABLE gt_hrp1000 WHERE otype = 'O'
* AND plvar = '01'.
** AND begda <= pn-endda AND endda >= pn-begda.
* IF gv_orgeh IS NOT INITIAL .
* READ TABLE gt_hrp1001 INTO gs_hrp1001 WITH KEY otype = 'O' objid = gv_orgeh
* sclas = 'O' subty = 'A002'.
* IF sy-subrc EQ 0 .
* READ TABLE gt_hrp1000 INTO gs_hrp1000 WITH KEY otype = 'O' objid = gv_orgeh .
* IF sy-subrc EQ 0 .
* gs_final-orgn_l1 = gs_hrp1000-stext .
* ENDIF .
* CLEAR : lv_sobid.
*
* lv_sobid = gs_hrp1001-sobid .
* READ TABLE gt_hrp1000 INTO gs_hrp1000 WITH KEY otype = 'O' objid = lv_sobid .
* IF sy-subrc EQ 0 .
* gs_final-sbu = gs_hrp1000-stext. "l2 org text
* gs_hrp1001-sobid = gs_hrp1000-stext .
* ENDIF .
*
* CONCATENATE gs_final-orgn_l1 '#' gs_hrp1001-sobid INTO gs_final-orgn_l1 .
** =
* READ TABLE gt_hrp1001 INTO gs_hrp1001 WITH KEY otype = 'O' objid = lv_sobid"gs_hrp1001-sobid
* sclas = 'O' subty = 'A002'.
* IF sy-subrc EQ 0 .
* CLEAR : lv_sobid .
* lv_sobid = gs_hrp1001-sobid .
* READ TABLE gt_hrp1000 INTO gs_hrp1000 WITH KEY otype = 'O' objid = lv_sobid .
* IF sy-subrc EQ 0 .
* gs_hrp1001-sobid = gs_hrp1000-stext .
* ENDIF .
* CONCATENATE gs_final-orgn_l1 '#' gs_hrp1001-sobid INTO gs_final-orgn_l1 .
* READ TABLE gt_hrp1001 INTO gs_hrp1001 WITH KEY otype = 'O' objid = lv_sobid"gs_hrp1001-sobid
* sclas = 'O' subty = 'A002'.
* IF sy-subrc EQ 0 .
*
* CLEAR : lv_sobid .
* lv_sobid = gs_hrp1001-sobid .
* READ TABLE gt_hrp1000 INTO gs_hrp1000 WITH KEY otype = 'O' objid = lv_sobid .
* IF sy-subrc EQ 0 .
* gs_hrp1001-sobid = gs_hrp1000-stext .
* ENDIF .
*
* CONCATENATE gs_final-orgn_l1 '#' gs_hrp1001-sobid INTO gs_final-orgn_l1 .
*
* ELSE .
* CONCATENATE gs_final-orgn_l1 '#' 'Null' INTO gs_final-orgn_l1 .
* ENDIF .
*
* ELSE .
* CONCATENATE gs_final-orgn_l1 '#' 'Null#Null' INTO gs_final-orgn_l1 .
* ENDIF .
* ELSE .
* CONCATENATE gs_final-orgn_l1 '#' 'Null#Null#Null' INTO gs_final-orgn_l1 .
* ENDIF .
*
* ELSE.
* CLEAR : gs_final-orgn_l1 .
* gs_final-orgn_l1 = 'Null#Null#Null#Null'.
* ENDIF .
CLEAR :gs_hrp1001 ,gv_position.
************* GETING ORGN LEVEL FROM 9011 INFTY .
* CLEAR : gs_final-orgn_l1 .
* CLEAR : gv_l1 , gv_l2 , gv_l3 , gv_l4 .
* rp_provide_from_last p9011 space pn-begda pn-endda . "
* IF pnp-sw-found EQ 1 .
* gv_l1 = p9011-orgn_l1 .
* gv_l2 = p9011-orgn_l2 .
* gv_l3 = p9011-orgn_l3 .
* gv_l4 = p9011-orgn_l4 .
* ENDIF .
* IF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL AND gv_l3 IS NOT INITIAL AND gv_l4 IS NOT INITIAL ).
* CONCATENATE gv_l1 gv_l2 gv_l3 gv_l4 INTO gs_final-orgn_l1 SEPARATED BY '#'.
* ELSEIF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL AND gv_l3 IS NOT INITIAL ).
* CONCATENATE gv_l1 gv_l2 gv_l3 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
* ELSEIF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL ).
* CONCATENATE gv_l1 gv_l2 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
* ELSEIF ( gv_l1 IS NOT INITIAL ).
* CONCATENATE gv_l1 'null' 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
* ELSEIF ( gv_l1 IS INITIAL AND gv_l2 IS INITIAL AND gv_l3 IS INITIAL AND gv_l4 IS INITIAL ) .
* CONCATENATE 'null' 'null' 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
* ENDIF .
*********************TO GET ORGN L1
CLEAR : gs_final-orgn_l1 .
CLEAR : gv_l1 , gv_l2 , gv_l3 , gv_l4 .
FREE : gt_str[] .
CALL FUNCTION 'RH_PM_GET_STRUCTURE'
EXPORTING
plvar = '01'
otype = 'O'
objid = p0001-orgeh
begda = pn-begda
endda = '99991231'
status = '1'
wegid = 'O-O'
* 77AW_INT = ' '
authy = 'X'
* DEPTH = 0
* CHECK_OBJECT = ' '
* PROGRESS_INDICATOR = ' '
* SVECT =
activ = 'X'
* BUFFER_MODE =
TABLES
objec_tab = gt_str
* STRUC_TAB =
* GDSTR_TAB =
EXCEPTIONS
not_found = 1
ppway_not_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
LOOP AT gt_str .
IF sy-tabix EQ 1 .
gv_l4 = gt_str-stext .
ELSEIF sy-tabix EQ 2 .
gv_l3 = gt_str-stext .
ELSEIF sy-tabix EQ 3 .
gv_l2 = gt_str-stext .
ELSEIF sy-tabix EQ 4 .
gv_l1 = gt_str-stext .
ENDIF .
CLEAR : gt_str.
ENDLOOP .
gs_final-sbu = gv_l2 .
IF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL AND gv_l3 IS NOT INITIAL AND gv_l4 IS NOT INITIAL ).
CONCATENATE gv_l1 gv_l2 gv_l3 gv_l4 INTO gs_final-orgn_l1 SEPARATED BY '#'.
ELSEIF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL AND gv_l3 IS NOT INITIAL ).
CONCATENATE gv_l1 gv_l2 gv_l3 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
ELSEIF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL ).
CONCATENATE gv_l1 gv_l2 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
ELSEIF ( gv_l1 IS NOT INITIAL ).
CONCATENATE gv_l1 'null' 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
ELSEIF ( gv_l1 IS INITIAL AND gv_l2 IS INITIAL AND gv_l3 IS INITIAL AND gv_l4 IS INITIAL ) .
CONCATENATE 'null' 'null' 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
ENDIF .
*******
rp_provide_from_last p0008 space pn-begda pn-endda . "
IF pnp-sw-found EQ 1 .
gs_final-grade = p0008-trfgr.
ENDIF .
IF p0001-plans IS NOT INITIAL .
CALL FUNCTION 'HRWPC_RFC_PLANS_TEXT_GET'
EXPORTING
plans = p0001-plans
begda = pn-begda
endda = pn-endda
langu = sy-langu
IMPORTING
plans_text2 = gv_position.
gs_final-designation = gv_position.
ENDIF.
*** PROVIDE * FROM p0041 BETWEEN pn-begda AND pn-endda.
*** IF p0041-dar01 = 'Z1'.
*** gs_final-joining_date = p0041-dat01.
*** ENDIF.
*** IF p0041-dar01 = 'Z9'.
*** gs_final-group_joining_date = p0041-dat01.
*** ENDIF.
*** ENDPROVIDE.
*******************FOR GROUP JOINING DATE
CLEAR : gs_hrp1001,gs_pa0041 .
DATA: gv_dar01 TYPE p0041-dar01,
gv_dat01 TYPE p0041-dat01,lv_clas TYPE hrp1001-sclas.
CLEAR : lv_clas .
* SELECT SINGLE sclas FROM hrp1001 INTO lv_clas WHERE otype EQ 'P' AND objid EQ pernr-pernr AND sclas EQ 'CP' .
* IF lv_clas IS NOT INITIAL .
* SELECT SINGLE * FROM hrp1001 INTO gs_hrp1001 WHERE otype EQ 'P' AND objid EQ pernr-pernr .
* IF gs_hrp1001-sclas EQ 'CP' .
* IF sy-subrc EQ 0 .
* SELECT SINGLE sobid FROM hrp1001 INTO sep_emp WHERE otype EQ gs_hrp1001-sclas AND objid EQ gs_hrp1001-sobid AND sclas EQ 'P'.
* ENDIF.
* ENDIF.
* ENDIF.
DATA : lv_cnt TYPE i.
CLEAR : wa_hrp1001,lv_cnt .
CLEAR sep_emp.
SELECT SINGLE * FROM hrp1001 INTO wa_hrp1001 WHERE objid EQ pernr-pernr AND otype EQ 'P' AND sclas EQ 'CP'.
IF sy-subrc EQ 0 .
SELECT COUNT(*) FROM hrp1001 INTO lv_cnt WHERE otype EQ 'CP' AND objid EQ wa_hrp1001-sobid .
IF lv_cnt > 1 .
SELECT SINGLE sobid FROM hrp1001 INTO sep_emp WHERE otype EQ 'CP' AND objid EQ wa_hrp1001-sobid AND sclas EQ 'P' .
ENDIF .
ENDIF .
IF sep_emp IS NOT INITIAL .
SELECT SINGLE * FROM pa0041 INTO gs_pa0041 WHERE pernr = sep_emp . "AND ENDDA EQ '9991231'.
DO 4 TIMES
VARYING gv_dar01 FROM gs_pa0041-dar01 NEXT gs_pa0041-dar02
VARYING gv_dat01 FROM gs_pa0041-dat01 NEXT gs_pa0041-dat02.
IF gv_dar01 = 'Z9'.
gs_final-group_joining_date = gv_dat01.
ENDIF.
ENDDO.
ENDIF .
************************************
CLEAR : gv_dar01, gv_dat01 .
DO 4 TIMES
VARYING gv_dar01 FROM p0041-dar01 NEXT p0041-dar02
VARYING gv_dat01 FROM p0041-dat01 NEXT p0041-dat02.
IF gv_dar01 = 'Z1' OR gv_dar01 = 'ZM'.
gs_final-joining_date = gv_dat01.
ENDIF.
IF gv_dar01 = 'Z9'.
IF sep_emp IS INITIAL .
gs_final-group_joining_date = gv_dat01.
ELSE .
ENDIF .
ENDIF.
ENDDO.
*SOBID = P0001-PLANS.
*CALL FUNCTION 'RH_GET_LEADING_POSITION'
* EXPORTING
* plvar = '01'
* otype = 'S'
* sobid = SOBID
* DATE = SY-DATUM
* AUTH = 'X'
** BUFFER_MODE = ' '
** CONSIDER_VAC_POS = ' '
* TABLES
* leading_pos = LEADING_POS
* EXCEPTIONS
* NO_LEAD_POS_FOUND = 1
* OTHERS = 2
* .
*
*READ TABLE LEADING_POS INDEX 1.
*
*select SINGLE * from PA0001 into gs_PA0001 where PLANS = LEADING_POS-OBJID
* AND BEGDA <= PN-ENDDA
* AND ENDDA >= PN-BEGDA.
*
*IF gs_PA0001 IS NOT INITIAL.
* gs_final-emp_manager_id = GS_PA0001-PERNR.
* gs_final-emp_manager_name = GS_PA0001-ENAME.
*ENDIF.
* MOVE-CORRESPONDING gs_final TO gs_fin .
* INSERT INTO zhr_emp_table VALUES gs_fin.
* REFRESH gt_emp[] .
* SELECT * FROM zhr_emp_table INTO TABLE gt_emp WHERE emp_num = gs_final-emp_num .
* IF gt_emp[] IS NOT INITIAL .
* READ TABLE gt_emp INTO gs_emp INDEX 1 .
* IF gs_emp = gs_fin .
* reject .
* ENDIF .
* ENDIF .
* BREAK-POINT .
*** rp_provide_from_last p0028 '0010' pn-begda pn-endda .
*** IF pnp-sw-found EQ 1 .
*** gs_final-blood_group = p0028-wtf01 .
*** ENDIF .
* rp_provide_from_last p0028 '0001' pn-begda pn-endda .
* IF pnp-sw-found EQ 1 .
**** IF p0028-sbj08 EQ '08' .
**** gs_final-blood_group = p0028-wtf08 .
**** ENDIF .
* DATA: gv_sbj01 TYPE p0028-sbj01,
* gv_wtf01 TYPE p0028-wtf01.
* DO 15 TIMES
* VARYING gv_sbj01 FROM p0028-sbj01 NEXT p0028-sbj02
* VARYING gv_wtf01 FROM p0028-wtf01 NEXT p0028-wtf02.
*
* IF gv_sbj01 = '08'.
* SELECT SINGLE * FROM t578w INTO gs_t578w WHERE subty = '0001' AND sbjkt = '08' AND wtfld = gv_wtf01.
* IF sy-subrc EQ 0 .
* gs_final-blood_group = gs_t578w-stext .
* EXIT.
* ENDIF .
* ENDIF .
* CLEAR : gs_t578w.
* ENDDO.
* ENDIF .
* IF p0028-wtf08 IS NOT INITIAL .
* SELECT SINGLE * FROM t578w INTO gs_t578w WHERE subty = '0001' AND sbjkt = '08' AND wtfld = p0028-wtf08 .
* IF sy-subrc EQ 0 .
* CLEAR : gs_final-blood_group .
* gs_final-blood_group = gs_t578w-stext .
* ENDIF .
* ENDIF .
* CLEAR : gs_t578w.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = gs_final-emp_num
IMPORTING
output = gs_final-emp_num.
********* added by chellam - 06.07.2015
IF gs_final-emp_num IS INITIAL.
gs_final-emp_num = 'null'.
ENDIF.
IF gs_final-title IS INITIAL.
gs_final-title = 'null'.
ENDIF.
IF gs_final-first_name IS INITIAL.
gs_final-first_name = 'null'.
ENDIF.
IF gs_final-last_name IS INITIAL.
gs_final-last_name = 'null'.
ENDIF.
IF gs_final-calling_name IS INITIAL.
gs_final-calling_name = 'null'.
ENDIF.
IF gs_final-perm_country IS INITIAL.
gs_final-perm_country = 'null'.
ENDIF.
IF gs_final-prsnt_country IS INITIAL.
gs_final-prsnt_country = 'null'.
ENDIF.
IF gs_final-office_email IS INITIAL.
gs_final-office_email = 'null'.
ENDIF.
IF gs_final-emer_contact_person_relation IS INITIAL.
gs_final-emer_contact_person_relation = 'null'.
ENDIF.
IF gs_final-orgn_l1 IS INITIAL.
gs_final-orgn_l1 = 'null'.
ENDIF.
IF gs_final-sbu IS INITIAL.
gs_final-sbu = 'null'.
ENDIF.
IF gs_final-entity_name IS INITIAL.
gs_final-entity_name = 'null'.
ENDIF.
IF gs_final-entity_branch IS INITIAL.
gs_final-entity_branch = 'null'.
ENDIF.
IF gs_final-org_country IS INITIAL.
gs_final-org_country = 'null'.
ENDIF.
IF gs_final-org_city IS INITIAL.
gs_final-org_city = 'null'.
ENDIF.
IF gs_final-office IS INITIAL .
gs_final-office = 'null'.
ENDIF .
IF gs_final-grade IS INITIAL.
gs_final-grade = 'null'.
ENDIF.
IF gs_final-designation IS INITIAL.
gs_final-designation = 'null'.
ENDIF.
IF gs_final-ldap_login_name IS INITIAL.
gs_final-ldap_login_name = 'null'.
ENDIF.
IF gs_final-src_hire IS INITIAL.
gs_final-src_hire = 'null'.
ENDIF.
IF gs_final-rrf_id IS INITIAL.
gs_final-rrf_id = 'null'.
ENDIF.
IF gs_final-ldap_login_name IS INITIAL.
gs_final-ldap_login_name = 'null'.
ENDIF.
IF gs_final-domain_name IS INITIAL.
gs_final-domain_name = 'null'.
ENDIF.
IF gs_final-birth_date IS INITIAL.
gs_final-birth_date = 'null'.
ELSE.
CLEAR : lv_date.
IF gs_final-birth_date NE '00000000'.
lv_date = gs_final-birth_date.
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-birth_date = lv_date.
ENDIF.
ENDIF.
IF gs_final-gender IS INITIAL.
gs_final-gender = 'null'.
ENDIF.
IF gs_final-blood_group IS INITIAL.
gs_final-blood_group = 'null'.
ENDIF.
IF gs_final-religion IS INITIAL.
gs_final-religion = 'null'.
ENDIF.
IF gs_final-caste IS INITIAL .
gs_final-caste = 'null'.
ENDIF .
IF gs_final-rrf_id IS INITIAL .
gs_final-rrf_id = 'null'.
ENDIF .
IF gs_final-src_hire IS INITIAL .
gs_final-src_hire = 'null'.
ENDIF .
IF gs_final-marital_status IS INITIAL.
gs_final-marital_status = 'null'.
ENDIF.
IF gs_final-wedding_date IS INITIAL.
gs_final-wedding_date = 'null'.
ELSE.
CLEAR : lv_date.
IF gs_final-wedding_date NE '00000000'.
lv_date = gs_final-wedding_date .
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-wedding_date = lv_date.
ENDIF.
ENDIF.
IF gs_final-joining_date IS INITIAL.
gs_final-joining_date = 'null'.
ELSE.
CLEAR : lv_date.
IF gs_final-joining_date NE '00000000'.
lv_date = gs_final-joining_date .
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-joining_date = lv_date.
ENDIF.
ENDIF.
IF gs_final-group_joining_date IS INITIAL .
gs_final-group_joining_date = 'null'.
ELSE.
CLEAR : lv_date.
IF gs_final-group_joining_date NE '00000000'.
lv_date = gs_final-group_joining_date .
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-group_joining_date = lv_date.
ENDIF .
ENDIF.
IF gs_final-confirmation_date IS INITIAL.
gs_final-confirmation_date = 'null'.
ELSE.
CLEAR : lv_date.
IF gs_final-confirmation_date NE '00000000'.
lv_date = gs_final-confirmation_date.
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-confirmation_date = lv_date.
ENDIF.
ENDIF.
IF gs_final-probation_desc IS INITIAL.
gs_final-probation_desc = 'null'.
ENDIF.
IF gs_final-employment_type IS INITIAL.
gs_final-employment_type = 'null'.
ENDIF.
IF gs_final-emp_status IS INITIAL.
gs_final-emp_status = 'null'.
ENDIF.
IF gs_final-nationality IS INITIAL.
gs_final-nationality = 'null'.
ENDIF.
IF gs_final-emp_manager_id IS INITIAL .
gs_final-emp_manager_id = 'null'.
ENDIF .
IF gs_final-emp_manager_name IS INITIAL .
gs_final-emp_manager_name = 'null'.
ENDIF .
IF gs_final-emp_manager_mail_id IS INITIAL.
gs_final-emp_manager_mail_id = 'null'.
ENDIF.
********* end of added by chellam - 06.07.2015
IF gs_final-perm_addr_line1 IS INITIAL .
gs_final-perm_addr_line1 = 'null'.
ENDIF .
IF gs_final-perm_addr_line2 IS INITIAL .
gs_final-perm_addr_line2 = 'null'.
ENDIF .
IF gs_final-perm_addr_line3 IS INITIAL .
gs_final-perm_addr_line3 = 'null'.
ENDIF .
IF gs_final-perm_addr_landmark IS INITIAL .
gs_final-perm_addr_landmark = 'null'.
ENDIF .
IF gs_final-perm_city_name IS INITIAL .
gs_final-perm_city_name = 'null'.
ENDIF .
IF gs_final-perm_state_name IS INITIAL .
gs_final-perm_state_name = 'null'.
ENDIF .
IF gs_final-perm_country_code IS INITIAL .
gs_final-perm_country_code = 'null'.
ENDIF .
IF gs_final-perm_postal_code IS INITIAL .
gs_final-perm_postal_code = 'null'.
ENDIF .
IF gs_final-prsnt_addr_line1 IS INITIAL .
gs_final-prsnt_addr_line1 = 'null'.
ENDIF .
IF gs_final-prsnt_addr_line2 IS INITIAL .
gs_final-prsnt_addr_line2 = 'null'.
ENDIF .
IF gs_final-prsnt_addr_line3 IS INITIAL .
gs_final-prsnt_addr_line3 = 'null'.
ENDIF .
IF gs_final-prsnt_addr_landmark IS INITIAL .
gs_final-prsnt_addr_landmark = 'null'.
ENDIF .
IF gs_final-prsnt_city_name IS INITIAL .
gs_final-prsnt_city_name = 'null'.
ENDIF .
IF gs_final-prsnt_state_name IS INITIAL .
gs_final-prsnt_state_name = 'null'.
ENDIF .
IF gs_final-prsnt_country_code IS INITIAL .
gs_final-prsnt_country_code = 'null'.
ENDIF .
IF gs_final-prsnt_postal_code IS INITIAL .
gs_final-prsnt_postal_code = 'null'.
ENDIF .
IF gs_final-personal_mobile_num IS INITIAL .
gs_final-personal_mobile_num = 'null'.
ENDIF .
IF gs_final-personal_email IS INITIAL .
gs_final-personal_email = 'null'.
ENDIF .
IF gs_final-pan_id IS INITIAL .
gs_final-pan_id = 'null'.
ENDIF .
IF gs_final-office_mobile_num IS INITIAL .
gs_final-office_mobile_num = 'null'.
ENDIF .
IF gs_final-lwd IS INITIAL .
gs_final-lwd = 'null'.
ELSE.
CLEAR lv_date.
lv_date = gs_final-lwd.
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-lwd = lv_date.
ENDIF .
IF gs_final-exit_reason IS INITIAL .
gs_final-exit_reason = 'null'.
ENDIF .
IF gs_final-driving_license IS INITIAL .
gs_final-driving_license = 'null'.
ENDIF .
IF gs_final-aadhar_id IS INITIAL .
gs_final-aadhar_id = 'null'.
ENDIF .
IF gs_final-cost_center IS INITIAL .
gs_final-cost_center = 'null'.
ENDIF .
IF gs_final-cost_center_text IS INITIAL .
gs_final-cost_center_text = 'null'.
ENDIF .
APPEND gs_final TO gt_final .
CLEAR : gs_final .
ENDIF ."IF FLG = 'X'.
END-OF-SELECTION .
*BREAK-POINT .
*********** added by chellam - 29.06.2015
******* Outbound **************
DATA : cl_os_chrms_empdet_data TYPE REF TO zco_si_emp_master_ob_async.
DATA : output TYPE zmt_emp_master.
DATA : lo_sys_exception TYPE REF TO cx_ai_system_fault. " Reference variables exception class
*IF FLG = 'X'.
CLEAR: gt_final_v1[],gs_final_v1.
IF gt_final[] IS NOT INITIAL .
gt_final_v1[] = gt_final[].
gs_final_v1-emp_num = 'EMP_NUM'.
gs_final_v1-title = 'TITLE'.
gs_final_v1-first_name = 'FIRST_NAME'.
gs_final_v1-last_name = 'LAST_NAME'.
gs_final_v1-calling_name = 'CALLING_NAME'.
gs_final_v1-perm_country = 'PERM_COUNTRY'.
gs_final_v1-prsnt_country = 'PRSNT_COUNTRY'.
gs_final_v1-office_email = 'OFFICE_EMAIL'.
gs_final_v1-emer_contact_person_relation = 'EMER_CONTACT_PERSON_RELATION'.
gs_final_v1-orgn_l1 = 'ORGN_L1'.
gs_final_v1-sbu = 'SBU'.
gs_final_v1-entity_name = 'ENTITY_NAME'.
gs_final_v1-entity_branch = 'ENTITY_BRANCH'.
gs_final_v1-org_country = 'ORG_COUNTRY'.
gs_final_v1-org_city = 'ORG_CITY'.
gs_final_v1-office = 'OFFICE'.
gs_final_v1-grade = 'GRADE'.
gs_final_v1-designation = 'DESIGNATION'.
gs_final_v1-ldap_login_name = 'LDAP_LOGIN_NAME'.
gs_final_v1-domain_name = 'DOMAIN_NAME'.
gs_final_v1-birth_date = 'BIRTH_DATE'.
gs_final_v1-gender = 'GENDER'.
gs_final_v1-blood_group = 'BLOOD_GROUP'.
gs_final_v1-religion = 'RELIGION'.
gs_final_v1-caste = 'CASTE'.
gs_final_v1-marital_status = 'MARITAL_STATUS'.
gs_final_v1-wedding_date = 'WEDDING_DATE'.
gs_final_v1-joining_date = 'JOINING_DATE'.
gs_final_v1-group_joining_date = 'GROUP_JOINING_DATE'.
gs_final_v1-confirmation_date = 'CONFIRMATION_DATE'.
gs_final_v1-probation_desc = 'PROBATION_DESC'.
gs_final_v1-employment_type = 'EMPLOYMENT_TYPE'.
gs_final_v1-emp_status = 'EMP_STATUS'.
gs_final_v1-nationality = 'NATIONALITY'.
gs_final_v1-emp_manager_id = 'EMP_MANAGER_ID'.
gs_final_v1-emp_manager_name = 'EMP_MANAGER_NAME'.
gs_final_v1-emp_manager_mail_id = 'EMP_MANAGER_MAIL_ID'.
gs_final_v1-perm_addr_line1 = 'PERM_ADDR_LINE1' .
gs_final_v1-perm_addr_line2 = 'PERM_ADDR_LINE2'.
gs_final_v1-perm_addr_line3 = 'PERM_ADDR_LINE3'.
gs_final_v1-perm_addr_landmark = 'PERM_ADDR_LANDMARK'.
gs_final_v1-perm_city_name = 'PERM_CITY_NAME' .
gs_final_v1-perm_state_name = 'PERM_STATE_NAME' .
gs_final_v1-perm_country_code = 'PERM_COUNTRY_CODE' .
gs_final_v1-perm_postal_code = 'PERM_POSTAL_CODE' .
gs_final_v1-prsnt_addr_line1 = 'PRSNT_ADDR_LINE1' .
gs_final_v1-prsnt_addr_line2 = 'PRSNT_ADDR_LINE2' .
gs_final_v1-prsnt_addr_line3 = 'PRSNT_ADDR_LINE3' .
gs_final_v1-prsnt_addr_landmark = 'PRSNT_ADDR_LANDMARK' .
gs_final_v1-prsnt_city_name = 'PRSNT_CITY_NAME' .
gs_final_v1-prsnt_state_name = 'PRSNT_STATE_NAME' .
gs_final_v1-prsnt_country_code = 'PRSNT_COUNTRY_CODE' .
gs_final_v1-prsnt_postal_code = 'PRSNT_POSTAL_CODE' .
gs_final_v1-personal_mobile_num = 'PERSONAL_MOBILE_NUM' .
gs_final_v1-office_mobile_num = 'OFFICE_MOBILE_NUM' .
gs_final_v1-personal_email = 'PERSONAL_EMAIL' .
gs_final_v1-pan_id = 'PAN_ID' .
gs_final_v1-rrf_id = 'RRF_ID' .
gs_final_v1-src_hire = 'SRC_HIRE' .
gs_final_v1-lwd = 'LWD'.
gs_final_v1-exit_reason = 'EXIT_REASON'.
gs_final_v1-driving_license = 'DRIVING_LICENSE'.
gs_final_v1-aadhar_id = 'AADHAR_ID'.
gs_final_v1-cost_center = 'COST_CENTER'.
gs_final_v1-cost_center_text = 'COST_CENTER_TEXT'.
INSERT gs_final_v1 INTO gt_final_v1 INDEX 1.
ENDIF .
* LOOP AT gt_final INTO gs_final.
* IF sy-tabix = 1.
*
* INSERT gs_final_v1 INTO gt_final_v1 INDEX 1.
* ELSE.
* gs_final_v1-emp_num = gs_final-emp_num.
* gs_final_v1-title = gs_final-title.
* gs_final_v1-first_name = gs_final-first_name.
* gs_final_v1-last_name = gs_final-last_name.
* gs_final_v1-calling_name = gs_final-calling_name.
* gs_final_v1-perm_country = gs_final-perm_country.
* gs_final_v1-prsnt_country = gs_final-prsnt_country.
* gs_final_v1-office_email = gs_final-office_email.
* gs_final_v1-emer_contact_person_relation = gs_final-emer_contact_person_relation.
* gs_final_v1-orgn_l1 = gs_final-orgn_l1.
* gs_final_v1-sbu = gs_final-sbu.
* gs_final_v1-entity_name = gs_final-entity_name .
* gs_final_v1-entity_branch = gs_final-entity_branch.
* gs_final_v1-org_country = gs_final-org_country .
* gs_final_v1-org_city = gs_final-org_city .
* gs_final_v1-office = gs_final-office .
* gs_final_v1-grade = gs_final-grade.
* gs_final_v1-designation = gs_final-designation.
* gs_final_v1-ldap_login_name = gs_final-ldap_login_name.
* gs_final_v1-domain_name = gs_final-domain_name.
* gs_final_v1-birth_date = gs_final-birth_date.
* gs_final_v1-gender = gs_final-birth_date.
* gs_final_v1-blood_group = gs_final-blood_group .
* gs_final_v1-religion = gs_final-religion .
* gs_final_v1-caste = gs_final-caste .
* gs_final_v1-marital_status = gs_final-marital_status.
* gs_final_v1-wedding_date = gs_final-wedding_date.
* gs_final_v1-joining_date = gs_final-joining_date .
* gs_final_v1-group_joining_date = gs_final-group_joining_date.
* gs_final_v1-confirmation_date = gs_final-confirmation_date.
* gs_final_v1-probation_desc = gs_final-probation_desc.
* gs_final_v1-employment_type = gs_final-employment_type.
* gs_final_v1-emp_status = gs_final-emp_status.
* gs_final_v1-nationality = gs_final-nationality.
* gs_final_v1-emp_manager_id = gs_final-emp_manager_id.
* gs_final_v1-emp_manager_name = gs_final-emp_manager_name.
* gs_final_v1-emp_manager_mail_id = gs_final-emp_manager_mail_id .
*
* APPEND gs_final_v1 TO gt_final_v1.
* ENDIF.
* CLEAR : gs_final_v1,gs_final.
* ENDLOOP.
IF gt_final_v1[] IS NOT INITIAL.
MOVE-CORRESPONDING gt_final_v1 TO output-mt_emp_master-header.
TRY.
CREATE OBJECT cl_os_chrms_empdet_data.
CATCH cx_ai_system_fault.
ENDTRY.
ENDIF.
IF output-mt_emp_master-header IS NOT INITIAL.
TRY.
CALL METHOD cl_os_chrms_empdet_data->si_emp_master_ob_async
EXPORTING
output = output.
CATCH cx_ai_system_fault INTO lo_sys_exception.
ENDTRY.
COMMIT WORK.
ENDIF.
*REPORT zhrcss_ghrms_emp_master.
*&---------------------------------------------------------------------*
*& Include ZHRCSS_GHRMS_REPORT_TOP
*&---------------------------------------------------------------------*
TABLES : pernr , t500p , t001p,t578w .
INFOTYPES : 0000, 0001, 0002, 0006, 0008, 0016, 0021, 0027,
0028, 0041, 0105, 0185, 0804, 9011, 9013.
TYPES : BEGIN OF ty_final,
emp_num TYPE pernr_d,
title TYPE pa0002-titel,
first_name TYPE pa0002-vorna,
last_name TYPE pa0002-nachn,
calling_name TYPE pa0002-rufnm,
perm_country TYPE pa0006-land1,
prsnt_country TYPE pa0006-land1,
office_email TYPE pa0105-usrid_long,
emer_contact_person_relation TYPE pa0021-favor,
orgn_l1 TYPE p0001-orgeh,
sbu TYPE p0001-orgeh,
entity_name TYPE t500p-name1,
entity_branch TYPE t001p-btext,
org_country TYPE t005t-landx,
org_city TYPE t500p-ort01,
* office
grade TYPE pa0008-trfgr,
designation TYPE stext,
ldap_login_name TYPE pa0105-usrid_long,
domain_name TYPE char20,
birth_date TYPE pa0002-gbdat,
gender TYPE char10,
blood_group TYPE pa0028-wtf01,
religion TYPE pa0002-konfe,
* caste TYPE
marital_status TYPE char10,
wedding_date TYPE pa0002-famdt,
joining_date TYPE pa0041-dat01,
* group_joining_date
confirmation_date TYPE pa0000-begda,
probation_desc TYPE char20, "pa0016 - PRBZT PRBEH
employment_type TYPE pa0001-persk,
emp_status TYPE pa0000-stat2,
nationality TYPE t005t-landx,
* Emp_manager_id TYPE
* Emp_manager_name
emp_manager_mail_id TYPE pa0105-usrid_long,
lwd TYPE pa0000-begda,
exit_reason TYPE mgtxt,
driving_license TYPE pa0185-ictyp,
aadhar_id TYPE pa0185-ictyp,
cost_center TYPE pa0027-kst01,
cost_center_text TYPE ktext,
END OF ty_final .
DATA : gt_hrp1001 TYPE TABLE OF hrp1001,
gs_hrp1001 TYPE hrp1001,
gs_hrp10012 TYPE hrp1001,
gt_hrp1000 TYPE TABLE OF hrp1000,
gs_hrp1000 TYPE hrp1000,
gs_pa0001 TYPE pa0001,
gs_t578w TYPE t578w,sep_emp TYPE hrp1001-sobid,gs_pa0041 TYPE pa0041.
TYPES : BEGIN OF ty_fin ,
emp_num TYPE string,
title TYPE string,
first_name TYPE string,
last_name TYPE string,
calling_name TYPE string,
END OF ty_fin .
************ added by chellam - 30.06.2015
TYPES : BEGIN OF ty_final_v1,
emp_num TYPE string,
title TYPE string,
first_name TYPE string,
last_name TYPE string,
calling_name TYPE string,
perm_country TYPE string,
prsnt_country TYPE string,
office_email TYPE string,
emer_contact_person_relation TYPE string,
orgn_l1 TYPE string,
sbu TYPE string,
entity_name TYPE string,
entity_branch TYPE string,
org_country TYPE string,
org_city TYPE string,
office TYPE string,
grade TYPE string,
designation TYPE string,
ldap_login_name TYPE string,
domain_name TYPE string,
birth_date TYPE string,
gender TYPE string,
blood_group TYPE string,
religion TYPE string,
caste TYPE string,
marital_status TYPE string,
wedding_date TYPE string,
joining_date TYPE string,
group_joining_date TYPE string,
confirmation_date TYPE string,
probation_desc TYPE string,
employment_type TYPE string,
emp_status TYPE string,
nationality TYPE string,
emp_manager_id TYPE string,
emp_manager_name TYPE string,
emp_manager_mail_id TYPE string,
********** NEWLY ADDED FIELDS
perm_addr_line1 TYPE string,
perm_addr_line2 TYPE string,
perm_addr_line3 TYPE string,
perm_addr_landmark TYPE string,
perm_city_name TYPE string,
perm_state_name TYPE string,
perm_country_code TYPE string,
perm_postal_code TYPE string,
prsnt_addr_line1 TYPE string,
prsnt_addr_line2 TYPE string,
prsnt_addr_line3 TYPE string,
prsnt_addr_landmark TYPE string,
prsnt_city_name TYPE string,
prsnt_state_name TYPE string,
prsnt_country_code TYPE string,
prsnt_postal_code TYPE string,
personal_mobile_num TYPE string,
office_mobile_num TYPE string,
personal_email TYPE string,
pan_id TYPE string,
rrf_id TYPE string,
src_hire TYPE string,
lwd TYPE string,
exit_reason TYPE string,
driving_license TYPE string,
aadhar_id TYPE string,
cost_center TYPE string,
cost_center_text TYPE string,
END OF ty_final_v1.
DATA : gt_final_v1 TYPE TABLE OF ty_final_v1,
gs_final_v1 TYPE ty_final_v1.
************ end of added by chellam - 30.06.2015
DATA : gt_final TYPE TABLE OF ty_final_v1,
gs_final TYPE ty_final_v1,
* gs_fin TYPE zhr_emp_table,
* gt_emp TYPE TABLE OF zhr_emp_table,
* gs_emp TYPE zhr_emp_table,
flg TYPE char1.
DATA : lv_plans TYPE pa0001-plans .
DATA : it_hrp1001 TYPE TABLE OF hrp1001 WITH HEADER LINE .
DATA : lv_date TYPE char10.
DATA : gt_fcat TYPE slis_t_fieldcat_alv,wa_hrp1001 TYPE hrp1001,
gs_fcat TYPE slis_fieldcat_alv,
gt_layout TYPE slis_layout_alv.
DATA : gv_l1 TYPE string,
gv_l2 TYPE string,
gv_l3 TYPE string,
gv_l4 TYPE string,
gv_date TYPE d.
DATA : gt_str TYPE TABLE OF objec WITH HEADER LINE .
DATA : gt_t500p TYPE TABLE OF t500p,
gs_t500p TYPE t500p,
gt_t001p TYPE TABLE OF t001p,
gs_t001p TYPE t001p,
gt_t005t TYPE TABLE OF t005t,
gs_t005t TYPE t005t,
gt_t503t TYPE TABLE OF t503t,
gs_t503t TYPE t503t,lv_cttyp TYPE cttyp,conf_dt TYPE begda .
DATA : gv_position TYPE stext,
gv_orgeh TYPE pa0001-orgeh,
gv_plans TYPE pa0001-plans,
gv_persa TYPE pa0001-werks,
gv_cost TYPE pa0027-kst01,
gv_cost_txt TYPE ktext,
gv_cost_per TYPE pkprz,
gv_cost_per1 TYPE string,
lv_domain TYPE char20,
lv_domain_new TYPE char20.
DATA: gt_t522t TYPE t522t OCCURS 0 WITH HEADER LINE,
gt_t578x TYPE t578x OCCURS 0 WITH HEADER LINE,
gt_t516t TYPE t516t OCCURS 0 WITH HEADER LINE.
* AT SELECTION-SCREEN .
SELECT * FROM t500p INTO CORRESPONDING FIELDS OF TABLE gt_t500p WHERE molga EQ '40' .
SELECT * FROM t001p INTO CORRESPONDING FIELDS OF TABLE gt_t001p WHERE molga EQ '40' .
SELECT * FROM t005t INTO CORRESPONDING FIELDS OF TABLE gt_t005t WHERE spras EQ 'EN' .
SELECT * FROM t522t INTO CORRESPONDING FIELDS OF TABLE gt_t522t WHERE sprsl EQ 'E' .
SELECT * FROM t516t INTO CORRESPONDING FIELDS OF TABLE gt_t516t WHERE sprsl EQ 'E' .
SELECT * FROM t503t INTO CORRESPONDING FIELDS OF TABLE gt_t503t WHERE sprsl EQ sy-langu .
SELECT * FROM t578x INTO CORRESPONDING FIELDS OF TABLE gt_t578x.
GET pernr .
****************** CHECKING FOR Z1 AND ZZ ACTION EMPLOYEES ALONE
*PROVIDE * FROM p0000 BETWEEN pn-begda AND pn-endda .
*
* IF p0000-massn EQ 'Z1' OR p0000-massn EQ 'ZZ' OR p0000-massn EQ 'ZM' OR p0000-massn EQ 'Z3' OR p0000-massn EQ 'ZA' OR p0000-massn EQ 'Z2' .
*
*
* ELSE .
* REJECT.
* ENDIF .
*ENDPROVIDE .
******************
CLEAR: flg,wa_hrp1001.
SORT p0001[] BY aedtm DESCENDING .
rp_provide_from_last p0001 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0001-aedtm >= pn-begda AND p0001-aedtm <= pn-endda .
IF p0001-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
*****manager change check
SELECT SINGLE * FROM hrp1001 INTO wa_hrp1001 WHERE otype EQ 'S'
AND objid EQ p0001-plans
AND plvar EQ '01'
AND subty EQ 'A002'
AND endda EQ '99991231'
AND aedtm >= pn-begda
AND aedtm <= pn-endda.
IF wa_hrp1001 IS NOT INITIAL .
IF wa_hrp1001-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
SORT p0002[] BY aedtm DESCENDING .
rp_provide_from_last p0002 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0002-aedtm >= pn-begda AND p0002-aedtm <= pn-endda .
IF p0002-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0006[] BY aedtm DESCENDING .
rp_provide_from_last p0006 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0006-aedtm >= pn-begda AND p0006-aedtm <= pn-endda .
IF p0006-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
*SORT p0008[] BY aedtm DESCENDING .
*rp_provide_from_last p0008 space pn-begda pn-endda .
*IF pnp-sw-found EQ 1 .
* IF p0008-aedtm >= pn-begda AND p0008-aedtm <= pn-endda .
* flg = 'X'.
* ENDIF .
*ENDIF .
**********************added code for log report change at infotype level ,
DATA : st_log TYPE hreic_s_logkey,
gt_tab TYPE TABLE OF pldoc_key,
gs_tab TYPE pldoc_key,
gs_det TYPE pldoc_key,
gt_status TYPE TABLE OF hrinftylog_fields,
gs_status TYPE hrinftylog_fields,
gt_temp_before TYPE TABLE OF prelp WITH HEADER LINE,
gt_temp_after TYPE TABLE OF prelp WITH HEADER LINE.
CLEAR : st_log , gt_tab[], gs_status, gs_det,gt_status[],gs_tab,gt_temp_before[],gt_temp_after[].
st_log-enddate = sy-datum .
st_log-startdate = sy-datum.
st_log-pernr = pernr-pernr .
CALL FUNCTION 'HREIC_GET_LOGGED_INFTY_CHANGES'
EXPORTING
is_log_key = st_log
IMPORTING
et_infty_modif = gt_tab.
*CLEAR : GS_DET .
IF gt_tab[] IS NOT INITIAL .
READ TABLE gt_tab INTO gs_tab WITH KEY bdate = sy-datum
infty = '0008'.
IF sy-subrc EQ 0 .
gs_det-relid = gs_tab-relid .
gs_det-tclas = gs_tab-tclas .
gs_det-pernr = gs_tab-pernr .
gs_det-infty = gs_tab-infty .
gs_det-bdate = gs_tab-bdate .
gs_det-btime = gs_tab-btime .
gs_det-seqnr = gs_tab-seqnr .
CALL FUNCTION 'HR_INFOTYPE_LOG_GET_DETAIL'
EXPORTING
logged_infotype = gs_det
auth_check = 'X'
* USE_ARCHIVE = ' '
* IMPORTING
* SUBRC =
TABLES
infty_tab_before = gt_temp_before
infty_tab_after = gt_temp_after
fields = gt_status.
READ TABLE gt_status INTO gs_status WITH KEY fname = 'TRFGR' .
IF sy-subrc EQ 0.
flg = 'X' .
ENDIF .
ENDIF .
ENDIF .
**********************
SORT p0028[] BY aedtm DESCENDING .
rp_provide_from_last p0028 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0028-aedtm >= pn-begda AND p0028-aedtm <= pn-endda .
IF p0028-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0027[] BY aedtm DESCENDING .
rp_provide_from_last p0027 '01' pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0027-aedtm >= pn-begda AND p0027-aedtm <= pn-endda .
IF p0027-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0041[] BY aedtm DESCENDING .
rp_provide_from_last p0041 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0041-aedtm >= pn-begda AND p0041-aedtm <= pn-endda .
IF p0041-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0000[] BY aedtm DESCENDING .
rp_provide_from_last p0000 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0000-aedtm >= pn-begda AND p0000-aedtm <= pn-endda .
IF p0000-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
*IF p0000-stat2 EQ '0'. " Chella 07.12.2016
* REJECT .
*ENDIF .
SORT p0185[] BY aedtm DESCENDING .
rp_provide_from_last p0185 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0185-aedtm >= pn-begda AND p0185-aedtm <= pn-endda .
IF p0185-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0105[] BY aedtm DESCENDING .
rp_provide_from_last p0105 '0010' pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0105-aedtm >= pn-begda AND p0105-aedtm <= pn-endda .
IF p0105-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0021[] BY aedtm DESCENDING .
rp_provide_from_last p0021 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0021-aedtm >= pn-begda AND p0021-aedtm <= pn-endda .
IF p0021-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
****Chella
*IF flg = 'X'.
* IF wa_hrp1001-uname = 'CUTOVERHR'
* AND p0000-uname = 'CUTOVERHR'
* AND p0001-uname = 'CUTOVERHR'
* AND p0002-uname = 'CUTOVERHR'
* AND p0006-uname = 'CUTOVERHR'
* AND p0028-uname = 'CUTOVERHR'
* AND p0041-uname = 'CUTOVERHR'
* AND p0185-uname = 'CUTOVERHR'
* AND p0105-uname = 'CUTOVERHR'
* AND p0021-uname = 'CUTOVERHR'.
* CLEAR flg.
* ENDIF .
*ENDIF.
***chella
IF flg = 'X'.
DATA: gt_pa0001 TYPE TABLE OF pa0001,
gs_pa0001 TYPE pa0001,
leading_pos TYPE hrobject OCCURS 0 WITH HEADER LINE,
gs_pa0105 TYPE pa0105,
sobid TYPE hrsobid-sobid.
gs_final-emp_num = pernr-pernr .
rp_provide_from_last p0000 space pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-emp_status = p0000-stat2 .
IF p0000-massn = 'Z3'.
CLEAR gv_date.
gs_final-lwd = gv_date = p0000-begda - 1.
SELECT SINGLE mgtxt FROM t530t INTO gs_final-exit_reason
WHERE sprsl = 'E' AND massn = p0000-massn
AND massg = p0000-massg.
IF sy-subrc NE 0 .
CLEAR gs_final-exit_reason.
ENDIF.
ENDIF.
ENDIF.
rp_provide_from_last p0027 '01' pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
DO 25 TIMES VARYING gv_cost FROM p0027-kst01 NEXT p0027-kst02
VARYING gv_cost_per FROM p0027-kpr01 NEXT p0027-kpr02.
IF gv_cost IS NOT INITIAL.
CLEAR gv_cost_txt.
SELECT SINGLE ktext FROM cskt INTO gv_cost_txt
WHERE spras = 'E'
AND kostl = gv_cost AND datbi >= sy-datum.
IF gs_final-cost_center_text IS INITIAL.
gs_final-cost_center_text = gv_cost_txt.
ELSE.
CONCATENATE gs_final-cost_center_text '##!' gv_cost_txt INTO gs_final-cost_center_text.
ENDIF.
gv_cost_per1 = gv_cost_per.
IF gs_final-cost_center IS INITIAL.
CONCATENATE gv_cost '&!#' gv_cost_per1 INTO gs_final-cost_center.
ELSE.
CONCATENATE gs_final-cost_center '##!' gv_cost_per1 INTO gs_final-cost_center.
ENDIF.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-cost_center WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-cost_center_text WITH space.
*** rp_provide_from_last p0000 'Z5' pn-begda pn-endda . " EMAIL
*** IF pnp-sw-found EQ 1 .
*** gs_final-probation_desc = 'Confirmed' .
*** gs_final-confirmation_date = p0000-begda .
*** ELSE .
*** gs_final-probation_desc = 'Probation' .
*** ENDIF.
**** ENDIF .
* READ TABLE gt_t005t INTO gs_t005t WITH KEY land1 = p0002-natio .
* IF sy-subrc EQ 0 .
***********************************PROBATION
CLEAR : lv_cttyp , conf_dt .
rp_provide_from_last p0016 space pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
lv_cttyp = p0016-cttyp .
ENDIF.
IF lv_cttyp EQ '10' .
gs_final-probation_desc = lv_cttyp .
ELSEIF lv_cttyp EQ '11' .
gs_final-probation_desc = lv_cttyp .
* SELECT SINGLE BEGDA FROM PA0000 INTO CONF_DT WHERE MASSN EQ 'Z5'.
READ TABLE p0000[] INTO p0000 WITH KEY massn = 'Z5'.
gs_final-confirmation_date = p0000-begda.
* SELECT SINGLE BEGDA FROM PA0000 INTO gs_final-confirmation_date WHERE MASSN EQ 'Z5'.
ENDIF .
rp_provide_from_last p0002 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
* READ TABLE gt_t522t WITH KEY anred = p0002-anred.
* IF sy-subrc = 0.
* gs_final-title = gt_t522t-atext .
* ENDIF.
gs_final-title = p0002-anred .
gs_final-first_name = p0002-vorna .
gs_final-last_name = p0002-nachn .
gs_final-calling_name = p0002-rufnm .
gs_final-birth_date = p0002-gbdat .
IF p0002-gesch EQ '1' .
gs_final-gender = 'Male'.
ELSEIF p0002-gesch EQ '2' .
gs_final-gender = 'Female'.
ELSEIF p0002-gesch EQ '3' .
gs_final-gender = 'Transgender'.
ENDIF .
* READ TABLE gt_t516t INTO gt_t516t WITH KEY konfe = p0002-konfe .
* IF sy-subrc EQ 0 .
* gs_final-religion = gt_t516t-ktext .
* ENDIF .
gs_final-religion = p0002-konfe .
IF p0002-famst EQ 0 .
gs_final-marital_status = 'Single'.
ELSEIF p0002-famst EQ 1 .
gs_final-marital_status = 'Married'.
ENDIF .
IF p0002-famdt NE '00000000'.
gs_final-wedding_date = p0002-famdt .
ENDIF .
IF p0002-natio IS NOT INITIAL .
gs_final-nationality = p0002-natio .
READ TABLE gt_t005t INTO gs_t005t WITH KEY land1 = p0002-natio .
IF sy-subrc EQ 0 .
* gs_final-nationality = gs_t005t-landx .
* gs_final-nationality = p0002-natio .
ENDIF .
ENDIF .
ENDIF .
CLEAR : gs_t005t .
rp_provide_from_last p0006 '1' pn-begda pn-endda . "PERMANENT ADDR
IF pnp-sw-found EQ 1 .
gs_final-perm_addr_line1 = p0006-name2 .
gs_final-perm_addr_line2 = p0006-stras .
gs_final-perm_addr_line3 = p0006-locat .
gs_final-perm_city_name = p0006-ort01 .
SELECT SINGLE bezei FROM t005u INTO gs_final-perm_state_name WHERE land1 EQ p0006-land1 AND bland EQ p0006-state AND spras EQ 'EN'.
* gs_final-perm_state_name = p0006-state .
gs_final-perm_country_code = p0006-land1 .
gs_final-perm_postal_code = p0006-pstlz .
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_city_name WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_state_name WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_country_code WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_postal_code WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_addr_line1 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_addr_line2 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_addr_line3 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN p0006-hsnmr WITH space.
CONCATENATE p0006-hsnmr ' ' gs_final-perm_addr_line2 INTO gs_final-perm_addr_line2 SEPARATED BY space . .
* gs_final-perm_addr_landmark =
* gs_final-prsnt_addr_line1 = p0006-name2 .
*
* gs_final-prsnt_addr_line2 = p0006-stras.
* gs_final-prsnt_addr_line3 = p0006-locat.
** GS_FINAL-PRSNT_ADDR_LANDMARK.
* gs_final-prsnt_city_name = p0006-ort01.
* gs_final-prsnt_state_name = p0006-state.
* gs_final-prsnt_country_code = p0006-land1.
* gs_final-prsnt_postal_code = p0006-pstlz.
READ TABLE gt_t005t INTO gs_t005t WITH KEY land1 = p0006-land1 .
IF sy-subrc EQ 0 .
* gs_final-perm_country = gs_t005t-landx . "p0006-land1 .
gs_final-perm_country = p0006-land1 .
ENDIF .
ENDIF .
CLEAR : gs_t005t.
rp_provide_from_last p0006 '2' pn-begda pn-endda . "TEMPORARY ADDR
IF pnp-sw-found EQ 1 .
gs_final-prsnt_addr_line1 = p0006-name2 .
gs_final-prsnt_addr_line2 = p0006-stras.
gs_final-prsnt_addr_line3 = p0006-locat.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_addr_line1 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_addr_line2 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_addr_line3 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN p0006-hsnmr WITH space.
* GS_FINAL-PRSNT_ADDR_LANDMARK.
CONCATENATE p0006-hsnmr ' ' gs_final-prsnt_addr_line2 INTO gs_final-prsnt_addr_line2 SEPARATED BY space .
*
gs_final-prsnt_city_name = p0006-ort01.
SELECT SINGLE bezei FROM t005u INTO gs_final-prsnt_state_name WHERE land1 EQ p0006-land1 AND bland EQ p0006-state AND spras EQ 'EN'.
* gs_final-prsnt_state_name = p0006-state.
gs_final-prsnt_country_code = p0006-land1.
gs_final-prsnt_postal_code = p0006-pstlz.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_city_name WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_city_name WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_country_code WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_postal_code WITH space.
READ TABLE gt_t005t INTO gs_t005t WITH KEY land1 = p0006-land1 .
IF sy-subrc EQ 0 .
* gs_final-prsnt_country = gs_t005t-landx."p0006-land1 .
gs_final-prsnt_country = p0006-land1 .
ENDIF .
ENDIF .
CLEAR : gs_t005t.
rp_provide_from_last p0105 '0010' pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
* IF p0105-usrty = '0010' .
gs_final-office_email = p0105-usrid_long .
* ENDIF.
ENDIF .
rp_provide_from_last p0105 'CELL' pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-personal_mobile_num = p0105-usrid .
ENDIF .
rp_provide_from_last p0105 'MAIL' pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-personal_email = p0105-usrid .
ENDIF .
rp_provide_from_last p0105 'MPHN' pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-office_mobile_num = p0105-usrid .
ENDIF .
rp_provide_from_last p0185 '02' pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-pan_id = p0185-icnum .
ENDIF .
rp_provide_from_last p0185 '06' pn-begda pn-endda . " Aadhar Card No.
IF pnp-sw-found EQ 1 .
gs_final-aadhar_id = p0185-icnum .
ENDIF .
rp_provide_from_last p0185 'Z3' pn-begda pn-endda . " Driving License
IF pnp-sw-found EQ 1 .
gs_final-driving_license = p0185-icnum .
ENDIF .
rp_provide_from_last p9013 space pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-rrf_id = p9013-rrf .
gs_final-src_hire = p9013-source .
ENDIF .
rp_provide_from_last p0804 space pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-blood_group = p0804-bgrup .
ENDIF .
********************
IF gs_final-office_email IS NOT INITIAL .
gs_final-ldap_login_name = gs_final-office_email .
SPLIT gs_final-office_email AT '@' INTO lv_domain lv_domain_new.
CONCATENATE '@' lv_domain_new INTO gs_final-domain_name .
CONDENSE gs_final-domain_name .
ENDIF .
CLEAR : gv_orgeh , gv_persa ,gv_plans.
rp_provide_from_last p0001 space pn-begda pn-endda . "organisational unit text
IF pnp-sw-found EQ 1 .
gv_orgeh = p0001-orgeh .
gv_plans = p0001-plans .
gv_persa = p0001-werks .
gs_final-orgn_l1 = gv_orgeh . " org unit
gs_final-entity_name = p0001-werks.
gs_final-entity_branch = p0001-btrtl .
gs_final-office = p0001-btrtl.
gs_final-employment_type = p0001-persk .
* CLEAR: gs_t503t.
* READ TABLE gt_t503t INTO gs_t503t WITH KEY persk = p0001-persk .
* IF sy-subrc = 0.
* gs_final-employment_type = gs_t503t-ptext.
* ENDIF.
ENDIF .
CLEAR : lv_plans .
REFRESH : it_hrp1001[] .
sobid = p0001-plans.
CALL FUNCTION 'RH_GET_LEADING_POSITION'
EXPORTING
plvar = '01'
otype = 'S'
sobid = sobid
date = sy-datum
auth = 'X'
* BUFFER_MODE = ' '
* CONSIDER_VAC_POS = ' '
TABLES
leading_pos = leading_pos
EXCEPTIONS
no_lead_pos_found = 1
OTHERS = 2.
READ TABLE leading_pos INDEX 1.
IF leading_pos-objid NE '00000000'.
SELECT SINGLE * FROM pa0001 INTO gs_pa0001 WHERE plans = leading_pos-objid
* AND begda <= pn-endda "Chella
* AND endda >= pn-begda.
AND endda = '99991231'. "Chella 28.06.2016
IF gs_pa0001 IS NOT INITIAL.
gs_final-emp_manager_id = gs_pa0001-pernr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = gs_final-emp_manager_id
IMPORTING
output = gs_final-emp_manager_id.
IF wa_hrp1001-begda NE '00000000' .
* CLEAR : gs_final-emp_manager_id .
CONCATENATE gs_final-emp_manager_id '$' wa_hrp1001-begda+0(4) '-' wa_hrp1001-begda+4(2) '-' wa_hrp1001-begda+6(2) INTO gs_final-emp_manager_id .
CONDENSE gs_final-emp_manager_id NO-GAPS .
ELSE .
CLEAR : it_hrp1001 .
SELECT SINGLE plans FROM pa0001 INTO lv_plans WHERE pernr EQ pernr-pernr AND endda EQ '99991231' .
IF lv_plans IS NOT INITIAL .
SELECT * FROM hrp1001 INTO CORRESPONDING FIELDS OF TABLE it_hrp1001 WHERE otype EQ 'S' AND objid EQ lv_plans .
READ TABLE it_hrp1001 WITH KEY rsign = 'A' relat = '002' endda = '99991231'.
IF sy-subrc EQ 0 .
.
CONCATENATE gs_final-emp_manager_id '$' it_hrp1001-begda+0(4) '-' it_hrp1001-begda+4(2) '-' it_hrp1001-begda+6(2) INTO gs_final-emp_manager_id .
CONDENSE gs_final-emp_manager_id NO-GAPS .
ENDIF .
ENDIF .
ENDIF .
gs_final-emp_manager_name = gs_pa0001-ename.
ENDIF.
SELECT SINGLE * FROM pa0105 INTO gs_pa0105 WHERE pernr = gs_pa0001-pernr
AND subty = '0010'
AND begda <= pn-endda
AND endda >= pn-begda.
IF gs_pa0105 IS NOT INITIAL. .
gs_final-emp_manager_mail_id = gs_pa0105-usrid_long .
ENDIF .
ENDIF .
CLEAR: gs_pa0105, gs_pa0001, leading_pos, sobid.
*
* CLEAR: gs_pa0105, gs_pa0001, leading_pos, sobid.
CLEAR : gs_pa0001 ,gs_hrp10012,gs_hrp1001.
***************
rp_provide_from_last p0021 space pn-begda pn-endda . "
IF pnp-sw-found EQ 1 ."FAMSA
* SELECT SINGLE stext FROM t591s INTO gs_final-emer_contact_person_relation WHERE sprsl EQ 'EN' AND infty EQ '0021' AND subty = p0021-famsa
.
gs_final-emer_contact_person_relation = p0021-famsa .
ENDIF .
CLEAR : gs_t001p , gs_t500p .
READ TABLE gt_t001p INTO gs_t001p WITH KEY werks = p0001-werks
btrtl = p0001-btrtl .
IF sy-subrc EQ 0 .
* gs_final-entity_branch = gs_t001p-btext .
ENDIF .
CLEAR : gs_t001p.
READ TABLE gt_t001p INTO gs_t001p WITH KEY btrtl = p0001-btrtl .
IF sy-subrc EQ 0 .
* gs_final-office = gs_t001p-btext ." for office name
ENDIF .
READ TABLE gt_t500p INTO gs_t500p WITH KEY persa = p0001-werks .
IF sy-subrc EQ 0 .
* gs_final-entity_name = gs_t500p-name1 .
READ TABLE gt_t005t INTO gs_t005t WITH KEY land1 = gs_t500p-land1 .
IF sy-subrc EQ 0 .
* gs_final-org_country = gs_t005t-landx.
gs_final-org_country = gs_t500p-land1 .
ENDIF .
gs_final-org_city = gs_t500p-ort01.
ENDIF.
** ENDIF
****org unit ***
* DATA : lv_sobid TYPE string .
* SELECT * FROM hrp1001 INTO TABLE gt_hrp1001 WHERE otype = 'O'
* AND plvar = '01'
* AND begda <= pn-endda AND endda >= pn-begda.
* SELECT * FROM hrp1000 INTO TABLE gt_hrp1000 WHERE otype = 'O'
* AND plvar = '01'.
** AND begda <= pn-endda AND endda >= pn-begda.
* IF gv_orgeh IS NOT INITIAL .
* READ TABLE gt_hrp1001 INTO gs_hrp1001 WITH KEY otype = 'O' objid = gv_orgeh
* sclas = 'O' subty = 'A002'.
* IF sy-subrc EQ 0 .
* READ TABLE gt_hrp1000 INTO gs_hrp1000 WITH KEY otype = 'O' objid = gv_orgeh .
* IF sy-subrc EQ 0 .
* gs_final-orgn_l1 = gs_hrp1000-stext .
* ENDIF .
* CLEAR : lv_sobid.
*
* lv_sobid = gs_hrp1001-sobid .
* READ TABLE gt_hrp1000 INTO gs_hrp1000 WITH KEY otype = 'O' objid = lv_sobid .
* IF sy-subrc EQ 0 .
* gs_final-sbu = gs_hrp1000-stext. "l2 org text
* gs_hrp1001-sobid = gs_hrp1000-stext .
* ENDIF .
*
* CONCATENATE gs_final-orgn_l1 '#' gs_hrp1001-sobid INTO gs_final-orgn_l1 .
** =
* READ TABLE gt_hrp1001 INTO gs_hrp1001 WITH KEY otype = 'O' objid = lv_sobid"gs_hrp1001-sobid
* sclas = 'O' subty = 'A002'.
* IF sy-subrc EQ 0 .
* CLEAR : lv_sobid .
* lv_sobid = gs_hrp1001-sobid .
* READ TABLE gt_hrp1000 INTO gs_hrp1000 WITH KEY otype = 'O' objid = lv_sobid .
* IF sy-subrc EQ 0 .
* gs_hrp1001-sobid = gs_hrp1000-stext .
* ENDIF .
* CONCATENATE gs_final-orgn_l1 '#' gs_hrp1001-sobid INTO gs_final-orgn_l1 .
* READ TABLE gt_hrp1001 INTO gs_hrp1001 WITH KEY otype = 'O' objid = lv_sobid"gs_hrp1001-sobid
* sclas = 'O' subty = 'A002'.
* IF sy-subrc EQ 0 .
*
* CLEAR : lv_sobid .
* lv_sobid = gs_hrp1001-sobid .
* READ TABLE gt_hrp1000 INTO gs_hrp1000 WITH KEY otype = 'O' objid = lv_sobid .
* IF sy-subrc EQ 0 .
* gs_hrp1001-sobid = gs_hrp1000-stext .
* ENDIF .
*
* CONCATENATE gs_final-orgn_l1 '#' gs_hrp1001-sobid INTO gs_final-orgn_l1 .
*
* ELSE .
* CONCATENATE gs_final-orgn_l1 '#' 'Null' INTO gs_final-orgn_l1 .
* ENDIF .
*
* ELSE .
* CONCATENATE gs_final-orgn_l1 '#' 'Null#Null' INTO gs_final-orgn_l1 .
* ENDIF .
* ELSE .
* CONCATENATE gs_final-orgn_l1 '#' 'Null#Null#Null' INTO gs_final-orgn_l1 .
* ENDIF .
*
* ELSE.
* CLEAR : gs_final-orgn_l1 .
* gs_final-orgn_l1 = 'Null#Null#Null#Null'.
* ENDIF .
CLEAR :gs_hrp1001 ,gv_position.
************* GETING ORGN LEVEL FROM 9011 INFTY .
* CLEAR : gs_final-orgn_l1 .
* CLEAR : gv_l1 , gv_l2 , gv_l3 , gv_l4 .
* rp_provide_from_last p9011 space pn-begda pn-endda . "
* IF pnp-sw-found EQ 1 .
* gv_l1 = p9011-orgn_l1 .
* gv_l2 = p9011-orgn_l2 .
* gv_l3 = p9011-orgn_l3 .
* gv_l4 = p9011-orgn_l4 .
* ENDIF .
* IF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL AND gv_l3 IS NOT INITIAL AND gv_l4 IS NOT INITIAL ).
* CONCATENATE gv_l1 gv_l2 gv_l3 gv_l4 INTO gs_final-orgn_l1 SEPARATED BY '#'.
* ELSEIF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL AND gv_l3 IS NOT INITIAL ).
* CONCATENATE gv_l1 gv_l2 gv_l3 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
* ELSEIF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL ).
* CONCATENATE gv_l1 gv_l2 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
* ELSEIF ( gv_l1 IS NOT INITIAL ).
* CONCATENATE gv_l1 'null' 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
* ELSEIF ( gv_l1 IS INITIAL AND gv_l2 IS INITIAL AND gv_l3 IS INITIAL AND gv_l4 IS INITIAL ) .
* CONCATENATE 'null' 'null' 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
* ENDIF .
*********************TO GET ORGN L1
CLEAR : gs_final-orgn_l1 .
CLEAR : gv_l1 , gv_l2 , gv_l3 , gv_l4 .
FREE : gt_str[] .
CALL FUNCTION 'RH_PM_GET_STRUCTURE'
EXPORTING
plvar = '01'
otype = 'O'
objid = p0001-orgeh
begda = pn-begda
endda = '99991231'
status = '1'
wegid = 'O-O'
* 77AW_INT = ' '
authy = 'X'
* DEPTH = 0
* CHECK_OBJECT = ' '
* PROGRESS_INDICATOR = ' '
* SVECT =
activ = 'X'
* BUFFER_MODE =
TABLES
objec_tab = gt_str
* STRUC_TAB =
* GDSTR_TAB =
EXCEPTIONS
not_found = 1
ppway_not_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
LOOP AT gt_str .
IF sy-tabix EQ 1 .
gv_l4 = gt_str-stext .
ELSEIF sy-tabix EQ 2 .
gv_l3 = gt_str-stext .
ELSEIF sy-tabix EQ 3 .
gv_l2 = gt_str-stext .
ELSEIF sy-tabix EQ 4 .
gv_l1 = gt_str-stext .
ENDIF .
CLEAR : gt_str.
ENDLOOP .
gs_final-sbu = gv_l2 .
IF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL AND gv_l3 IS NOT INITIAL AND gv_l4 IS NOT INITIAL ).
CONCATENATE gv_l1 gv_l2 gv_l3 gv_l4 INTO gs_final-orgn_l1 SEPARATED BY '#'.
ELSEIF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL AND gv_l3 IS NOT INITIAL ).
CONCATENATE gv_l1 gv_l2 gv_l3 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
ELSEIF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL ).
CONCATENATE gv_l1 gv_l2 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
ELSEIF ( gv_l1 IS NOT INITIAL ).
CONCATENATE gv_l1 'null' 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
ELSEIF ( gv_l1 IS INITIAL AND gv_l2 IS INITIAL AND gv_l3 IS INITIAL AND gv_l4 IS INITIAL ) .
CONCATENATE 'null' 'null' 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
ENDIF .
*******
rp_provide_from_last p0008 space pn-begda pn-endda . "
IF pnp-sw-found EQ 1 .
gs_final-grade = p0008-trfgr.
ENDIF .
IF p0001-plans IS NOT INITIAL .
CALL FUNCTION 'HRWPC_RFC_PLANS_TEXT_GET'
EXPORTING
plans = p0001-plans
begda = pn-begda
endda = pn-endda
langu = sy-langu
IMPORTING
plans_text2 = gv_position.
gs_final-designation = gv_position.
ENDIF.
*** PROVIDE * FROM p0041 BETWEEN pn-begda AND pn-endda.
*** IF p0041-dar01 = 'Z1'.
*** gs_final-joining_date = p0041-dat01.
*** ENDIF.
*** IF p0041-dar01 = 'Z9'.
*** gs_final-group_joining_date = p0041-dat01.
*** ENDIF.
*** ENDPROVIDE.
*******************FOR GROUP JOINING DATE
CLEAR : gs_hrp1001,gs_pa0041 .
DATA: gv_dar01 TYPE p0041-dar01,
gv_dat01 TYPE p0041-dat01,lv_clas TYPE hrp1001-sclas.
CLEAR : lv_clas .
* SELECT SINGLE sclas FROM hrp1001 INTO lv_clas WHERE otype EQ 'P' AND objid EQ pernr-pernr AND sclas EQ 'CP' .
* IF lv_clas IS NOT INITIAL .
* SELECT SINGLE * FROM hrp1001 INTO gs_hrp1001 WHERE otype EQ 'P' AND objid EQ pernr-pernr .
* IF gs_hrp1001-sclas EQ 'CP' .
* IF sy-subrc EQ 0 .
* SELECT SINGLE sobid FROM hrp1001 INTO sep_emp WHERE otype EQ gs_hrp1001-sclas AND objid EQ gs_hrp1001-sobid AND sclas EQ 'P'.
* ENDIF.
* ENDIF.
* ENDIF.
DATA : lv_cnt TYPE i.
CLEAR : wa_hrp1001,lv_cnt .
CLEAR sep_emp.
SELECT SINGLE * FROM hrp1001 INTO wa_hrp1001 WHERE objid EQ pernr-pernr AND otype EQ 'P' AND sclas EQ 'CP'.
IF sy-subrc EQ 0 .
SELECT COUNT(*) FROM hrp1001 INTO lv_cnt WHERE otype EQ 'CP' AND objid EQ wa_hrp1001-sobid .
IF lv_cnt > 1 .
SELECT SINGLE sobid FROM hrp1001 INTO sep_emp WHERE otype EQ 'CP' AND objid EQ wa_hrp1001-sobid AND sclas EQ 'P' .
ENDIF .
ENDIF .
IF sep_emp IS NOT INITIAL .
SELECT SINGLE * FROM pa0041 INTO gs_pa0041 WHERE pernr = sep_emp . "AND ENDDA EQ '9991231'.
DO 4 TIMES
VARYING gv_dar01 FROM gs_pa0041-dar01 NEXT gs_pa0041-dar02
VARYING gv_dat01 FROM gs_pa0041-dat01 NEXT gs_pa0041-dat02.
IF gv_dar01 = 'Z9'.
gs_final-group_joining_date = gv_dat01.
ENDIF.
ENDDO.
ENDIF .
************************************
CLEAR : gv_dar01, gv_dat01 .
DO 4 TIMES
VARYING gv_dar01 FROM p0041-dar01 NEXT p0041-dar02
VARYING gv_dat01 FROM p0041-dat01 NEXT p0041-dat02.
IF gv_dar01 = 'Z1' OR gv_dar01 = 'ZM'.
gs_final-joining_date = gv_dat01.
ENDIF.
IF gv_dar01 = 'Z9'.
IF sep_emp IS INITIAL .
gs_final-group_joining_date = gv_dat01.
ELSE .
ENDIF .
ENDIF.
ENDDO.
*SOBID = P0001-PLANS.
*CALL FUNCTION 'RH_GET_LEADING_POSITION'
* EXPORTING
* plvar = '01'
* otype = 'S'
* sobid = SOBID
* DATE = SY-DATUM
* AUTH = 'X'
** BUFFER_MODE = ' '
** CONSIDER_VAC_POS = ' '
* TABLES
* leading_pos = LEADING_POS
* EXCEPTIONS
* NO_LEAD_POS_FOUND = 1
* OTHERS = 2
* .
*
*READ TABLE LEADING_POS INDEX 1.
*
*select SINGLE * from PA0001 into gs_PA0001 where PLANS = LEADING_POS-OBJID
* AND BEGDA <= PN-ENDDA
* AND ENDDA >= PN-BEGDA.
*
*IF gs_PA0001 IS NOT INITIAL.
* gs_final-emp_manager_id = GS_PA0001-PERNR.
* gs_final-emp_manager_name = GS_PA0001-ENAME.
*ENDIF.
* MOVE-CORRESPONDING gs_final TO gs_fin .
* INSERT INTO zhr_emp_table VALUES gs_fin.
* REFRESH gt_emp[] .
* SELECT * FROM zhr_emp_table INTO TABLE gt_emp WHERE emp_num = gs_final-emp_num .
* IF gt_emp[] IS NOT INITIAL .
* READ TABLE gt_emp INTO gs_emp INDEX 1 .
* IF gs_emp = gs_fin .
* reject .
* ENDIF .
* ENDIF .
* BREAK-POINT .
*** rp_provide_from_last p0028 '0010' pn-begda pn-endda .
*** IF pnp-sw-found EQ 1 .
*** gs_final-blood_group = p0028-wtf01 .
*** ENDIF .
* rp_provide_from_last p0028 '0001' pn-begda pn-endda .
* IF pnp-sw-found EQ 1 .
**** IF p0028-sbj08 EQ '08' .
**** gs_final-blood_group = p0028-wtf08 .
**** ENDIF .
* DATA: gv_sbj01 TYPE p0028-sbj01,
* gv_wtf01 TYPE p0028-wtf01.
* DO 15 TIMES
* VARYING gv_sbj01 FROM p0028-sbj01 NEXT p0028-sbj02
* VARYING gv_wtf01 FROM p0028-wtf01 NEXT p0028-wtf02.
*
* IF gv_sbj01 = '08'.
* SELECT SINGLE * FROM t578w INTO gs_t578w WHERE subty = '0001' AND sbjkt = '08' AND wtfld = gv_wtf01.
* IF sy-subrc EQ 0 .
* gs_final-blood_group = gs_t578w-stext .
* EXIT.
* ENDIF .
* ENDIF .
* CLEAR : gs_t578w.
* ENDDO.
* ENDIF .
* IF p0028-wtf08 IS NOT INITIAL .
* SELECT SINGLE * FROM t578w INTO gs_t578w WHERE subty = '0001' AND sbjkt = '08' AND wtfld = p0028-wtf08 .
* IF sy-subrc EQ 0 .
* CLEAR : gs_final-blood_group .
* gs_final-blood_group = gs_t578w-stext .
* ENDIF .
* ENDIF .
* CLEAR : gs_t578w.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = gs_final-emp_num
IMPORTING
output = gs_final-emp_num.
********* added by chellam - 06.07.2015
IF gs_final-emp_num IS INITIAL.
gs_final-emp_num = 'null'.
ENDIF.
IF gs_final-title IS INITIAL.
gs_final-title = 'null'.
ENDIF.
IF gs_final-first_name IS INITIAL.
gs_final-first_name = 'null'.
ENDIF.
IF gs_final-last_name IS INITIAL.
gs_final-last_name = 'null'.
ENDIF.
IF gs_final-calling_name IS INITIAL.
gs_final-calling_name = 'null'.
ENDIF.
IF gs_final-perm_country IS INITIAL.
gs_final-perm_country = 'null'.
ENDIF.
IF gs_final-prsnt_country IS INITIAL.
gs_final-prsnt_country = 'null'.
ENDIF.
IF gs_final-office_email IS INITIAL.
gs_final-office_email = 'null'.
ENDIF.
IF gs_final-emer_contact_person_relation IS INITIAL.
gs_final-emer_contact_person_relation = 'null'.
ENDIF.
IF gs_final-orgn_l1 IS INITIAL.
gs_final-orgn_l1 = 'null'.
ENDIF.
IF gs_final-sbu IS INITIAL.
gs_final-sbu = 'null'.
ENDIF.
IF gs_final-entity_name IS INITIAL.
gs_final-entity_name = 'null'.
ENDIF.
IF gs_final-entity_branch IS INITIAL.
gs_final-entity_branch = 'null'.
ENDIF.
IF gs_final-org_country IS INITIAL.
gs_final-org_country = 'null'.
ENDIF.
IF gs_final-org_city IS INITIAL.
gs_final-org_city = 'null'.
ENDIF.
IF gs_final-office IS INITIAL .
gs_final-office = 'null'.
ENDIF .
IF gs_final-grade IS INITIAL.
gs_final-grade = 'null'.
ENDIF.
IF gs_final-designation IS INITIAL.
gs_final-designation = 'null'.
ENDIF.
IF gs_final-ldap_login_name IS INITIAL.
gs_final-ldap_login_name = 'null'.
ENDIF.
IF gs_final-src_hire IS INITIAL.
gs_final-src_hire = 'null'.
ENDIF.
IF gs_final-rrf_id IS INITIAL.
gs_final-rrf_id = 'null'.
ENDIF.
IF gs_final-ldap_login_name IS INITIAL.
gs_final-ldap_login_name = 'null'.
ENDIF.
IF gs_final-domain_name IS INITIAL.
gs_final-domain_name = 'null'.
ENDIF.
IF gs_final-birth_date IS INITIAL.
gs_final-birth_date = 'null'.
ELSE.
CLEAR : lv_date.
IF gs_final-birth_date NE '00000000'.
lv_date = gs_final-birth_date.
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-birth_date = lv_date.
ENDIF.
ENDIF.
IF gs_final-gender IS INITIAL.
gs_final-gender = 'null'.
ENDIF.
IF gs_final-blood_group IS INITIAL.
gs_final-blood_group = 'null'.
ENDIF.
IF gs_final-religion IS INITIAL.
gs_final-religion = 'null'.
ENDIF.
IF gs_final-caste IS INITIAL .
gs_final-caste = 'null'.
ENDIF .
IF gs_final-rrf_id IS INITIAL .
gs_final-rrf_id = 'null'.
ENDIF .
IF gs_final-src_hire IS INITIAL .
gs_final-src_hire = 'null'.
ENDIF .
IF gs_final-marital_status IS INITIAL.
gs_final-marital_status = 'null'.
ENDIF.
IF gs_final-wedding_date IS INITIAL.
gs_final-wedding_date = 'null'.
ELSE.
CLEAR : lv_date.
IF gs_final-wedding_date NE '00000000'.
lv_date = gs_final-wedding_date .
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-wedding_date = lv_date.
ENDIF.
ENDIF.
IF gs_final-joining_date IS INITIAL.
gs_final-joining_date = 'null'.
ELSE.
CLEAR : lv_date.
IF gs_final-joining_date NE '00000000'.
lv_date = gs_final-joining_date .
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-joining_date = lv_date.
ENDIF.
ENDIF.
IF gs_final-group_joining_date IS INITIAL .
gs_final-group_joining_date = 'null'.
ELSE.
CLEAR : lv_date.
IF gs_final-group_joining_date NE '00000000'.
lv_date = gs_final-group_joining_date .
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-group_joining_date = lv_date.
ENDIF .
ENDIF.
IF gs_final-confirmation_date IS INITIAL.
gs_final-confirmation_date = 'null'.
ELSE.
CLEAR : lv_date.
IF gs_final-confirmation_date NE '00000000'.
lv_date = gs_final-confirmation_date.
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-confirmation_date = lv_date.
ENDIF.
ENDIF.
IF gs_final-probation_desc IS INITIAL.
gs_final-probation_desc = 'null'.
ENDIF.
IF gs_final-employment_type IS INITIAL.
gs_final-employment_type = 'null'.
ENDIF.
IF gs_final-emp_status IS INITIAL.
gs_final-emp_status = 'null'.
ENDIF.
IF gs_final-nationality IS INITIAL.
gs_final-nationality = 'null'.
ENDIF.
IF gs_final-emp_manager_id IS INITIAL .
gs_final-emp_manager_id = 'null'.
ENDIF .
IF gs_final-emp_manager_name IS INITIAL .
gs_final-emp_manager_name = 'null'.
ENDIF .
IF gs_final-emp_manager_mail_id IS INITIAL.
gs_final-emp_manager_mail_id = 'null'.
ENDIF.
********* end of added by chellam - 06.07.2015
IF gs_final-perm_addr_line1 IS INITIAL .
gs_final-perm_addr_line1 = 'null'.
ENDIF .
IF gs_final-perm_addr_line2 IS INITIAL .
gs_final-perm_addr_line2 = 'null'.
ENDIF .
IF gs_final-perm_addr_line3 IS INITIAL .
gs_final-perm_addr_line3 = 'null'.
ENDIF .
IF gs_final-perm_addr_landmark IS INITIAL .
gs_final-perm_addr_landmark = 'null'.
ENDIF .
IF gs_final-perm_city_name IS INITIAL .
gs_final-perm_city_name = 'null'.
ENDIF .
IF gs_final-perm_state_name IS INITIAL .
gs_final-perm_state_name = 'null'.
ENDIF .
IF gs_final-perm_country_code IS INITIAL .
gs_final-perm_country_code = 'null'.
ENDIF .
IF gs_final-perm_postal_code IS INITIAL .
gs_final-perm_postal_code = 'null'.
ENDIF .
IF gs_final-prsnt_addr_line1 IS INITIAL .
gs_final-prsnt_addr_line1 = 'null'.
ENDIF .
IF gs_final-prsnt_addr_line2 IS INITIAL .
gs_final-prsnt_addr_line2 = 'null'.
ENDIF .
IF gs_final-prsnt_addr_line3 IS INITIAL .
gs_final-prsnt_addr_line3 = 'null'.
ENDIF .
IF gs_final-prsnt_addr_landmark IS INITIAL .
gs_final-prsnt_addr_landmark = 'null'.
ENDIF .
IF gs_final-prsnt_city_name IS INITIAL .
gs_final-prsnt_city_name = 'null'.
ENDIF .
IF gs_final-prsnt_state_name IS INITIAL .
gs_final-prsnt_state_name = 'null'.
ENDIF .
IF gs_final-prsnt_country_code IS INITIAL .
gs_final-prsnt_country_code = 'null'.
ENDIF .
IF gs_final-prsnt_postal_code IS INITIAL .
gs_final-prsnt_postal_code = 'null'.
ENDIF .
IF gs_final-personal_mobile_num IS INITIAL .
gs_final-personal_mobile_num = 'null'.
ENDIF .
IF gs_final-personal_email IS INITIAL .
gs_final-personal_email = 'null'.
ENDIF .
IF gs_final-pan_id IS INITIAL .
gs_final-pan_id = 'null'.
ENDIF .
IF gs_final-office_mobile_num IS INITIAL .
gs_final-office_mobile_num = 'null'.
ENDIF .
IF gs_final-lwd IS INITIAL .
gs_final-lwd = 'null'.
ELSE.
CLEAR lv_date.
lv_date = gs_final-lwd.
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-lwd = lv_date.
ENDIF .
IF gs_final-exit_reason IS INITIAL .
gs_final-exit_reason = 'null'.
ENDIF .
IF gs_final-driving_license IS INITIAL .
gs_final-driving_license = 'null'.
ENDIF .
IF gs_final-aadhar_id IS INITIAL .
gs_final-aadhar_id = 'null'.
ENDIF .
IF gs_final-cost_center IS INITIAL .
gs_final-cost_center = 'null'.
ENDIF .
IF gs_final-cost_center_text IS INITIAL .
gs_final-cost_center_text = 'null'.
ENDIF .
APPEND gs_final TO gt_final .
CLEAR : gs_final .
ENDIF ."IF FLG = 'X'.
END-OF-SELECTION .
*BREAK-POINT .
*********** added by chellam - 29.06.2015
******* Outbound **************
DATA : cl_os_chrms_empdet_data TYPE REF TO zco_si_emp_master_ob_async.
DATA : output TYPE zmt_emp_master.
DATA : lo_sys_exception TYPE REF TO cx_ai_system_fault. " Reference variables exception class
*IF FLG = 'X'.
CLEAR: gt_final_v1[],gs_final_v1.
IF gt_final[] IS NOT INITIAL .
gt_final_v1[] = gt_final[].
gs_final_v1-emp_num = 'EMP_NUM'.
gs_final_v1-title = 'TITLE'.
gs_final_v1-first_name = 'FIRST_NAME'.
gs_final_v1-last_name = 'LAST_NAME'.
gs_final_v1-calling_name = 'CALLING_NAME'.
gs_final_v1-perm_country = 'PERM_COUNTRY'.
gs_final_v1-prsnt_country = 'PRSNT_COUNTRY'.
gs_final_v1-office_email = 'OFFICE_EMAIL'.
gs_final_v1-emer_contact_person_relation = 'EMER_CONTACT_PERSON_RELATION'.
gs_final_v1-orgn_l1 = 'ORGN_L1'.
gs_final_v1-sbu = 'SBU'.
gs_final_v1-entity_name = 'ENTITY_NAME'.
gs_final_v1-entity_branch = 'ENTITY_BRANCH'.
gs_final_v1-org_country = 'ORG_COUNTRY'.
gs_final_v1-org_city = 'ORG_CITY'.
gs_final_v1-office = 'OFFICE'.
gs_final_v1-grade = 'GRADE'.
gs_final_v1-designation = 'DESIGNATION'.
gs_final_v1-ldap_login_name = 'LDAP_LOGIN_NAME'.
gs_final_v1-domain_name = 'DOMAIN_NAME'.
gs_final_v1-birth_date = 'BIRTH_DATE'.
gs_final_v1-gender = 'GENDER'.
gs_final_v1-blood_group = 'BLOOD_GROUP'.
gs_final_v1-religion = 'RELIGION'.
gs_final_v1-caste = 'CASTE'.
gs_final_v1-marital_status = 'MARITAL_STATUS'.
gs_final_v1-wedding_date = 'WEDDING_DATE'.
gs_final_v1-joining_date = 'JOINING_DATE'.
gs_final_v1-group_joining_date = 'GROUP_JOINING_DATE'.
gs_final_v1-confirmation_date = 'CONFIRMATION_DATE'.
gs_final_v1-probation_desc = 'PROBATION_DESC'.
gs_final_v1-employment_type = 'EMPLOYMENT_TYPE'.
gs_final_v1-emp_status = 'EMP_STATUS'.
gs_final_v1-nationality = 'NATIONALITY'.
gs_final_v1-emp_manager_id = 'EMP_MANAGER_ID'.
gs_final_v1-emp_manager_name = 'EMP_MANAGER_NAME'.
gs_final_v1-emp_manager_mail_id = 'EMP_MANAGER_MAIL_ID'.
gs_final_v1-perm_addr_line1 = 'PERM_ADDR_LINE1' .
gs_final_v1-perm_addr_line2 = 'PERM_ADDR_LINE2'.
gs_final_v1-perm_addr_line3 = 'PERM_ADDR_LINE3'.
gs_final_v1-perm_addr_landmark = 'PERM_ADDR_LANDMARK'.
gs_final_v1-perm_city_name = 'PERM_CITY_NAME' .
gs_final_v1-perm_state_name = 'PERM_STATE_NAME' .
gs_final_v1-perm_country_code = 'PERM_COUNTRY_CODE' .
gs_final_v1-perm_postal_code = 'PERM_POSTAL_CODE' .
gs_final_v1-prsnt_addr_line1 = 'PRSNT_ADDR_LINE1' .
gs_final_v1-prsnt_addr_line2 = 'PRSNT_ADDR_LINE2' .
gs_final_v1-prsnt_addr_line3 = 'PRSNT_ADDR_LINE3' .
gs_final_v1-prsnt_addr_landmark = 'PRSNT_ADDR_LANDMARK' .
gs_final_v1-prsnt_city_name = 'PRSNT_CITY_NAME' .
gs_final_v1-prsnt_state_name = 'PRSNT_STATE_NAME' .
gs_final_v1-prsnt_country_code = 'PRSNT_COUNTRY_CODE' .
gs_final_v1-prsnt_postal_code = 'PRSNT_POSTAL_CODE' .
gs_final_v1-personal_mobile_num = 'PERSONAL_MOBILE_NUM' .
gs_final_v1-office_mobile_num = 'OFFICE_MOBILE_NUM' .
gs_final_v1-personal_email = 'PERSONAL_EMAIL' .
gs_final_v1-pan_id = 'PAN_ID' .
gs_final_v1-rrf_id = 'RRF_ID' .
gs_final_v1-src_hire = 'SRC_HIRE' .
gs_final_v1-lwd = 'LWD'.
gs_final_v1-exit_reason = 'EXIT_REASON'.
gs_final_v1-driving_license = 'DRIVING_LICENSE'.
gs_final_v1-aadhar_id = 'AADHAR_ID'.
gs_final_v1-cost_center = 'COST_CENTER'.
gs_final_v1-cost_center_text = 'COST_CENTER_TEXT'.
INSERT gs_final_v1 INTO gt_final_v1 INDEX 1.
ENDIF .
* LOOP AT gt_final INTO gs_final.
* IF sy-tabix = 1.
*
* INSERT gs_final_v1 INTO gt_final_v1 INDEX 1.
* ELSE.
* gs_final_v1-emp_num = gs_final-emp_num.
* gs_final_v1-title = gs_final-title.
* gs_final_v1-first_name = gs_final-first_name.
* gs_final_v1-last_name = gs_final-last_name.
* gs_final_v1-calling_name = gs_final-calling_name.
* gs_final_v1-perm_country = gs_final-perm_country.
* gs_final_v1-prsnt_country = gs_final-prsnt_country.
* gs_final_v1-office_email = gs_final-office_email.
* gs_final_v1-emer_contact_person_relation = gs_final-emer_contact_person_relation.
* gs_final_v1-orgn_l1 = gs_final-orgn_l1.
* gs_final_v1-sbu = gs_final-sbu.
* gs_final_v1-entity_name = gs_final-entity_name .
* gs_final_v1-entity_branch = gs_final-entity_branch.
* gs_final_v1-org_country = gs_final-org_country .
* gs_final_v1-org_city = gs_final-org_city .
* gs_final_v1-office = gs_final-office .
* gs_final_v1-grade = gs_final-grade.
* gs_final_v1-designation = gs_final-designation.
* gs_final_v1-ldap_login_name = gs_final-ldap_login_name.
* gs_final_v1-domain_name = gs_final-domain_name.
* gs_final_v1-birth_date = gs_final-birth_date.
* gs_final_v1-gender = gs_final-birth_date.
* gs_final_v1-blood_group = gs_final-blood_group .
* gs_final_v1-religion = gs_final-religion .
* gs_final_v1-caste = gs_final-caste .
* gs_final_v1-marital_status = gs_final-marital_status.
* gs_final_v1-wedding_date = gs_final-wedding_date.
* gs_final_v1-joining_date = gs_final-joining_date .
* gs_final_v1-group_joining_date = gs_final-group_joining_date.
* gs_final_v1-confirmation_date = gs_final-confirmation_date.
* gs_final_v1-probation_desc = gs_final-probation_desc.
* gs_final_v1-employment_type = gs_final-employment_type.
* gs_final_v1-emp_status = gs_final-emp_status.
* gs_final_v1-nationality = gs_final-nationality.
* gs_final_v1-emp_manager_id = gs_final-emp_manager_id.
* gs_final_v1-emp_manager_name = gs_final-emp_manager_name.
* gs_final_v1-emp_manager_mail_id = gs_final-emp_manager_mail_id .
*
* APPEND gs_final_v1 TO gt_final_v1.
* ENDIF.
* CLEAR : gs_final_v1,gs_final.
* ENDLOOP.
IF gt_final_v1[] IS NOT INITIAL.
MOVE-CORRESPONDING gt_final_v1 TO output-mt_emp_master-header.
TRY.
CREATE OBJECT cl_os_chrms_empdet_data.
CATCH cx_ai_system_fault.
ENDTRY.
ENDIF.
IF output-mt_emp_master-header IS NOT INITIAL.
TRY.
CALL METHOD cl_os_chrms_empdet_data->si_emp_master_ob_async
EXPORTING
output = output.
CATCH cx_ai_system_fault INTO lo_sys_exception.
ENDTRY.
COMMIT WORK.
ENDIF.
* ENDIF.
*********** end of added by chellam - 29.06.2015
* ENDIF . " FLG = 'X'.
*
*IF GT_FINAL[] IS NOT INITIAL .
* PERFORM FIELDCAT .
* CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
* EXPORTING
* I_CALLBACK_PROGRAM = SY-CPROG
** I_CALLBACK_PF_STATUS_SET = 'FRM_STATUS'
** I_CALLBACK_USER_COMMAND = 'VALIDATE_COMMAND'
** I_CALLBACK_TOP_OF_PAGE = ' '
** I_CALLBACK_HTML_TOP_OF_PAGE = ' '
** I_CALLBACK_HTML_END_OF_LIST = ' '
** I_STRUCTURE_NAME =
** I_BACKGROUND_ID = ' '
** I_GRID_TITLE =
** I_GRID_SETTINGS =
* IS_LAYOUT = GT_LAYOUT
* IT_FIELDCAT = GT_FCAT
** IT_EXCLUDING =
* TABLES
* T_OUTTAB = GT_FINAL
** EXCEPTIONS
** PROGRAM_ERROR = 1
** OTHERS = 2
* .
* ELSE .
* MESSAGE 'DATA DOES NOT EXIST' TYPE 'E' DISPLAY LIKE 'I' .
*
*ENDIF .
**&---------------------------------------------------------------------*
**& FORM FIELDCAT
**&---------------------------------------------------------------------*
** TEXT
**----------------------------------------------------------------------*
** --> P1 TEXT
** <-- P2 TEXT
**----------------------------------------------------------------------*
*FORM FIELDCAT .
*
*
* PERFORM FIELD_CAT USING '1' 'EMP_NUM' 'GT_FINAL' TEXT-001 '8' '' ''.
* PERFORM FIELD_CAT USING '2' 'TITLE' 'GT_FINAL' TEXT-014 '8' '' ''.
* PERFORM FIELD_CAT USING '3' 'FIRST_NAME' 'GT_FINAL' TEXT-002 '8' '' ''.
* PERFORM FIELD_CAT USING '4' 'LAST_NAME' 'GT_FINAL' TEXT-003 '8' '' ''.
* PERFORM FIELD_CAT USING '5' 'CALLING_NAME' 'GT_FINAL' TEXT-004 '8' '' ''.
* PERFORM FIELD_CAT USING '6' 'PERM_COUNTRY' 'GT_FINAL' TEXT-015 '8' '' ''.
* PERFORM FIELD_CAT USING '7' 'PRSNT_COUNTRY' 'GT_FINAL' TEXT-005 '8' '' ''.
* PERFORM FIELD_CAT USING '8' 'OFFICE_EMAIL' 'GT_FINAL' TEXT-006 '8' '' 'X' .
* PERFORM FIELD_CAT USING '9' 'EMER_CONTACT_PERSON_RELATION' 'GT_FINAL' TEXT-007 '8' '' 'X' .
* PERFORM FIELD_CAT USING '10' 'ORGN_L1' 'GT_FINAL' TEXT-068 '8' '' 'X' .
* PERFORM FIELD_CAT USING '11' 'SBU' 'GT_FINAL' TEXT-069 '8' '' 'X' .
* PERFORM FIELD_CAT USING '12' 'ENTITY_NAME' 'GT_FINAL' TEXT-008 '8' '' '' .
* PERFORM FIELD_CAT USING '13' 'ENTITY_BRANCH' 'GT_FINAL' TEXT-009 '8' '' ''.
* PERFORM FIELD_CAT USING '14' 'ORG_COUNTRY' 'GT_FINAL' TEXT-077 '8' '' ''.
* PERFORM FIELD_CAT USING '15' 'ORG_CITY' 'GT_FINAL' TEXT-087 '8' '' ''.
* PERFORM FIELD_CAT USING '16' 'GRADE' 'GT_FINAL' TEXT-067 '8' '' ''.
* PERFORM FIELD_CAT USING '17' 'DESIGNATION' 'GT_FINAL' TEXT-010 '8' '' ''.
* PERFORM FIELD_CAT USING '18' 'LDAP_LOGIN_NAME' 'GT_FINAL' TEXT-026 '8' '' ''.
* PERFORM FIELD_CAT USING '19' 'DOMAIN_NAME' 'GT_FINAL' TEXT-027 '8' '' ''.
* PERFORM FIELD_CAT USING '20' 'BIRTH_DATE' 'GT_FINAL' TEXT-011 '8' '' ''.
* PERFORM FIELD_CAT USING '21' 'GENDER' 'GT_FINAL' TEXT-012 '8' '' ''.
* PERFORM FIELD_CAT USING '22' 'BLOOD_GROUP' 'GT_FINAL' TEXT-013 '8' '' ''.
* PERFORM FIELD_CAT USING '23' 'RELIGION' 'GT_FINAL' TEXT-030 '8' '' ''.
* PERFORM FIELD_CAT USING '24' 'MARITAL_STATUS' 'GT_FINAL' TEXT-029 '15' '' ''.
* PERFORM FIELD_CAT USING '25' 'WEDDING_DATE' 'GT_FINAL' TEXT-070 '15' '' ''.
* PERFORM FIELD_CAT USING '26' 'JOINING_DATE' 'GT_FINAL' TEXT-063 '8' '' ''.
* PERFORM FIELD_CAT USING '27' 'CONFIRMATION_DATE' 'GT_FINAL' TEXT-064 '8' '' ''.
* PERFORM FIELD_CAT USING '28' 'PROBATION_DESC' 'GT_FINAL' TEXT-065 '8' '' ''.
* PERFORM FIELD_CAT USING '29' 'EMPLOYMENT_TYPE' 'GT_FINAL' TEXT-066 '8' '' ''.
* PERFORM FIELD_CAT USING '30' 'EMP_STATUS' 'GT_FINAL' TEXT-017 '8' '' ''.
* PERFORM FIELD_CAT USING '31' 'NATIONALITY' 'GT_FINAL' TEXT-018 '8' '' ''.
* PERFORM FIELD_CAT USING '32' 'EMP_MANAGER_MAIL_ID' 'GT_FINAL' TEXT-019 '8' '' ''.
* PERFORM FIELD_CAT USING '33' 'BLOOD_GROUP' 'GT_FINAL' TEXT-020 '8' '' ''.
*
*ENDFORM.
*
*
*FORM FIELD_CAT USING VALUE(P_0736)
*VALUE(P_0737)
*VALUE(P_0738)
*P_TEXT_001
*VALUE(P_0740)
*VALUE(P_0741)
*VALUE(P_0742).
* GS_FCAT-COL_POS = P_0736.
* GS_FCAT-FIELDNAME = P_0737.
* GS_FCAT-TABNAME = P_0738.
* GS_FCAT-REPTEXT_DDIC = P_TEXT_001.
* GS_FCAT-OUTPUTLEN = P_0740.
* APPEND GS_FCAT TO GT_FCAT.
* CLEAR :GS_FCAT.
* GT_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
*ENDFORM. " FIELD_CATREPORT zhrcss_ghrms_emp_master.
*REPORT zhrcss_ghrms_emp_master.
*&---------------------------------------------------------------------*
*& Include ZHRCSS_GHRMS_REPORT_TOP
*&---------------------------------------------------------------------*
TABLES : pernr , t500p , t001p,t578w .
INFOTYPES : 0000, 0001, 0002, 0006, 0008, 0016, 0021, 0027,
0028, 0041, 0105, 0185, 0804, 9011, 9013.
TYPES : BEGIN OF ty_final,
emp_num TYPE pernr_d,
title TYPE pa0002-titel,
first_name TYPE pa0002-vorna,
last_name TYPE pa0002-nachn,
calling_name TYPE pa0002-rufnm,
perm_country TYPE pa0006-land1,
prsnt_country TYPE pa0006-land1,
office_email TYPE pa0105-usrid_long,
emer_contact_person_relation TYPE pa0021-favor,
orgn_l1 TYPE p0001-orgeh,
sbu TYPE p0001-orgeh,
entity_name TYPE t500p-name1,
entity_branch TYPE t001p-btext,
org_country TYPE t005t-landx,
org_city TYPE t500p-ort01,
* office
grade TYPE pa0008-trfgr,
designation TYPE stext,
ldap_login_name TYPE pa0105-usrid_long,
domain_name TYPE char20,
birth_date TYPE pa0002-gbdat,
gender TYPE char10,
blood_group TYPE pa0028-wtf01,
religion TYPE pa0002-konfe,
* caste TYPE
marital_status TYPE char10,
wedding_date TYPE pa0002-famdt,
joining_date TYPE pa0041-dat01,
* group_joining_date
confirmation_date TYPE pa0000-begda,
probation_desc TYPE char20, "pa0016 - PRBZT PRBEH
employment_type TYPE pa0001-persk,
emp_status TYPE pa0000-stat2,
nationality TYPE t005t-landx,
* Emp_manager_id TYPE
* Emp_manager_name
emp_manager_mail_id TYPE pa0105-usrid_long,
lwd TYPE pa0000-begda,
exit_reason TYPE mgtxt,
driving_license TYPE pa0185-ictyp,
aadhar_id TYPE pa0185-ictyp,
cost_center TYPE pa0027-kst01,
cost_center_text TYPE ktext,
END OF ty_final .
DATA : gt_hrp1001 TYPE TABLE OF hrp1001,
gs_hrp1001 TYPE hrp1001,
gs_hrp10012 TYPE hrp1001,
gt_hrp1000 TYPE TABLE OF hrp1000,
gs_hrp1000 TYPE hrp1000,
gs_pa0001 TYPE pa0001,
gs_t578w TYPE t578w,sep_emp TYPE hrp1001-sobid,gs_pa0041 TYPE pa0041.
TYPES : BEGIN OF ty_fin ,
emp_num TYPE string,
title TYPE string,
first_name TYPE string,
last_name TYPE string,
calling_name TYPE string,
END OF ty_fin .
************ added by chellam - 30.06.2015
TYPES : BEGIN OF ty_final_v1,
emp_num TYPE string,
title TYPE string,
first_name TYPE string,
last_name TYPE string,
calling_name TYPE string,
perm_country TYPE string,
prsnt_country TYPE string,
office_email TYPE string,
emer_contact_person_relation TYPE string,
orgn_l1 TYPE string,
sbu TYPE string,
entity_name TYPE string,
entity_branch TYPE string,
org_country TYPE string,
org_city TYPE string,
office TYPE string,
grade TYPE string,
designation TYPE string,
ldap_login_name TYPE string,
domain_name TYPE string,
birth_date TYPE string,
gender TYPE string,
blood_group TYPE string,
religion TYPE string,
caste TYPE string,
marital_status TYPE string,
wedding_date TYPE string,
joining_date TYPE string,
group_joining_date TYPE string,
confirmation_date TYPE string,
probation_desc TYPE string,
employment_type TYPE string,
emp_status TYPE string,
nationality TYPE string,
emp_manager_id TYPE string,
emp_manager_name TYPE string,
emp_manager_mail_id TYPE string,
********** NEWLY ADDED FIELDS
perm_addr_line1 TYPE string,
perm_addr_line2 TYPE string,
perm_addr_line3 TYPE string,
perm_addr_landmark TYPE string,
perm_city_name TYPE string,
perm_state_name TYPE string,
perm_country_code TYPE string,
perm_postal_code TYPE string,
prsnt_addr_line1 TYPE string,
prsnt_addr_line2 TYPE string,
prsnt_addr_line3 TYPE string,
prsnt_addr_landmark TYPE string,
prsnt_city_name TYPE string,
prsnt_state_name TYPE string,
prsnt_country_code TYPE string,
prsnt_postal_code TYPE string,
personal_mobile_num TYPE string,
office_mobile_num TYPE string,
personal_email TYPE string,
pan_id TYPE string,
rrf_id TYPE string,
src_hire TYPE string,
lwd TYPE string,
exit_reason TYPE string,
driving_license TYPE string,
aadhar_id TYPE string,
cost_center TYPE string,
cost_center_text TYPE string,
END OF ty_final_v1.
DATA : gt_final_v1 TYPE TABLE OF ty_final_v1,
gs_final_v1 TYPE ty_final_v1.
************ end of added by chellam - 30.06.2015
DATA : gt_final TYPE TABLE OF ty_final_v1,
gs_final TYPE ty_final_v1,
* gs_fin TYPE zhr_emp_table,
* gt_emp TYPE TABLE OF zhr_emp_table,
* gs_emp TYPE zhr_emp_table,
flg TYPE char1.
DATA : lv_plans TYPE pa0001-plans .
DATA : it_hrp1001 TYPE TABLE OF hrp1001 WITH HEADER LINE .
DATA : lv_date TYPE char10.
DATA : gt_fcat TYPE slis_t_fieldcat_alv,wa_hrp1001 TYPE hrp1001,
gs_fcat TYPE slis_fieldcat_alv,
gt_layout TYPE slis_layout_alv.
DATA : gv_l1 TYPE string,
gv_l2 TYPE string,
gv_l3 TYPE string,
gv_l4 TYPE string,
gv_date TYPE d.
DATA : gt_str TYPE TABLE OF objec WITH HEADER LINE .
DATA : gt_t500p TYPE TABLE OF t500p,
gs_t500p TYPE t500p,
gt_t001p TYPE TABLE OF t001p,
gs_t001p TYPE t001p,
gt_t005t TYPE TABLE OF t005t,
gs_t005t TYPE t005t,
gt_t503t TYPE TABLE OF t503t,
gs_t503t TYPE t503t,lv_cttyp TYPE cttyp,conf_dt TYPE begda .
DATA : gv_position TYPE stext,
gv_orgeh TYPE pa0001-orgeh,
gv_plans TYPE pa0001-plans,
gv_persa TYPE pa0001-werks,
gv_cost TYPE pa0027-kst01,
gv_cost_txt TYPE ktext,
gv_cost_per TYPE pkprz,
gv_cost_per1 TYPE string,
lv_domain TYPE char20,
lv_domain_new TYPE char20.
DATA: gt_t522t TYPE t522t OCCURS 0 WITH HEADER LINE,
gt_t578x TYPE t578x OCCURS 0 WITH HEADER LINE,
gt_t516t TYPE t516t OCCURS 0 WITH HEADER LINE.
* AT SELECTION-SCREEN .
SELECT * FROM t500p INTO CORRESPONDING FIELDS OF TABLE gt_t500p WHERE molga EQ '40' .
SELECT * FROM t001p INTO CORRESPONDING FIELDS OF TABLE gt_t001p WHERE molga EQ '40' .
SELECT * FROM t005t INTO CORRESPONDING FIELDS OF TABLE gt_t005t WHERE spras EQ 'EN' .
SELECT * FROM t522t INTO CORRESPONDING FIELDS OF TABLE gt_t522t WHERE sprsl EQ 'E' .
SELECT * FROM t516t INTO CORRESPONDING FIELDS OF TABLE gt_t516t WHERE sprsl EQ 'E' .
SELECT * FROM t503t INTO CORRESPONDING FIELDS OF TABLE gt_t503t WHERE sprsl EQ sy-langu .
SELECT * FROM t578x INTO CORRESPONDING FIELDS OF TABLE gt_t578x.
GET pernr .
****************** CHECKING FOR Z1 AND ZZ ACTION EMPLOYEES ALONE
*PROVIDE * FROM p0000 BETWEEN pn-begda AND pn-endda .
*
* IF p0000-massn EQ 'Z1' OR p0000-massn EQ 'ZZ' OR p0000-massn EQ 'ZM' OR p0000-massn EQ 'Z3' OR p0000-massn EQ 'ZA' OR p0000-massn EQ 'Z2' .
*
*
* ELSE .
* REJECT.
* ENDIF .
*ENDPROVIDE .
******************
CLEAR: flg,wa_hrp1001.
SORT p0001[] BY aedtm DESCENDING .
rp_provide_from_last p0001 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0001-aedtm >= pn-begda AND p0001-aedtm <= pn-endda .
IF p0001-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
*****manager change check
SELECT SINGLE * FROM hrp1001 INTO wa_hrp1001 WHERE otype EQ 'S'
AND objid EQ p0001-plans
AND plvar EQ '01'
AND subty EQ 'A002'
AND endda EQ '99991231'
AND aedtm >= pn-begda
AND aedtm <= pn-endda.
IF wa_hrp1001 IS NOT INITIAL .
IF wa_hrp1001-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
SORT p0002[] BY aedtm DESCENDING .
rp_provide_from_last p0002 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0002-aedtm >= pn-begda AND p0002-aedtm <= pn-endda .
IF p0002-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0006[] BY aedtm DESCENDING .
rp_provide_from_last p0006 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0006-aedtm >= pn-begda AND p0006-aedtm <= pn-endda .
IF p0006-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
*SORT p0008[] BY aedtm DESCENDING .
*rp_provide_from_last p0008 space pn-begda pn-endda .
*IF pnp-sw-found EQ 1 .
* IF p0008-aedtm >= pn-begda AND p0008-aedtm <= pn-endda .
* flg = 'X'.
* ENDIF .
*ENDIF .
**********************added code for log report change at infotype level ,
DATA : st_log TYPE hreic_s_logkey,
gt_tab TYPE TABLE OF pldoc_key,
gs_tab TYPE pldoc_key,
gs_det TYPE pldoc_key,
gt_status TYPE TABLE OF hrinftylog_fields,
gs_status TYPE hrinftylog_fields,
gt_temp_before TYPE TABLE OF prelp WITH HEADER LINE,
gt_temp_after TYPE TABLE OF prelp WITH HEADER LINE.
CLEAR : st_log , gt_tab[], gs_status, gs_det,gt_status[],gs_tab,gt_temp_before[],gt_temp_after[].
st_log-enddate = sy-datum .
st_log-startdate = sy-datum.
st_log-pernr = pernr-pernr .
CALL FUNCTION 'HREIC_GET_LOGGED_INFTY_CHANGES'
EXPORTING
is_log_key = st_log
IMPORTING
et_infty_modif = gt_tab.
*CLEAR : GS_DET .
IF gt_tab[] IS NOT INITIAL .
READ TABLE gt_tab INTO gs_tab WITH KEY bdate = sy-datum
infty = '0008'.
IF sy-subrc EQ 0 .
gs_det-relid = gs_tab-relid .
gs_det-tclas = gs_tab-tclas .
gs_det-pernr = gs_tab-pernr .
gs_det-infty = gs_tab-infty .
gs_det-bdate = gs_tab-bdate .
gs_det-btime = gs_tab-btime .
gs_det-seqnr = gs_tab-seqnr .
CALL FUNCTION 'HR_INFOTYPE_LOG_GET_DETAIL'
EXPORTING
logged_infotype = gs_det
auth_check = 'X'
* USE_ARCHIVE = ' '
* IMPORTING
* SUBRC =
TABLES
infty_tab_before = gt_temp_before
infty_tab_after = gt_temp_after
fields = gt_status.
READ TABLE gt_status INTO gs_status WITH KEY fname = 'TRFGR' .
IF sy-subrc EQ 0.
flg = 'X' .
ENDIF .
ENDIF .
ENDIF .
**********************
SORT p0028[] BY aedtm DESCENDING .
rp_provide_from_last p0028 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0028-aedtm >= pn-begda AND p0028-aedtm <= pn-endda .
IF p0028-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0027[] BY aedtm DESCENDING .
rp_provide_from_last p0027 '01' pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0027-aedtm >= pn-begda AND p0027-aedtm <= pn-endda .
IF p0027-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0041[] BY aedtm DESCENDING .
rp_provide_from_last p0041 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0041-aedtm >= pn-begda AND p0041-aedtm <= pn-endda .
IF p0041-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0000[] BY aedtm DESCENDING .
rp_provide_from_last p0000 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0000-aedtm >= pn-begda AND p0000-aedtm <= pn-endda .
IF p0000-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
*IF p0000-stat2 EQ '0'. " Chella 07.12.2016
* REJECT .
*ENDIF .
SORT p0185[] BY aedtm DESCENDING .
rp_provide_from_last p0185 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0185-aedtm >= pn-begda AND p0185-aedtm <= pn-endda .
IF p0185-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0105[] BY aedtm DESCENDING .
rp_provide_from_last p0105 '0010' pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0105-aedtm >= pn-begda AND p0105-aedtm <= pn-endda .
IF p0105-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
SORT p0021[] BY aedtm DESCENDING .
rp_provide_from_last p0021 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
IF p0021-aedtm >= pn-begda AND p0021-aedtm <= pn-endda .
IF p0021-uname NE 'CUTOVERHR' .
flg = 'X'.
ENDIF .
ENDIF .
ENDIF .
****Chella
*IF flg = 'X'.
* IF wa_hrp1001-uname = 'CUTOVERHR'
* AND p0000-uname = 'CUTOVERHR'
* AND p0001-uname = 'CUTOVERHR'
* AND p0002-uname = 'CUTOVERHR'
* AND p0006-uname = 'CUTOVERHR'
* AND p0028-uname = 'CUTOVERHR'
* AND p0041-uname = 'CUTOVERHR'
* AND p0185-uname = 'CUTOVERHR'
* AND p0105-uname = 'CUTOVERHR'
* AND p0021-uname = 'CUTOVERHR'.
* CLEAR flg.
* ENDIF .
*ENDIF.
***chella
IF flg = 'X'.
DATA: gt_pa0001 TYPE TABLE OF pa0001,
gs_pa0001 TYPE pa0001,
leading_pos TYPE hrobject OCCURS 0 WITH HEADER LINE,
gs_pa0105 TYPE pa0105,
sobid TYPE hrsobid-sobid.
gs_final-emp_num = pernr-pernr .
rp_provide_from_last p0000 space pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-emp_status = p0000-stat2 .
IF p0000-massn = 'Z3'.
CLEAR gv_date.
gs_final-lwd = gv_date = p0000-begda - 1.
SELECT SINGLE mgtxt FROM t530t INTO gs_final-exit_reason
WHERE sprsl = 'E' AND massn = p0000-massn
AND massg = p0000-massg.
IF sy-subrc NE 0 .
CLEAR gs_final-exit_reason.
ENDIF.
ENDIF.
ENDIF.
rp_provide_from_last p0027 '01' pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
DO 25 TIMES VARYING gv_cost FROM p0027-kst01 NEXT p0027-kst02
VARYING gv_cost_per FROM p0027-kpr01 NEXT p0027-kpr02.
IF gv_cost IS NOT INITIAL.
CLEAR gv_cost_txt.
SELECT SINGLE ktext FROM cskt INTO gv_cost_txt
WHERE spras = 'E'
AND kostl = gv_cost AND datbi >= sy-datum.
IF gs_final-cost_center_text IS INITIAL.
gs_final-cost_center_text = gv_cost_txt.
ELSE.
CONCATENATE gs_final-cost_center_text '##!' gv_cost_txt INTO gs_final-cost_center_text.
ENDIF.
gv_cost_per1 = gv_cost_per.
IF gs_final-cost_center IS INITIAL.
CONCATENATE gv_cost '&!#' gv_cost_per1 INTO gs_final-cost_center.
ELSE.
CONCATENATE gs_final-cost_center '##!' gv_cost_per1 INTO gs_final-cost_center.
ENDIF.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-cost_center WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-cost_center_text WITH space.
*** rp_provide_from_last p0000 'Z5' pn-begda pn-endda . " EMAIL
*** IF pnp-sw-found EQ 1 .
*** gs_final-probation_desc = 'Confirmed' .
*** gs_final-confirmation_date = p0000-begda .
*** ELSE .
*** gs_final-probation_desc = 'Probation' .
*** ENDIF.
**** ENDIF .
* READ TABLE gt_t005t INTO gs_t005t WITH KEY land1 = p0002-natio .
* IF sy-subrc EQ 0 .
***********************************PROBATION
CLEAR : lv_cttyp , conf_dt .
rp_provide_from_last p0016 space pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
lv_cttyp = p0016-cttyp .
ENDIF.
IF lv_cttyp EQ '10' .
gs_final-probation_desc = lv_cttyp .
ELSEIF lv_cttyp EQ '11' .
gs_final-probation_desc = lv_cttyp .
* SELECT SINGLE BEGDA FROM PA0000 INTO CONF_DT WHERE MASSN EQ 'Z5'.
READ TABLE p0000[] INTO p0000 WITH KEY massn = 'Z5'.
gs_final-confirmation_date = p0000-begda.
* SELECT SINGLE BEGDA FROM PA0000 INTO gs_final-confirmation_date WHERE MASSN EQ 'Z5'.
ENDIF .
rp_provide_from_last p0002 space pn-begda pn-endda .
IF pnp-sw-found EQ 1 .
* READ TABLE gt_t522t WITH KEY anred = p0002-anred.
* IF sy-subrc = 0.
* gs_final-title = gt_t522t-atext .
* ENDIF.
gs_final-title = p0002-anred .
gs_final-first_name = p0002-vorna .
gs_final-last_name = p0002-nachn .
gs_final-calling_name = p0002-rufnm .
gs_final-birth_date = p0002-gbdat .
IF p0002-gesch EQ '1' .
gs_final-gender = 'Male'.
ELSEIF p0002-gesch EQ '2' .
gs_final-gender = 'Female'.
ELSEIF p0002-gesch EQ '3' .
gs_final-gender = 'Transgender'.
ENDIF .
* READ TABLE gt_t516t INTO gt_t516t WITH KEY konfe = p0002-konfe .
* IF sy-subrc EQ 0 .
* gs_final-religion = gt_t516t-ktext .
* ENDIF .
gs_final-religion = p0002-konfe .
IF p0002-famst EQ 0 .
gs_final-marital_status = 'Single'.
ELSEIF p0002-famst EQ 1 .
gs_final-marital_status = 'Married'.
ENDIF .
IF p0002-famdt NE '00000000'.
gs_final-wedding_date = p0002-famdt .
ENDIF .
IF p0002-natio IS NOT INITIAL .
gs_final-nationality = p0002-natio .
READ TABLE gt_t005t INTO gs_t005t WITH KEY land1 = p0002-natio .
IF sy-subrc EQ 0 .
* gs_final-nationality = gs_t005t-landx .
* gs_final-nationality = p0002-natio .
ENDIF .
ENDIF .
ENDIF .
CLEAR : gs_t005t .
rp_provide_from_last p0006 '1' pn-begda pn-endda . "PERMANENT ADDR
IF pnp-sw-found EQ 1 .
gs_final-perm_addr_line1 = p0006-name2 .
gs_final-perm_addr_line2 = p0006-stras .
gs_final-perm_addr_line3 = p0006-locat .
gs_final-perm_city_name = p0006-ort01 .
SELECT SINGLE bezei FROM t005u INTO gs_final-perm_state_name WHERE land1 EQ p0006-land1 AND bland EQ p0006-state AND spras EQ 'EN'.
* gs_final-perm_state_name = p0006-state .
gs_final-perm_country_code = p0006-land1 .
gs_final-perm_postal_code = p0006-pstlz .
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_city_name WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_state_name WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_country_code WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_postal_code WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_addr_line1 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_addr_line2 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-perm_addr_line3 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN p0006-hsnmr WITH space.
CONCATENATE p0006-hsnmr ' ' gs_final-perm_addr_line2 INTO gs_final-perm_addr_line2 SEPARATED BY space . .
* gs_final-perm_addr_landmark =
* gs_final-prsnt_addr_line1 = p0006-name2 .
*
* gs_final-prsnt_addr_line2 = p0006-stras.
* gs_final-prsnt_addr_line3 = p0006-locat.
** GS_FINAL-PRSNT_ADDR_LANDMARK.
* gs_final-prsnt_city_name = p0006-ort01.
* gs_final-prsnt_state_name = p0006-state.
* gs_final-prsnt_country_code = p0006-land1.
* gs_final-prsnt_postal_code = p0006-pstlz.
READ TABLE gt_t005t INTO gs_t005t WITH KEY land1 = p0006-land1 .
IF sy-subrc EQ 0 .
* gs_final-perm_country = gs_t005t-landx . "p0006-land1 .
gs_final-perm_country = p0006-land1 .
ENDIF .
ENDIF .
CLEAR : gs_t005t.
rp_provide_from_last p0006 '2' pn-begda pn-endda . "TEMPORARY ADDR
IF pnp-sw-found EQ 1 .
gs_final-prsnt_addr_line1 = p0006-name2 .
gs_final-prsnt_addr_line2 = p0006-stras.
gs_final-prsnt_addr_line3 = p0006-locat.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_addr_line1 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_addr_line2 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_addr_line3 WITH space.
REPLACE ALL OCCURRENCES OF ',' IN p0006-hsnmr WITH space.
* GS_FINAL-PRSNT_ADDR_LANDMARK.
CONCATENATE p0006-hsnmr ' ' gs_final-prsnt_addr_line2 INTO gs_final-prsnt_addr_line2 SEPARATED BY space .
*
gs_final-prsnt_city_name = p0006-ort01.
SELECT SINGLE bezei FROM t005u INTO gs_final-prsnt_state_name WHERE land1 EQ p0006-land1 AND bland EQ p0006-state AND spras EQ 'EN'.
* gs_final-prsnt_state_name = p0006-state.
gs_final-prsnt_country_code = p0006-land1.
gs_final-prsnt_postal_code = p0006-pstlz.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_city_name WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_city_name WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_country_code WITH space.
REPLACE ALL OCCURRENCES OF ',' IN gs_final-prsnt_postal_code WITH space.
READ TABLE gt_t005t INTO gs_t005t WITH KEY land1 = p0006-land1 .
IF sy-subrc EQ 0 .
* gs_final-prsnt_country = gs_t005t-landx."p0006-land1 .
gs_final-prsnt_country = p0006-land1 .
ENDIF .
ENDIF .
CLEAR : gs_t005t.
rp_provide_from_last p0105 '0010' pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
* IF p0105-usrty = '0010' .
gs_final-office_email = p0105-usrid_long .
* ENDIF.
ENDIF .
rp_provide_from_last p0105 'CELL' pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-personal_mobile_num = p0105-usrid .
ENDIF .
rp_provide_from_last p0105 'MAIL' pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-personal_email = p0105-usrid .
ENDIF .
rp_provide_from_last p0105 'MPHN' pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-office_mobile_num = p0105-usrid .
ENDIF .
rp_provide_from_last p0185 '02' pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-pan_id = p0185-icnum .
ENDIF .
rp_provide_from_last p0185 '06' pn-begda pn-endda . " Aadhar Card No.
IF pnp-sw-found EQ 1 .
gs_final-aadhar_id = p0185-icnum .
ENDIF .
rp_provide_from_last p0185 'Z3' pn-begda pn-endda . " Driving License
IF pnp-sw-found EQ 1 .
gs_final-driving_license = p0185-icnum .
ENDIF .
rp_provide_from_last p9013 space pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-rrf_id = p9013-rrf .
gs_final-src_hire = p9013-source .
ENDIF .
rp_provide_from_last p0804 space pn-begda pn-endda . " EMAIL
IF pnp-sw-found EQ 1 .
gs_final-blood_group = p0804-bgrup .
ENDIF .
********************
IF gs_final-office_email IS NOT INITIAL .
gs_final-ldap_login_name = gs_final-office_email .
SPLIT gs_final-office_email AT '@' INTO lv_domain lv_domain_new.
CONCATENATE '@' lv_domain_new INTO gs_final-domain_name .
CONDENSE gs_final-domain_name .
ENDIF .
CLEAR : gv_orgeh , gv_persa ,gv_plans.
rp_provide_from_last p0001 space pn-begda pn-endda . "organisational unit text
IF pnp-sw-found EQ 1 .
gv_orgeh = p0001-orgeh .
gv_plans = p0001-plans .
gv_persa = p0001-werks .
gs_final-orgn_l1 = gv_orgeh . " org unit
gs_final-entity_name = p0001-werks.
gs_final-entity_branch = p0001-btrtl .
gs_final-office = p0001-btrtl.
gs_final-employment_type = p0001-persk .
* CLEAR: gs_t503t.
* READ TABLE gt_t503t INTO gs_t503t WITH KEY persk = p0001-persk .
* IF sy-subrc = 0.
* gs_final-employment_type = gs_t503t-ptext.
* ENDIF.
ENDIF .
CLEAR : lv_plans .
REFRESH : it_hrp1001[] .
sobid = p0001-plans.
CALL FUNCTION 'RH_GET_LEADING_POSITION'
EXPORTING
plvar = '01'
otype = 'S'
sobid = sobid
date = sy-datum
auth = 'X'
* BUFFER_MODE = ' '
* CONSIDER_VAC_POS = ' '
TABLES
leading_pos = leading_pos
EXCEPTIONS
no_lead_pos_found = 1
OTHERS = 2.
READ TABLE leading_pos INDEX 1.
IF leading_pos-objid NE '00000000'.
SELECT SINGLE * FROM pa0001 INTO gs_pa0001 WHERE plans = leading_pos-objid
* AND begda <= pn-endda "Chella
* AND endda >= pn-begda.
AND endda = '99991231'. "Chella 28.06.2016
IF gs_pa0001 IS NOT INITIAL.
gs_final-emp_manager_id = gs_pa0001-pernr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = gs_final-emp_manager_id
IMPORTING
output = gs_final-emp_manager_id.
IF wa_hrp1001-begda NE '00000000' .
* CLEAR : gs_final-emp_manager_id .
CONCATENATE gs_final-emp_manager_id '$' wa_hrp1001-begda+0(4) '-' wa_hrp1001-begda+4(2) '-' wa_hrp1001-begda+6(2) INTO gs_final-emp_manager_id .
CONDENSE gs_final-emp_manager_id NO-GAPS .
ELSE .
CLEAR : it_hrp1001 .
SELECT SINGLE plans FROM pa0001 INTO lv_plans WHERE pernr EQ pernr-pernr AND endda EQ '99991231' .
IF lv_plans IS NOT INITIAL .
SELECT * FROM hrp1001 INTO CORRESPONDING FIELDS OF TABLE it_hrp1001 WHERE otype EQ 'S' AND objid EQ lv_plans .
READ TABLE it_hrp1001 WITH KEY rsign = 'A' relat = '002' endda = '99991231'.
IF sy-subrc EQ 0 .
.
CONCATENATE gs_final-emp_manager_id '$' it_hrp1001-begda+0(4) '-' it_hrp1001-begda+4(2) '-' it_hrp1001-begda+6(2) INTO gs_final-emp_manager_id .
CONDENSE gs_final-emp_manager_id NO-GAPS .
ENDIF .
ENDIF .
ENDIF .
gs_final-emp_manager_name = gs_pa0001-ename.
ENDIF.
SELECT SINGLE * FROM pa0105 INTO gs_pa0105 WHERE pernr = gs_pa0001-pernr
AND subty = '0010'
AND begda <= pn-endda
AND endda >= pn-begda.
IF gs_pa0105 IS NOT INITIAL. .
gs_final-emp_manager_mail_id = gs_pa0105-usrid_long .
ENDIF .
ENDIF .
CLEAR: gs_pa0105, gs_pa0001, leading_pos, sobid.
*
* CLEAR: gs_pa0105, gs_pa0001, leading_pos, sobid.
CLEAR : gs_pa0001 ,gs_hrp10012,gs_hrp1001.
***************
rp_provide_from_last p0021 space pn-begda pn-endda . "
IF pnp-sw-found EQ 1 ."FAMSA
* SELECT SINGLE stext FROM t591s INTO gs_final-emer_contact_person_relation WHERE sprsl EQ 'EN' AND infty EQ '0021' AND subty = p0021-famsa
.
gs_final-emer_contact_person_relation = p0021-famsa .
ENDIF .
CLEAR : gs_t001p , gs_t500p .
READ TABLE gt_t001p INTO gs_t001p WITH KEY werks = p0001-werks
btrtl = p0001-btrtl .
IF sy-subrc EQ 0 .
* gs_final-entity_branch = gs_t001p-btext .
ENDIF .
CLEAR : gs_t001p.
READ TABLE gt_t001p INTO gs_t001p WITH KEY btrtl = p0001-btrtl .
IF sy-subrc EQ 0 .
* gs_final-office = gs_t001p-btext ." for office name
ENDIF .
READ TABLE gt_t500p INTO gs_t500p WITH KEY persa = p0001-werks .
IF sy-subrc EQ 0 .
* gs_final-entity_name = gs_t500p-name1 .
READ TABLE gt_t005t INTO gs_t005t WITH KEY land1 = gs_t500p-land1 .
IF sy-subrc EQ 0 .
* gs_final-org_country = gs_t005t-landx.
gs_final-org_country = gs_t500p-land1 .
ENDIF .
gs_final-org_city = gs_t500p-ort01.
ENDIF.
** ENDIF
****org unit ***
* DATA : lv_sobid TYPE string .
* SELECT * FROM hrp1001 INTO TABLE gt_hrp1001 WHERE otype = 'O'
* AND plvar = '01'
* AND begda <= pn-endda AND endda >= pn-begda.
* SELECT * FROM hrp1000 INTO TABLE gt_hrp1000 WHERE otype = 'O'
* AND plvar = '01'.
** AND begda <= pn-endda AND endda >= pn-begda.
* IF gv_orgeh IS NOT INITIAL .
* READ TABLE gt_hrp1001 INTO gs_hrp1001 WITH KEY otype = 'O' objid = gv_orgeh
* sclas = 'O' subty = 'A002'.
* IF sy-subrc EQ 0 .
* READ TABLE gt_hrp1000 INTO gs_hrp1000 WITH KEY otype = 'O' objid = gv_orgeh .
* IF sy-subrc EQ 0 .
* gs_final-orgn_l1 = gs_hrp1000-stext .
* ENDIF .
* CLEAR : lv_sobid.
*
* lv_sobid = gs_hrp1001-sobid .
* READ TABLE gt_hrp1000 INTO gs_hrp1000 WITH KEY otype = 'O' objid = lv_sobid .
* IF sy-subrc EQ 0 .
* gs_final-sbu = gs_hrp1000-stext. "l2 org text
* gs_hrp1001-sobid = gs_hrp1000-stext .
* ENDIF .
*
* CONCATENATE gs_final-orgn_l1 '#' gs_hrp1001-sobid INTO gs_final-orgn_l1 .
** =
* READ TABLE gt_hrp1001 INTO gs_hrp1001 WITH KEY otype = 'O' objid = lv_sobid"gs_hrp1001-sobid
* sclas = 'O' subty = 'A002'.
* IF sy-subrc EQ 0 .
* CLEAR : lv_sobid .
* lv_sobid = gs_hrp1001-sobid .
* READ TABLE gt_hrp1000 INTO gs_hrp1000 WITH KEY otype = 'O' objid = lv_sobid .
* IF sy-subrc EQ 0 .
* gs_hrp1001-sobid = gs_hrp1000-stext .
* ENDIF .
* CONCATENATE gs_final-orgn_l1 '#' gs_hrp1001-sobid INTO gs_final-orgn_l1 .
* READ TABLE gt_hrp1001 INTO gs_hrp1001 WITH KEY otype = 'O' objid = lv_sobid"gs_hrp1001-sobid
* sclas = 'O' subty = 'A002'.
* IF sy-subrc EQ 0 .
*
* CLEAR : lv_sobid .
* lv_sobid = gs_hrp1001-sobid .
* READ TABLE gt_hrp1000 INTO gs_hrp1000 WITH KEY otype = 'O' objid = lv_sobid .
* IF sy-subrc EQ 0 .
* gs_hrp1001-sobid = gs_hrp1000-stext .
* ENDIF .
*
* CONCATENATE gs_final-orgn_l1 '#' gs_hrp1001-sobid INTO gs_final-orgn_l1 .
*
* ELSE .
* CONCATENATE gs_final-orgn_l1 '#' 'Null' INTO gs_final-orgn_l1 .
* ENDIF .
*
* ELSE .
* CONCATENATE gs_final-orgn_l1 '#' 'Null#Null' INTO gs_final-orgn_l1 .
* ENDIF .
* ELSE .
* CONCATENATE gs_final-orgn_l1 '#' 'Null#Null#Null' INTO gs_final-orgn_l1 .
* ENDIF .
*
* ELSE.
* CLEAR : gs_final-orgn_l1 .
* gs_final-orgn_l1 = 'Null#Null#Null#Null'.
* ENDIF .
CLEAR :gs_hrp1001 ,gv_position.
************* GETING ORGN LEVEL FROM 9011 INFTY .
* CLEAR : gs_final-orgn_l1 .
* CLEAR : gv_l1 , gv_l2 , gv_l3 , gv_l4 .
* rp_provide_from_last p9011 space pn-begda pn-endda . "
* IF pnp-sw-found EQ 1 .
* gv_l1 = p9011-orgn_l1 .
* gv_l2 = p9011-orgn_l2 .
* gv_l3 = p9011-orgn_l3 .
* gv_l4 = p9011-orgn_l4 .
* ENDIF .
* IF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL AND gv_l3 IS NOT INITIAL AND gv_l4 IS NOT INITIAL ).
* CONCATENATE gv_l1 gv_l2 gv_l3 gv_l4 INTO gs_final-orgn_l1 SEPARATED BY '#'.
* ELSEIF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL AND gv_l3 IS NOT INITIAL ).
* CONCATENATE gv_l1 gv_l2 gv_l3 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
* ELSEIF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL ).
* CONCATENATE gv_l1 gv_l2 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
* ELSEIF ( gv_l1 IS NOT INITIAL ).
* CONCATENATE gv_l1 'null' 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
* ELSEIF ( gv_l1 IS INITIAL AND gv_l2 IS INITIAL AND gv_l3 IS INITIAL AND gv_l4 IS INITIAL ) .
* CONCATENATE 'null' 'null' 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
* ENDIF .
*********************TO GET ORGN L1
CLEAR : gs_final-orgn_l1 .
CLEAR : gv_l1 , gv_l2 , gv_l3 , gv_l4 .
FREE : gt_str[] .
CALL FUNCTION 'RH_PM_GET_STRUCTURE'
EXPORTING
plvar = '01'
otype = 'O'
objid = p0001-orgeh
begda = pn-begda
endda = '99991231'
status = '1'
wegid = 'O-O'
* 77AW_INT = ' '
authy = 'X'
* DEPTH = 0
* CHECK_OBJECT = ' '
* PROGRESS_INDICATOR = ' '
* SVECT =
activ = 'X'
* BUFFER_MODE =
TABLES
objec_tab = gt_str
* STRUC_TAB =
* GDSTR_TAB =
EXCEPTIONS
not_found = 1
ppway_not_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
LOOP AT gt_str .
IF sy-tabix EQ 1 .
gv_l4 = gt_str-stext .
ELSEIF sy-tabix EQ 2 .
gv_l3 = gt_str-stext .
ELSEIF sy-tabix EQ 3 .
gv_l2 = gt_str-stext .
ELSEIF sy-tabix EQ 4 .
gv_l1 = gt_str-stext .
ENDIF .
CLEAR : gt_str.
ENDLOOP .
gs_final-sbu = gv_l2 .
IF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL AND gv_l3 IS NOT INITIAL AND gv_l4 IS NOT INITIAL ).
CONCATENATE gv_l1 gv_l2 gv_l3 gv_l4 INTO gs_final-orgn_l1 SEPARATED BY '#'.
ELSEIF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL AND gv_l3 IS NOT INITIAL ).
CONCATENATE gv_l1 gv_l2 gv_l3 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
ELSEIF ( gv_l1 IS NOT INITIAL AND gv_l2 IS NOT INITIAL ).
CONCATENATE gv_l1 gv_l2 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
ELSEIF ( gv_l1 IS NOT INITIAL ).
CONCATENATE gv_l1 'null' 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
ELSEIF ( gv_l1 IS INITIAL AND gv_l2 IS INITIAL AND gv_l3 IS INITIAL AND gv_l4 IS INITIAL ) .
CONCATENATE 'null' 'null' 'null' 'null' INTO gs_final-orgn_l1 SEPARATED BY '#'.
ENDIF .
*******
rp_provide_from_last p0008 space pn-begda pn-endda . "
IF pnp-sw-found EQ 1 .
gs_final-grade = p0008-trfgr.
ENDIF .
IF p0001-plans IS NOT INITIAL .
CALL FUNCTION 'HRWPC_RFC_PLANS_TEXT_GET'
EXPORTING
plans = p0001-plans
begda = pn-begda
endda = pn-endda
langu = sy-langu
IMPORTING
plans_text2 = gv_position.
gs_final-designation = gv_position.
ENDIF.
*** PROVIDE * FROM p0041 BETWEEN pn-begda AND pn-endda.
*** IF p0041-dar01 = 'Z1'.
*** gs_final-joining_date = p0041-dat01.
*** ENDIF.
*** IF p0041-dar01 = 'Z9'.
*** gs_final-group_joining_date = p0041-dat01.
*** ENDIF.
*** ENDPROVIDE.
*******************FOR GROUP JOINING DATE
CLEAR : gs_hrp1001,gs_pa0041 .
DATA: gv_dar01 TYPE p0041-dar01,
gv_dat01 TYPE p0041-dat01,lv_clas TYPE hrp1001-sclas.
CLEAR : lv_clas .
* SELECT SINGLE sclas FROM hrp1001 INTO lv_clas WHERE otype EQ 'P' AND objid EQ pernr-pernr AND sclas EQ 'CP' .
* IF lv_clas IS NOT INITIAL .
* SELECT SINGLE * FROM hrp1001 INTO gs_hrp1001 WHERE otype EQ 'P' AND objid EQ pernr-pernr .
* IF gs_hrp1001-sclas EQ 'CP' .
* IF sy-subrc EQ 0 .
* SELECT SINGLE sobid FROM hrp1001 INTO sep_emp WHERE otype EQ gs_hrp1001-sclas AND objid EQ gs_hrp1001-sobid AND sclas EQ 'P'.
* ENDIF.
* ENDIF.
* ENDIF.
DATA : lv_cnt TYPE i.
CLEAR : wa_hrp1001,lv_cnt .
CLEAR sep_emp.
SELECT SINGLE * FROM hrp1001 INTO wa_hrp1001 WHERE objid EQ pernr-pernr AND otype EQ 'P' AND sclas EQ 'CP'.
IF sy-subrc EQ 0 .
SELECT COUNT(*) FROM hrp1001 INTO lv_cnt WHERE otype EQ 'CP' AND objid EQ wa_hrp1001-sobid .
IF lv_cnt > 1 .
SELECT SINGLE sobid FROM hrp1001 INTO sep_emp WHERE otype EQ 'CP' AND objid EQ wa_hrp1001-sobid AND sclas EQ 'P' .
ENDIF .
ENDIF .
IF sep_emp IS NOT INITIAL .
SELECT SINGLE * FROM pa0041 INTO gs_pa0041 WHERE pernr = sep_emp . "AND ENDDA EQ '9991231'.
DO 4 TIMES
VARYING gv_dar01 FROM gs_pa0041-dar01 NEXT gs_pa0041-dar02
VARYING gv_dat01 FROM gs_pa0041-dat01 NEXT gs_pa0041-dat02.
IF gv_dar01 = 'Z9'.
gs_final-group_joining_date = gv_dat01.
ENDIF.
ENDDO.
ENDIF .
************************************
CLEAR : gv_dar01, gv_dat01 .
DO 4 TIMES
VARYING gv_dar01 FROM p0041-dar01 NEXT p0041-dar02
VARYING gv_dat01 FROM p0041-dat01 NEXT p0041-dat02.
IF gv_dar01 = 'Z1' OR gv_dar01 = 'ZM'.
gs_final-joining_date = gv_dat01.
ENDIF.
IF gv_dar01 = 'Z9'.
IF sep_emp IS INITIAL .
gs_final-group_joining_date = gv_dat01.
ELSE .
ENDIF .
ENDIF.
ENDDO.
*SOBID = P0001-PLANS.
*CALL FUNCTION 'RH_GET_LEADING_POSITION'
* EXPORTING
* plvar = '01'
* otype = 'S'
* sobid = SOBID
* DATE = SY-DATUM
* AUTH = 'X'
** BUFFER_MODE = ' '
** CONSIDER_VAC_POS = ' '
* TABLES
* leading_pos = LEADING_POS
* EXCEPTIONS
* NO_LEAD_POS_FOUND = 1
* OTHERS = 2
* .
*
*READ TABLE LEADING_POS INDEX 1.
*
*select SINGLE * from PA0001 into gs_PA0001 where PLANS = LEADING_POS-OBJID
* AND BEGDA <= PN-ENDDA
* AND ENDDA >= PN-BEGDA.
*
*IF gs_PA0001 IS NOT INITIAL.
* gs_final-emp_manager_id = GS_PA0001-PERNR.
* gs_final-emp_manager_name = GS_PA0001-ENAME.
*ENDIF.
* MOVE-CORRESPONDING gs_final TO gs_fin .
* INSERT INTO zhr_emp_table VALUES gs_fin.
* REFRESH gt_emp[] .
* SELECT * FROM zhr_emp_table INTO TABLE gt_emp WHERE emp_num = gs_final-emp_num .
* IF gt_emp[] IS NOT INITIAL .
* READ TABLE gt_emp INTO gs_emp INDEX 1 .
* IF gs_emp = gs_fin .
* reject .
* ENDIF .
* ENDIF .
* BREAK-POINT .
*** rp_provide_from_last p0028 '0010' pn-begda pn-endda .
*** IF pnp-sw-found EQ 1 .
*** gs_final-blood_group = p0028-wtf01 .
*** ENDIF .
* rp_provide_from_last p0028 '0001' pn-begda pn-endda .
* IF pnp-sw-found EQ 1 .
**** IF p0028-sbj08 EQ '08' .
**** gs_final-blood_group = p0028-wtf08 .
**** ENDIF .
* DATA: gv_sbj01 TYPE p0028-sbj01,
* gv_wtf01 TYPE p0028-wtf01.
* DO 15 TIMES
* VARYING gv_sbj01 FROM p0028-sbj01 NEXT p0028-sbj02
* VARYING gv_wtf01 FROM p0028-wtf01 NEXT p0028-wtf02.
*
* IF gv_sbj01 = '08'.
* SELECT SINGLE * FROM t578w INTO gs_t578w WHERE subty = '0001' AND sbjkt = '08' AND wtfld = gv_wtf01.
* IF sy-subrc EQ 0 .
* gs_final-blood_group = gs_t578w-stext .
* EXIT.
* ENDIF .
* ENDIF .
* CLEAR : gs_t578w.
* ENDDO.
* ENDIF .
* IF p0028-wtf08 IS NOT INITIAL .
* SELECT SINGLE * FROM t578w INTO gs_t578w WHERE subty = '0001' AND sbjkt = '08' AND wtfld = p0028-wtf08 .
* IF sy-subrc EQ 0 .
* CLEAR : gs_final-blood_group .
* gs_final-blood_group = gs_t578w-stext .
* ENDIF .
* ENDIF .
* CLEAR : gs_t578w.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = gs_final-emp_num
IMPORTING
output = gs_final-emp_num.
********* added by chellam - 06.07.2015
IF gs_final-emp_num IS INITIAL.
gs_final-emp_num = 'null'.
ENDIF.
IF gs_final-title IS INITIAL.
gs_final-title = 'null'.
ENDIF.
IF gs_final-first_name IS INITIAL.
gs_final-first_name = 'null'.
ENDIF.
IF gs_final-last_name IS INITIAL.
gs_final-last_name = 'null'.
ENDIF.
IF gs_final-calling_name IS INITIAL.
gs_final-calling_name = 'null'.
ENDIF.
IF gs_final-perm_country IS INITIAL.
gs_final-perm_country = 'null'.
ENDIF.
IF gs_final-prsnt_country IS INITIAL.
gs_final-prsnt_country = 'null'.
ENDIF.
IF gs_final-office_email IS INITIAL.
gs_final-office_email = 'null'.
ENDIF.
IF gs_final-emer_contact_person_relation IS INITIAL.
gs_final-emer_contact_person_relation = 'null'.
ENDIF.
IF gs_final-orgn_l1 IS INITIAL.
gs_final-orgn_l1 = 'null'.
ENDIF.
IF gs_final-sbu IS INITIAL.
gs_final-sbu = 'null'.
ENDIF.
IF gs_final-entity_name IS INITIAL.
gs_final-entity_name = 'null'.
ENDIF.
IF gs_final-entity_branch IS INITIAL.
gs_final-entity_branch = 'null'.
ENDIF.
IF gs_final-org_country IS INITIAL.
gs_final-org_country = 'null'.
ENDIF.
IF gs_final-org_city IS INITIAL.
gs_final-org_city = 'null'.
ENDIF.
IF gs_final-office IS INITIAL .
gs_final-office = 'null'.
ENDIF .
IF gs_final-grade IS INITIAL.
gs_final-grade = 'null'.
ENDIF.
IF gs_final-designation IS INITIAL.
gs_final-designation = 'null'.
ENDIF.
IF gs_final-ldap_login_name IS INITIAL.
gs_final-ldap_login_name = 'null'.
ENDIF.
IF gs_final-src_hire IS INITIAL.
gs_final-src_hire = 'null'.
ENDIF.
IF gs_final-rrf_id IS INITIAL.
gs_final-rrf_id = 'null'.
ENDIF.
IF gs_final-ldap_login_name IS INITIAL.
gs_final-ldap_login_name = 'null'.
ENDIF.
IF gs_final-domain_name IS INITIAL.
gs_final-domain_name = 'null'.
ENDIF.
IF gs_final-birth_date IS INITIAL.
gs_final-birth_date = 'null'.
ELSE.
CLEAR : lv_date.
IF gs_final-birth_date NE '00000000'.
lv_date = gs_final-birth_date.
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-birth_date = lv_date.
ENDIF.
ENDIF.
IF gs_final-gender IS INITIAL.
gs_final-gender = 'null'.
ENDIF.
IF gs_final-blood_group IS INITIAL.
gs_final-blood_group = 'null'.
ENDIF.
IF gs_final-religion IS INITIAL.
gs_final-religion = 'null'.
ENDIF.
IF gs_final-caste IS INITIAL .
gs_final-caste = 'null'.
ENDIF .
IF gs_final-rrf_id IS INITIAL .
gs_final-rrf_id = 'null'.
ENDIF .
IF gs_final-src_hire IS INITIAL .
gs_final-src_hire = 'null'.
ENDIF .
IF gs_final-marital_status IS INITIAL.
gs_final-marital_status = 'null'.
ENDIF.
IF gs_final-wedding_date IS INITIAL.
gs_final-wedding_date = 'null'.
ELSE.
CLEAR : lv_date.
IF gs_final-wedding_date NE '00000000'.
lv_date = gs_final-wedding_date .
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-wedding_date = lv_date.
ENDIF.
ENDIF.
IF gs_final-joining_date IS INITIAL.
gs_final-joining_date = 'null'.
ELSE.
CLEAR : lv_date.
IF gs_final-joining_date NE '00000000'.
lv_date = gs_final-joining_date .
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-joining_date = lv_date.
ENDIF.
ENDIF.
IF gs_final-group_joining_date IS INITIAL .
gs_final-group_joining_date = 'null'.
ELSE.
CLEAR : lv_date.
IF gs_final-group_joining_date NE '00000000'.
lv_date = gs_final-group_joining_date .
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-group_joining_date = lv_date.
ENDIF .
ENDIF.
IF gs_final-confirmation_date IS INITIAL.
gs_final-confirmation_date = 'null'.
ELSE.
CLEAR : lv_date.
IF gs_final-confirmation_date NE '00000000'.
lv_date = gs_final-confirmation_date.
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-confirmation_date = lv_date.
ENDIF.
ENDIF.
IF gs_final-probation_desc IS INITIAL.
gs_final-probation_desc = 'null'.
ENDIF.
IF gs_final-employment_type IS INITIAL.
gs_final-employment_type = 'null'.
ENDIF.
IF gs_final-emp_status IS INITIAL.
gs_final-emp_status = 'null'.
ENDIF.
IF gs_final-nationality IS INITIAL.
gs_final-nationality = 'null'.
ENDIF.
IF gs_final-emp_manager_id IS INITIAL .
gs_final-emp_manager_id = 'null'.
ENDIF .
IF gs_final-emp_manager_name IS INITIAL .
gs_final-emp_manager_name = 'null'.
ENDIF .
IF gs_final-emp_manager_mail_id IS INITIAL.
gs_final-emp_manager_mail_id = 'null'.
ENDIF.
********* end of added by chellam - 06.07.2015
IF gs_final-perm_addr_line1 IS INITIAL .
gs_final-perm_addr_line1 = 'null'.
ENDIF .
IF gs_final-perm_addr_line2 IS INITIAL .
gs_final-perm_addr_line2 = 'null'.
ENDIF .
IF gs_final-perm_addr_line3 IS INITIAL .
gs_final-perm_addr_line3 = 'null'.
ENDIF .
IF gs_final-perm_addr_landmark IS INITIAL .
gs_final-perm_addr_landmark = 'null'.
ENDIF .
IF gs_final-perm_city_name IS INITIAL .
gs_final-perm_city_name = 'null'.
ENDIF .
IF gs_final-perm_state_name IS INITIAL .
gs_final-perm_state_name = 'null'.
ENDIF .
IF gs_final-perm_country_code IS INITIAL .
gs_final-perm_country_code = 'null'.
ENDIF .
IF gs_final-perm_postal_code IS INITIAL .
gs_final-perm_postal_code = 'null'.
ENDIF .
IF gs_final-prsnt_addr_line1 IS INITIAL .
gs_final-prsnt_addr_line1 = 'null'.
ENDIF .
IF gs_final-prsnt_addr_line2 IS INITIAL .
gs_final-prsnt_addr_line2 = 'null'.
ENDIF .
IF gs_final-prsnt_addr_line3 IS INITIAL .
gs_final-prsnt_addr_line3 = 'null'.
ENDIF .
IF gs_final-prsnt_addr_landmark IS INITIAL .
gs_final-prsnt_addr_landmark = 'null'.
ENDIF .
IF gs_final-prsnt_city_name IS INITIAL .
gs_final-prsnt_city_name = 'null'.
ENDIF .
IF gs_final-prsnt_state_name IS INITIAL .
gs_final-prsnt_state_name = 'null'.
ENDIF .
IF gs_final-prsnt_country_code IS INITIAL .
gs_final-prsnt_country_code = 'null'.
ENDIF .
IF gs_final-prsnt_postal_code IS INITIAL .
gs_final-prsnt_postal_code = 'null'.
ENDIF .
IF gs_final-personal_mobile_num IS INITIAL .
gs_final-personal_mobile_num = 'null'.
ENDIF .
IF gs_final-personal_email IS INITIAL .
gs_final-personal_email = 'null'.
ENDIF .
IF gs_final-pan_id IS INITIAL .
gs_final-pan_id = 'null'.
ENDIF .
IF gs_final-office_mobile_num IS INITIAL .
gs_final-office_mobile_num = 'null'.
ENDIF .
IF gs_final-lwd IS INITIAL .
gs_final-lwd = 'null'.
ELSE.
CLEAR lv_date.
lv_date = gs_final-lwd.
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = lv_date
IMPORTING
output = lv_date.
REPLACE ALL OCCURRENCES OF '.' IN lv_date WITH '/' .
gs_final-lwd = lv_date.
ENDIF .
IF gs_final-exit_reason IS INITIAL .
gs_final-exit_reason = 'null'.
ENDIF .
IF gs_final-driving_license IS INITIAL .
gs_final-driving_license = 'null'.
ENDIF .
IF gs_final-aadhar_id IS INITIAL .
gs_final-aadhar_id = 'null'.
ENDIF .
IF gs_final-cost_center IS INITIAL .
gs_final-cost_center = 'null'.
ENDIF .
IF gs_final-cost_center_text IS INITIAL .
gs_final-cost_center_text = 'null'.
ENDIF .
APPEND gs_final TO gt_final .
CLEAR : gs_final .
ENDIF ."IF FLG = 'X'.
END-OF-SELECTION .
*BREAK-POINT .
*********** added by chellam - 29.06.2015
******* Outbound **************
DATA : cl_os_chrms_empdet_data TYPE REF TO zco_si_emp_master_ob_async.
DATA : output TYPE zmt_emp_master.
DATA : lo_sys_exception TYPE REF TO cx_ai_system_fault. " Reference variables exception class
*IF FLG = 'X'.
CLEAR: gt_final_v1[],gs_final_v1.
IF gt_final[] IS NOT INITIAL .
gt_final_v1[] = gt_final[].
gs_final_v1-emp_num = 'EMP_NUM'.
gs_final_v1-title = 'TITLE'.
gs_final_v1-first_name = 'FIRST_NAME'.
gs_final_v1-last_name = 'LAST_NAME'.
gs_final_v1-calling_name = 'CALLING_NAME'.
gs_final_v1-perm_country = 'PERM_COUNTRY'.
gs_final_v1-prsnt_country = 'PRSNT_COUNTRY'.
gs_final_v1-office_email = 'OFFICE_EMAIL'.
gs_final_v1-emer_contact_person_relation = 'EMER_CONTACT_PERSON_RELATION'.
gs_final_v1-orgn_l1 = 'ORGN_L1'.
gs_final_v1-sbu = 'SBU'.
gs_final_v1-entity_name = 'ENTITY_NAME'.
gs_final_v1-entity_branch = 'ENTITY_BRANCH'.
gs_final_v1-org_country = 'ORG_COUNTRY'.
gs_final_v1-org_city = 'ORG_CITY'.
gs_final_v1-office = 'OFFICE'.
gs_final_v1-grade = 'GRADE'.
gs_final_v1-designation = 'DESIGNATION'.
gs_final_v1-ldap_login_name = 'LDAP_LOGIN_NAME'.
gs_final_v1-domain_name = 'DOMAIN_NAME'.
gs_final_v1-birth_date = 'BIRTH_DATE'.
gs_final_v1-gender = 'GENDER'.
gs_final_v1-blood_group = 'BLOOD_GROUP'.
gs_final_v1-religion = 'RELIGION'.
gs_final_v1-caste = 'CASTE'.
gs_final_v1-marital_status = 'MARITAL_STATUS'.
gs_final_v1-wedding_date = 'WEDDING_DATE'.
gs_final_v1-joining_date = 'JOINING_DATE'.
gs_final_v1-group_joining_date = 'GROUP_JOINING_DATE'.
gs_final_v1-confirmation_date = 'CONFIRMATION_DATE'.
gs_final_v1-probation_desc = 'PROBATION_DESC'.
gs_final_v1-employment_type = 'EMPLOYMENT_TYPE'.
gs_final_v1-emp_status = 'EMP_STATUS'.
gs_final_v1-nationality = 'NATIONALITY'.
gs_final_v1-emp_manager_id = 'EMP_MANAGER_ID'.
gs_final_v1-emp_manager_name = 'EMP_MANAGER_NAME'.
gs_final_v1-emp_manager_mail_id = 'EMP_MANAGER_MAIL_ID'.
gs_final_v1-perm_addr_line1 = 'PERM_ADDR_LINE1' .
gs_final_v1-perm_addr_line2 = 'PERM_ADDR_LINE2'.
gs_final_v1-perm_addr_line3 = 'PERM_ADDR_LINE3'.
gs_final_v1-perm_addr_landmark = 'PERM_ADDR_LANDMARK'.
gs_final_v1-perm_city_name = 'PERM_CITY_NAME' .
gs_final_v1-perm_state_name = 'PERM_STATE_NAME' .
gs_final_v1-perm_country_code = 'PERM_COUNTRY_CODE' .
gs_final_v1-perm_postal_code = 'PERM_POSTAL_CODE' .
gs_final_v1-prsnt_addr_line1 = 'PRSNT_ADDR_LINE1' .
gs_final_v1-prsnt_addr_line2 = 'PRSNT_ADDR_LINE2' .
gs_final_v1-prsnt_addr_line3 = 'PRSNT_ADDR_LINE3' .
gs_final_v1-prsnt_addr_landmark = 'PRSNT_ADDR_LANDMARK' .
gs_final_v1-prsnt_city_name = 'PRSNT_CITY_NAME' .
gs_final_v1-prsnt_state_name = 'PRSNT_STATE_NAME' .
gs_final_v1-prsnt_country_code = 'PRSNT_COUNTRY_CODE' .
gs_final_v1-prsnt_postal_code = 'PRSNT_POSTAL_CODE' .
gs_final_v1-personal_mobile_num = 'PERSONAL_MOBILE_NUM' .
gs_final_v1-office_mobile_num = 'OFFICE_MOBILE_NUM' .
gs_final_v1-personal_email = 'PERSONAL_EMAIL' .
gs_final_v1-pan_id = 'PAN_ID' .
gs_final_v1-rrf_id = 'RRF_ID' .
gs_final_v1-src_hire = 'SRC_HIRE' .
gs_final_v1-lwd = 'LWD'.
gs_final_v1-exit_reason = 'EXIT_REASON'.
gs_final_v1-driving_license = 'DRIVING_LICENSE'.
gs_final_v1-aadhar_id = 'AADHAR_ID'.
gs_final_v1-cost_center = 'COST_CENTER'.
gs_final_v1-cost_center_text = 'COST_CENTER_TEXT'.
INSERT gs_final_v1 INTO gt_final_v1 INDEX 1.
ENDIF .
* LOOP AT gt_final INTO gs_final.
* IF sy-tabix = 1.
*
* INSERT gs_final_v1 INTO gt_final_v1 INDEX 1.
* ELSE.
* gs_final_v1-emp_num = gs_final-emp_num.
* gs_final_v1-title = gs_final-title.
* gs_final_v1-first_name = gs_final-first_name.
* gs_final_v1-last_name = gs_final-last_name.
* gs_final_v1-calling_name = gs_final-calling_name.
* gs_final_v1-perm_country = gs_final-perm_country.
* gs_final_v1-prsnt_country = gs_final-prsnt_country.
* gs_final_v1-office_email = gs_final-office_email.
* gs_final_v1-emer_contact_person_relation = gs_final-emer_contact_person_relation.
* gs_final_v1-orgn_l1 = gs_final-orgn_l1.
* gs_final_v1-sbu = gs_final-sbu.
* gs_final_v1-entity_name = gs_final-entity_name .
* gs_final_v1-entity_branch = gs_final-entity_branch.
* gs_final_v1-org_country = gs_final-org_country .
* gs_final_v1-org_city = gs_final-org_city .
* gs_final_v1-office = gs_final-office .
* gs_final_v1-grade = gs_final-grade.
* gs_final_v1-designation = gs_final-designation.
* gs_final_v1-ldap_login_name = gs_final-ldap_login_name.
* gs_final_v1-domain_name = gs_final-domain_name.
* gs_final_v1-birth_date = gs_final-birth_date.
* gs_final_v1-gender = gs_final-birth_date.
* gs_final_v1-blood_group = gs_final-blood_group .
* gs_final_v1-religion = gs_final-religion .
* gs_final_v1-caste = gs_final-caste .
* gs_final_v1-marital_status = gs_final-marital_status.
* gs_final_v1-wedding_date = gs_final-wedding_date.
* gs_final_v1-joining_date = gs_final-joining_date .
* gs_final_v1-group_joining_date = gs_final-group_joining_date.
* gs_final_v1-confirmation_date = gs_final-confirmation_date.
* gs_final_v1-probation_desc = gs_final-probation_desc.
* gs_final_v1-employment_type = gs_final-employment_type.
* gs_final_v1-emp_status = gs_final-emp_status.
* gs_final_v1-nationality = gs_final-nationality.
* gs_final_v1-emp_manager_id = gs_final-emp_manager_id.
* gs_final_v1-emp_manager_name = gs_final-emp_manager_name.
* gs_final_v1-emp_manager_mail_id = gs_final-emp_manager_mail_id .
*
* APPEND gs_final_v1 TO gt_final_v1.
* ENDIF.
* CLEAR : gs_final_v1,gs_final.
* ENDLOOP.
IF gt_final_v1[] IS NOT INITIAL.
MOVE-CORRESPONDING gt_final_v1 TO output-mt_emp_master-header.
TRY.
CREATE OBJECT cl_os_chrms_empdet_data.
CATCH cx_ai_system_fault.
ENDTRY.
ENDIF.
IF output-mt_emp_master-header IS NOT INITIAL.
TRY.
CALL METHOD cl_os_chrms_empdet_data->si_emp_master_ob_async
EXPORTING
output = output.
CATCH cx_ai_system_fault INTO lo_sys_exception.
ENDTRY.
COMMIT WORK.
ENDIF.
No comments:
Post a Comment