ZXPADU02
*&---------------------------------------------------------------------*
*& Include ZHR_EX_IT0001_ONBOARDING
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
* Develpoment spfecification
* - Modul HCM (Oneboarding process)
*
* Autor: Regotz Michel, T-Systems DMC AG, 11.2014
*
* Description:
* ************
* This Include creat a Form for the onboarding process (Modul HCM).
* This Include passes all th neesessary parameters to ZHR_ON_MAIL.
* HR JBSL wants to indroduce an onboarding process which is supported
* by SAP HR module. The new Process is planned to be in place as of
* 01.12.2014.
* Starting point for this process in SAP are predefined actions and the
* corresponding entry in IT0001 for the field enrty "job". According
* to the job assignment a mail will be sent with a variety of
* information from IT0000, IT0001, IT0002 and additional information
* about It packages an share point links.
* The onboarding process enables a smooth start of work for a new
* employee; required working packages are going to be ready for the
* first working day. In addition, this process reduces paperwork for
* line managers when hiring a new employee an relives various department
* (HR, IT-S, IT-I) in their everyday operation
*
* Table 1: ZHRONBOARD_JOBID
* Transaction: ZHR_JOBID
* The onboarding table 1 provides information about payroll area,
* job-ID, validity date and packages (IT-I, IT-S, working clothes).
* The table 1 is maintained in SAP by authorized sap HR user.
* To display the right packages on Pdf, user exit shall check the table
* fields marked with CHECK.
* If the job-ID is delimited (validity end date exists) the table 1
* should be set up like a SAP standard table, which means it shall
* display only the valid/actual entries; the delimited entries should
* be hidden but enabled for display Multiple different packages -
* all active packages have to be displayed on the PDF Blank fields -
* do not need to be displayed Double packages - a package should be
* displayed only once on the Pdf.
*
* Table 2: ZHRONBOARD_LINK
* Transaction: ZHR_PACKAGES
* The onboarding Table 2 provides information about payroll area,
* packages, validity dates and share point link.
* Both tables are maintained directly in P11; table contents do not need
* to be transported. Package field 10 digit alphanumeric code;
* additional > 100
*
* Table 3. ZHRONBOARD_FORMS
* Transaction: ZHR_FORMS
* This table shows the relationship between forms (Pdf) and distribution
* lists. IT-S shall maintain the distribution list via SOST.
*
* Change History:
* ***************
* MRU19012015 Addtional text for no packages according PHP 20003787
*&---------------------------------------------------------------------*
*& 16.03.2015 REGOTZ M PHP 20003883 DEJK914742
*& Change Selection Date for Cost center Text
*&---------------------------------------------------------------------*
*& 16.12.2015 LEHERT V PHP 20004194 DEJK915887
*& Print from only on creation, not on change
*&---------------------------------------------------------------------*
INCLUDE zhr_ex_it0001_onboarding_top.
CASE innnn-infty.
WHEN 0001.
"Neuer Einbau
"Holt die Daten vom Infotypen 0000
CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
EXPORTING
prelp = innnn
IMPORTING
pnnnn = i0000. "here you have record of IT0001
DATA: gs_pa0000 TYPE pa0000.
"Holle dir den Massnahmegrund im Infotyp 0000
SELECT SINGLE * FROM pa0000 INTO gs_pa0000
WHERE pernr = innnn-pernr
AND begda = i0000-begda.
"Neuer Einbau
"Massnahmen bei dennen der IT0001 schon existiert werden geholt
SELECT SINGLE massn FROM zhronboard_updat INTO gf_updat "ins REGTOZ M 18022015
WHERE massn = ipsyst-massn. "ins REGTOZ M 18022015
IF ( sy-ucomm = 'UPD' AND ipsyst-ioper = 'INS' ) "ins VLE16122015
OR ( sy-ucomm = 'UPD' AND gf_updat IS NOT INITIAL
AND gs_pa0000-massg IS NOT INITIAL ). "ins REGTOZ M 18022015
SELECT SINGLE * FROM zhronboard_forms INTO gs_forms
WHERE bukrs = ipsyst-bukrs
AND massn = ipsyst-massn
AND begda <= sy-datum
AND endda >= sy-datum.
IF sy-subrc = 0 AND gs_forms-include = 'ONBOARDING'.
"Formular für den Onboarding Prozess
INCLUDE zhr_it0001_onboarding_f1.
ELSEIF sy-subrc = 0 AND gs_forms-include = 'Hier kann ein weitere Formularname hinterlegt werden'.
"Test Formular: Include wurde nurm zum testen erstellt. Kann gelöscht werden
INCLUDE zhr_it0001_onboarding_f2.
"INCLUDE zhr_version01.
ELSE.
"mache nichts
ENDIF.
ENDIF.
Include
*&---------------------------------------------------------------------*
*& Include ZHR_IT0001_ONBOARDING_F1
*&---------------------------------------------------------------------*
* Formular für den Onboarding Prozess wird hier erzeugt
*&---------------------------------------------------------------------*
*& DATEN aus Infotypen laden
*&---------------------------------------------------------------------*
"METHODE UM DIE DATEN ZUHOLEN
"Holt die Daten vom Infotypen 0000
CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
EXPORTING
prelp = innnn
IMPORTING
pnnnn = i0000. "here you have record of IT0001
"Holt die Daten vom Infotypen 0001
CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
EXPORTING
prelp = innnn
IMPORTING
pnnnn = i0001. "here you have record of IT0001
"Holt die Daten vom Infotypen 0002
CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
EXPORTING
prelp = innnn
IMPORTING
pnnnn = i0002. "here you have record of IT0001
*&---------------------------------------------------------------------*
*& DATEN SAMMELN
*&---------------------------------------------------------------------*
"gf_datum = Systemdatum
gf_datum = sy-datum.
"Company Code text (Buchungskreistext)
SELECT SINGLE butxt FROM t001 INTO gs_data-butxt
WHERE spras = 'D'
AND bukrs = i0001-bukrs.
"zähle die Anzahl Zeichen des Buchungskreis
gs_data-butxtz = STRLEN( gs_data-butxt ).
"Lösche die Führenden Leerzeichen.
gs_data-butxts = gs_data-butxt.
SHIFT gs_data-butxts LEFT DELETING LEADING ' '.
"Personnel Number (Personalnummer)
gs_data-pernr = innnn-pernr.
"löschen der führenden Nullen (Personalnummer)
SHIFT gs_data-pernr LEFT DELETING LEADING '0'.
"zähle die Anzahl Zeichen der Personalnummer
gs_data-pernrz = STRLEN( gs_data-pernr ).
"Lösche die Führenden Leerzeichen.
gs_data-pernrs = gs_data-pernr.
SHIFT gs_data-pernrs LEFT DELETING LEADING ' '.
"Name (Name)
gs_data-ename = i0001-ename.
"Vorname
SELECT SINGLE vnamc FROM pa0002 INTO gs_data-vnamc
"WHERE sprsl = sy-langu
WHERE pernr = innnn-pernr
AND begda <= sy-datum
AND endda >= sy-datum.
"Umwandeln Grossschreibung in Gross und Kleins schreibung.
TRANSLATE gs_data-vnamc TO LOWER CASE.
WHILE sy-subrc = 0.
TRANSLATE gs_data-vnamc+gf_offset(1) TO UPPER CASE.
FIND REGEX '(<[a-z])' IN gs_data-vnamc MATCH OFFSET gs_data-vnamc.
ENDWHILE.
CLEAR gf_offset.
"Vorname
SELECT SINGLE vorna FROM pa0002 INTO gs_data-vorna
"WHERE sprsl = sy-langu
WHERE pernr = innnn-pernr
AND begda <= sy-datum
AND endda >= sy-datum.
"Nachname
SELECT SINGLE nchmc FROM pa0002 INTO gs_data-nchmc
"WHERE sprsl = sy-langu
WHERE pernr = innnn-pernr
AND begda <= sy-datum
AND endda >= sy-datum.
"Umwandeln Grossschreibung in Gross und Kleins schreibung.
TRANSLATE gs_data-nchmc TO LOWER CASE.
WHILE sy-subrc = 0.
TRANSLATE gs_data-nchmc+gf_offset(1) TO UPPER CASE.
FIND REGEX '(<[a-z])' IN gs_data-nchmc MATCH OFFSET gs_data-nchmc.
ENDWHILE.
CLEAR gf_offset.
"Nachname
SELECT SINGLE nachn FROM pa0002 INTO gs_data-nachn
"WHERE sprsl = sy-langu
WHERE pernr = innnn-pernr
AND begda <= sy-datum
AND endda >= sy-datum.
"Entry date (Eintrittsdatum)
gs_data-begda = i0000-begda.
"Job (Stellentext)
SELECT SINGLE stltx FROM t513s INTO gs_data-stltx
WHERE sprsl = 'D'
AND stell = i0001-stell
AND begda <= sy-datum
AND endda >= sy-datum.
"Position
SELECT SINGLE stext FROM hrp1000 INTO gs_data-plstx
WHERE plvar = '01'
AND otype = 'S'
AND begda <= sy-datum
AND endda >= sy-datum
AND objid = i0001-plans.
"Org. Unit
"Position
SELECT SINGLE stext FROM hrp1000 INTO gs_data-orgtx
WHERE plvar = '01'
AND otype = 'O'
AND begda <= sy-datum
AND endda >= sy-datum
AND objid = i0001-orgeh.
"Cost center (Kostenstelle)
gs_data-kostl = i0001-kostl.
"löschen der führenden Nullen (Kostenstelle)
SHIFT gs_data-kostl LEFT DELETING LEADING '0'.
"zähle die Anzahl Zeichen der Kostenstelle
gs_data-kostlz = STRLEN( gs_data-kostl ).
"Lösche die Führenden Leerzeichen.
gs_data-kostls = gs_data-kostl.
SHIFT gs_data-kostls LEFT DELETING LEADING ' '.
"Cost center Text (Kostenstellentext) CSKT
SELECT SINGLE ltext FROM cskt INTO gs_data-kostx
WHERE spras = sy-langu
AND kokrs = i0001-bukrs
AND kostl = i0001-kostl
AND datbi >= sy-datum. "Insert DEJK914742
"Personnel Subarea (Personalteilbereich)
gs_data-btrtl = i0001-btrtl.
"Personell Subarea Text (Personalteilbereichtext)
SELECT SINGLE btext FROM t001p INTO gs_data-btext
WHERE werks = i0001-werks
AND btrtl = i0001-btrtl.
"Employee Subgroup (Mitarbeiterkreis)
gs_data-persk = i0001-persk.
"Employee Subgroup text (Mitarbeiterkreis Text)
SELECT SINGLE ptext FROM t503t
INTO gs_data-ptext
WHERE sprsl = sy-langu
AND persk = i0001-persk.
"Location (Personalbereichstext)
SELECT SINGLE name1 FROM t500p
INTO gs_data-pbtxt
WHERE persa = i0001-werks.
"BU/SU (Anstellungsverhältnis)
gs_data-ansvh = i0001-ansvh.
SELECT SINGLE atx FROM t542t INTO gs_data-anstx
WHERE molga = '02'
AND spras = sy-langu
AND ansvh = i0001-ansvh.
"Kommunkikationssprache Kürzel (p0002-sprsl)
SELECT SINGLE sprsl FROM pa0002 INTO gs_data-sprsl
WHERE pernr = innnn-pernr
AND begda <= sy-datum
AND endda >= sy-datum.
"Kommunkikationssprache Text(t002t-sptxt)
SELECT SINGLE sptxt FROM t002t INTO gs_data-sptxt
WHERE spras = 'EN'
AND sprsl = gs_data-sprsl.
"Responsible HR (Sachbearbeiter Personal Text T526-SACHN)
SELECT SINGLE sachn FROM t526 INTO gs_data-sachn
WHERE sachx = i0001-sachp
AND werks = i0001-sbmod.
"Manager of employee (Vorgesetzter)
"Organisationstruktur lesen
CALL FUNCTION 'RH_STRUC_GET'
EXPORTING
act_otype = 'S'
act_objid = i0001-plans
act_wegid = 'S_UP' "auch Möglich 'O-O-S-P' oder 'A002'
act_plvar = '01'
act_begda = i0001-begda
act_endda = i0001-endda
TABLES
result_tab = gt_result_tab
result_objec = gt_result_objec
result_struc = gt_result_struc
EXCEPTIONS
no_plvar_found = 1
no_entry_found = 2
OTHERS = 3.
"Manager ermitteln
IF sy-subrc = 0.
LOOP AT gt_result_struc INTO gs_rs_struc WHERE otype = 'O'.
"Prüfe Verknüpfung B012 zwischen Organisationseinheit und Planstelle
IF gf_vorge IS INITIAL.
SELECT SINGLE sobid FROM hrp1001 INTO gf_objid
WHERE otype = 'O'
AND objid = gs_rs_struc-objid
AND plvar = '01'
AND subty = 'B012'
AND begda <= gf_datum
AND endda >= gf_datum
AND sclas = 'S'.
"Prüfe Verknüpfung zwischen Planstelle und Person A002
IF gf_objid IS NOT INITIAL AND gf_objid <> i0001-plans..
SELECT SINGLE sobid FROM hrp1001 INTO gf_objid_p
WHERE otype = 'S'
AND objid = gf_objid
AND plvar = '01'
AND subty = 'A008'
AND begda <= gf_datum
AND endda >= gf_datum
AND sclas = 'P'.
ENDIF.
"Hole den Namen des Vorgesetzen
IF gf_objid_p IS NOT INITIAL.
SELECT SINGLE ename FROM pa0001 INTO gf_vorge
WHERE pernr = gf_objid_p
AND begda <= gf_datum
AND endda >= gf_datum.
ENDIF.
ENDIF.
ENDLOOP.
ELSE.
"Mache nichts
ENDIF.
"Befülle Struktur mit dem Vorgesetzen
gs_data-vorge = gf_vorge.
CLEAR gf_vorge.
"e-Mail Manager IT105 Art 0010 (P0105-USRID_LONG)
"Hole die Personalnummer des Vorgesetzten
SELECT SINGLE pernr FROM pa0001 INTO gf_vorge_pernr
WHERE pernr = gf_objid_p
AND begda <= gf_datum
AND endda >= gf_datum.
"Hole die E-Mail Adresse
SELECT SINGLE usrid_long FROM pa0105 INTO gf_vorge_mail
WHERE pernr = gf_vorge_pernr
AND begda <= gf_datum
AND endda >= gf_datum
AND subty = '0010'.
gs_data-vmail = gf_vorge_mail.
CLEAR: gf_vorge_mail, gf_vorge_pernr.
"Hole den Massnahmentext
SELECT SINGLE MNTXT from t529t into gs_data-mntxt "ins REGTOZ M 18022015
WHERE massn = ipsyst-massn "ins REGTOZ M 18022015
AND sprsl = 'E'. "ins REGTOZ M 18022015
*&---------------------------------------------------------------------*
*& Druckausgabe einschalten
*&---------------------------------------------------------------------*
"Wird benötigt um den Spool eindeutig zu indentifizieren und zu finden
gf_spoolname = 'XSPOOLTOPDF'.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
copies = 1 "Anzahl
destination = 'LOCL'
immediately = '' "Wenn X wird der Druckauftrag sofort an den Drucker gesendet
expiration = 8 "Von SAP werden 8 Tage empfholen
line_count = 65 "Listen Zeilen pro Seite
line_size = 132 "Zeichen pro Listen Zeile
list_name = gf_spoolname
list_text = 'ONBOARDING' "Name/Titel des Jobs
no_dialog = 'X' "Wenn X wird kein Druckdialogfenster angezeigt
release = 'X' "Wenn X wird der Auftrag nach der Ausgabe sofort gelöscht
report = 'ZXPADU02' "Hier Kann man den Reportnamen angeben
user = sy-uname
IMPORTING
out_parameters = gs_druckparameter
valid = gf_gut
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF gf_gut = 'X'.
NEW-PAGE PRINT ON PARAMETERS gs_druckparameter NO DIALOG.
ENDIF.
*&---------------------------------------------------------------------*
*& Start Formular
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Kopf
*&---------------------------------------------------------------------*
WRITE: /,
/ 'ONBOARDING', '-',gs_data-butxts, '-', gs_data-pernrs, '-', gs_data-ename,
/, '------------------------------------------------------------------------------------------------------------------------------------------',
/7 '***EMPLOYEE ', gs_data-pernrs, ' ', gs_data-mntxt, ' ***', "' ENTRY NOTIFICATION***', "change REGTOZ M 18022015
/, '------------------------------------------------------------------------------------------------------------------------------------------',
/,
/7 'First name:', 30 gs_data-vnamc,
/,
/7 'Name:', 30 gs_data-nchmc,
/,
/7 'Personnel number:', 30 gs_data-pernrs,
/,
/7 'Entry date:', 30 gs_data-begda,
/,
/7 'Job:', 30 gs_data-stltx,
/,
/7 'Position:', 30 gs_data-plstx,
/,
/7 'Org. Unit:', 30 gs_data-orgtx,
/,
/7 'Costcenter:', 30 gs_data-kostls, gs_data-kostx,
/,
/7 'Personnel sub area:', 30 gs_data-btrtl, 35 gs_data-btext,
/,
/7 'Employee sub group:', 30 gs_data-persk, 33 gs_data-ptext,
/,
/7 'Location:', 30 gs_data-pbtxt,
/,
/7 'BU/SU:', 30 gs_data-anstx,
/,
/7 'Comm. Language:', 30 gs_data-sprsl, 33 gs_data-sptxt,
/,
/7 'Responsible HR:', 30 gs_data-sachn,
/,
/7 'Manager of employee:', 30 gs_data-vorge,
/, '------------------------------------------------------------------------------------------------------------------------------------------',
/7 '***REQUIRED ONBOARDING PACKAGES***',
/, '------------------------------------------------------------------------------------------------------------------------------------------'.
*&---------------------------------------------------------------------*
*& Dynamik
*&---------------------------------------------------------------------*
" Hole alle betroffenen Datensätze aus der Kundeneigenentabelle
SELECT * FROM zhronboard_jobid INTO TABLE gt_jobid
WHERE stell = i0001-stell
AND bukrs = i0001-bukrs
AND begda <= gf_datum
AND endda >= gf_datum.
"Erstelle eine Liste mit allen Einträgen
LOOP AT gt_jobid INTO gs_jobid.
"lese alle IT-I package
gs_link-bukrs = gs_jobid-bukrs.
gs_link-pack = gs_jobid-itip.
SELECT SINGLE sharepoint FROM zhronboard_link INTO gs_link-share
WHERE bukrs = i0001-bukrs
AND packid = gs_link-pack
AND begda <= gf_datum
AND endda >= gf_datum.
IF gs_link-pack IS NOT INITIAL AND gs_link-share IS NOT INITIAL.
APPEND gs_link TO gt_link.
CLEAR gs_link.
ELSEIF gs_link-pack IS NOT INITIAL AND gs_link-share IS INITIAL.
gs_link-share = 'Link is missing. Please maintain the ZHRONBOARD_LINK table.'.
APPEND gs_link TO gt_link.
CLEAR gs_link.
ELSE .
CLEAR gs_link.
ENDIF.
"lese alle IT-S package
gs_link-bukrs = gs_jobid-bukrs.
gs_link-pack = gs_jobid-itsp.
SELECT SINGLE sharepoint FROM zhronboard_link INTO gs_link-share
WHERE bukrs = i0001-bukrs
AND packid = gs_link-pack
AND begda <= gf_datum
AND endda >= gf_datum.
IF gs_link-pack IS NOT INITIAL AND gs_link-share IS NOT INITIAL.
APPEND gs_link TO gt_link.
CLEAR gs_link.
ELSEIF gs_link-pack IS NOT INITIAL AND gs_link-share IS INITIAL.
gs_link-share = 'Link is missing. Please maintain the ZHRONBOARD_LINK table.'.
APPEND gs_link TO gt_link.
CLEAR gs_link.
ELSE .
CLEAR gs_link.
ENDIF.
"lese alle XXP package
gs_link-bukrs = gs_jobid-bukrs.
gs_link-pack = gs_jobid-xxp.
SELECT SINGLE sharepoint FROM zhronboard_link INTO gs_link-share
WHERE bukrs = i0001-bukrs
AND packid = gs_link-pack
AND begda <= gf_datum
AND endda >= gf_datum.
IF gs_link-pack IS NOT INITIAL AND gs_link-share IS NOT INITIAL.
APPEND gs_link TO gt_link.
CLEAR gs_link.
ELSEIF gs_link-pack IS NOT INITIAL AND gs_link-share IS INITIAL.
gs_link-share = 'Link is missing. Please maintain the ZHRONBOARD_LINK table.'.
APPEND gs_link TO gt_link.
CLEAR gs_link.
ELSE .
CLEAR gs_link.
ENDIF.
ENDLOOP.
"Tabelle nach ABC Sortieren Grunlage ist der Link
SORT gt_link DESCENDING BY pack.
"Lösche doppelte Einträge.
DELETE ADJACENT DUPLICATES FROM gt_link.
"Tabelle nach ABC Sortieren Grunlage ist der Link
SORT gt_link DESCENDING BY share.
LOOP AT gt_link INTO gs_link.
WRITE: /,
/7 gs_link-pack, 30 gs_link-share.
ENDLOOP.
* Begin MRU19012015 (PHP 20003787
if gt_link[] is initial.
WRITE: /,
/7 'There is no standard IT equipment planned for this job, thank you to order manually with the link below.' color 2 INTENSIFIED on.
endif.
* End MRU19012015
*&---------------------------------------------------------------------*
*& Fusszeile
*&---------------------------------------------------------------------*
WRITE: /, '------------------------------------------------------------------------------------------------------------------------------------------',
/7 '***ADDITIONAL REQUIREMENTS***',
/, '------------------------------------------------------------------------------------------------------------------------------------------',
/,
/7 'In case you have additional requirements to onboard your employee, please click here:',
/,
/7 'http://servicedesk.emea.jetaviation.ch/HEAT/Login.aspx',
/,
/,
/ 'Initialized at:', 30 sy-datum,
/, '------------------------------------------------------------------------------------------------------------------------------------------',
/7 'SAP Message autom. created by ', sy-uname,
/, '------------------------------------------------------------------------------------------------------------------------------------------'.
*&---------------------------------------------------------------------*
*& Ende Formular
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& druckausgabe_ausschalten
*&---------------------------------------------------------------------*
IF gf_gut = 'X'.
NEW-PAGE PRINT OFF.
ENDIF.
*&---------------------------------------------------------------------*
*& Spoolnummer holen
*&---------------------------------------------------------------------*
"Spoolnummer holen
SELECT * FROM tsp01 INTO gs_tsp01
WHERE rqowner = sy-uname
AND rq2name = gf_spoolname
ORDER BY rqcretime ASCENDING.
gf_spoolnr = gs_tsp01-rqident.
ENDSELECT.
*&---------------------------------------------------------------------*
*& E-MAIL Absender holen
*&---------------------------------------------------------------------*
"Holle mir die Daten zur UserID
SELECT SINGLE * FROM pa0105 INTO gs_105
WHERE usrid = sy-uname
AND begda <= gf_datum
AND endda >= gf_datum
AND subty = '0001'.
IF sy-subrc = 0.
"Hole die E-Mail Adresse zur UserID aus dem IT0105
SELECT SINGLE usrid_long FROM pa0105 INTO gf_receiver
WHERE pernr = gs_105-pernr
AND begda <= gf_datum
AND endda >= gf_datum
AND subty = '0010'.
ELSE.
* SELECT SINGLE * FROM usr21 INTO gs_105 "del DEJK915500
SELECT SINGLE * FROM usr21 INTO gs_usr21 "ins DEJK915500
WHERE bname = sy-uname.
SELECT SINGLE smtp_addr FROM adr6 INTO gf_receiver
WHERE addrnumber = gs_usr21-addrnumber
AND persnumber = gs_usr21-persnumber.
ENDIF.
*&---------------------------------------------------------------------*
*& E-MAIL senden mit Programm (Werteübergabe)
*&---------------------------------------------------------------------*
"Übergabe der E-MAIL Adresse des Vorgesetzten
rspar_line-selname = 'S_MAILS'.
rspar_line-kind = 'P'.
rspar_line-sign = 'I'.
rspar_line-option = 'EQ'.
rspar_line-low = gs_data-vmail.
APPEND rspar_line TO rspar_tab.
"Übergabe Header erstellen
* CONCATENATE 'ONBOARDING' '-' gs_data-pernr '-' gs_data-ename INTO gf_header. "del VLE21072015
* Begin of ins VLE21072015
CLEAR gf_date_ext.
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
DATE_INTERNAL = gs_data-begda
IMPORTING
DATE_EXTERNAL = gf_date_ext
EXCEPTIONS
DATE_INTERNAL_IS_INVALID = 1
OTHERS = 2.
IF sy-subrc <> 0.
gf_date_ext = gs_data-begda.
ENDIF.
CONCATENATE 'ONBOARDING' '-' gf_date_ext '-' gs_data-pernr '-' gs_data-ename "ins VLE21072015
INTO gf_header.
* End of ins VLE21072015
SUBMIT zhr_on_mail USING SELECTION-SCREEN '1000'
WITH SELECTION-TABLE rspar_tab
WITH p_dil = gs_forms-so_dli_nam
WITH p_header = gf_header
WITH p_spooln = gf_spoolnr
WITH p_sender = gf_receiver
AND RETURN.
Mail Programm
*&---------------------------------------------------------------------*
*& Report ZHR_ON_MAIL
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
* Develpoment spfecification
* - Modul HCM (Oneboarding process)
*
* Autor: Regotz Michel, T-Systems DMC AG, 11.2014
*
* Description:
* ************
* This Programm send the Mail for the onboarding process (Modul HCM).
* HR JBSL wants to indroduce an onboarding process which is supported
* by SAP HR module. The new Process is planned to be in place as of
* 01.12.2014.
* Starting point for this process in SAP are predefined actions and the
* corresponding entry in IT0001 for the field enrty "job". According
* to the job assignment a mail will be sent with a variety of
* information from IT0000, IT0001, IT0002 and additional information
* about It packages an share point links.
* The onboarding process enables a smooth start of work for a new
* employee; required working packages are going to be ready for the
* first working day. In addition, this process reduces paperwork for
* line managers when hiring a new employee an relives various department
* (HR, IT-S, IT-I) in their everyday operation
*
* Table 1: ZHRONBOARD_JOBID
* Transaction: ZHR_JOBID
* The onboarding table 1 provides information about payroll area,
* job-ID, validity date and packages (IT-I, IT-S, working clothes).
* The table 1 is maintained in SAP by authorized sap HR user.
* To display the right packages on Pdf, user exit shall check the table
* fields marked with CHECK.
* If the job-ID is delimited (validity end date exists) the table 1
* should be set up like a SAP standard table, which means it shall
* display only the valid/actual entries; the delimited entries should
* be hidden but enabled for display Multiple different packages -
* all active packages have to be displayed on the PDF Blank fields -
* do not need to be displayed Double packages - a package should be
* displayed only once on the Pdf.
*
* Table 2: ZHRONBOARD_LINK
* Transaction: ZHR_PACKAGES
* The onboarding Table 2 provides information about payroll area,
* packages, validity dates and share point link.
* Both tables are maintained directly in P11; table contents do not need
* to be transported. Package field 10 digit alphanumeric code;
* additional > 100
*
* Table 3. ZHRONBOARD_FORMS
* Transaction: ZHR_FORMS
* This table shows the relationship between forms (Pdf) and distribution
* lists. IT-S shall maintain the distribution list via SOST.
*
* Change History:
* ***************
* Example
* SMI22062002: Correction Selectionscreen
REPORT zhr_on_mail.
*&---------------------------------------------------------------------*
*& Includes
*&---------------------------------------------------------------------*
"Datendekleration
INCLUDE zhr_on_mail_top.
"Screen Parameter
INCLUDE zhr_on_mail_screen.
"Forms
INCLUDE zhr_on_mail_forms.
*&---------------------------------------------------------------------*
*& Selection-Screen
*&---------------------------------------------------------------------*
AT SELECTION-SCREEN OUTPUT.
PERFORM comment.
*&---------------------------------------------------------------------*
*& START-OF-SELECTION
*&---------------------------------------------------------------------*
START-OF-SELECTION.
"Spoolauftragkonvertieren
PERFORM spooltopdf.
"Einen String aus dem Spoolauftrag erstellen
PERFORM string.
"String des PDF-Quelltexts in itab konvertieren
PERFORM stringtopdf.
"Spoolauftrag in ITAB holen
PERFORM spooltoitab.
"ITAB mit Spool darsellung für HTML bereinigen
PERFORM html.
"Nachrichtenext des Mails erstellen (in HTML)
PERFORM mailtext.
"Dokumentdaten festlegen
PERFORM maildata.
"Empfängerliste aufbauen
PERFORM mailreceivers.
"E-Mail versenden
PERFORM send_mail.