OM Auswertung BU Division Department Department
*&---------------------------------------------------------------------*
*& Report ZHR_SF_OM
*&---------------------------------------------------------------------*
* ___ _____ ___ _ _ ____ ____ ____ ### ###
* / __)( _ )/ __)( )/ )( _ \(_ _)(_ _) ###=ooO=========Ooo=###
*( (__ )(_)(( (__ ) ( )___/ _)(_ )( ### \\ (o o) // ###
* \___)(_____)\___)(_)\_)(__) (____) (__) ----------(_)----------
*&---------------------------------------------------------------------*
******************************* MREGOTZ **************************
************************************************************************
*&H PROGRAMMNAME : ZHR_SF_OM
*&H TRANSAKTIONSCODE : ZHR_SF_OM
*&H PROGRAMMTITEL : Sap Successfactors OM DATA
*&H ZWECK : Report gibt BU Division und Departments aus.
*&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 OM BU DIV DEP für SF
*&D --------------------------------------------------------------------
*&D Leistung : Eerleichterter Vergeleich Succesfactors
*&D --------------------------------------------------------------------
*&D Tabellen : zhr_sf_om
*&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_om." 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.
"=======================================================================
" Datendeklaration
"=======================================================================
*-----------------------------------------------------------------------
* Beginn Datendeklarationen fuer den Tabelle ZHR_LV_COCKPIT
*-----------------------------------------------------------------------
* Werte beschaffen
*-----------------------------------------------------------------------
DATA: gt_data TYPE TABLE OF zhr_sf_om.
DATA: gs_data TYPE zhr_sf_om.
DATA: gt_datab TYPE TABLE OF zhr_sf_om.
DATA: gs_datab TYPE zhr_sf_om.
DATA: gt_datad TYPE TABLE OF zhr_sf_om.
DATA: gs_datad TYPE zhr_sf_om.
DATA: gt_data1 TYPE TABLE OF zhr_sf_om.
DATA: gs_data1 TYPE zhr_sf_om.
DATA: gt_data2 TYPE TABLE OF zhr_sf_om.
DATA: gs_data2 TYPE zhr_sf_om.
DATA: gt_data3 TYPE TABLE OF zhr_sf_om.
DATA: gs_data3 TYPE zhr_sf_om.
DATA: gt_data4 TYPE TABLE OF zhr_sf_om.
DATA: gs_data4 TYPE zhr_sf_om.
DATA: gt_data5 TYPE TABLE OF zhr_sf_om.
DATA: gs_data5 TYPE zhr_sf_om.
DATA: gt_data6 TYPE TABLE OF zhr_sf_om.
DATA: gs_data6 TYPE zhr_sf_om.
DATA: gt_data7 TYPE TABLE OF zhr_sf_om.
DATA: gs_data7 TYPE zhr_sf_om.
DATA: gt_data8 TYPE TABLE OF zhr_sf_om.
DATA: gs_data8 TYPE zhr_sf_om.
DATA: gt_data9 TYPE TABLE OF zhr_sf_om.
DATA: gs_data9 TYPE zhr_sf_om.
DATA: gt_data10 TYPE TABLE OF zhr_sf_om.
DATA: gs_data10 TYPE zhr_sf_om.
*DATA: gf_datum TYPE sy-datum.
"FUBA OM
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.
DATA: gs_result_tab TYPE swhactor,
gs_result_objec TYPE objec,
gs_result_struc TYPE struc.
"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: p_objid TYPE pd_objid_r.
PARAMETERS: p_datum TYPE sy-datum.
*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.
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.
p_datum = sy-datum.
p_objid = '50000049'.
p_csv = 'X'.
IF sy-uname = 'REGOTZ M'.
p_file = 'C:\Users\RegotzM\Desktop\BU_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 = p_datum.
*GET peras.
PERFORM read_data.
END-OF-SELECTION.
*=======================================================================
* Ausgabe
*=======================================================================
PERFORM show_alv.
IF p_csv = 'X'.
PERFORM download_csv.
ENDIF.
*=======================================================================
* FORM F4 HELP
*=======================================================================
*&---------------------------------------------------------------------*
*& 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 DATA
*=======================================================================
*&---------------------------------------------------------------------*
*& Form READ_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_data .
"*********************************************************************
"* BU LESEN
"*********************************************************************
CALL FUNCTION 'Z_HR_SF_OM'
EXPORTING
i_datum = p_datum
i_objid = p_objid
i_spalte = '1'
TABLES
et_data = gt_datab
ct_data = gt_datab.
"*********************************************************************
"* DIVISION LESEN
"*********************************************************************
CALL FUNCTION 'Z_HR_SF_OM'
EXPORTING
i_datum = p_datum
i_objid = p_objid
i_spalte = '2'
TABLES
et_data = gt_datab
ct_data = gt_datad.
"*********************************************************************
"* Pepartment 1 LESEN
"*********************************************************************
CALL FUNCTION 'Z_HR_SF_OM'
EXPORTING
i_datum = p_datum
i_objid = p_objid
i_spalte = '3'
TABLES
et_data = gt_datad
ct_data = gt_data1.
"*********************************************************************
"* Pepartment 1 LESEN
"*********************************************************************
CALL FUNCTION 'Z_HR_SF_OM'
EXPORTING
i_datum = p_datum
i_objid = p_objid
i_spalte = '4'
TABLES
et_data = gt_data1
ct_data = gt_data2.
"*********************************************************************
"* Pepartment 1 LESEN
"*********************************************************************
CALL FUNCTION 'Z_HR_SF_OM'
EXPORTING
i_datum = p_datum
i_objid = p_objid
i_spalte = '5'
TABLES
et_data = gt_data2
ct_data = gt_data3.
"*********************************************************************
"* Pepartment 1 LESEN
"*********************************************************************
CALL FUNCTION 'Z_HR_SF_OM'
EXPORTING
i_datum = p_datum
i_objid = p_objid
i_spalte = '6'
TABLES
et_data = gt_data3
ct_data = gt_data4.
"*********************************************************************
"* Pepartment 1 LESEN
"*********************************************************************
CALL FUNCTION 'Z_HR_SF_OM'
EXPORTING
i_datum = p_datum
i_objid = p_objid
i_spalte = '7'
TABLES
et_data = gt_data4
ct_data = gt_data5.
"*********************************************************************
"* Pepartment 1 LESEN
"*********************************************************************
CALL FUNCTION 'Z_HR_SF_OM'
EXPORTING
i_datum = p_datum
i_objid = p_objid
i_spalte = '8'
TABLES
et_data = gt_data5
ct_data = gt_data6.
"*********************************************************************
"* Pepartment 1 LESEN
"*********************************************************************
CALL FUNCTION 'Z_HR_SF_OM'
EXPORTING
i_datum = p_datum
i_objid = p_objid
i_spalte = '9'
TABLES
et_data = gt_data6
ct_data = gt_data7.
"*********************************************************************
"* Pepartment 1 LESEN
"*********************************************************************
CALL FUNCTION 'Z_HR_SF_OM'
EXPORTING
i_datum = p_datum
i_objid = p_objid
i_spalte = '10'
TABLES
et_data = gt_data7
ct_data = gt_data8.
"*********************************************************************
"* Pepartment 1 LESEN
"*********************************************************************
CALL FUNCTION 'Z_HR_SF_OM'
EXPORTING
i_datum = p_datum
i_objid = p_objid
i_spalte = '11'
TABLES
et_data = gt_data8
ct_data = gt_data9.
"*********************************************************************
"* Pepartment 1 LESEN
"*********************************************************************
CALL FUNCTION 'Z_HR_SF_OM'
EXPORTING
i_datum = p_datum
i_objid = p_objid
i_spalte = '12'
TABLES
et_data = gt_data9
ct_data = gt_data10.
"*********************************************************************
"* In Hauptstruktur einfügen
"*********************************************************************
INSERT LINES OF gt_datab INTO TABLE gt_data.
INSERT LINES OF gt_datad INTO TABLE gt_data.
INSERT LINES OF gt_data1 INTO TABLE gt_data.
INSERT LINES OF gt_data2 INTO TABLE gt_data.
INSERT LINES OF gt_data3 INTO TABLE gt_data.
INSERT LINES OF gt_data4 INTO TABLE gt_data.
INSERT LINES OF gt_data5 INTO TABLE gt_data.
INSERT LINES OF gt_data6 INTO TABLE gt_data.
INSERT LINES OF gt_data7 INTO TABLE gt_data.
INSERT LINES OF gt_data8 INTO TABLE gt_data.
INSERT LINES OF gt_data9 INTO TABLE gt_data.
INSERT LINES OF gt_data10 INTO TABLE gt_data.
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 ).
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
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
'OE;OE Text;OE;OE Text;OE;OE Text;OE;OE Text;'
'OE;OE Text;OE;OE Text;OE;OE Text;OE;OE Text;'
'OE;OE Text;OE;OE Text;OE;OE Text;OE;OE Text;'
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_csv
"Tests
* "*********************************************************************
* "* DIVISION LESEN
* "*********************************************************************
* LOOP AT gt_datab INTO gs_datab.
* CALL FUNCTION 'RH_STRUC_GET'
* EXPORTING
* act_otype = 'O'
* act_objid = gs_datab-bu
* act_wegid = 'O-O_DOWN'"'OR-O-O' "'O-O_DOWN'
* act_plvar = '01'
* act_begda = p_datum
* act_endda = p_datum
* 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.
* ELSE.
* SORT gt_result_struc BY level ASCENDING.
* LOOP AT gt_result_struc INTO gs_result_struc.
* IF gs_result_struc-level = '2'.
* MOVE-CORRESPONDING gs_datab TO gs_datad.
* gs_datad-divis = gs_result_struc-objid.
* READ TABLE gt_result_objec INTO gs_result_objec WITH KEY objid = gs_datad-divis.
* gs_datad-ditxt = gs_result_objec-stext.
* APPEND gs_datad TO gt_datad.
* CLEAR: gs_datad, gs_result_struc, gs_result_objec.
* ENDIF.
* ENDLOOP.
* ENDIF.
* ENDLOOP.
* CLEAR: gt_result_struc, gt_result_objec.
* "*********************************************************************
* "* BU LESEN
* "*********************************************************************
* "Orgstruktur lesen
* CALL FUNCTION 'RH_STRUC_GET'
* EXPORTING
* act_otype = 'O'
* act_objid = p_objid
* act_wegid = 'O-O_DOWN'"'OR-O-O' "'O-O_DOWN'
* act_plvar = '01'
* act_begda = p_datum
* act_endda = p_datum
* 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.
* ELSE.
* SORT gt_result_struc BY level ASCENDING.
* LOOP AT gt_result_struc INTO gs_result_struc.
* IF gs_result_struc-level = '2'.
* gs_datab-bu = gs_result_struc-objid.
* READ TABLE gt_result_objec INTO gs_result_objec WITH KEY objid = gs_datab-bu.
* gs_datab-butxt = gs_result_objec-stext.
* APPEND gs_datab TO gt_datab.
* CLEAR: gs_datab, gs_result_struc, gs_result_objec.
* ENDIF.
* ENDLOOP.
* ENDIF.
* CLEAR: gt_result_struc, gt_result_objec.
"*********************************************************************
"* Vorlage für FUBA
"*********************************************************************
* LOOP AT gt_datad INTO gs_datad. "!!!!
* CALL FUNCTION 'RH_STRUC_GET'
* EXPORTING
* act_otype = 'O'
* act_objid = gs_datad-divis "!!!!
* act_wegid = 'O-O_DOWN'"'OR-O-O' "'O-O_DOWN'
* act_plvar = '01'
* act_begda = p_datum
* act_endda = p_datum
* 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.
* ELSE.
* SORT gt_result_struc BY level ASCENDING.
* LOOP AT gt_result_struc INTO gs_result_struc.
* IF gs_result_struc-level = '2'.
* MOVE-CORRESPONDING gs_datad TO gs_data1. "!!!.
* gs_data1-dep1 = gs_result_struc-objid. "!!!
* READ TABLE gt_result_objec INTO gs_result_objec WITH KEY objid = gs_data1-dep1."!!!.
* gs_data1-DTXT1 = gs_result_objec-stext. "!!!
* APPEND gs_data1 TO gt_data1. "!!
* CLEAR: gs_data1, gs_result_struc, gs_result_objec."!!
* ENDIF.
* ENDLOOP.
* ENDIF.
* ENDLOOP.
* CLEAR: gt_result_struc, gt_result_objec.