Migration Susses Factors
*&---------------------------------------------------------------------*
*& Report ZHR_SF_DATA
*&---------------------------------------------------------------------*
* ___ _____ ___ _ _ ____ ____ ____ ### ###
* / __)( _ )/ __)( )/ )( _ \(_ _)(_ _) ###=ooO=========Ooo=###
*( (__ )(_)(( (__ ) ( )___/ _)(_ )( ### \\ (o o) // ###
* \___)(_____)\___)(_)\_)(__) (____) (__) ----------(_)----------
*&---------------------------------------------------------------------*
******************************* MREGOTZ **************************
************************************************************************
*&H PROGRAMMNAME : ZHR_SF_DATA
*&H TRANSAKTIONSCODE : ZHR_SF_DATA
*&H PROGRAMMTITEL : Sap Successfactors DATA
*&H ZWECK : Holt verschiedene HR Daten für Successfactors
*&H AUTOR : Regotz Michel
*&H DATUM : 01.05.2017
*&H VORAUSSETZUNGEN : Swisscom Spezifisch
*&H SAP-MODUL : HR-PY
*&H
*&H Company/Department : Swisscom AG
*&H Phone : +41 79 322 04 86 (Mobil)
*&H E-Mail : Michel.Regotz@Swisscom.ch
*&H
************************************************************************
*&D Beschreibung : Vereinfacht Vergleich Succesfactors Daten
*&D --------------------------------------------------------------------
*&D Leistung : Eerleichterter Vergeleich Succesfactors
*&D --------------------------------------------------------------------
*&D Tabellen : zhr_sf_data
*&D --------------------------------------------------------------------
*&D Verarbeitung : Aufbau eines ALVs
*&D Anzeigen des ALVs
************************************************************************
*&C Change history :
*&C --------------------------------------------------------------------
*&C Developer | Date | Description
*&C --------------------------------------------------------------------
*&C Michel Regotz | 16.05.2017 | Produktivsetzung
*&C --------------------------------------------------------------------
*&C <Name> | <Date> | <Description>
*&C --------------------------------------------------------------------
*&C <Name> | <Date> | <Description>
*&C --------------------------------------------------------------------
*&C <Name> | <Date> | <Description>
************************************************************************
REPORT zhr_sf_data." MESSAGE-ID zhr_lv_cockpit.
"Wird für den Befehl GET PERAS benötigt
NODES: person,group,peras.
"Tabelle der Personalnummer für GET PERAS
TABLES: pernr, pa0000.
"Folgende Infotypen werden bei der Daten Selektion im Report verwendet
INFOTYPES: 0000, 0001, 0002, 0006, 0007, 0008, 0016, 0017, 0014, 0028, 0036, 0040, 0041, 0048, 0050, 0105, 0315.
"=======================================================================
" Datendeklaration
"=======================================================================
*-----------------------------------------------------------------------
* Beginn Datendeklarationen fuer den Tabelle ZHR_LV_COCKPIT
*-----------------------------------------------------------------------
* Werte beschaffen
*-----------------------------------------------------------------------
DATA: gs_pa0000 TYPE pa0000.
DATA: gt_pa0000 TYPE TABLE OF pa0000.
DATA: gs_pa0001 TYPE pa0001.
DATA: gt_pa0001 TYPE TABLE OF pa0001.
DATA: gs_pa0002 TYPE pa0002.
DATA: gt_pa0002 TYPE TABLE OF pa0002.
DATA: gs_pa0006 TYPE pa0006.
DATA: gt_pa0006 TYPE TABLE OF pa0006.
DATA: gs_pa0008 TYPE pa0008.
DATA: gt_pa0008 TYPE TABLE OF pa0008.
DATA: gs_pa0028 TYPE pa0028.
DATA: gt_pa0028 TYPE TABLE OF pa0028.
DATA: gs_pa0040 TYPE pa0040.
DATA: gt_pa0040 TYPE TABLE OF pa0040.
DATA: gs_t526 TYPE t526.
DATA: gt_t526 TYPE TABLE OF t526.
DATA: gt_data_1 TYPE TABLE OF zhr_sf_data_1.
DATA: gs_data_1 TYPE zhr_sf_data_1.
DATA: gt_data_2 TYPE TABLE OF zhr_sf_data_2.
DATA: gs_data_2 TYPE zhr_sf_data_2.
DATA: gt_data_3 TYPE TABLE OF zhr_sf_data_3.
DATA: gs_data_3 TYPE zhr_sf_data_3.
DATA: gt_data_4 TYPE TABLE OF zhr_sf_data_4.
DATA: gs_data_4 TYPE zhr_sf_data_4.
DATA: gt_data_5 TYPE TABLE OF zhr_sf_data_5.
DATA: gs_data_5 TYPE zhr_sf_data_5.
DATA: gt_data_6 TYPE TABLE OF zhr_sf_data_6.
DATA: gs_data_6 TYPE zhr_sf_data_6.
DATA: gt_data_7 TYPE TABLE OF zhr_sf_data_7.
DATA: gs_data_7 TYPE zhr_sf_data_7.
DATA: gt_data_8 TYPE TABLE OF zhr_sf_data_8.
DATA: gs_data_8 TYPE zhr_sf_data_8.
DATA: gt_data_9 TYPE TABLE OF zhr_sf_data_9.
DATA: gs_data_9 TYPE zhr_sf_data_9.
DATA: gt_data_10 TYPE TABLE OF zhr_sf_data_10.
DATA: gs_data_10 TYPE zhr_sf_data_10.
DATA: gt_data_11 TYPE TABLE OF zhr_sf_data_11.
DATA: gs_data_11 TYPE zhr_sf_data_11.
DATA: gt_data_12 TYPE TABLE OF zhr_sf_data_12.
DATA: gs_data_12 TYPE zhr_sf_data_12.
DATA: gt_data_13 TYPE TABLE OF zhr_sf_data_13.
DATA: gs_data_13 TYPE zhr_sf_data_13.
DATA: gf_datum TYPE sy-datum.
DATA: gt_result_tab TYPE TABLE OF swhactor,
gt_result_objec TYPE TABLE OF objec,
gt_result_struc TYPE TABLE OF struc,
gs_rs_tab TYPE swhactor,
gs_rs_objec TYPE objec,
gs_rs_struc TYPE struc,
gf_objid_p TYPE objid,
gf_objid TYPE objid,
gf_count TYPE i,
gf_vorge TYPE char40,
gf_vorge_pernr TYPE p_pernr,
gf_vorge_mail TYPE comm_id_long.
DATA: gf_sbjkt TYPE sbjkt.
"Tabelle für die .CSV-Konvertierung
TYPES truxs_t_text_data(4096) TYPE c OCCURS 0.
DATA: outtab_csv TYPE truxs_t_text_data.
DATA: gs_outtab_csv LIKE LINE OF outtab_csv.
"Big Version Pfad auswählen um CSV zuspeichern
DATA: ld_filename TYPE string,
ld_path TYPE string,
ld_fullpath TYPE string,
ld_result TYPE i,
gd_file TYPE c.
"=======================================================================
" Datendeklaration für ALV
"=======================================================================
*-----------------------------------------------------------------------
* Beginn Datendeklarationen fuer den ALV
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block zu den Datendeklarationen des ABAP-Programms
* Auch die Handler-Definition fuer Doppeklick ist eine Deklaration
*-----------------------------------------------------------------------
DATA go_alv TYPE REF TO cl_salv_table.
DATA go_functions TYPE REF TO cl_salv_functions_list.
DATA: go_columns TYPE REF TO cl_salv_columns_table,
go_column TYPE REF TO cl_salv_column_table.
DATA: gs_color TYPE lvc_s_colo.
DATA go_display TYPE REF TO cl_salv_display_settings.
DATA go_events TYPE REF TO cl_salv_events_table.
DATA: go_layout TYPE REF TO cl_salv_layout,
gf_variant TYPE slis_vari,
gs_key TYPE salv_s_layout_key.
DATA: go_selections TYPE REF TO cl_salv_selections.
DATA: go_err_salv TYPE REF TO cx_salv_msg.
DATA: go_err_salv_exist TYPE REF TO cx_salv_existing.
DATA: go_err_wrong_call TYPE REF TO cx_salv_wrong_call.
DATA: gf_string TYPE string.
DATA: go_func TYPE REF TO cl_salv_functions_list.
"=======================================================================
" Selektionsscreen für ALV
"=======================================================================
*-----------------------------------------------------------------------
* Selektion
*-----------------------------------------------------------------------
"Auswahl
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-010.
PARAMETERS p1 RADIOBUTTON GROUP 1.
PARAMETERS p2 RADIOBUTTON GROUP 1.
PARAMETERS: p3 RADIOBUTTON GROUP 1.
PARAMETERS: p4 RADIOBUTTON GROUP 1.
PARAMETERS: p5 RADIOBUTTON GROUP 1.
PARAMETERS: p6 RADIOBUTTON GROUP 1.
PARAMETERS: p7 RADIOBUTTON GROUP 1.
PARAMETERS: p8 RADIOBUTTON GROUP 1.
PARAMETERS: p9 RADIOBUTTON GROUP 1.
PARAMETERS: p10 RADIOBUTTON GROUP 1.
PARAMETERS: p11 RADIOBUTTON GROUP 1.
PARAMETERS: p12 RADIOBUTTON GROUP 1.
PARAMETERS: p13 RADIOBUTTON GROUP 1.
*PARAMETERS: p13 RADIOBUTTON GROUP 1.
SELECTION-SCREEN END OF BLOCK b1.
"Download Selektion
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-020.
"Hier kann man das XLS eingeben
PARAMETERS: p_file TYPE rlgrap-filename.
PARAMETERS: p_csv AS CHECKBOX.
PARAMETERS: p_ini AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b2.
"Beschreibung
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-030.
SELECTION-SCREEN COMMENT 1(75) text-031.
SELECTION-SCREEN END OF BLOCK b3.
*=======================================================================
* INITIALIZATION
*==========================================pnpbegda=============================
INITIALIZATION.
pnpbegda = sy-datum.
p_csv = 'X'.
IF sy-uname = 'REGOTZ M'.
p_file = 'C:\Users\RegotzM\Desktop\D1_Sätze.CSV'.
ENDIF.
*=======================================================================
* START OF SELECTION
*=======================================================================
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM f4_help.
*=======================================================================
* START OF SELECTION
*=======================================================================
START-OF-SELECTION.
"Datum aus der Selektion
gf_datum = pn-endda.
GET peras.
"Logik
IF p1 = 'X'.
PERFORM read_data.
ELSEIF p2 = 'X'.
PERFORM read_data2.
ELSEIF p3 = 'X'.
PERFORM read_data3.
ELSEIF p4 = 'X'.
PERFORM read_data4.
ELSEIF p5 = 'X'.
PERFORM read_data5.
ELSEIF p6 = 'X'.
PERFORM read_data6.
ELSEIF p7 = 'X'.
PERFORM read_data7.
ELSEIF p8 = 'X'.
PERFORM read_data8.
ELSEIF p9 = 'X'.
PERFORM read_data9.
ELSEIF p10 = 'X'.
PERFORM read_data10.
ELSEIF p11 = 'X'.
PERFORM read_data11.
ELSEIF p12 = 'X'.
PERFORM read_data12.
ELSEIF p13 = 'X'.
PERFORM read_data13.
ENDIF.
END-OF-SELECTION.
*=======================================================================
* Ausgabe
*=======================================================================
IF p1 = 'X'.
PERFORM show_alv.
IF p_csv = 'X'.
PERFORM download_csv.
ENDIF.
ELSEIF p2 = 'X'.
PERFORM show_alv2.
IF p_csv = 'X'.
PERFORM download_csv2.
ENDIF.
ELSEIF p3 = 'X'.
PERFORM show_alv3.
IF p_csv = 'X'.
PERFORM download_csv3.
ENDIF.
ELSEIF p4 = 'X'.
PERFORM show_alv4.
IF p_csv = 'X'.
PERFORM download_csv4.
ENDIF.
ELSEIF p5 = 'X'.
PERFORM show_alv5.
IF p_csv = 'X'.
PERFORM download_csv5.
ENDIF.
ELSEIF p6 = 'X'.
PERFORM show_alv6.
IF p_csv = 'X'.
PERFORM download_csv6.
ENDIF.
ELSEIF p7 = 'X'.
PERFORM show_alv7.
IF p_csv = 'X'.
PERFORM download_csv7.
ENDIF.
ELSEIF p8 = 'X'.
PERFORM show_alv8.
IF p_csv = 'X'.
PERFORM download_csv8.
ENDIF.
ELSEIF p9 = 'X'.
PERFORM show_alv9.
IF p_csv = 'X'.
PERFORM download_csv9.
ENDIF.
ELSEIF p10 = 'X'.
PERFORM show_alv10.
IF p_csv = 'X'.
PERFORM download_csv10.
ENDIF.
ELSEIF p11 = 'X'.
PERFORM show_alv11.
IF p_csv = 'X'.
PERFORM download_csv11.
ENDIF.
ELSEIF p12 = 'X'.
PERFORM show_alv12.
IF p_csv = 'X'.
PERFORM download_csv12.
ENDIF.
ELSEIF p13 = 'X'.
PERFORM show_alv13.
IF p_csv = 'X'.
PERFORM download_csv13.
ENDIF.
ENDIF.
*=======================================================================
* FORM READ DATA
*=======================================================================
*=======================================================================
* Basic Import
*=======================================================================
*&---------------------------------------------------------------------*
*& Form READ_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data .
**************************************************************************
* IT0000
**************************************************************************
PROVIDE * FROM p0000 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* Beschäftigung
"*********************************************************************
gs_data_1-status = p0000-stat2.
IF gs_data_1-status = '3'.
gs_data_1-status = 'ACTIVE'.
ELSE.
gs_data_1-status = 'INACTIVE'.
ENDIF.
ENDPROVIDE.
"***********************************************************************
"* PNR
"***********************************************************************
gs_data_1-pernr = pernr-pernr.
OVERLAY gs_data_1-pernr WITH '0000000000'.
"***********************************************************************
"* USERID
"***********************************************************************
SELECT SINGLE usrid FROM pa0105 INTO gs_data_1-userid
WHERE pernr = pernr-pernr
AND begda <= gf_datum
AND endda >= gf_datum
AND subty = 'Z003'.
**************************************************************************
* IT0002
**************************************************************************
PROVIDE * FROM p0002 BETWEEN gf_datum AND gf_datum.
"Vorname
gs_data_1-vorna = p0002-vorna.
"Nachname
gs_data_1-nachn = p0002-nachn.
ENDPROVIDE.
"***********************************************************************
"* EMAIL
"***********************************************************************
SELECT SINGLE usrid_long FROM pa0105 INTO gs_data_1-mail
WHERE pernr = pernr-pernr
AND begda <= gf_datum
AND endda >= gf_datum
AND subty = '0010'.
**************************************************************************
* IT0001 Vorgesetzter Manager
**************************************************************************
PROVIDE * FROM p0001 BETWEEN gf_datum AND gf_datum.
"Organisationstruktur lesen
CALL FUNCTION 'RH_STRUC_GET'
EXPORTING
act_otype = 'S'
act_objid = p0001-plans
act_wegid = 'S_UP' "auch Möglich 'O-O-S-P' oder 'A002'
act_plvar = '01'
act_begda = p0001-begda
act_endda = p0001-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 <> p0001-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.
IF gf_objid_p IS NOT INITIAL. "NEW
EXIT.
ENDIF.
ENDIF.
ENDLOOP.
ELSE.
"Mache nichts
ENDIF.
ENDPROVIDE.
gs_data_1-manager = gf_objid_p.
IF gf_objid_p IS INITIAL.
gs_data_1-manager = 'NO_MANAGER'.
ENDIF.
CLEAR: gt_result_tab, gt_result_objec, gt_result_struc,
gs_rs_tab, gs_rs_objec, gs_rs_struc,
gf_objid_p, gf_objid, gf_vorge, gf_vorge_pernr,
gf_vorge_mail.
"**************************************************************************
"* HR (Sachbearbeiter)
"**************************************************************************
PROVIDE * FROM p0001 BETWEEN gf_datum AND gf_datum.
SELECT SINGLE * FROM t526 INTO gs_t526
WHERE werks = p0001-sbmod AND
sachx <= p0001-sachp.
IF gs_t526-usrid IS NOT INITIAL.
CLEAR: gs_data_1-hr.
SELECT SINGLE pernr FROM pa0105 INTO gs_data_1-hr
WHERE subty = 'Z003' AND
usrid = gs_t526-usrid AND
begda <= gf_datum AND
endda >= gf_datum.
IF gs_data_11-relai IS INITIAL.
gs_data_1-hr = gs_t526-sachn.
ENDIF.
ELSE.
gs_data_1-hr = gs_t526-sachn.
ENDIF.
CLEAR: gs_t526.
ENDPROVIDE.
"**************************************************************************
"* Time Zone
"**************************************************************************
gs_data_1-tzone = 'Europe/Zurich'.
"**************************************************************************
"* Hire Date
"**************************************************************************
"***************************************************************************
"** IT0001
"***************************************************************************
* PROVIDE * FROM p0001 BETWEEN gf_datum AND gf_datum.
* "**************************************************************************
* "* Hire Date
* "**************************************************************************
* IF p_ini = 'X'.
* SELECT * FROM pa0000 INTO TABLE gt_pa0000
* WHERE pernr = pernr-pernr.
* SORT gt_pa0000 BY endda DESCENDING.
* LOOP AT gt_pa0000 INTO gs_pa0000.
* CASE gs_pa0000-massn.
* WHEN '01' OR '06' OR '51' OR '50' OR '20' OR '12' OR '13'.
* "Event Date
* CONCATENATE
* gs_pa0000-begda+4(2) '/'
* gs_pa0000-begda+6(2) '/'
* gs_pa0000-begda(4)
* INTO gs_data_1-hired.
* EXIT.
* WHEN OTHERS.
* CLEAR: gs_pa0000.
* ENDCASE.
* ENDLOOP.
* CLEAR: gs_pa0000.
* ELSE.
* SELECT SINGLE * FROM pa0001 INTO gs_pa0001
* WHERE pernr = pernr-pernr AND
* begda <= gf_datum AND
* endda >= gf_datum.
* CONCATENATE
* gs_pa0001-begda+4(2) '/'
* gs_pa0001-begda+6(2) '/'
* gs_pa0001-begda(4)
* INTO gs_data_1-hired.
* CLEAR: gs_pa0001.
* ENDIF.
* ENDPROVIDE.
* CLEAR: gs_pa0001, gt_pa0001, gt_pa0000, gs_pa0000.
CONCATENATE
gf_datum+6(2) '/'
gf_datum+4(2) '/'
gf_datum(4)
INTO gs_data_1-hired.
"**************************************************************************
"* Default Local
"**************************************************************************
gs_data_1-zzhr_local = 'en_US'.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_1 TO gt_data_1.
CLEAR gs_data_1.
ENDFORM. " READ_DATA
*=======================================================================
* FORM SHOW_ALV
*=======================================================================
*&---------------------------------------------------------------------*
*& Form show_alv
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM show_alv .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_1 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. "show_alv
*&---------------------------------------------------------------------*
*& Form download_csv
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM download_csv.
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_1
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
gs_outtab_csv = 'STATUS;USERID;USERNAME;FIRSTNAME;LASTNAME;EMAIL;MANAGER;HR;TIMEZONE;HIREDATE;DEFAULT_LOCALE'.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. "download_csv
*&---------------------------------------------------------------------*
*& Form f4_help
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f4_help.
* Dialog Bildschirm zum speichern der Daten
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
* window_title = ' '
default_extension = 'CSV'
default_file_name = 'D1_Sätze'
initial_directory = 'c:\temp\'
CHANGING
filename = ld_filename
path = ld_path
fullpath = ld_fullpath
user_action = ld_result.
p_file = ld_fullpath.
ENDFORM. "f4_help
*=======================================================================
* Person Info Import
*=======================================================================
*&---------------------------------------------------------------------*
*& Form READ_DATA2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data2 .
"***********************************************************************
"* PNR
"***********************************************************************
gs_data_2-pernr = pernr-pernr.
**************************************************************************
* IT0002
**************************************************************************
PROVIDE * FROM p0002 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* Land, Ort, Datum des Todes
"*********************************************************************
CONCATENATE p0002-gbdat+6(2) '/' p0002-gbdat+4(2) '/' p0002-gbdat(4)
INTO gs_data_2-gbdat.
"gs_data_2-gblnd = p0002-gblnd.
SELECT SINGLE iso FROM zhr_sf_data_iso INTO gs_data_2-gblnd
WHERE land = p0002-gblnd.
* gs_data_2-gbort = p0002-gbort.
gs_data_2-death = ''.
ENDPROVIDE.
"***********************************************************************
"* Globale PNR
"***********************************************************************
gs_data_2-gpernr = pernr-pernr.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_2 TO gt_data_2.
CLEAR gs_data_2.
ENDFORM. " READ_DATA2
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv2 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_2 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv2 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_2
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
gs_outtab_csv = 'user-id;date-of-birth;country-of-birth;place-of-birth;date-of-death;person-id-external'.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " DOWNLOAD_CSV2
*=======================================================================
* Employment Details Import
*=======================================================================
*&---------------------------------------------------------------------*
*& Form READ_DATA2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data3 .
"***********************************************************************
"* PNR
"***********************************************************************
gs_data_3-pernr = pernr-pernr.
gs_data_3-epernr = pernr-pernr.
**************************************************************************
* IT0000
**************************************************************************
SELECT * FROM pa0000 INTO TABLE gt_pa0000
WHERE pernr = pernr-pernr.
SORT gt_pa0000 BY endda DESCENDING.
"*********************************************************************
"* Eintritt
"*********************************************************************
LOOP AT gt_pa0000 INTO gs_pa0000.
IF gs_pa0000-massn = '01' OR
gs_pa0000-massn = '50' OR
gs_pa0000-massn = '51' OR
gs_pa0000-massn = '06' OR
gs_pa0000-massn = '20' OR
gs_pa0000-massn = '12' OR
gs_pa0000-massn = '13'.
CONCATENATE gs_pa0000-begda+6(2) '/' gs_pa0000-begda+4(2) '/' gs_pa0000-begda(4)
INTO gs_data_3-hire.
EXIT.
ENDIF.
ENDLOOP.
CLEAR: gt_pa0000, gs_pa0000.
gs_data_3-ohire = gs_data_3-hire.
gs_data_3-fhire = gs_data_3-hire.
**************************************************************************
* IT0001
**************************************************************************
* PROVIDE * FROM p0001 BETWEEN gf_datum AND gf_datum.
* "*********************************************************************
* "* Stelle Job Number
* "*********************************************************************
* gs_data_3-stell = p0001-stell.
* ENDPROVIDE.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_3 TO gt_data_3.
CLEAR gs_data_3.
ENDFORM. " READ_DATA2
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv3 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_3 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv3 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_3
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
gs_outtab_csv = 'user-id;person-id-external;start-date;originalStartDate;seniorityDate;benefits-eligibility-start-date;serviceDate;professionalServiceDate;notes;firstDateWorked;jobNumber'.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " DOWNLOAD_CSV2
*=======================================================================
* Job History
*=======================================================================
*&---------------------------------------------------------------------*
*& Form READ_DATA2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data4 .
"*********************************************************************
"* Pernr
"*********************************************************************
gs_data_4-pernr = pernr-pernr.
"*********************************************************************
"* Standard Monthly Hours
"*********************************************************************
gs_data_4-mhour = '184'.
***************************************************************************
** IT0001
***************************************************************************
PROVIDE * FROM p0001 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* Initial load End Date und Event Date
"*********************************************************************
IF p_ini = 'X'.
SELECT * FROM pa0000 INTO TABLE gt_pa0000
WHERE pernr = pernr-pernr.
SORT gt_pa0000 BY endda DESCENDING.
LOOP AT gt_pa0000 INTO gs_pa0000.
CASE gs_pa0000-massn.
WHEN '01' OR '06' OR '51' OR '50' OR '20' OR '12' OR '13'.
"Event Date
* CONCATENATE
* gs_pa0000-begda+4(2) '/'
* gs_pa0000-begda+6(2) '/'
* gs_pa0000-begda(4)
* INTO gs_data_4-begda.
CONCATENATE
gf_datum+6(2) '/'
gf_datum+4(2) '/'
gf_datum(4)
INTO gs_data_4-begda.
"End Date
* CONCATENATE
* gs_pa0000-endda+4(2) '/'
* gs_pa0000-endda+6(2) '/'
* gs_pa0000-endda(4)
* INTO gs_data_4-endda.
CONCATENATE
'31' '/'
'12' '/'
'9999'
INTO gs_data_4-endda.
"Initialisieren falls 12/31/9999
IF p_ini = 'X' AND gs_data_4-endda = '12/31/9999'.
CLEAR: gs_data_4-endda.
ENDIF.
"*********************************************************************
"* Event Reaseon by initial load
"*********************************************************************
CASE gs_pa0000-massn.
WHEN '01' OR '06' OR '51' OR '50' OR '20'.
CASE p0000-massg.
WHEN 'Z1'.
gs_data_4-massg = 'HIRIMP'.
WHEN OTHERS.
gs_data_4-massg = 'HIRIMP'.
ENDCASE.
WHEN '12' OR '13'.
CASE p0000-massg.
WHEN 'Z1'.
gs_data_4-massg = 'REHIMP'.
WHEN OTHERS.
gs_data_4-massg = 'REHIMP'.
ENDCASE.
WHEN OTHERS.
"mache nichts.
ENDCASE.
EXIT.
WHEN OTHERS.
CLEAR: gs_pa0000.
ENDCASE.
ENDLOOP.
CLEAR: gt_pa0000, gs_pa0000.
ELSE.
"*********************************************************************
"* End Date
"*********************************************************************.
* CONCATENATE
* p0001-endda+4(2) '/'
* p0001-endda+6(2) '/'
* p0001-endda(4)
* INTO gs_data_4-endda.
SELECT SINGLE * FROM pa0001 INTO gs_pa0001
WHERE pernr = pernr-pernr AND
begda <= gf_datum AND
endda >= gf_datum.
* CONCATENATE
* gs_pa0001-endda+4(2) '/'
* gs_pa0001-endda+6(2) '/'
* gs_pa0001-endda(4)
* INTO gs_data_4-endda.
CONCATENATE
'31' '/'
'12' '/'
'9999'
INTO gs_data_4-endda.
"*********************************************************************
"* Event Date
"*********************************************************************
* CONCATENATE
* p0001-begda+4(2) '/'
* p0001-begda+6(2) '/'
* p0001-begda(4)
* INTO gs_data_4-begda.
* CONCATENATE
* gs_pa0001-begda+4(2) '/'
* gs_pa0001-begda+6(2) '/'
* gs_pa0001-begda(4)
* INTO gs_data_4-begda.
CONCATENATE
gf_datum+6(2) '/'
gf_datum+4(2) '/'
gf_datum(4)
INTO gs_data_4-begda.
CLEAR: gs_pa0001.
ENDIF.
"*********************************************************************
"* Job Title
"*********************************************************************
SELECT SINGLE stltx FROM t513s INTO gs_data_4-stltx
WHERE stell = p0001-stell AND
begda <= gf_datum AND
endda >= gf_datum AND
sprsl = sy-langu.
"*********************************************************************
"* Job code
"*********************************************************************
gs_data_4-stell = p0001-stell.
"*********************************************************************
"* Department
"*********************************************************************
gs_data_4-orgeh = p0001-orgeh.
"*********************************************************************
"* ORGSTRUCKTUR LESEN
"*********************************************************************
"Lokale Deklaration:
* DATA: lt_result_tab TYPE TABLE OF swhactor,
* lt_result_objec TYPE TABLE OF objec,
* lt_result_struc TYPE TABLE OF struc,
* ls_rs_tab TYPE swhactor,
* ls_rs_objec TYPE objec,
* ls_rs_struc TYPE struc,
* lf_count TYPE i.
"Orgstruktur lesen
CALL FUNCTION 'RH_STRUC_GET'
EXPORTING
act_otype = 'S'
act_objid = p0001-plans
act_wegid = 'S_UP'
act_plvar = '01'
act_begda = p0001-endda
act_endda = p0001-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.
IF sy-subrc <> 0.
"mache nichts
ELSE.
"Count organisational units along the evaluation path:
gf_count = lines( gt_result_objec ).
"*********************************************************************
"* Buisnessunit
"*********************************************************************
IF gf_count - 1 = 1.
READ TABLE gt_result_objec INTO gs_rs_objec INDEX gf_count. "If no BU available one level higher
gs_data_4-busin = gs_rs_objec-objid.
ELSE.
READ TABLE gt_result_objec INTO gs_rs_objec INDEX gf_count - 1. "because BU is 1st level.
IF gf_count - 1 <= 1.
"mache nicht
ELSE.
gs_data_4-busin = gs_rs_objec-objid.
ENDIF.
ENDIF.
"*********************************************************************
"* Division
"*********************************************************************
READ TABLE gt_result_objec INTO gs_rs_objec INDEX gf_count - 2. "because DEP is 2nd level.
IF gf_count - 2 <= 1.
"mache nichts
ELSE.
gs_data_4-divis = gs_rs_objec-objid.
ENDIF.
ENDIF.
CLEAR: gs_rs_objec,
gt_result_tab,
gt_result_objec,
gt_result_struc.
"*********************************************************************
"* Department
"*********************************************************************
" Department initialisieren falls es gleich der Division ist.
IF gs_data_4-divis = gs_data_4-orgeh.
CLEAR gs_data_4-orgeh.
ENDIF.
"*********************************************************************
"* Location
"*********************************************************************
gs_data_4-locat = p0001-btrtl.
"*********************************************************************
"* Company
"*********************************************************************
gs_data_4-bukrs = p0001-bukrs.
"*********************************************************************
"* Costcenter Kostenstelle
"*********************************************************************
CONCATENATE
p0001-kostl
'_'
p0001-bukrs
INTO gs_data_4-kostl.
SHIFT gs_data_4-kostl LEFT DELETING LEADING '0'.
"*********************************************************************
"* Employee Group class
"*********************************************************************
SELECT SINGLE ptext FROM t501t INTO gs_data_4-pgtxt
WHERE persg = p0001-persg AND
sprsl = sy-langu.
CASE gs_data_4-pgtxt.
WHEN 'Intern General Mgmt'.
gs_data_4-pgtxt = 'Intern General Management'.
WHEN 'Ext. own Contractor'.
gs_data_4-pgtxt = 'Extern 3rd Contractor'.
WHEN 'Ext. 3rd Contractor'.
gs_data_4-pgtxt = 'Extern own Contractor'.
ENDCASE.
"*********************************************************************
"* Employment Sub Group
"*********************************************************************
SELECT SINGLE ptext FROM t503t INTO gs_data_4-pktxt
WHERE persk = p0001-persk AND
sprsl = 'E'. "sy-langu.
CASE gs_data_4-pktxt.
WHEN 'Salaried w overtime'.
gs_data_4-pktxt = 'Salaried with overtime'.
WHEN 'Salaried wo overtime'.
gs_data_4-pktxt = 'Salaried without overtime'.
ENDCASE.
"*********************************************************************
"* Regular-temp
"*********************************************************************
IF p0001-persg = 8 OR p0001-persg = 9.
gs_data_4-rtemp = 'Temporary'.
ELSE.
gs_data_4-rtemp = 'Permanent'.
ENDIF.
"*********************************************************************
"* Company Entry Date
"*********************************************************************
SELECT SINGLE * FROM pa0001 INTO gs_pa0001
WHERE pernr = pernr-pernr AND
begda <= gf_datum AND
endda >= gf_datum.
* CONCATENATE
* gs_pa0001-begda+4(2) '/'
* gs_pa0001-begda+6(2) '/'
* gs_pa0001-begda(4)
* INTO gs_data_4-hire.
CONCATENATE
gf_datum+6(2) '/'
gf_datum+4(2) '/'
gf_datum(4)
INTO gs_data_4-hire.
CLEAR gs_pa0001.
"*********************************************************************
"* Location Entry Date
"*********************************************************************
gs_data_4-lhire = gs_data_4-hire.
"*********************************************************************
"* Department Entry Date
"*********************************************************************
gs_data_4-dhire = gs_data_4-hire.
"*********************************************************************
"* Job Grad Bezeichung eines Objektes welches mit dem Objekt Stelle
"* Verknüpft ist. 1.Lese Verknüpfungen HRP1001 2.Lese Text aus HRP1000
"*********************************************************************
DATA: gt_hri1001 TYPE STANDARD TABLE OF hri1001,
gs_hri1001 TYPE hri1001."relation
"Lese HRP1001 Verknüpfungen
CALL FUNCTION 'RHOM_READ_RELAT_BUFFERED'
EXPORTING
otype = 'C'
objid = p0001-stell
plvar = '01'
* SUBTY =
* ISTAT =
begda = gf_datum
endda = gf_datum
auth_fcode = 'DISP'
with_stru_auth = 'X'
buffer_mode = 'X'
TABLES
* OBJECTS =
i1001 = gt_hri1001
EXCEPTIONS
no_active_plvar = 1
OTHERS = 2.
IF sy-subrc <> 0.
"Mache nichts
ELSE.
DELETE gt_hri1001 WHERE rsign <> 'B' AND relat <> 'ZJG'.
DELETE gt_hri1001 WHERE relat <> 'ZJG'.
ENDIF.
READ TABLE gt_hri1001 INTO gs_hri1001 INDEX 1.
"Lese HRP1000 Objekt
SELECT SINGLE stext FROM hrp1000 INTO gs_data_4-bzig
WHERE plvar = gs_hri1001-plvar AND
otype = gs_hri1001-sclas AND
objid = gs_hri1001-sobid AND
istat = gs_hri1001-istat AND
begda <= gs_hri1001-begda AND
endda >= gs_hri1001-endda AND
langu = sy-langu.
**************************************************************************
* Supervisor
**************************************************************************
PROVIDE * FROM p0001 BETWEEN gf_datum AND gf_datum.
"Organisationstruktur lesen
CALL FUNCTION 'RH_STRUC_GET'
EXPORTING
act_otype = 'S'
act_objid = p0001-plans
act_wegid = 'S_UP' "auch Möglich 'O-O-S-P' oder 'A002'
act_plvar = '01'
act_begda = p0001-begda
act_endda = p0001-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 <> p0001-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.
IF gf_objid_p IS NOT INITIAL.
EXIT.
ENDIF.
ENDIF.
ENDLOOP.
ELSE.
"Mache nichts
ENDIF.
ENDPROVIDE.
gs_data_4-mpernr = gf_objid_p.
IF gf_objid_p IS INITIAL.
gs_data_4-mpernr = 'NO_MANAGER'.
ENDIF.
CLEAR: gt_result_tab, gt_result_objec, gt_result_struc,
gs_rs_tab, gs_rs_objec, gs_rs_struc,
gf_objid_p, gf_objid, gf_vorge, gf_vorge_pernr,
gf_vorge_mail.
ENDPROVIDE.
***************************************************************************
** IT0050
***************************************************************************
PROVIDE * FROM p0050 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* Local Badge ID
"*********************************************************************
gs_data_4-zausw = p0050-zausw.
ENDPROVIDE.
"*********************************************************************
"* Employee Type
"*********************************************************************
gs_data_4-etype = 'Regular'.
***************************************************************************
** IT0008
***************************************************************************
PROVIDE * FROM p0008 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* FTE
"*********************************************************************
gs_data_4-bsgrd = p0008-bsgrd / 100.
"*********************************************************************
"* Pay Scale Level Entry Date
"*********************************************************************
SELECT SINGLE * FROM pa0008 INTO gs_pa0008
WHERE pernr = pernr-pernr AND
begda <= gf_datum AND
endda >= gf_datum.
* CONCATENATE
* gs_pa0008-begda+4(2) '/'
* gs_pa0008-begda+6(2) '/'
* gs_pa0008-begda(4)
* INTO gs_data_4-phire.
CONCATENATE
gf_datum+6(2) '/'
gf_datum+4(2) '/'
gf_datum(4)
INTO gs_data_4-phire.
"*********************************************************************
"* Pay Scale Area
"*********************************************************************
"gs_data_4-trfgb = p0008-trfgb.
"Text
SELECT SINGLE tgbtx FROM t510g INTO gs_data_4-trfgb
WHERE molga = '02' AND
trfgb = p0008-trfgb.
"*********************************************************************
"* Pay Scale Type
"*********************************************************************
"gs_data_4-trfar = p0008-trfar.
"Text
SELECT SINGLE tartx FROM t510a INTO gs_data_4-trfar
WHERE molga = '02' AND
trfar = p0008-trfar.
"*********************************************************************
"* Pay Scale Group
"*********************************************************************
gs_data_4-trfgr = p0008-trfgr.
ENDPROVIDE.
"*********************************************************************
"* Standard Hours
"*********************************************************************
gs_data_4-whour = '42.50'.
***************************************************************************
** IT0007
***************************************************************************
PROVIDE * FROM p0007 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* Working Days per Week
"*********************************************************************
gs_data_4-wkwdy = p0007-wkwdy.
"*********************************************************************
"* Working Days per Week
"*********************************************************************
IF p0007-teilk IS INITIAL.
gs_data_4-teilk = 'yes'.
ELSE.
gs_data_4-teilk = 'no'.
ENDIF.
ENDPROVIDE.
"*********************************************************************
"* Is Shift Employee
"*********************************************************************
gs_data_4-shift = 'yes'.
"*********************************************************************
"* Time Zone
"*********************************************************************
gs_data_4-cet = 'CET'.
***************************************************************************
** IT0000
***************************************************************************
IF p_ini IS INITIAL.
PROVIDE * FROM p0000 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* Event Reason
"*********************************************************************
gs_data_4-massg = p0000-massg.
CASE p0000-massn.
WHEN '01' OR '06' OR '51' OR '50' OR '20'.
IF p_ini IS INITIAL.
CASE p0000-massg.
WHEN 'Z1'.
gs_data_4-massg = 'HIRNEW'.
WHEN OTHERS.
gs_data_4-massg = 'HIRNEW'.
ENDCASE.
ELSE.
* CASE p0000-massg.
* WHEN 'Z1'.
* gs_data_4-massg = 'HIRIMP'.
* WHEN OTHERS.
* gs_data_4-massg = 'HIRIMP'.
* ENDCASE.
ENDIF.
WHEN '12' OR '13'.
IF p_ini IS INITIAL.
CASE p0000-massg.
WHEN 'Z1'.
gs_data_4-massg = 'REHREH'.
WHEN OTHERS.
gs_data_4-massg = 'REHREH'.
ENDCASE.
ELSE.
* CASE p0000-massg.
* WHEN 'Z1'.
* gs_data_4-massg = 'REHIMP'.
* WHEN OTHERS.
* gs_data_4-massg = 'REHIMP'.
* ENDCASE.
ENDIF.
WHEN '02'.
CASE p0000-massg.
WHEN '11'.
gs_data_4-massg = 'JOBLGRAD'.
WHEN '03'.
gs_data_4-massg = 'JOBTITLE'.
WHEN '14'.
gs_data_4-massg = 'JOBLATRL'.
WHEN '06'.
gs_data_4-massg = 'JOBLOCN'.
WHEN '10'.
gs_data_4-massg = 'JOBUGRDE'.
WHEN '04'.
gs_data_4-massg = 'JOBFTPT'.
WHEN '05'.
gs_data_4-massg = 'JOBPTFT'.
WHEN OTHERS.
gs_data_4-massg = 'JOBUGRDE'.
ENDCASE.
WHEN '10'.
CASE p0000-massg.
WHEN '89'.
gs_data_4-massg = 'TERIATTD'.
WHEN '62' OR '72' OR '48' OR '74' OR '80' OR '66'.
gs_data_4-massg = 'TERVPERS'.
WHEN '20'.
gs_data_4-massg = 'TERRESIG'.
WHEN '46'.
gs_data_4-massg = 'TERDISM'.
WHEN '09'.
gs_data_4-massg = 'TERIDEAT'.
WHEN '87'.
gs_data_4-massg = 'TERIDISH'.
WHEN '68'.
gs_data_4-massg = 'TERVHLTH'.
WHEN '88'.
gs_data_4-massg = 'TERINHLT'.
WHEN '85'.
gs_data_4-massg = 'TERINONP'.
WHEN '78'.
gs_data_4-massg = 'TERVSCHOL'.
WHEN '03'.
gs_data_4-massg = 'TERVVSP'.
WHEN '21'.
gs_data_4-massg = 'TERIRSTR'.
WHEN 'Z6'.
gs_data_4-massg = 'TEROTH'.
WHEN '25'.
gs_data_4-massg = 'TERMUA'.
WHEN '10'.
gs_data_4-massg = 'TERTECO'.
WHEN '95'.
gs_data_4-massg = 'TERPROB'.
WHEN '96'.
gs_data_4-massg = 'TERPROE'.
WHEN OTHERS.
gs_data_4-massg = 'TERTVTERM'.
ENDCASE.
WHEN OTHERS.
gs_data_4-massg = 'DATACHG'.
ENDCASE.
ENDPROVIDE.
ENDIF.
"*********************************************************************
"* Competition Clause
"*********************************************************************
gs_data_4-comcl = 'no'.
"*********************************************************************
"* Sideline Job Checked
"*********************************************************************
gs_data_4-sijob = 'no'.
"*********************************************************************
"* Employee Notice Period
"*********************************************************************
gs_data_4-noper = '3 months as of month end'.
"*********************************************************************
"* Custom-string22
"*********************************************************************
* SELECT * FROM pa0028 INTO TABLE gt_pa0028
* WHERE pernr = pernr-pernr AND
* subty = 'JET'.
* SORT gt_pa0028 BY endda DESCENDING.
* READ TABLE gt_pa0028 INTO gs_pa0028 INDEX 1.
* SELECT SINGLE rstxt FROM t578y INTO gs_data_4-cus22
* WHERE sprsl = 'EN' AND
* resul = gs_pa0028-resul.
"*********************************************************************
"* Custom-string7
"*********************************************************************
* gs_data_4-cus07 = gs_pa0028-subty.
"*********************************************************************
"* Custom-string23
"*********************************************************************
* CONCATENATE
* gs_pa0028-exdat+4(2) '/'
* gs_pa0028-exdat+6(2) '/'
* gs_pa0028-exdat(4)
* INTO gs_data_4-cus23.
* IF gs_data_4-cus23 = '00/00/0000'.
* CLEAR: gs_data_4-cus23.
* ENDIF.
"*********************************************************************
"* Custom-date2
"*********************************************************************
* gs_data_4-cus02 = gs_pa0028-wtf01.
"*********************************************************************
"* Custom-date3
"*********************************************************************
* CONCATENATE
* gs_pa0028-dtf01+4(2) '/'
* gs_pa0028-dtf01+6(2) '/'
* gs_pa0028-dtf01(4)
* INTO gs_data_4-cus03.
* IF gs_data_4-cus03 = '00/00/0000'.
* CLEAR: gs_data_4-cus03.
* ENDIF.
* CLEAR: gt_pa0028, gs_pa0028.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_4 TO gt_data_4.
CLEAR gs_data_4.
ENDFORM. " READ_DATA2
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv4 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_4 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv4 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_4
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
CONCATENATE
'user-id;custom-string6;end-date;custom-string8;custom-string9;'
'custom-string10;custom-string13;custom-string20;start-date;job-title;'
'job-code;employee-type;department;division;location;radford-jobcode;'
'notes;company;business-unit;cost-center;employee-class;employment-type;'
'fte;regular-temp;standard-hours;workingDaysPerWeek;companyEntryDate;'
'locationEntryDate;departmentEntryDate;payScaleLevelEntryDate;'
'local-job-title;is-fulltime-employee;pay-grade;is-shift-employee;'
'seq-number;payScaleArea;payScaleType;payScaleGroup;payScaleLevel;'
'manager-id;attachment-id;expected-return-date;timezone;event-reason;'
'probation-period-end-date;is-competition-clause-active;is-side-line-job-allowed;'
'notice-period;contract-end-date;contract-type;initial-entry-date;'
'entry-into-group;period-indicator;work-location;'
'labor-Protection;custom-string22;excl-executive-sector;custom-string40;'
'employee-workgroup-membership;custom-string7;custom-string23;custom-date2;'
'custom-date3;contract-id;contract-date;custom-string25;'
'contract-number'
* ry-min-wage;spcl-rule-non-manual-worker;'
* 'payment-in-lieu-of-notice;guaranteed-payment;calculation-base;'
* 'credit-for-previous-service;assessment-status;current-wage-level;'
* 'degree-of-productivity;custom-date4;custom-date5;custom-date6;custom-date7;'
* 'flsa-status;custom-string21;eeo-class;custom-string11;custom-string12;operation'
* 'user-id;custom-string6;end-date;custom-string8;custom-string9;'
* 'custom-string10;custom-string13;custom-string20;start-date;job-title;'
* 'job-code;employee-type;department;division;location;radford-jobcode;'
* 'notes;company;business-unit;cost-center;employee-class;employment-type;'
* 'fte;regular-temp;standard-hours;workingDaysPerWeek;companyEntryDate;'
* 'locationEntryDate;departmentEntryDate;payScaleLevelEntryDate;'
* 'local-job-title;is-fulltime-employee;pay-grade;is-shift-employee;'
* 'seq-number;payScaleArea;payScaleType;payScaleGroup;payScaleLevel;'
* 'manager-id;attachment-id;expected-return-date;timezone;event-reason;'
* 'probation-period-end-date;is-competition-clause-active;is-side-line-job-allowed;'
* 'notice-period;contract-end-date;contract-type;initial-entry-date;'
* 'entry-into-group;period-indicator;work-permit-expiry;work-location;'
* 'labor-Protection;custom-string22;excl-executive-sector;custom-string40;'
* 'employee-workgroup-membership;custom-string7;custom-string23;custom-date2;'
* 'custom-date3;contract-id;contract-date;custom-string24;custom-string25;'
* 'contract-number;ineligible-statutory-min-wage;spcl-rule-non-manual-worker;'
* 'payment-in-lieu-of-notice;guaranteed-payment;calculation-base;'
* 'credit-for-previous-service;assessment-status;current-wage-level;'
* 'degree-of-productivity;custom-date4;custom-date5;custom-date6;custom-date7;'
* 'flsa-status;custom-string21;eeo-class;custom-string11;custom-string12;operation'
INTO gs_outtab_csv.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " DOWNLOAD_CSV2
*=======================================================================
* Personal Info Import
*=======================================================================
*&---------------------------------------------------------------------*
*& Form READ_DATA2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data5 .
"*********************************************************************
"* Personalnummer
"*********************************************************************
gs_data_5-pernr = pernr-pernr.
***************************************************************************
** IT0002
***************************************************************************
PROVIDE * FROM p0002 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* Native Preferred Language Muttersprache Communication language
"*********************************************************************
SELECT SINGLE sptxt FROM t002t INTO gs_data_5-sptxt
WHERE spras = 'EN' AND
sprsl = p0002-sprsl.
CASE gs_data_5-sptxt.
WHEN 'English'.
gs_data_5-sptxt = 'English'.
WHEN 'French'.
gs_data_5-sptxt = 'French'.
WHEN 'German'.
gs_data_5-sptxt = 'German'.
WHEN OTHERS.
gs_data_5-sptxt = 'English'.
ENDCASE.
gs_data_5-sprsl = gs_data_5-sptxt.
"*********************************************************************
"* End Date Endedatum
"*********************************************************************
SELECT SINGLE * FROM pa0002 INTO gs_pa0002
WHERE pernr = pernr-pernr AND
begda <= gf_datum AND
endda >= gf_datum.
CONCATENATE
gs_pa0002-endda+6(2) '/'
gs_pa0002-endda+4(2) '/'
gs_pa0002-endda(4)
INTO gs_data_5-endda.
* CONCATENATE
* p0002-endda+4(2) '/'
* p0002-endda+6(2) '/'
* p0002-endda(4)
* INTO gs_data_5-endda.
"*********************************************************************
"* Event Date Beginndatum
"*********************************************************************
* CONCATENATE
* gf_datum+4(2) '/'
* gf_datum+6(2) '/'
* gf_datum(4)
* INTO gs_data_5-begda.
CONCATENATE
gf_datum+6(2) '/'
gf_datum+4(2) '/'
gf_datum(4)
INTO gs_data_5-begda.
CLEAR: gs_pa0002.
* CONCATENATE
* p0002-begda+4(2) '/'
* p0002-begda+6(2) '/'
* p0002-begda(4)
* INTO gs_data_5-begda.
"*********************************************************************
"* First Name Vorname
"*********************************************************************
gs_data_5-vorna = p0002-vorna.
"*********************************************************************
"* Last Name Nachname
"*********************************************************************
gs_data_5-nachn = p0002-nachn.
"*********************************************************************
"* Salutation Anrede
"*********************************************************************
SELECT SINGLE atext FROM t522t INTO gs_data_5-anrex
WHERE anred = p0002-anred AND
sprsl = 'EN'.
* CASE gs_data_5-anrex.
* WHEN 'Mr.'.
* gs_data_5-anrex = 'Mr.'.
* WHEN 'Mrs.'.
* gs_data_5-anrex = 'Mrs.'.
* WHEN 'Ms'.
* gs_data_5-anrex = 'Ms'.
* WHEN OTHERS.
* gs_data_5-anrex = ''.
* ENDCASE.
"*********************************************************************
"* Gender Geschlecht
"*********************************************************************
CASE p0002-anred.
WHEN 1.
gs_data_5-gesch = 'M'.
WHEN 2.
gs_data_5-gesch = 'F'.
WHEN 3.
gs_data_5-gesch = 'F'.
WHEN OTHERS.
"MACHE NICHTS
ENDCASE.
"*********************************************************************
"* Marital Status Familienstands Bezeichnung
"*********************************************************************
SELECT SINGLE ftext FROM t502t INTO gs_data_5-fatxt
WHERE sprsl = 'EN' AND
famst = p0002-famst.
CASE gs_data_5-fatxt.
WHEN 'Single'.
gs_data_5-fatxt = 'Single'.
WHEN 'Married'.
gs_data_5-fatxt = 'Married'.
WHEN 'Divorced'.
gs_data_5-fatxt = 'Divorced'.
WHEN 'Separated'.
gs_data_5-fatxt = 'Separated'.
WHEN 'Widowed'.
gs_data_5-fatxt = 'Widowed'.
WHEN 'RegPar'.
gs_data_5-fatxt = 'missing'.
"PACS meldet XY noch
WHEN OTHERS.
gs_data_5-fatxt = ''.
ENDCASE.
"*********************************************************************
"* Nationaltity Nationalität
"*********************************************************************
"Bezeichnung
* SELECT SINGLE natio FROM t005t INTO gs_data_5-natio
* WHERE spras = sy-langu AND
* land1 = p0002-natio.
"ISO Code
SELECT SINGLE iso FROM zhr_sf_data_iso INTO gs_data_5-natio
WHERE land = p0002-natio.
"*********************************************************************
"* since Familienstand seit
"*********************************************************************
CONCATENATE
p0002-famdt+6(2) '/'
p0002-famdt+4(2) '/'
p0002-famdt(4)
INTO gs_data_5-famdt.
IF gs_data_5-famdt = '00/00/0000'.
CLEAR: gs_data_5-famdt.
ENDIF.
"*********************************************************************
"* Initials
"*********************************************************************
gs_data_5-inits = p0002-inits.
"*********************************************************************
"* birth-name
"*********************************************************************
gs_data_5-name2 = p0002-name2.
"*********************************************************************
"* Second Nationality
"*********************************************************************
SELECT SINGLE natio FROM t005t INTO gs_data_5-nati2
WHERE spras = sy-langu AND
land1 = p0002-nati2.
ENDPROVIDE.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_5 TO gt_data_5.
CLEAR gs_data_5.
ENDFORM. " READ_DATA2
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv5 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_5 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv5 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_5
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
CONCATENATE
'personInfo.person-id-external;custom-string1;end-date;'
'custom-date1;custom-date2;custom-date3;start-date;'
'first-name;last-name;middle-name;salutation;gender;'
'marital-status;native-preferred-lang;first-name-alt1;'
'middle-name-alt1;last-name-alt1;nationality;since;'
'preferred-name;initials;title;birth-name;second-nationality;'
'attachment-id;operation'
INTO gs_outtab_csv.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " DOWNLOAD_CSV2
*=======================================================================
* Adress information
*=======================================================================
*&---------------------------------------------------------------------*
*& Form READ_DATA2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data6 .
***************************************************************************
** IT0006
***************************************************************************
PROVIDE * FROM p0006 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* Personalnummer
"*********************************************************************
gs_data_6-pernr = pernr-pernr.
"*********************************************************************
"* Event Date Beginndatum
"*********************************************************************
SELECT SINGLE * FROM pa0006 INTO gs_pa0006
WHERE pernr = pernr-pernr AND
begda <= gf_datum AND
endda >= gf_datum AND
subty = p0006-subty.
* CONCATENATE
* gs_pa0006-begda+4(2) '/'
* gs_pa0006-begda+6(2) '/'
* gs_pa0006-begda(4)
* INTO gs_data_6-begda.
* CONCATENATE
* p0006-begda+4(2) '/'
* p0006-begda+6(2) '/'
* p0006-begda(4)
* INTO gs_data_6-begda.
CONCATENATE
gf_datum+6(2) '/'
gf_datum+4(2) '/'
gf_datum(4)
INTO gs_data_6-begda..
CLEAR: gs_pa0002.
"*********************************************************************
"* End Date Endedatum
"*********************************************************************
CONCATENATE
gs_pa0006-endda+6(2) '/'
gs_pa0006-endda+4(2) '/'
gs_pa0006-endda(4)
INTO gs_data_6-endda.
CLEAR: gs_pa0006.
* CONCATENATE
* p0006-endda+4(2) '/'
* p0006-endda+6(2) '/'
* p0006-endda(4)
* INTO gs_data_6-endda.
"*********************************************************************
"* Adresse1 Strasse
"*********************************************************************
gs_data_6-stras = p0006-stras.
"*********************************************************************
"* Adresse2 Name2 c/o
"*********************************************************************
gs_data_6-name2 = p0006-name2.
"*********************************************************************
"* City Ort
"*********************************************************************
gs_data_6-ort01 = p0006-ort01.
"*********************************************************************
"* Postalcode PLZ Postleitzahl
"*********************************************************************
gs_data_6-pstlz = p0006-pstlz.
"*********************************************************************
"* Country Land
"*********************************************************************
"gs_data_6-land1 = p0006-land1.
"ISO Code
SELECT SINGLE iso FROM zhr_sf_data_iso INTO gs_data_6-land1
WHERE land = p0006-land1.
"*********************************************************************
"* State Canton
"*********************************************************************
gs_data_6-state = p0006-state.
"*********************************************************************
"* Address type Subtyp
"*********************************************************************
gs_data_6-anssa = p0006-anssa.
CASE gs_data_6-anssa.
WHEN '1'.
gs_data_6-anssa = 'home'.
WHEN '2'.
gs_data_6-anssa = 'Temp_addr'.
WHEN OTHERS.
gs_data_6-anssa = ''.
ENDCASE.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_6 TO gt_data_6.
CLEAR gs_data_6.
ENDPROVIDE.
ENDFORM. " READ_DATA2
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv6 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_6 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv6 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_6
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
CONCATENATE
'personInfo.person-id-external;start-date;end-date;'
'address1;address2;address3;city;zip-code;country;'
'notes;address4;address5;address6;address7;county;'
'state;address8;address9;address10;address11;address-type;'
'operation'
INTO gs_outtab_csv.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " DOWNLOAD_CSV2
*=======================================================================
* Email Information
*=======================================================================
*&---------------------------------------------------------------------*
*& Form READ_DATA2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data7 .
***************************************************************************
** IT0105
***************************************************************************
PROVIDE * FROM p0105 BETWEEN gf_datum AND gf_datum.
IF p0105-usrty = '0010'.
"*********************************************************************
"* Personalnummer
"*********************************************************************
gs_data_7-pernr = pernr-pernr.
"*********************************************************************
"* Systemid Userid Username
"*********************************************************************
gs_data_7-usrty = p0105-usrty.
CASE gs_data_7-usrty.
WHEN '0010'.
gs_data_7-usrty = 'Business'.
WHEN OTHERS.
"mache nichts
ENDCASE.
"*********************************************************************
"* Email E-Mail Mail
"*********************************************************************
gs_data_7-usrid_long = p0105-usrid_long.
"*********************************************************************
"* is Primary isPrimary
"*********************************************************************
gs_data_7-ztrue = 'TRUE'.
ELSE.
"mache nichts
ENDIF.
ENDPROVIDE.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_7 TO gt_data_7.
CLEAR gs_data_7.
ENDFORM. " READ_DATA2
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv7 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_7 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv7 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_7
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
CONCATENATE
'personInfo.person-id-external;email-type;email-address;'
'isPrimary;operation'
INTO gs_outtab_csv.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " DOWNLOAD_CSV2
*=======================================================================
* Phone Information
*=======================================================================
*&---------------------------------------------------------------------*
*& Form READ_DATA2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data8 .
***************************************************************************
** IT0105
***************************************************************************
PROVIDE * FROM p0105 BETWEEN gf_datum AND gf_datum.
IF p0105-usrty = '0020'.
"*********************************************************************
"* Personalnummer
"*********************************************************************
gs_data_8-pernr = pernr-pernr.
"*********************************************************************
"* Systemid Userid Username
"*********************************************************************
gs_data_8-usrty = p0105-usrty.
CASE gs_data_8-usrty.
WHEN '0020'.
gs_data_8-usrty = 'Business'.
WHEN OTHERS.
"mache nichts
ENDCASE.
"*********************************************************************
"* Country Code Ländercode
"*********************************************************************
* gs_data_8-couco ='0041'.
"*********************************************************************
"* Phone number Telefonnummer
"*********************************************************************
gs_data_8-usrid_long = p0105-usrid_long.
"*********************************************************************
"* is Primary isPrimary
"*********************************************************************
gs_data_8-ztrue = 'TRUE'.
ELSE.
"mache nichts
ENDIF.
ENDPROVIDE.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_8 TO gt_data_8.
CLEAR gs_data_8.
ENDFORM. " READ_DATA2
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv8 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_8 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv8 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_8
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
CONCATENATE
'personInfo.person-id-external;phone-type;country-code;'
'area-code;phone-number;isPrimary;operation'
INTO gs_outtab_csv.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " DOWNLOAD_CSV2
*=======================================================================
* National ID Information
*=======================================================================
*&---------------------------------------------------------------------*
*& Form READ_DATA2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data9 .
"*********************************************************************
"* Personalnummer
"*********************************************************************
gs_data_9-pernr = pernr-pernr.
"*********************************************************************
"* Country Land
"*********************************************************************
gs_data_9-couny = 'CHE'.
"*********************************************************************
"* National ID Card Type
"*********************************************************************
gs_data_9-natid = 'AHV'.
***************************************************************************
** IT0036
***************************************************************************
PROVIDE * FROM p0036 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* National id AHV Nummer
"*********************************************************************
* gs_data_9-ahvnr = p0036-ahvnr.
gs_data_9-nahvn = p0036-nahvn.
CONCATENATE
p0036-nahvn(3)
'.'
p0036-nahvn+3(4)
'.'
p0036-nahvn+7(4)
'.'
p0036-nahvn+11(2)
INTO gs_data_9-nahvn.
IF gs_data_9-nahvn = '...'.
CLEAR gs_data_9-nahvn.
ENDIF.
ENDPROVIDE.
"*********************************************************************
"* is Primary isPrimary
"*********************************************************************
gs_data_9-ztrue = 'TRUE'.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_9 TO gt_data_9.
CLEAR gs_data_9.
ENDFORM. " READ_DATA2
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv9 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_9 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv9 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_9
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
CONCATENATE
'personInfo.person-id-external;country;card-type;'
'national-id;isPrimary;notes;operation'
INTO gs_outtab_csv.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " DOWNLOAD_CSV2
*=======================================================================
* Compensation Info
*=======================================================================
*&---------------------------------------------------------------------*
*& Form READ_DATA2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data10 .
"*********************************************************************
"* Personalnummer
"*********************************************************************
gs_data_10-pernr = pernr-pernr.
***************************************************************************
** IT0001
***************************************************************************
PROVIDE * FROM p0001 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* End Date Endedatum
"*********************************************************************
SELECT SINGLE * FROM pa0001 INTO gs_pa0001
WHERE pernr = pernr-pernr AND
begda <= gf_datum AND
endda >= gf_datum.
CONCATENATE
gs_pa0001-endda+6(2) '/'
gs_pa0001-endda+4(2) '/'
gs_pa0001-endda(4)
INTO gs_data_10-endda.
CLEAR: gs_pa0001.
* CONCATENATE
* p0001-endda+4(2) '/'
* p0001-endda+6(2) '/'
* p0001-endda(4)
* INTO gs_data_10-endda.
"*********************************************************************
"* Pay Group Abrechnungskreis
"*********************************************************************
gs_data_10-abkrs = p0001-abkrs.
"*********************************************************************
"* Pay Group Abrechnungskreis
"*********************************************************************
CASE p0001-abkrs.
WHEN '01' OR '21' OR '41' OR '51' OR '46' OR '71'.
gs_data_10-atext = 'Salaried'.
WHEN OTHERS.
gs_data_10-atext = 'Hourly'.
ENDCASE.
"*********************************************************************
"* Initial Load
"*********************************************************************
IF p_ini = 'X'.
"*********************************************************************
"* Event Reason
"*********************************************************************
SELECT * FROM pa0000 INTO TABLE gt_pa0000
WHERE pernr = pernr-pernr.
SORT gt_pa0000 BY endda DESCENDING.
LOOP AT gt_pa0000 INTO gs_pa0000.
CASE gs_pa0000-massn.
WHEN '01' OR '06' OR '51' OR '50' OR '20' OR '12' OR '13'.
CONCATENATE
gf_datum+6(2) '/'
gf_datum+4(2) '/'
gf_datum(4)
INTO gs_data_10-begda.
"*********************************************************************
"* Event Reaseon by initial load
"*********************************************************************
CASE gs_pa0000-massn.
WHEN '01' OR '06' OR '51' OR '50' OR '20'.
CASE p0000-massg.
WHEN 'Z1'.
gs_data_10-event = 'HIRIMP'.
WHEN OTHERS.
gs_data_10-event = 'HIRIMP'.
ENDCASE.
WHEN '12' OR '13'.
CASE p0000-massg.
WHEN 'Z1'.
gs_data_10-event = 'REHIMP'.
WHEN OTHERS.
gs_data_10-event = 'REHIMP'.
ENDCASE.
WHEN OTHERS.
"mache nichts.
ENDCASE.
EXIT.
WHEN OTHERS.
CLEAR: gs_pa0000.
ENDCASE.
ENDLOOP.
CLEAR: gt_pa0000, gs_pa0000.
ELSE.
"*********************************************************************
"* Event Reason
"*********************************************************************
gs_data_10-event = 'JOBUGRDE'.
"*********************************************************************
"* Event Date Beginndatum
"*********************************************************************
SELECT SINGLE * FROM pa0001 INTO gs_pa0001
WHERE pernr = pernr-pernr AND
begda <= gf_datum AND
endda >= gf_datum.
CONCATENATE
gs_pa0001-begda+6(2) '/'
gs_pa0001-begda+4(2) '/'
gs_pa0001-begda(4)
INTO gs_data_10-begda.
CLEAR: gs_pa0001.
* CONCATENATE
* p0001-begda+4(2) '/'
* p0001-begda+6(2) '/'
* p0001-begda(4)
* INTO gs_data_10-begda.
ENDIF.
ENDPROVIDE.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_10 TO gt_data_10.
CLEAR gs_data_10.
ENDFORM. " READ_DATA2
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv10 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_10 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv10 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_10
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
CONCATENATE
'user-id;custom-string1;end-date;'
'custom-string2;custom-date1;custom-date2;'
'custom-long1;start-date;pay-type;'
'notes;pay-group;is-eligible-for-benefits;'
'is-eligible-for-car;benefits-rate;event-reason;'
'payroll-id'
INTO gs_outtab_csv.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " DOWNLOAD_CSV2
*=======================================================================
* Job Relations
*=======================================================================
*&---------------------------------------------------------------------*
*& Form READ_DATA2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data11 .
"***********************************************************************
"* PNR User-id
"***********************************************************************
gs_data_11-pernr = pernr-pernr.
"*********************************************************************
"* End Date
"*********************************************************************.
SELECT SINGLE * FROM pa0001 INTO gs_pa0001
WHERE pernr = pernr-pernr AND
begda <= gf_datum AND
endda >= gf_datum.
* CONCATENATE
* gs_pa0001-endda+4(2) '/'
* gs_pa0001-endda+6(2) '/'
* gs_pa0001-endda(4)
* INTO gs_data_11-endda.
CONCATENATE
'31' '/'
'12' '/'
'9999'
INTO gs_data_11-endda.
"*********************************************************************
"* start-date
"*********************************************************************
* CONCATENATE
* gs_pa0001-begda+4(2) '/'
* gs_pa0001-begda+6(2) '/'
* gs_pa0001-begda(4)
* INTO gs_data_11-begda.
CONCATENATE
gf_datum+6(2) '/'
gf_datum+4(2) '/'
gf_datum(4)
INTO gs_data_11-begda.
CLEAR: gs_pa0001.
"*********************************************************************
"* Relationship-type
"*********************************************************************
gs_data_11-relat = 'HR Generalist'."'HR Strategic BP'. " 'HR Generalist'.
"*********************************************************************
"* rel-user-id
"*********************************************************************
PROVIDE * FROM p0001 BETWEEN gf_datum AND gf_datum.
SELECT SINGLE * FROM t526 INTO gs_t526
WHERE werks = p0001-sbmod AND
sachx <= p0001-sachp.
IF gs_t526-usrid IS NOT INITIAL.
CLEAR: gs_data_11-relai.
SELECT SINGLE pernr FROM pa0105 INTO gs_data_11-relai
WHERE subty = '0001' AND
usrid = gs_t526-usrid AND
begda <= gf_datum AND
endda >= gf_datum.
IF gs_data_11-relai IS INITIAL.
gs_data_11-relai = gs_t526-sachn.
ENDIF.
ELSE.
gs_data_11-relai = gs_t526-sachn.
ENDIF.
ENDPROVIDE.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_11 TO gt_data_11.
CLEAR gs_data_11.
ENDFORM. " READ_DATA2
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv11 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_11 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv11 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_11
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
gs_outtab_csv = 'user-id;start-date;end-date;relationship-type;rel-user-id;operation'.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " DOWNLOAD_CSV2
*=======================================================================
* Global Information
*=======================================================================
*&---------------------------------------------------------------------*
*& Form READ_DATA12
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data12 .
"***********************************************************************
"* PNR User-id
"***********************************************************************
gs_data_12-pernr = pernr-pernr.
"*********************************************************************
"* End Date
"*********************************************************************.
* SELECT SINGLE * FROM pa0040 INTO gs_pa0040
* WHERE pernr = pernr-pernr AND
* subty = '80' AND
* begda <= gf_datum AND
* endda >= gf_datum.
* CONCATENATE
* gs_pa0040-endda+4(2) '/'
* gs_pa0040-endda+6(2) '/'
* gs_pa0040-endda(4)
* INTO gs_data_12-endda.
CONCATENATE
'31' '/'
'12' '/'
'9999'
INTO gs_data_12-endda.
"*********************************************************************
"* start-date
"*********************************************************************
* CONCATENATE
* gs_pa0040-begda+4(2) '/'
* gs_pa0040-begda+6(2) '/'
* gs_pa0040-begda(4)
* INTO gs_data_12-begda.
* CLEAR: gs_pa0040.
CONCATENATE
gf_datum+6(2) '/'
gf_datum+4(2) '/'
gf_datum(4)
INTO gs_data_12-begda.
"*********************************************************************
"* rel-user-id
"*********************************************************************
* PROVIDE * FROM p0006 BETWEEN gf_datum AND gf_datum.
* SELECT SINGLE iso FROM zhr_sf_data_iso INTO gs_data_12-couty
* WHERE land = p0006-land1.
* ENDPROVIDE.
*********************************************************************
* IT0002
*********************************************************************
PROVIDE * FROM p0002 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* Land, Ort, Datum des Todes
"*********************************************************************
gs_data_12-gbort = p0002-gbort.
ENDPROVIDE.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_12 TO gt_data_12.
CLEAR gs_data_12.
ENDFORM. "read_data12
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv12 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_12 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv12 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_12
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
CONCATENATE
'personInfo.person-id-external;start-date;end-date;country;'
'genericString6;genericString13;genericString7;genericString2;'
'genericString9;genericString15;genericString14;genericString1;'
'genericString8;genericString12;genericDate1;genericString4;'
'genericString5;genericNumber7;genericString3;genericString11;'
'genericNumber8;genericString10;genericDate7;'
'genericString16;genericString17;genericString18;genericNumber1;genericNumber2;'
'genericNumber3;genericDate2;genericNumber4;genericDate3;'
'genericNumber6;custom-string15;custom-date1;custom-date2;'
'custom-string2;genericNumber5;genericNumber9;genericNumber12;'
'genericDate5;custom-string12'
INTO gs_outtab_csv.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " READ_DATA12
*=======================================================================
* Work permit
*=======================================================================
*&---------------------------------------------------------------------*
*& Form READ_DATA13
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data13 .
"***********************************************************************
"* PNR
"***********************************************************************
gs_data_13-pernr = pernr-pernr.
**************************************************************************
* IT0002
**************************************************************************
* PROVIDE * FROM p0002 BETWEEN gf_datum AND gf_datum.
* "*********************************************************************
* "* Sponsor
* "*********************************************************************
* "leer lassen
* "*********************************************************************
* "* Country ISO
* "*********************************************************************
* SELECT SINGLE iso FROM zhr_sf_data_iso INTO gs_data_13-gblnd
* WHERE land = p0002-gblnd.
* ENDPROVIDE.
* "*********************************************************************
* "* Country ISO
* "*********************************************************************
gs_data_13-gblnd = 'Switzerland'.
**************************************************************************
* IT0048
**************************************************************************
PROVIDE * FROM p0048 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* document type
"*********************************************************************
gs_data_13-astat = p0048-astat.
CASE gs_data_13-astat.
WHEN 'B'.
gs_data_13-astat = 'CHE - Annual residence B'.
WHEN 'B EU'.
gs_data_13-astat = 'CHE - Annual residence B_EU'.
WHEN 'C'.
gs_data_13-astat = 'CHE - Authority to establish business C'.
WHEN 'C EU'.
gs_data_13-astat = 'CHE - Authority to establish business C_EU'.
WHEN 'F'.
gs_data_13-astat = 'CHE - Temporarily employed F'.
WHEN 'G'.
gs_data_13-astat = 'CHE - Frontier commuter G'.
WHEN 'G EU'.
gs_data_13-astat = 'CHE - Frontier commuter G_EU'.
WHEN 'L'.
gs_data_13-astat = 'CHE - Short-term resident (max 18 mth) L'.
WHEN 'L EU'.
gs_data_13-astat = 'CHE - Short-term resident (max 18 mth) L_EU'.
WHEN 'N'.
gs_data_13-astat = 'CHE - Asylum seeker N'.
WHEN 'S'.
gs_data_13-astat = 'CHE - In need of protection S'.
WHEN 'Z1'.
gs_data_13-astat = 'CHE - Third nationality non-resident Z1'.
WHEN 'P'.
gs_data_13-astat = 'CHE - Passport'.
WHEN 'Z2'.
gs_data_13-astat = 'CHE - Third nationality w/o employment Z2'.
ENDCASE.
"*********************************************************************
"* Locument Number
"*********************************************************************
gs_data_13-bewnr = p0048-bewnr.
"*********************************************************************
"* Issue Date
"*********************************************************************
CONCATENATE
p0048-einrd+6(2) '/'
p0048-einrd+4(2) '/'
p0048-einrd(4)
INTO gs_data_13-einrd .
"*********************************************************************
"* Issue Place
"*********************************************************************
"leer lassen
"*********************************************************************
"* Expiry Date
"*********************************************************************
CONCATENATE
p0048-ablad+6(2) '/'
p0048-ablad+4(2) '/'
p0048-ablad(4)
INTO gs_data_13-ablad.
"*********************************************************************
"* Attachment
"*********************************************************************
"leer lassen
"*********************************************************************
"* Notes
"*********************************************************************
"leer lassen
ENDPROVIDE.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_13 TO gt_data_13.
CLEAR gs_data_13.
ENDFORM. " READ_DATA13
*&---------------------------------------------------------------------*
*& Form show_alv13
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM show_alv13 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_13 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv13.
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_13
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
CONCATENATE
'user-id;custom-string1;country;document-type;document-number;'
'issue-date;issue-place;expiration-date;attachment-id;notes;'
INTO gs_outtab_csv.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. "download_csv13
*&---------------------------------------------------------------------*
*& Report ZHR_SF_DATA
*&---------------------------------------------------------------------*
* ___ _____ ___ _ _ ____ ____ ____ ### ###
* / __)( _ )/ __)( )/ )( _ \(_ _)(_ _) ###=ooO=========Ooo=###
*( (__ )(_)(( (__ ) ( )___/ _)(_ )( ### \\ (o o) // ###
* \___)(_____)\___)(_)\_)(__) (____) (__) ----------(_)----------
*&---------------------------------------------------------------------*
******************************* MREGOTZ **************************
************************************************************************
*&H PROGRAMMNAME : ZHR_SF_DATA
*&H TRANSAKTIONSCODE : ZHR_SF_DATA
*&H PROGRAMMTITEL : Sap Successfactors DATA
*&H ZWECK : Holt verschiedene HR Daten für Successfactors
*&H AUTOR : Regotz Michel
*&H DATUM : 01.05.2017
*&H VORAUSSETZUNGEN : Swisscom Spezifisch
*&H SAP-MODUL : HR-PY
*&H
*&H Company/Department : Swisscom AG
*&H Phone : +41 79 322 04 86 (Mobil)
*&H E-Mail : Michel.Regotz@Swisscom.ch
*&H
************************************************************************
*&D Beschreibung : Vereinfacht Vergleich Succesfactors Daten
*&D --------------------------------------------------------------------
*&D Leistung : Eerleichterter Vergeleich Succesfactors
*&D --------------------------------------------------------------------
*&D Tabellen : zhr_sf_data
*&D --------------------------------------------------------------------
*&D Verarbeitung : Aufbau eines ALVs
*&D Anzeigen des ALVs
************************************************************************
*&C Change history :
*&C --------------------------------------------------------------------
*&C Developer | Date | Description
*&C --------------------------------------------------------------------
*&C Michel Regotz | 16.05.2017 | Produktivsetzung
*&C --------------------------------------------------------------------
*&C <Name> | <Date> | <Description>
*&C --------------------------------------------------------------------
*&C <Name> | <Date> | <Description>
*&C --------------------------------------------------------------------
*&C <Name> | <Date> | <Description>
************************************************************************
REPORT zhr_sf_data." MESSAGE-ID zhr_lv_cockpit.
"Wird für den Befehl GET PERAS benötigt
NODES: person,group,peras.
"Tabelle der Personalnummer für GET PERAS
TABLES: pernr, pa0000.
"Folgende Infotypen werden bei der Daten Selektion im Report verwendet
INFOTYPES: 0000, 0001, 0002, 0006, 0007, 0008, 0016, 0017, 0014, 0028, 0036, 0040, 0041, 0050, 0105, 0315.
"=======================================================================
" Datendeklaration
"=======================================================================
*-----------------------------------------------------------------------
* Beginn Datendeklarationen fuer den Tabelle ZHR_LV_COCKPIT
*-----------------------------------------------------------------------
* Werte beschaffen
*-----------------------------------------------------------------------
DATA: gs_pa0000 TYPE pa0000.
DATA: gt_pa0000 TYPE TABLE OF pa0000.
DATA: gs_pa0001 TYPE pa0001.
DATA: gt_pa0001 TYPE TABLE OF pa0001.
DATA: gs_pa0002 TYPE pa0002.
DATA: gt_pa0002 TYPE TABLE OF pa0002.
DATA: gs_pa0006 TYPE pa0006.
DATA: gt_pa0006 TYPE TABLE OF pa0006.
DATA: gs_pa0008 TYPE pa0008.
DATA: gt_pa0008 TYPE TABLE OF pa0008.
DATA: gs_pa0028 TYPE pa0028.
DATA: gt_pa0028 TYPE TABLE OF pa0028.
DATA: gs_pa0040 TYPE pa0040.
DATA: gt_pa0040 TYPE TABLE OF pa0040.
DATA: gs_t526 TYPE t526.
DATA: gt_t526 TYPE TABLE OF t526.
DATA: gt_data_1 TYPE TABLE OF zhr_sf_data_1.
DATA: gs_data_1 TYPE zhr_sf_data_1.
DATA: gt_data_2 TYPE TABLE OF zhr_sf_data_2.
DATA: gs_data_2 TYPE zhr_sf_data_2.
DATA: gt_data_3 TYPE TABLE OF zhr_sf_data_3.
DATA: gs_data_3 TYPE zhr_sf_data_3.
DATA: gt_data_4 TYPE TABLE OF zhr_sf_data_4.
DATA: gs_data_4 TYPE zhr_sf_data_4.
DATA: gt_data_5 TYPE TABLE OF zhr_sf_data_5.
DATA: gs_data_5 TYPE zhr_sf_data_5.
DATA: gt_data_6 TYPE TABLE OF zhr_sf_data_6.
DATA: gs_data_6 TYPE zhr_sf_data_6.
DATA: gt_data_7 TYPE TABLE OF zhr_sf_data_7.
DATA: gs_data_7 TYPE zhr_sf_data_7.
DATA: gt_data_8 TYPE TABLE OF zhr_sf_data_8.
DATA: gs_data_8 TYPE zhr_sf_data_8.
DATA: gt_data_9 TYPE TABLE OF zhr_sf_data_9.
DATA: gs_data_9 TYPE zhr_sf_data_9.
DATA: gt_data_10 TYPE TABLE OF zhr_sf_data_10.
DATA: gs_data_10 TYPE zhr_sf_data_10.
DATA: gt_data_11 TYPE TABLE OF zhr_sf_data_11.
DATA: gs_data_11 TYPE zhr_sf_data_11.
DATA: gt_data_12 TYPE TABLE OF zhr_sf_data_12.
DATA: gs_data_12 TYPE zhr_sf_data_12.
DATA: gf_datum TYPE sy-datum.
DATA: gt_result_tab TYPE TABLE OF swhactor,
gt_result_objec TYPE TABLE OF objec,
gt_result_struc TYPE TABLE OF struc,
gs_rs_tab TYPE swhactor,
gs_rs_objec TYPE objec,
gs_rs_struc TYPE struc,
gf_objid_p TYPE objid,
gf_objid TYPE objid,
gf_count TYPE i,
gf_vorge TYPE char40,
gf_vorge_pernr TYPE p_pernr,
gf_vorge_mail TYPE comm_id_long.
DATA: gf_sbjkt TYPE sbjkt.
"Tabelle für die .CSV-Konvertierung
TYPES truxs_t_text_data(4096) TYPE c OCCURS 0.
DATA: outtab_csv TYPE truxs_t_text_data.
DATA: gs_outtab_csv LIKE LINE OF outtab_csv.
"Big Version Pfad auswählen um CSV zuspeichern
DATA: ld_filename TYPE string,
ld_path TYPE string,
ld_fullpath TYPE string,
ld_result TYPE i,
gd_file TYPE c.
"=======================================================================
" Datendeklaration für ALV
"=======================================================================
*-----------------------------------------------------------------------
* Beginn Datendeklarationen fuer den ALV
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block zu den Datendeklarationen des ABAP-Programms
* Auch die Handler-Definition fuer Doppeklick ist eine Deklaration
*-----------------------------------------------------------------------
DATA go_alv TYPE REF TO cl_salv_table.
DATA go_functions TYPE REF TO cl_salv_functions_list.
DATA: go_columns TYPE REF TO cl_salv_columns_table,
go_column TYPE REF TO cl_salv_column_table.
DATA: gs_color TYPE lvc_s_colo.
DATA go_display TYPE REF TO cl_salv_display_settings.
DATA go_events TYPE REF TO cl_salv_events_table.
DATA: go_layout TYPE REF TO cl_salv_layout,
gf_variant TYPE slis_vari,
gs_key TYPE salv_s_layout_key.
DATA: go_selections TYPE REF TO cl_salv_selections.
DATA: go_err_salv TYPE REF TO cx_salv_msg.
DATA: go_err_salv_exist TYPE REF TO cx_salv_existing.
DATA: go_err_wrong_call TYPE REF TO cx_salv_wrong_call.
DATA: gf_string TYPE string.
DATA: go_func TYPE REF TO cl_salv_functions_list.
"=======================================================================
" Selektionsscreen für ALV
"=======================================================================
*-----------------------------------------------------------------------
* Selektion
*-----------------------------------------------------------------------
"Auswahl
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-010.
PARAMETERS p1 RADIOBUTTON GROUP 1.
PARAMETERS p2 RADIOBUTTON GROUP 1.
PARAMETERS: p3 RADIOBUTTON GROUP 1.
PARAMETERS: p4 RADIOBUTTON GROUP 1.
PARAMETERS: p5 RADIOBUTTON GROUP 1.
PARAMETERS: p6 RADIOBUTTON GROUP 1.
PARAMETERS: p7 RADIOBUTTON GROUP 1.
PARAMETERS: p8 RADIOBUTTON GROUP 1.
PARAMETERS: p9 RADIOBUTTON GROUP 1.
PARAMETERS: p10 RADIOBUTTON GROUP 1.
PARAMETERS: p11 RADIOBUTTON GROUP 1.
PARAMETERS: p12 RADIOBUTTON GROUP 1.
*PARAMETERS: p13 RADIOBUTTON GROUP 1.
SELECTION-SCREEN END OF BLOCK b1.
"Download Selektion
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-020.
"Hier kann man das XLS eingeben
PARAMETERS: p_file TYPE rlgrap-filename.
PARAMETERS: p_csv AS CHECKBOX.
PARAMETERS: p_ini AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b2.
"Beschreibung
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-030.
SELECTION-SCREEN COMMENT 1(75) text-031.
SELECTION-SCREEN END OF BLOCK b3.
*=======================================================================
* INITIALIZATION
*=======================================================================
INITIALIZATION.
pnpbegda = sy-datum.
p_csv = 'X'.
IF sy-uname = 'REGOTZ M'.
p_file = 'C:\Users\RegotzM\Desktop\D1_Sätze.CSV'.
ENDIF.
*=======================================================================
* START OF SELECTION
*=======================================================================
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM f4_help.
*=======================================================================
* START OF SELECTION
*=======================================================================
START-OF-SELECTION.
"Datum aus der Selektion
gf_datum = pn-endda.
GET peras.
"Logik
IF p1 = 'X'.
PERFORM read_data.
ELSEIF p2 = 'X'.
PERFORM read_data2.
ELSEIF p3 = 'X'.
PERFORM read_data3.
ELSEIF p4 = 'X'.
PERFORM read_data4.
ELSEIF p5 = 'X'.
PERFORM read_data5.
ELSEIF p6 = 'X'.
PERFORM read_data6.
ELSEIF p7 = 'X'.
PERFORM read_data7.
ELSEIF p8 = 'X'.
PERFORM read_data8.
ELSEIF p9 = 'X'.
PERFORM read_data9.
ELSEIF p10 = 'X'.
PERFORM read_data10.
ELSEIF p11 = 'X'.
PERFORM read_data11.
ELSEIF p12 = 'X'.
PERFORM read_data12.
* ELSEIF p13 = 'X'.
* PERFORM read_data13.
ENDIF.
END-OF-SELECTION.
*=======================================================================
* Ausgabe
*=======================================================================
IF p1 = 'X'.
PERFORM show_alv.
IF p_csv = 'X'.
PERFORM download_csv.
ENDIF.
ELSEIF p2 = 'X'.
PERFORM show_alv2.
IF p_csv = 'X'.
PERFORM download_csv2.
ENDIF.
ELSEIF p3 = 'X'.
PERFORM show_alv3.
IF p_csv = 'X'.
PERFORM download_csv3.
ENDIF.
ELSEIF p4 = 'X'.
PERFORM show_alv4.
IF p_csv = 'X'.
PERFORM download_csv4.
ENDIF.
ELSEIF p5 = 'X'.
PERFORM show_alv5.
IF p_csv = 'X'.
PERFORM download_csv5.
ENDIF.
ELSEIF p6 = 'X'.
PERFORM show_alv6.
IF p_csv = 'X'.
PERFORM download_csv6.
ENDIF.
ELSEIF p7 = 'X'.
PERFORM show_alv7.
IF p_csv = 'X'.
PERFORM download_csv7.
ENDIF.
ELSEIF p8 = 'X'.
PERFORM show_alv8.
IF p_csv = 'X'.
PERFORM download_csv8.
ENDIF.
ELSEIF p9 = 'X'.
PERFORM show_alv9.
IF p_csv = 'X'.
PERFORM download_csv9.
ENDIF.
ELSEIF p10 = 'X'.
PERFORM show_alv10.
IF p_csv = 'X'.
PERFORM download_csv10.
ENDIF.
ELSEIF p11 = 'X'.
PERFORM show_alv11.
IF p_csv = 'X'.
PERFORM download_csv11.
ENDIF.
ELSEIF p12 = 'X'.
PERFORM show_alv12.
IF p_csv = 'X'.
PERFORM download_csv12.
ENDIF.
* ELSEIF p13 = 'X'.
* PERFORM show_alv13.
* IF p_csv = 'X'.
* PERFORM download_csv13.
* ENDIF.
ENDIF.
*=======================================================================
* FORM READ DATA
*=======================================================================
*&---------------------------------------------------------------------*
*& Form READ_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data .
**************************************************************************
* IT0000
**************************************************************************
PROVIDE * FROM p0000 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* Beschäftigung
"*********************************************************************
gs_data_1-status = p0000-stat2.
IF gs_data_1-status = '3'.
gs_data_1-status = 'ACTIVE'.
ELSE.
gs_data_1-status = 'INACTIVE'.
ENDIF.
ENDPROVIDE.
"***********************************************************************
"* PNR
"***********************************************************************
gs_data_1-pernr = pernr-pernr.
OVERLAY gs_data_1-pernr WITH '0000000000'.
"***********************************************************************
"* USERID
"***********************************************************************
SELECT SINGLE usrid FROM pa0105 INTO gs_data_1-userid
WHERE pernr = pernr-pernr
AND begda <= gf_datum
AND endda >= gf_datum
AND subty = 'Z003'.
**************************************************************************
* IT0002
**************************************************************************
PROVIDE * FROM p0002 BETWEEN gf_datum AND gf_datum.
"Vorname
gs_data_1-vorna = p0002-vorna.
"Nachname
gs_data_1-nachn = p0002-nachn.
ENDPROVIDE.
"***********************************************************************
"* EMAIL
"***********************************************************************
SELECT SINGLE usrid_long FROM pa0105 INTO gs_data_1-mail
WHERE pernr = pernr-pernr
AND begda <= gf_datum
AND endda >= gf_datum
AND subty = '0010'.
**************************************************************************
* IT0001 Vorgesetzter Manager
**************************************************************************
PROVIDE * FROM p0001 BETWEEN gf_datum AND gf_datum.
"Organisationstruktur lesen
CALL FUNCTION 'RH_STRUC_GET'
EXPORTING
act_otype = 'S'
act_objid = p0001-plans
act_wegid = 'S_UP' "auch Möglich 'O-O-S-P' oder 'A002'
act_plvar = '01'
act_begda = p0001-begda
act_endda = p0001-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 <> p0001-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.
ENDIF.
ENDLOOP.
ELSE.
"Mache nichts
ENDIF.
ENDPROVIDE.
gs_data_1-manager = gf_objid_p.
IF gf_objid_p IS INITIAL.
gs_data_1-manager = 'NO_MANAGER'.
ENDIF.
CLEAR: gt_result_tab, gt_result_objec, gt_result_struc,
gs_rs_tab, gs_rs_objec, gs_rs_struc,
gf_objid_p, gf_objid, gf_vorge, gf_vorge_pernr,
gf_vorge_mail.
"**************************************************************************
"* Time Zone
"**************************************************************************
gs_data_1-tzone = 'CET'.
"**************************************************************************
"* Hire Date
"**************************************************************************
"***************************************************************************
"** IT0001
"***************************************************************************
PROVIDE * FROM p0001 BETWEEN gf_datum AND gf_datum.
"**************************************************************************
"* Hire Date
"**************************************************************************
IF p_ini = 'X'.
SELECT * FROM pa0000 INTO TABLE gt_pa0000
WHERE pernr = pernr-pernr.
SORT gt_pa0000 BY endda DESCENDING.
LOOP AT gt_pa0000 INTO gs_pa0000.
CASE gs_pa0000-massn.
WHEN '01' OR '06' OR '51' OR '50' OR '20' OR '12' OR '13'.
"Event Date
CONCATENATE
gs_pa0000-begda+4(2) '/'
gs_pa0000-begda+6(2) '/'
gs_pa0000-begda(4)
INTO gs_data_1-hired.
EXIT.
WHEN OTHERS.
CLEAR: gs_pa0000.
ENDCASE.
ENDLOOP.
CLEAR: gs_pa0000.
ELSE.
SELECT SINGLE * FROM pa0001 INTO gs_pa0001
WHERE pernr = pernr-pernr AND
begda <= gf_datum AND
endda >= gf_datum.
CONCATENATE
gs_pa0001-begda+4(2) '/'
gs_pa0001-begda+6(2) '/'
gs_pa0001-begda(4)
INTO gs_data_1-hired.
CLEAR: gs_pa0001.
ENDIF.
ENDPROVIDE.
CLEAR: gs_pa0001, gt_pa0001, gt_pa0000, gs_pa0000.
"**************************************************************************
"* Default Local
"**************************************************************************
gs_data_1-zzhr_local = 'en_US'.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_1 TO gt_data_1.
CLEAR gs_data_1.
ENDFORM. " READ_DATA
*=======================================================================
* FORM SHOW_ALV
*=======================================================================
*&---------------------------------------------------------------------*
*& Form show_alv
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM show_alv .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_1 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. "show_alv
*&---------------------------------------------------------------------*
*& Form download_csv
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM download_csv.
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_1
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
gs_outtab_csv = 'STATUS;USERID;USERNAME;FIRSTNAME;LASTNAME;EMAIL;MANAGER;TIMEZONE;HIREDATE;DEFAULT_LOCALE'.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. "download_csv
*&---------------------------------------------------------------------*
*& Form f4_help
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f4_help.
* Dialog Bildschirm zum speichern der Daten
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
* window_title = ' '
default_extension = 'CSV'
default_file_name = 'D1_Sätze'
initial_directory = 'c:\temp\'
CHANGING
filename = ld_filename
path = ld_path
fullpath = ld_fullpath
user_action = ld_result.
p_file = ld_fullpath.
ENDFORM. "f4_help
*&---------------------------------------------------------------------*
*& Form READ_DATA2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data2 .
"***********************************************************************
"* PNR
"***********************************************************************
gs_data_2-pernr = pernr-pernr.
**************************************************************************
* IT0002
**************************************************************************
PROVIDE * FROM p0002 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* Land, Ort, Datum des Todes
"*********************************************************************
CONCATENATE p0002-gbdat+4(2) '/' p0002-gbdat+6(2) '/' p0002-gbdat(4)
INTO gs_data_2-gbdat.
"gs_data_2-gblnd = p0002-gblnd.
SELECT SINGLE iso FROM zhr_sf_data_iso INTO gs_data_2-gblnd
WHERE land = p0002-gblnd.
* gs_data_2-gbort = p0002-gbort.
gs_data_2-death = ''.
ENDPROVIDE.
"***********************************************************************
"* Globale PNR
"***********************************************************************
gs_data_2-gpernr = pernr-pernr.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_2 TO gt_data_2.
CLEAR gs_data_2.
ENDFORM. " READ_DATA2
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv2 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_2 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv2 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_2
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
gs_outtab_csv = 'user-id;date-of-birth;country-of-birth;place-of-birth;date-of-death;person-id-external'.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
*& Form READ_DATA2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data3 .
"***********************************************************************
"* PNR
"***********************************************************************
gs_data_3-pernr = pernr-pernr.
gs_data_3-epernr = pernr-pernr.
**************************************************************************
* IT0000
**************************************************************************
SELECT * FROM pa0000 INTO TABLE gt_pa0000
WHERE pernr = pernr-pernr.
SORT gt_pa0000 BY endda DESCENDING.
"*********************************************************************
"* Eintritt
"*********************************************************************
LOOP AT gt_pa0000 INTO gs_pa0000.
IF gs_pa0000-massn = '01' OR
gs_pa0000-massn = '50' OR
gs_pa0000-massn = '51' OR
gs_pa0000-massn = '06' OR
gs_pa0000-massn = '20' OR
gs_pa0000-massn = '12' OR
gs_pa0000-massn = '13'.
CONCATENATE gs_pa0000-begda+4(2) '/' gs_pa0000-begda+6(2) '/' gs_pa0000-begda(4)
INTO gs_data_3-hire.
EXIT.
ENDIF.
ENDLOOP.
CLEAR: gt_pa0000, gs_pa0000.
gs_data_3-ohire = gs_data_3-hire.
gs_data_3-fhire = gs_data_3-hire.
**************************************************************************
* IT0001
**************************************************************************
PROVIDE * FROM p0001 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* Stelle Job Number
"*********************************************************************
gs_data_3-stell = p0001-stell.
ENDPROVIDE.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_3 TO gt_data_3.
CLEAR gs_data_3.
ENDFORM. " READ_DATA2
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv3 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_3 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv3 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_3
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
gs_outtab_csv = 'user-id;person-id-external;start-date;originalStartDate;seniorityDate;benefits-eligibility-start-date;serviceDate;ProfessionalServiceDate;notes;firstDateWorked;jobNumber'.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
*& Form READ_DATA2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data4 .
"*********************************************************************
"* Pernr
"*********************************************************************
gs_data_4-pernr = pernr-pernr.
"*********************************************************************
"* Standard Monthly Hours
"*********************************************************************
gs_data_4-mhour = '184'.
***************************************************************************
** IT0001
***************************************************************************
PROVIDE * FROM p0001 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* Initial load End Date und Event Date
"*********************************************************************
IF p_ini = 'X'.
SELECT * FROM pa0000 INTO TABLE gt_pa0000
WHERE pernr = pernr-pernr.
SORT gt_pa0000 BY endda DESCENDING.
LOOP AT gt_pa0000 INTO gs_pa0000.
CASE gs_pa0000-massn.
WHEN '01' OR '06' OR '51' OR '50' OR '20' OR '12' OR '13'.
"Event Date
CONCATENATE
gs_pa0000-begda+4(2) '/'
gs_pa0000-begda+6(2) '/'
gs_pa0000-begda(4)
INTO gs_data_4-begda.
"End Date
CONCATENATE
gs_pa0000-endda+4(2) '/'
gs_pa0000-endda+6(2) '/'
gs_pa0000-endda(4)
INTO gs_data_4-endda.
"Initialisieren falls 12/31/9999
IF p_ini = 'X' AND gs_data_4-endda = '12/31/9999'.
CLEAR: gs_data_4-endda.
ENDIF.
"*********************************************************************
"* Event Reaseon by initial load
"*********************************************************************
CASE gs_pa0000-massn.
WHEN '01' OR '06' OR '51' OR '50' OR '20'.
CASE p0000-massg.
WHEN 'Z1'.
gs_data_4-massg = 'HIRIMP'.
WHEN OTHERS.
gs_data_4-massg = 'HIRIMP'.
ENDCASE.
WHEN '12' OR '13'.
CASE p0000-massg.
WHEN 'Z1'.
gs_data_4-massg = 'REHIMP'.
WHEN OTHERS.
gs_data_4-massg = 'REHIMP'.
ENDCASE.
WHEN OTHERS.
"mache nichts.
ENDCASE.
EXIT.
WHEN OTHERS.
CLEAR: gs_pa0000.
ENDCASE.
ENDLOOP.
CLEAR: gt_pa0000, gs_pa0000.
ELSE.
"*********************************************************************
"* End Date
"*********************************************************************.
* CONCATENATE
* p0001-endda+4(2) '/'
* p0001-endda+6(2) '/'
* p0001-endda(4)
* INTO gs_data_4-endda.
SELECT SINGLE * FROM pa0001 INTO gs_pa0001
WHERE pernr = pernr-pernr AND
begda <= gf_datum AND
endda >= gf_datum.
CONCATENATE
gs_pa0001-endda+4(2) '/'
gs_pa0001-endda+6(2) '/'
gs_pa0001-endda(4)
INTO gs_data_4-endda.
"*********************************************************************
"* Event Date
"*********************************************************************
* CONCATENATE
* p0001-begda+4(2) '/'
* p0001-begda+6(2) '/'
* p0001-begda(4)
* INTO gs_data_4-begda.
CONCATENATE
gs_pa0001-begda+4(2) '/'
gs_pa0001-begda+6(2) '/'
gs_pa0001-begda(4)
INTO gs_data_4-begda.
CLEAR: gs_pa0001.
ENDIF.
"*********************************************************************
"* Job Title
"*********************************************************************
SELECT SINGLE stltx FROM t513s INTO gs_data_4-stltx
WHERE stell = p0001-stell AND
begda <= gf_datum AND
endda >= gf_datum AND
sprsl = sy-langu.
"*********************************************************************
"* Job code
"*********************************************************************
gs_data_4-stell = p0001-stell.
"*********************************************************************
"* Department
"*********************************************************************
gs_data_4-orgeh = p0001-orgeh.
"*********************************************************************
"* ORGSTRUCKTUR LESEN
"*********************************************************************
"Lokale Deklaration:
* DATA: lt_result_tab TYPE TABLE OF swhactor,
* lt_result_objec TYPE TABLE OF objec,
* lt_result_struc TYPE TABLE OF struc,
* ls_rs_tab TYPE swhactor,
* ls_rs_objec TYPE objec,
* ls_rs_struc TYPE struc,
* lf_count TYPE i.
"Orgstruktur lesen
CALL FUNCTION 'RH_STRUC_GET'
EXPORTING
act_otype = 'S'
act_objid = p0001-plans
act_wegid = 'S_UP'
act_plvar = '01'
act_begda = p0001-endda
act_endda = p0001-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.
IF sy-subrc <> 0.
"mache nichts
ELSE.
"Count organisational units along the evaluation path:
gf_count = lines( gt_result_objec ).
"*********************************************************************
"* Buisnessunit
"*********************************************************************
IF gf_count - 1 = 1.
READ TABLE gt_result_objec INTO gs_rs_objec INDEX gf_count. "If no BU available one level higher
gs_data_4-busin = gs_rs_objec-objid.
ELSE.
READ TABLE gt_result_objec INTO gs_rs_objec INDEX gf_count - 1. "because BU is 1st level.
IF gf_count - 1 <= 1.
"mache nicht
ELSE.
gs_data_4-busin = gs_rs_objec-objid.
ENDIF.
ENDIF.
"*********************************************************************
"* Division
"*********************************************************************
READ TABLE gt_result_objec INTO gs_rs_objec INDEX gf_count - 2. "because DEP is 2nd level.
IF gf_count - 2 <= 1.
"mache nichts
ELSE.
gs_data_4-divis = gs_rs_objec-objid.
ENDIF.
ENDIF.
CLEAR: gs_rs_objec,
gt_result_tab,
gt_result_objec,
gt_result_struc.
"*********************************************************************
"* Department
"*********************************************************************
" Department initialisieren falls es gleich der Division ist.
IF gs_data_4-divis = gs_data_4-orgeh.
CLEAR gs_data_4-orgeh.
ENDIF.
"*********************************************************************
"* Location
"*********************************************************************
gs_data_4-locat = p0001-btrtl.
"*********************************************************************
"* Company
"*********************************************************************
gs_data_4-bukrs = p0001-bukrs.
"*********************************************************************
"* Costcenter Kostenstelle
"*********************************************************************
CONCATENATE
p0001-kostl
'_'
p0001-bukrs
INTO gs_data_4-kostl.
SHIFT gs_data_4-kostl LEFT DELETING LEADING '0'.
"*********************************************************************
"* Employee Group class
"*********************************************************************
SELECT SINGLE ptext FROM t501t INTO gs_data_4-pgtxt
WHERE persg = p0001-persg AND
sprsl = sy-langu.
"*********************************************************************
"* Employment Sub Group
"*********************************************************************
SELECT SINGLE ptext FROM t503t INTO gs_data_4-pktxt
WHERE persk = p0001-persk AND
sprsl = 'E'. "sy-langu.
CASE gs_data_4-pktxt.
WHEN 'Salaried w overtime'.
gs_data_4-pktxt = 'Salaried with overtime'.
WHEN 'Salaried wo overtime'.
gs_data_4-pktxt = 'Salaried without overtime'.
ENDCASE.
"*********************************************************************
"* Regular-temp
"*********************************************************************
IF p0001-persg = 8 OR p0001-persg = 9.
gs_data_4-rtemp = 'Temporary'.
ELSE.
gs_data_4-rtemp = 'Permanent'.
ENDIF.
"*********************************************************************
"* Company Entry Date
"*********************************************************************
SELECT SINGLE * FROM pa0001 INTO gs_pa0001
WHERE pernr = pernr-pernr AND
begda <= gf_datum AND
endda >= gf_datum.
CONCATENATE
gs_pa0001-begda+4(2) '/'
gs_pa0001-begda+6(2) '/'
gs_pa0001-begda(4)
INTO gs_data_4-hire.
CLEAR gs_pa0001.
"*********************************************************************
"* Location Entry Date
"*********************************************************************
gs_data_4-lhire = gs_data_4-hire.
"*********************************************************************
"* Department Entry Date
"*********************************************************************
gs_data_4-dhire = gs_data_4-hire.
"*********************************************************************
"* Job Grad Bezeichung eines Objektes welches mit dem Objekt Stelle
"* Verknüpft ist. 1.Lese Verknüpfungen HRP1001 2.Lese Text aus HRP1000
"*********************************************************************
DATA: gt_hri1001 TYPE STANDARD TABLE OF hri1001,
gs_hri1001 TYPE hri1001."relation
"Lese HRP1001 Verknüpfungen
CALL FUNCTION 'RHOM_READ_RELAT_BUFFERED'
EXPORTING
otype = 'C'
objid = p0001-stell
plvar = '01'
* SUBTY =
* ISTAT =
begda = gf_datum
endda = gf_datum
auth_fcode = 'DISP'
with_stru_auth = 'X'
buffer_mode = 'X'
TABLES
* OBJECTS =
i1001 = gt_hri1001
EXCEPTIONS
no_active_plvar = 1
OTHERS = 2.
IF sy-subrc <> 0.
"Mache nichts
ELSE.
DELETE gt_hri1001 WHERE rsign <> 'B' AND relat <> 'ZJG'.
DELETE gt_hri1001 WHERE relat <> 'ZJG'.
ENDIF.
READ TABLE gt_hri1001 INTO gs_hri1001 INDEX 1.
"Lese HRP1000 Objekt
SELECT SINGLE stext FROM hrp1000 INTO gs_data_4-bzig
WHERE plvar = gs_hri1001-plvar AND
otype = gs_hri1001-sclas AND
objid = gs_hri1001-sobid AND
istat = gs_hri1001-istat AND
begda <= gs_hri1001-begda AND
endda >= gs_hri1001-endda AND
langu = sy-langu.
**************************************************************************
* Supervisor
**************************************************************************
PROVIDE * FROM p0001 BETWEEN gf_datum AND gf_datum.
"Organisationstruktur lesen
CALL FUNCTION 'RH_STRUC_GET'
EXPORTING
act_otype = 'S'
act_objid = p0001-plans
act_wegid = 'S_UP' "auch Möglich 'O-O-S-P' oder 'A002'
act_plvar = '01'
act_begda = p0001-begda
act_endda = p0001-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 <> p0001-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.
ENDIF.
ENDLOOP.
ELSE.
"Mache nichts
ENDIF.
ENDPROVIDE.
gs_data_4-mpernr = gf_objid_p.
IF gf_objid_p IS INITIAL.
gs_data_4-mpernr = 'NO_MANAGER'.
ENDIF.
CLEAR: gt_result_tab, gt_result_objec, gt_result_struc,
gs_rs_tab, gs_rs_objec, gs_rs_struc,
gf_objid_p, gf_objid, gf_vorge, gf_vorge_pernr,
gf_vorge_mail.
ENDPROVIDE.
***************************************************************************
** IT0050
***************************************************************************
PROVIDE * FROM p0050 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* Local Badge ID
"*********************************************************************
gs_data_4-zausw = p0050-zausw.
ENDPROVIDE.
"*********************************************************************
"* Employee Type
"*********************************************************************
gs_data_4-etype = 'Regular'.
***************************************************************************
** IT0008
***************************************************************************
PROVIDE * FROM p0008 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* FTE
"*********************************************************************
gs_data_4-bsgrd = p0008-bsgrd / 100.
"*********************************************************************
"* Pay Scale Level Entry Date
"*********************************************************************
SELECT SINGLE * FROM pa0008 INTO gs_pa0008
WHERE pernr = pernr-pernr AND
begda <= gf_datum AND
endda >= gf_datum.
CONCATENATE
gs_pa0008-begda+4(2) '/'
gs_pa0008-begda+6(2) '/'
gs_pa0008-begda(4)
INTO gs_data_4-phire.
"*********************************************************************
"* Pay Scale Area
"*********************************************************************
gs_data_4-trfgb = p0008-trfgb.
"*********************************************************************
"* Pay Scale Type
"*********************************************************************
gs_data_4-trfar = p0008-trfar.
"*********************************************************************
"* Pay Scale Group
"*********************************************************************
gs_data_4-trfgr = p0008-trfgr.
ENDPROVIDE.
"*********************************************************************
"* Standard Hours
"*********************************************************************
gs_data_4-whour = '42.50'.
***************************************************************************
** IT0007
***************************************************************************
PROVIDE * FROM p0007 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* Working Days per Week
"*********************************************************************
gs_data_4-wkwdy = p0007-wkwdy.
"*********************************************************************
"* Working Days per Week
"*********************************************************************
IF p0007-teilk IS INITIAL.
gs_data_4-teilk = 'yes'.
ELSE.
gs_data_4-teilk = 'no'.
ENDIF.
ENDPROVIDE.
"*********************************************************************
"* Is Shift Employee
"*********************************************************************
gs_data_4-shift = 'yes'.
"*********************************************************************
"* Time Zone
"*********************************************************************
gs_data_4-cet = 'CET'.
***************************************************************************
** IT0000
***************************************************************************
IF p_ini IS INITIAL.
PROVIDE * FROM p0000 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* Event Reason
"*********************************************************************
gs_data_4-massg = p0000-massg.
CASE p0000-massn.
WHEN '01' OR '06' OR '51' OR '50' OR '20'.
IF p_ini IS INITIAL.
CASE p0000-massg.
WHEN 'Z1'.
gs_data_4-massg = 'HIRNEW'.
WHEN OTHERS.
gs_data_4-massg = 'HIRNEW'.
ENDCASE.
ELSE.
* CASE p0000-massg.
* WHEN 'Z1'.
* gs_data_4-massg = 'HIRIMP'.
* WHEN OTHERS.
* gs_data_4-massg = 'HIRIMP'.
* ENDCASE.
ENDIF.
WHEN '12' OR '13'.
IF p_ini IS INITIAL.
CASE p0000-massg.
WHEN 'Z1'.
gs_data_4-massg = 'REHREH'.
WHEN OTHERS.
gs_data_4-massg = 'REHREH'.
ENDCASE.
ELSE.
* CASE p0000-massg.
* WHEN 'Z1'.
* gs_data_4-massg = 'REHIMP'.
* WHEN OTHERS.
* gs_data_4-massg = 'REHIMP'.
* ENDCASE.
ENDIF.
WHEN '02'.
CASE p0000-massg.
WHEN '11'.
gs_data_4-massg = 'JOBLGRAD'.
WHEN '03'.
gs_data_4-massg = 'JOBTITLE'.
WHEN '14'.
gs_data_4-massg = 'JOBLATRL'.
WHEN '06'.
gs_data_4-massg = 'JOBLOCN'.
WHEN '10'.
gs_data_4-massg = 'JOBUGRDE'.
WHEN '04'.
gs_data_4-massg = 'JOBFTPT'.
WHEN '05'.
gs_data_4-massg = 'JOBPTFT'.
WHEN OTHERS.
gs_data_4-massg = 'JOBUGRDE'.
ENDCASE.
WHEN '10'.
CASE p0000-massg.
WHEN '89'.
gs_data_4-massg = 'TERIATTD'.
WHEN '62' OR '72' OR '48' OR '74' OR '80' OR '66'.
gs_data_4-massg = 'TERVPERS'.
WHEN '20'.
gs_data_4-massg = 'TERRESIG'.
WHEN '46'.
gs_data_4-massg = 'TERDISM'.
WHEN '09'.
gs_data_4-massg = 'TERIDEAT'.
WHEN '87'.
gs_data_4-massg = 'TERIDISH'.
WHEN '68'.
gs_data_4-massg = 'TERVHLTH'.
WHEN '88'.
gs_data_4-massg = 'TERINHLT'.
WHEN '85'.
gs_data_4-massg = 'TERINONP'.
WHEN '78'.
gs_data_4-massg = 'TERVSCHOL'.
WHEN '03'.
gs_data_4-massg = 'TERVVSP'.
WHEN '21'.
gs_data_4-massg = 'TERIRSTR'.
WHEN 'Z6'.
gs_data_4-massg = 'TEROTH'.
WHEN '25'.
gs_data_4-massg = 'TERMUA'.
WHEN '10'.
gs_data_4-massg = 'TERTECO'.
WHEN '95'.
gs_data_4-massg = 'TERPROB'.
WHEN '96'.
gs_data_4-massg = 'TERPROE'.
WHEN OTHERS.
gs_data_4-massg = 'TERTVTERM'.
ENDCASE.
WHEN OTHERS.
gs_data_4-massg = 'DATACHG'.
ENDCASE.
ENDPROVIDE.
ENDIF.
"*********************************************************************
"* Competition Clause
"*********************************************************************
gs_data_4-comcl = 'no'.
"*********************************************************************
"* Sideline Job Checked
"*********************************************************************
gs_data_4-sijob = 'no'.
"*********************************************************************
"* Employee Notice Period
"*********************************************************************
gs_data_4-noper = '3 months as of month end'.
"*********************************************************************
"* Custom-string22
"*********************************************************************
SELECT * FROM pa0028 INTO TABLE gt_pa0028
WHERE pernr = pernr-pernr AND
subty = 'JET'.
SORT gt_pa0028 BY endda DESCENDING.
READ TABLE gt_pa0028 INTO gs_pa0028 INDEX 1.
SELECT SINGLE rstxt FROM t578y INTO gs_data_4-cus22
WHERE sprsl = 'EN' AND
resul = gs_pa0028-resul.
"*********************************************************************
"* Custom-string7
"*********************************************************************
gs_data_4-cus07 = gs_pa0028-subty.
"*********************************************************************
"* Custom-string23
"*********************************************************************
CONCATENATE
gs_pa0028-exdat+4(2) '/'
gs_pa0028-exdat+6(2) '/'
gs_pa0028-exdat(4)
INTO gs_data_4-cus23.
"*********************************************************************
"* Custom-date2
"*********************************************************************
gs_data_4-cus02 = gs_pa0028-wtf01.
"*********************************************************************
"* Custom-date3
"*********************************************************************
CONCATENATE
gs_pa0028-dtf01+4(2) '/'
gs_pa0028-dtf01+6(2) '/'
gs_pa0028-dtf01(4)
INTO gs_data_4-cus03.
CLEAR: gt_pa0028, gs_pa0028.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_4 TO gt_data_4.
CLEAR gs_data_4.
ENDFORM. " READ_DATA2
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv4 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_4 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv4 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_4
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
CONCATENATE
'user-id;custom-string6;end-date;custom-string8;custom-string9;'
'custom-string10;custom-string13;custom-string20;start-date;job-title;'
'job-code;employee-type;department;division;location;radford-jobcode;'
'notes;company;business-unit;cost-center;employee-class;employment-type;'
'fte;regular-temp;standard-hours;workingDaysPerWeek;companyEntryDate;'
'locationEntryDate;departmentEntryDate;payScaleLevelEntryDate;'
'local-job-title;is-fulltime-employee;pay-grade;is-shift-employee;'
'seq-number;payScaleArea;payScaleType;payScaleGroup;payScaleLevel;'
'manager-id;attachment-id;expected-return-date;timezone;event-reason;'
'probation-period-end-date;is-competition-clause-active;is-side-line-job-allowed;'
'notice-period;contract-end-date;contract-type;initial-entry-date;'
'entry-into-group;period-indicator;work-permit-expiry;work-location;'
'labor-Protection;custom-string22;excl-executive-sector;custom-string40;'
'employee-workgroup-membership;custom-string7;custom-string23;custom-date2;'
'custom-date3;contract-id;contract-date;custom-string24;custom-string25;'
'contract-number;ineligible-statutory-min-wage;spcl-rule-non-manual-worker;'
'payment-in-lieu-of-notice;guaranteed-payment;calculation-base;'
'credit-for-previous-service;assessment-status;current-wage-level;'
'degree-of-productivity;custom-date4;custom-date5;custom-date6;custom-date7;'
'flsa-status;custom-string21;eeo-class;custom-string11;custom-string12;operation'
INTO gs_outtab_csv.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
*& Form READ_DATA2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data5 .
"*********************************************************************
"* Personalnummer
"*********************************************************************
gs_data_5-pernr = pernr-pernr.
***************************************************************************
** IT0002
***************************************************************************
PROVIDE * FROM p0002 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* Native Preferred Language Muttersprache Communication language
"*********************************************************************
SELECT SINGLE sptxt FROM t002t INTO gs_data_5-sptxt
WHERE spras = 'EN' AND
sprsl = p0002-sprsl.
CASE gs_data_5-sptxt.
WHEN 'English'.
gs_data_5-sptxt = 'English'.
WHEN 'French'.
gs_data_5-sptxt = 'French'.
WHEN 'German'.
gs_data_5-sptxt = 'German'.
WHEN OTHERS.
gs_data_5-sptxt = 'English'.
ENDCASE.
gs_data_5-sprsl = gs_data_5-sptxt.
"*********************************************************************
"* End Date Endedatum
"*********************************************************************
SELECT SINGLE * FROM pa0002 INTO gs_pa0002
WHERE pernr = pernr-pernr AND
begda <= gf_datum AND
endda >= gf_datum.
CONCATENATE
gs_pa0002-endda+4(2) '/'
gs_pa0002-endda+6(2) '/'
gs_pa0002-endda(4)
INTO gs_data_5-endda.
* CONCATENATE
* p0002-endda+4(2) '/'
* p0002-endda+6(2) '/'
* p0002-endda(4)
* INTO gs_data_5-endda.
"*********************************************************************
"* Event Date Beginndatum
"*********************************************************************
CONCATENATE
gs_pa0002-begda+4(2) '/'
gs_pa0002-begda+6(2) '/'
gs_pa0002-begda(4)
INTO gs_data_5-begda.
CLEAR: gs_pa0002.
* CONCATENATE
* p0002-begda+4(2) '/'
* p0002-begda+6(2) '/'
* p0002-begda(4)
* INTO gs_data_5-begda.
"*********************************************************************
"* First Name Vorname
"*********************************************************************
gs_data_5-vorna = p0002-vorna.
"*********************************************************************
"* Last Name Nachname
"*********************************************************************
gs_data_5-nachn = p0002-nachn.
"*********************************************************************
"* Salutation Anrede
"*********************************************************************
SELECT SINGLE atext FROM t522t INTO gs_data_5-anrex
WHERE anred = p0002-anred AND
sprsl = 'EN'.
* CASE gs_data_5-anrex.
* WHEN 'Mr.'.
* gs_data_5-anrex = 'Mr.'.
* WHEN 'Mrs.'.
* gs_data_5-anrex = 'Mrs.'.
* WHEN 'Ms'.
* gs_data_5-anrex = 'Ms'.
* WHEN OTHERS.
* gs_data_5-anrex = ''.
* ENDCASE.
"*********************************************************************
"* Gender Geschlecht
"*********************************************************************
CASE p0002-anred.
WHEN 1.
gs_data_5-gesch = 'M'.
WHEN 2.
gs_data_5-gesch = 'F'.
WHEN 3.
gs_data_5-gesch = 'F'.
WHEN OTHERS.
"MACHE NICHTS
ENDCASE.
"*********************************************************************
"* Marital Status Familienstands Bezeichnung
"*********************************************************************
SELECT SINGLE ftext FROM t502t INTO gs_data_5-fatxt
WHERE sprsl = 'EN' AND
famst = p0002-famst.
CASE gs_data_5-fatxt.
WHEN 'Single'.
gs_data_5-fatxt = 'Single'.
WHEN 'Married'.
gs_data_5-fatxt = 'Married'.
WHEN 'Divorced'.
gs_data_5-fatxt = 'Divorced'.
WHEN 'Separated'.
gs_data_5-fatxt = 'Separated'.
WHEN 'Widowed'.
gs_data_5-fatxt = 'Widowed'.
WHEN 'RegPar'.
gs_data_5-fatxt = 'missing'.
"PACS meldet XY noch
WHEN OTHERS.
gs_data_5-fatxt = ''.
ENDCASE.
"*********************************************************************
"* Nationaltity Nationalität
"*********************************************************************
"Bezeichnung
* SELECT SINGLE natio FROM t005t INTO gs_data_5-natio
* WHERE spras = sy-langu AND
* land1 = p0002-natio.
"ISO Code
SELECT SINGLE iso FROM zhr_sf_data_iso INTO gs_data_5-natio
WHERE land = p0002-natio.
"*********************************************************************
"* since Familienstand seit
"*********************************************************************
CONCATENATE
p0002-famdt+4(2) '/'
p0002-famdt+6(2) '/'
p0002-famdt(4)
INTO gs_data_5-famdt.
"*********************************************************************
"* Initials
"*********************************************************************
gs_data_5-inits = p0002-inits.
"*********************************************************************
"* birth-name
"*********************************************************************
gs_data_5-name2 = p0002-name2.
"*********************************************************************
"* Second Nationality
"*********************************************************************
SELECT SINGLE natio FROM t005t INTO gs_data_5-nati2
WHERE spras = sy-langu AND
land1 = p0002-nati2.
ENDPROVIDE.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_5 TO gt_data_5.
CLEAR gs_data_5.
ENDFORM. " READ_DATA2
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv5 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_5 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv5 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_5
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
CONCATENATE
'personInfo.person-id-external;custom-string1;end-date;'
'custom-date1;custom-date2;custom-date3;start-date;'
'first-name;last-name;middle-name;salutation;gender;'
'marital-status;native-preferred-lang;first-name-alt1;'
'middle-name-alt1;last-name-alt1;nationality;since;'
'preferred-name;initials;title;birth-name;second-nationality;'
'operation'
INTO gs_outtab_csv.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
*& Form READ_DATA2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data6 .
***************************************************************************
** IT0006
***************************************************************************
PROVIDE * FROM p0006 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* Personalnummer
"*********************************************************************
gs_data_6-pernr = pernr-pernr.
"*********************************************************************
"* Event Date Beginndatum
"*********************************************************************
SELECT SINGLE * FROM pa0006 INTO gs_pa0006
WHERE pernr = pernr-pernr AND
begda <= gf_datum AND
endda >= gf_datum AND
subty = p0006-subty.
CONCATENATE
gs_pa0006-begda+4(2) '/'
gs_pa0006-begda+6(2) '/'
gs_pa0006-begda(4)
INTO gs_data_6-begda.
* CONCATENATE
* p0006-begda+4(2) '/'
* p0006-begda+6(2) '/'
* p0006-begda(4)
* INTO gs_data_6-begda.
"*********************************************************************
"* End Date Endedatum
"*********************************************************************
CONCATENATE
gs_pa0006-endda+4(2) '/'
gs_pa0006-endda+6(2) '/'
gs_pa0006-endda(4)
INTO gs_data_6-endda.
CLEAR: gs_pa0006.
* CONCATENATE
* p0006-endda+4(2) '/'
* p0006-endda+6(2) '/'
* p0006-endda(4)
* INTO gs_data_6-endda.
"*********************************************************************
"* Adresse1 Strasse
"*********************************************************************
gs_data_6-stras = p0006-stras.
"*********************************************************************
"* Adresse2 Name2 c/o
"*********************************************************************
gs_data_6-name2 = p0006-name2.
"*********************************************************************
"* City Ort
"*********************************************************************
gs_data_6-ort01 = p0006-ort01.
"*********************************************************************
"* Postalcode PLZ Postleitzahl
"*********************************************************************
gs_data_6-pstlz = p0006-pstlz.
"*********************************************************************
"* Country Land
"*********************************************************************
"gs_data_6-land1 = p0006-land1.
"ISO Code
SELECT SINGLE iso FROM zhr_sf_data_iso INTO gs_data_6-land1
WHERE land = p0006-land1.
"*********************************************************************
"* State Canton
"*********************************************************************
gs_data_6-state = p0006-state.
"*********************************************************************
"* Address type Subtyp
"*********************************************************************
gs_data_6-anssa = p0006-anssa.
CASE gs_data_6-anssa.
WHEN '1'.
gs_data_6-anssa = 'home'.
WHEN '2'.
gs_data_6-anssa = 'business'.
WHEN OTHERS.
gs_data_6-anssa = ''.
ENDCASE.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_6 TO gt_data_6.
CLEAR gs_data_6.
ENDPROVIDE.
ENDFORM. " READ_DATA2
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv6 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_6 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv6 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_6
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
CONCATENATE
'personInfo.person-id-external;start-date;end-date;'
'address1;address2;address3;city;zip-code;country;'
'notes;address4;address5;address6;address7;county;'
'state;address8;address9;address10;address11;address-type;'
'operation'
INTO gs_outtab_csv.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
*& Form READ_DATA2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data7 .
***************************************************************************
** IT0105
***************************************************************************
PROVIDE * FROM p0105 BETWEEN gf_datum AND gf_datum.
IF p0105-usrty = '0010'.
"*********************************************************************
"* Personalnummer
"*********************************************************************
gs_data_7-pernr = pernr-pernr.
"*********************************************************************
"* Systemid Userid Username
"*********************************************************************
gs_data_7-usrty = p0105-usrty.
CASE gs_data_7-usrty.
WHEN '0010'.
gs_data_7-usrty = 'Business'.
WHEN OTHERS.
"mache nichts
ENDCASE.
"*********************************************************************
"* Email E-Mail Mail
"*********************************************************************
gs_data_7-usrid_long = p0105-usrid_long.
"*********************************************************************
"* is Primary isPrimary
"*********************************************************************
gs_data_7-ztrue = 'TRUE'.
ELSE.
"mache nichts
ENDIF.
ENDPROVIDE.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_7 TO gt_data_7.
CLEAR gs_data_7.
ENDFORM. " READ_DATA2
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv7 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_7 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv7 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_7
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
CONCATENATE
'personInfo.person-id-external,email-type,email-address,'
'isPrimary,operation'
INTO gs_outtab_csv.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
*& Form READ_DATA2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data8 .
***************************************************************************
** IT0105
***************************************************************************
PROVIDE * FROM p0105 BETWEEN gf_datum AND gf_datum.
IF p0105-usrty = '0020'.
"*********************************************************************
"* Personalnummer
"*********************************************************************
gs_data_8-pernr = pernr-pernr.
"*********************************************************************
"* Systemid Userid Username
"*********************************************************************
gs_data_8-usrty = p0105-usrty.
CASE gs_data_8-usrty.
WHEN '0020'.
gs_data_8-usrty = 'Business'.
WHEN OTHERS.
"mache nichts
ENDCASE.
"*********************************************************************
"* Country Code Ländercode
"*********************************************************************
gs_data_8-couco ='0041'.
"*********************************************************************
"* Phone number Telefonnummer
"*********************************************************************
gs_data_8-usrid_long = p0105-usrid_long.
"*********************************************************************
"* is Primary isPrimary
"*********************************************************************
gs_data_8-ztrue = 'TRUE'.
ELSE.
"mache nichts
ENDIF.
ENDPROVIDE.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_8 TO gt_data_8.
CLEAR gs_data_8.
ENDFORM. " READ_DATA2
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv8 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_8 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv8 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_8
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
CONCATENATE
'personInfo.person-id-external;phone-type;country-code;'
'area-code;phone-number;isPrimary;operation'
INTO gs_outtab_csv.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
*& Form READ_DATA2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data9 .
"*********************************************************************
"* Personalnummer
"*********************************************************************
gs_data_9-pernr = pernr-pernr.
"*********************************************************************
"* Country Land
"*********************************************************************
gs_data_9-couny = 'CHE'.
"*********************************************************************
"* National ID Card Type
"*********************************************************************
gs_data_9-natid = 'AHV'.
***************************************************************************
** IT0036
***************************************************************************
PROVIDE * FROM p0036 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* National id AHV Nummer
"*********************************************************************
* gs_data_9-ahvnr = p0036-ahvnr.
gs_data_9-nahvn = p0036-nahvn.
ENDPROVIDE.
"*********************************************************************
"* is Primary isPrimary
"*********************************************************************
gs_data_9-ztrue = 'TRUE'.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_9 TO gt_data_9.
CLEAR gs_data_9.
ENDFORM. " READ_DATA2
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv9 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_9 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv9 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_9
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
CONCATENATE
'personInfo.person-id-external,country,card-type,'
'national-id,isPrimary,notes,operation'
INTO gs_outtab_csv.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
*& Form READ_DATA2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data10 .
"*********************************************************************
"* Personalnummer
"*********************************************************************
gs_data_10-pernr = pernr-pernr.
***************************************************************************
** IT0001
***************************************************************************
PROVIDE * FROM p0001 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* Event Date Beginndatum
"*********************************************************************
SELECT SINGLE * FROM pa0001 INTO gs_pa0001
WHERE pernr = pernr-pernr AND
begda <= gf_datum AND
endda >= gf_datum.
CONCATENATE
gs_pa0001-begda+4(2) '/'
gs_pa0001-begda+6(2) '/'
gs_pa0001-begda(4)
INTO gs_data_10-begda.
* CONCATENATE
* p0001-begda+4(2) '/'
* p0001-begda+6(2) '/'
* p0001-begda(4)
* INTO gs_data_10-begda.
"*********************************************************************
"* End Date Endedatum
"*********************************************************************
CONCATENATE
gs_pa0001-endda+4(2) '/'
gs_pa0001-endda+6(2) '/'
gs_pa0001-endda(4)
INTO gs_data_10-endda.
CLEAR: gs_pa0001.
* CONCATENATE
* p0001-endda+4(2) '/'
* p0001-endda+6(2) '/'
* p0001-endda(4)
* INTO gs_data_10-endda.
"*********************************************************************
"* Pay Group Abrechnungskreis
"*********************************************************************
gs_data_10-abkrs = p0001-abkrs.
"*********************************************************************
"* Pay Group Abrechnungskreis
"*********************************************************************
CASE p0001-abkrs.
WHEN '01' OR '21' OR '41' OR '51' OR '46' OR '71'.
gs_data_10-atext = 'salaried'.
WHEN OTHERS.
gs_data_10-atext = 'hourly'.
ENDCASE.
ENDPROVIDE.
"*********************************************************************
"* Event Reason
"*********************************************************************
gs_data_10-event = 'JOBUGRDE'.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_10 TO gt_data_10.
CLEAR gs_data_10.
ENDFORM. " READ_DATA2
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv10 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_10 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv10 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_10
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
CONCATENATE
'user-id;custom-string1;end-date;'
'custom-string2;custom-date1;custom-date2;'
'custom-long1;start-date;pay-type;'
'notes;pay-group;is-eligible-for-benefits;'
'is-eligible-for-car;benefits-rate;event-reason;'
'payroll-id'
INTO gs_outtab_csv.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
*& Form READ_DATA2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data11 .
"***********************************************************************
"* PNR User-id
"***********************************************************************
gs_data_11-pernr = pernr-pernr.
"*********************************************************************
"* End Date
"*********************************************************************.
SELECT SINGLE * FROM pa0001 INTO gs_pa0001
WHERE pernr = pernr-pernr AND
begda <= gf_datum AND
endda >= gf_datum.
CONCATENATE
gs_pa0001-endda+4(2) '/'
gs_pa0001-endda+6(2) '/'
gs_pa0001-endda(4)
INTO gs_data_11-endda.
"*********************************************************************
"* start-date
"*********************************************************************
CONCATENATE
gs_pa0001-begda+4(2) '/'
gs_pa0001-begda+6(2) '/'
gs_pa0001-begda(4)
INTO gs_data_11-begda.
CLEAR: gs_pa0001.
"*********************************************************************
"* Relationship-type
"*********************************************************************
gs_data_11-relat = 'HR Generalist'.
"*********************************************************************
"* rel-user-id
"*********************************************************************
PROVIDE * FROM p0001 BETWEEN gf_datum AND gf_datum.
SELECT SINGLE * FROM t526 INTO gs_t526
WHERE werks = p0001-sbmod AND
sachx <= p0001-sachp.
IF gs_t526-usrid IS NOT INITIAL.
CLEAR: gs_data_11-relai.
SELECT SINGLE pernr FROM pa0105 INTO gs_data_11-relai
WHERE subty = 'Z003' AND
usrid = gs_t526-usrid AND
begda <= gf_datum AND
endda >= gf_datum.
IF gs_data_11-relai IS INITIAL.
gs_data_11-relai = gs_t526-sachn.
ENDIF.
ELSE.
gs_data_11-relai = gs_t526-sachn.
ENDIF.
ENDPROVIDE.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_11 TO gt_data_11.
CLEAR gs_data_11.
ENDFORM. " READ_DATA2
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv11 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_11 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv11 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_11
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
gs_outtab_csv = 'user-id;start-date;end-date;relationship-type;rel-user-id;operation'.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
*& Form ISO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form READ_DATA12
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data12 .
"***********************************************************************
"* PNR User-id
"***********************************************************************
gs_data_12-pernr = pernr-pernr.
"*********************************************************************
"* End Date
"*********************************************************************.
SELECT SINGLE * FROM pa0040 INTO gs_pa0040
WHERE pernr = pernr-pernr AND
subty = '80' AND
begda <= gf_datum AND
endda >= gf_datum.
CONCATENATE
gs_pa0040-endda+4(2) '/'
gs_pa0040-endda+6(2) '/'
gs_pa0040-endda(4)
INTO gs_data_12-endda.
"*********************************************************************
"* start-date
"*********************************************************************
CONCATENATE
gs_pa0040-begda+4(2) '/'
gs_pa0040-begda+6(2) '/'
gs_pa0040-begda(4)
INTO gs_data_12-begda.
CLEAR: gs_pa0040.
"*********************************************************************
"* rel-user-id
"*********************************************************************
PROVIDE * FROM p0006 BETWEEN gf_datum AND gf_datum.
SELECT SINGLE iso FROM zhr_sf_data_iso INTO gs_data_12-couty
WHERE land = p0006-land1.
ENDPROVIDE.
*********************************************************************
* IT0002
*********************************************************************
PROVIDE * FROM p0002 BETWEEN gf_datum AND gf_datum.
"*********************************************************************
"* Land, Ort, Datum des Todes
"*********************************************************************
gs_data_12-gbort = p0002-gbort.
ENDPROVIDE.
**************************************************************************
* In Tabelle einfügen
**************************************************************************
APPEND gs_data_12 TO gt_data_12.
CLEAR gs_data_12.
ENDFORM. "read_data12
*&---------------------------------------------------------------------*
*& Form SHOW_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_alv12 .
*-----------------------------------------------------------------------
* Beginn ALV-Ausgabe
*-----------------------------------------------------------------------
* Kopieren Sie diesen Block an das Endes des Verarbeitungsblocks
* des ABAP-Programms
*-----------------------------------------------------------------------
"**************************************************************************
"* Instanz der Klasse cl_salv_table erzeugen
"**************************************************************************
TRY.
cl_salv_table=>factory(
EXPORTING list_display = if_salv_c_bool_sap=>false
r_container = cl_gui_custom_container=>default_screen
IMPORTING r_salv_table = go_alv
CHANGING t_table = gt_data_12 ).
CATCH cx_salv_msg INTO go_err_salv.
* Fehler anzeigen
gf_string = go_err_salv->get_text( ).
MESSAGE gf_string TYPE 'E'.
ENDTRY.
"**************************************************************************
"* optimale Spaltenbreite aktivieren
"**************************************************************************
" Instanz für Spalten holen
go_columns = go_alv->get_columns( ).
" Spaltenbreite optimieren
go_columns->set_optimize( abap_true ). " nur ein 'X'
"**************************************************************************
"* Selection-Mode aktivieren
"**************************************************************************
" Instanz des Selection-Objektes holen
go_selections = go_alv->get_selections( ).
" Selektionsmodus setzen
go_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
"**************************************************************************
"* Alle Standard-Funktionen auf aktiv setzen
"**************************************************************************
" Instanz für Funktionen holen Funktionstasten (Sortieren, Filtern, Excel-Export etc.)
go_functions = go_alv->get_functions( ).
" Alle Standardfunktionen aktivieren
go_functions->set_all( abap_true ). " nur ein 'X'
"**************************************************************************
"* Alle Standard-Anzeige Möglichkeiten definieren
"**************************************************************************
" Titel und/oder Streifenmuster
go_display = go_alv->get_display_settings( ).
" Titel
go_display->set_list_header( value = text-001 ).
" Streifenmuster
go_display->set_striped_pattern( abap_true ).
"***************************************************************************
"* Alle Standard-Layout Möglichkeiten definieren
"***************************************************************************
" Instanz des Layouts holen get layout object
go_layout = go_alv->get_layout( ).
" set Layout save restriction
" 1. Set Layout Key .. Unique key identifies the Differenet ALVs
gs_key-report = sy-repid.
go_layout->set_key( gs_key ).
" 2. Remove Save layout the restriction.
go_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
" Default Layout hinterlegen set initial Layout
gf_variant = '/DEFAULT'.
go_layout->set_initial_layout( gf_variant ).
* "***************************************************************************
* "* Doppelklick Ereigniss einbauen.
* "***************************************************************************
* " Ereignisse einlesen und Handler für Doppelklick registrieren
* go_events = go_alv->get_event( ).
* SET HANDLER lcl_event_handler=>on_double_click FOR go_events.
* "**************************************************************************
* "* Toolbar um eigene Funktionen erweitern
* "**************************************************************************
* TRY.
* " Neue Funktion für das ALV vorsehen
* go_functions->add_function(
* name = 'NFUNC'
* icon = '@L1@' " Irgendein ICON aus Tabelle ICON
* text = 'ZHR_LV_COCKPIT_VIEW bearbeiten'
* tooltip = 'Hinzugefügte Funktion'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* CATCH cx_salv_existing INTO go_err_salv_exist.
* " Fehler anzeigen
* gf_string = go_err_salv_exist->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* CATCH cx_salv_wrong_call INTO go_err_wrong_call.
* " Fehler anzeigen
* gf_string = go_err_wrong_call->get_text( ).
* MESSAGE gf_string TYPE 'E'.
* ENDTRY.
"**************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"**************************************************************************
* " Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
* " Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler.
** EXPORTING
** ir_salv = go_alv
** it_cockpit = gt_cockpit.
*
* " ... und bei den Plegeview aufruf registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* Ampel einbauen
"*************************************************************************
* " Ampel einbauen
* " 1. Hole die Zeilen
* go_columns = go_alv->get_columns( ).
* " 2. Hole sag bei welcher Spalte eine Ampelfunktion hinterlegt werden soll.
* go_columns->set_exception_column( value = 'LIGHT' ).
* TRY.
* go_column ?= go_columns->get_column( 'LIGHT' ).
* go_column->set_medium_text( 'STATUS' ).
* go_column->set_long_text( 'STATUS' ).
* go_column->set_short_text( 'STATUS' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
"***************************************************************************
"* Ereignis zum Behandeln des Button-Click registrieren
"***************************************************************************
** Das Objekt für die möglichen ALV-Ereignisse holen
* go_events = go_alv->get_event( ).
** Objekt für die Ereignisbehandlung erzeugen ...
* CREATE OBJECT go_event_handler
* EXPORTING
* cr_salv = go_alv
* it_sflight = gt_sflight.
** ... und bei den ALV-Ereignissen registrieren
* SET HANDLER go_event_handler->handle_toolbar_click FOR go_events.
"**************************************************************************
"* ALV-Anzeige anstoßen
"**************************************************************************
" Liste anzeigen
go_alv->display( ).
"**************************************************************************
"* Toolbar um eigene Funktionen erweitern dafür braucht es ein Container
"**************************************************************************
"Trägerbildschirm" für Container rufen (Sonst findet es keinen Container)
WRITE: space.
ENDFORM. " SHOW_ALV2
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_CSV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM download_csv12 .
****************************************************************
* Daten konvertieren
****************************************************************
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = gt_data_12
CHANGING
i_tab_converted_data = outtab_csv
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim konvertieren ins .CSV-Format!'.
ENDIF.
****************************************************************
* Daten speichern
****************************************************************
DATA: l_filename TYPE string.
l_filename = p_file.
"Header einfügen
CONCATENATE
'personInfo.person-id-external;start-date;end-date;country;'
'genericString6;genericString13;genericString7;genericString2;'
'genericString9;genericString15;genericString14;genericString1;'
'genericString8;genericString12;genericDate1;genericString4;'
'genericString5;genericNumber7;genericString3;genericString11;'
'genericNumber8;genericNumber1;genericString10;genericDate7;'
'genericString16;genericString17;genericString18;genericNumber2;'
'genericNumber3;genericDate2;genericNumber4;genericDate3;'
'genericNumber6;custom-string15;custom-date1;custom-date2;'
'custom-string2;genericNumber5;genericNumber9;genericNumber12;'
'genericDate5;custom-string12'
INTO gs_outtab_csv.
INSERT gs_outtab_csv INTO outtab_csv INDEX 1.
"Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
TABLES
data_tab = outtab_csv
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WRITE: 'Fehler ', sy-subrc, ' beim Speichern der .CSV-Datei!'.
ENDIF.
ENDFORM. " READ_DATA12