[ABAP] Excel-Ole Komplexbeispiel

DATA: o_excel TYPE ole2_object.
DATA: o_workbook TYPE ole2_object.
DATA: o_sheet TYPE ole2_object.
DATA: o_cell TYPE ole2_object.
DATA: o_range TYPE ole2_object.
DATA: o_font TYPE ole2_object.
DATA: o_border TYPE ole2_object.
DATA: o_column TYPE ole2_object.
DATA: o_interior TYPE ole2_object.
DATA: o_page TYPE ole2_object.

DATA: cell_value TYPE string.

PARAMETERS: p_fname TYPE file_table-filename OBLIGATORY DEFAULT 'c:\temp\Test.xlsx'.

* wenn die F4-Hilfe für den Dateinamen aufgerufen wird
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
  DATA: lv_action TYPE i.
  DATA: lv_filename TYPE string.
  DATA: lv_fullpath TYPE string.
  DATA: lv_path TYPE string.

* FileOpen-Dialog aufrufen
  TRY.
      cl_gui_frontend_services=>file_save_dialog( EXPORTING
                                                    default_extension   = 'xlsx'
                                                    default_file_name   = |{ p_fname }|
                                                    file_filter         = |MS Excel (*.xlsx)\|*.xlsx\|{ cl_gui_frontend_services=>filetype_all }|
                                                    prompt_on_overwrite = abap_true
                                                  CHANGING
                                                    filename          = lv_filename     " Dateiname
                                                    path              = lv_path         " Pfad
                                                    fullpath          = lv_fullpath     " Pfad + Dateiname
                                                    user_action       = lv_action ).    " Benutzeraktion

      IF lv_action EQ cl_gui_frontend_services=>action_ok.
        p_fname = lv_fullpath.
      ENDIF.

    CATCH cx_root INTO DATA(e_text).          " Oberklasse für Exceptions abfangen und Kurztext übergeben
      MESSAGE e_text->get_text( ) TYPE 'I'.   " Exception Kurztext ausgeben
  ENDTRY.

START-OF-SELECTION.
  TRY.
* Excel starten
      CREATE OBJECT o_excel 'Excel.Application'.

      IF sy-subrc NE 0.
        WRITE : / 'Fehler.'.
      ELSE.
* Excel sichtbar
        SET PROPERTY OF o_excel 'Visible' = 1.

* Anzahl Sheets setzen
        SET PROPERTY OF o_excel 'SheetsInNewWorkbook' = 1.

* Workbook holen
        CALL METHOD OF o_excel 'WorkBooks' = o_workbook.

* neues Workbook mit einer Sheet hinzufügen
        CALL METHOD OF o_workbook 'Add'.

* 1. Sheet holen
        CALL METHOD OF o_excel 'Worksheets' = o_sheet
          EXPORTING #1 = 1.

* Sheet activieren
        CALL METHOD OF o_sheet 'Activate'.

* Sheet benennen
        SET PROPERTY OF o_sheet 'Name' = 'Tabelle mit Testwerten'.

* Zelle 1,1 ermitteln
        CALL METHOD OF o_excel 'Cells' = o_cell
           EXPORTING
             #1 = 1   " Zeile
             #2 = 1.  " Spalte

* Wert schreiben
        SET PROPERTY OF o_cell 'Value' = 'Text 1_1'.

* Zellen-Objekt wieder freigeben
        FREE OBJECT o_cell.

* Zelle 1,2 ermitteln
        CALL METHOD OF o_excel 'Cells' = o_cell
           EXPORTING
             #1 = 1   " Zeile
             #2 = 2.  " Spalte

* Wert schreiben
        SET PROPERTY OF o_cell 'Value' = 'Text 1_2'.

* Zellen-Objekt wieder freigeben
        FREE OBJECT o_cell.

* Zelle 2,1 ermitteln
        CALL METHOD OF o_excel 'Cells' = o_cell
           EXPORTING
             #1 = 2   " Zeile
             #2 = 1.  " Spalte

* Wert schreiben
        SET PROPERTY OF o_cell 'Value' = 'Text 2_1'.

* Zellen-Objekt wieder freigeben
        FREE OBJECT o_cell.

* Zelle 2,2 ermitteln
        CALL METHOD OF o_excel 'Cells' = o_cell
           EXPORTING
             #1 = 2   " Zeile
             #2 = 2.  " Spalte

* Wert schreiben
        SET PROPERTY OF o_cell 'Value' = 'Text 2_2'.

* Zellen-Objekt wieder freigeben
        FREE OBJECT o_cell.

* Range (Bereich) [A2:B2] definieren
        CALL METHOD OF o_excel 'Range' = o_range
          EXPORTING
            #1 = 'A2'
            #2 = 'B2'.

* Range Schrift setzen
        GET PROPERTY OF o_range 'Font' = o_font.
        SET PROPERTY OF o_font 'Bold' = 1.
        SET PROPERTY OF o_font 'ColorIndex' = 4.
        SET PROPERTY OF o_font 'Size' = 12.

* Font-Objekt wieder freigeben
        FREE OBJECT o_font.

* Rahmen für Range setzen
        CALL METHOD OF o_range 'Select' .
        CALL METHOD OF o_range 'BorderAround'
          EXPORTING
            #1 = 1  " Stil
            #2 = 2. " Dicke (1..4)

* Zellhintergrund für Range setzen
        CALL METHOD OF o_range 'Interior' = o_interior.
        SET PROPERTY OF o_interior 'ColorIndex' = 6. " gelb
        SET PROPERTY OF o_interior 'Pattern' = 1.

* Hintergrund-Objekt wieder freigeben
        FREE OBJECT o_interior.

* Range-Objekt wieder freigeben
        FREE OBJECT o_range.

* Zelle ermitteln
        CALL METHOD OF o_excel 'Cells' = o_cell
           EXPORTING
             #1 = 1   " Zeile
             #2 = 2.  " Spalte

* Zellwert holen
        GET PROPERTY OF o_cell 'Value' = cell_value.

* Zell-Objekt wieder freigeben
        FREE OBJECT o_cell.

* Zellwert ausgeben
        WRITE: / cell_value.

* Zelle ermitteln
        CALL METHOD OF o_excel 'Cells' = o_cell
           EXPORTING
             #1 = 2   " Zeile
             #2 = 2.  " Spalte

* Font der Zelle holen und Darstellung ändern
        GET PROPERTY OF o_cell 'Font' = o_font.
        SET PROPERTY OF o_font 'Name' = 'Courier New'. " Schriftart
        SET PROPERTY OF o_font 'Bold' = 0.             " Schriftstil: 0 - normal, 1 - fett
        SET PROPERTY OF o_font 'Italic' = 1.           " Schriftstil: 0 - normal, 1 - Italic
        SET PROPERTY OF o_font 'ColorIndex' = 5.       " Farbindex: 1=Schwarz, 2=weiss, 3=rot, 4=grün, 5=blau, 6=gelb
        SET PROPERTY OF o_font 'Size' = 16.            " Schriftgröße [px]
        SET PROPERTY OF o_font 'Underline' = 2.        " xlUnderlineStyleSingle

* Font-Objekt wieder freigeben
        FREE OBJECT o_font.
* Zell-Objekt wieder freigeben
        FREE OBJECT o_cell.

* Spaltenbreite automatisch anpassen
        CALL METHOD OF o_excel 'Columns' = o_column.
        CALL METHOD OF o_column 'Autofit'.

* Spalten-Objekt wieder freigeben
        FREE OBJECT o_column.

* Spalte 1 holen
        CALL METHOD OF o_excel 'Columns' = o_column
          EXPORTING
            #1 = 1. " erste Spalte

* Spaltenformat festlegen
        SET PROPERTY OF o_column 'NumberFormat' = '@'. " Format: "Text"

* Spalten-Objekt wieder freigeben
        FREE OBJECT o_column.

*        " Inhalt der Zwischenablage in die akt. Sheet Zelle 'A1' kopieren
*        CALL METHOD OF o_excel 'Cells' = o_cell
*          EXPORTING
*            #1 = 1  " Zeile
*            #2 = 1. " Spalte
*        CALL METHOD OF o_cell 'SELECT'.
*        CALL METHOD OF o_sheet 'Paste'.
*        " Objekt wieder freigeben
*        FREE OBJECT o_cell.

* Seitenausrichtung -> Querformat
        GET PROPERTY OF o_sheet 'PageSetup' = o_page.
        SET PROPERTY OF o_page 'Orientation' = 2.     " xlLandscape
        SET PROPERTY OF o_page 'PrintGridlines' = 1.  " Gitterlinien drucken
        SET PROPERTY OF o_page 'LeftMargin' = '5.00'. " Seitenränder
        SET PROPERTY OF o_page 'RightMargin' = '2.00'.
        SET PROPERTY OF o_page 'TopMargin' = '2.00'.
        SET PROPERTY OF o_page 'BottomMargin'= '2.00'.

* Seiten-Objekt wieder freigeben
        FREE OBJECT o_page.

* Drucken
*        CALL METHOD OF o_workbook 'PrintOut' .

* MessageDialog für Überschreiben einer bestehenden Datei unterdrücken
        SET PROPERTY OF o_excel 'DisplayAlerts' = 0.

* Datei speichern unter ...
        CALL METHOD OF o_sheet 'SaveAs'
          EXPORTING
            #1 = p_fname.
*            #2 = 1. " Fileformat

* Alle Messages in Excel wieder zulassen
        SET PROPERTY OF o_excel 'DisplayAlerts' = -1.

* Workbook schließen
        CALL METHOD OF o_workbook 'Close'.

* Excel schließen
        CALL METHOD OF o_excel 'Quit'.

* Objekte freigeben
        FREE OBJECT: o_sheet,
                     o_workbook,
                     o_excel.
      ENDIF.
    CATCH cx_root INTO DATA(e_text).          " Oberklasse für Exceptions abfangen und Kurztext übergeben
      MESSAGE e_text->get_text( ) TYPE 'I'.   " Exception Kurztext ausgeben
  ENDTRY.

[ABAP] Dynamische WHERE-Clause für AMDP aus SELECT-OPTIONS generieren

* https://blogs.sap.com/2015/03/30/handling-of-select-options-parameters-within-amdp/
DATA: lv_matnr TYPE mara-matnr.
DATA: lv_mtart TYPE mara-mtart.

SELECT-OPTIONS: so_matnr FOR lv_matnr.
SELECT-OPTIONS: so_mtart FOR lv_mtart.

START-OF-SELECTION.

* SELECT-OPTIONS in deine dynamische WHERE-Clause überführen
  DATA(lv_where_string) = cl_shdb_seltab=>combine_seltabs( it_named_seltabs = VALUE #( ( name = 'MATNR' dref = REF #( so_matnr[] ) )
                                                                                       ( name = 'MTART' dref = REF #( so_mtart[] ) )
                                                                                     )
                                                         ).

  WRITE: / lv_where_string.

[ABAP] Infos zu einem DB-View lesen

PARAMETERS: p_view TYPE ddobjname DEFAULT 'LIKPUK'.

* Views mit Texten
DATA: lv_dd25v TYPE dd25v.
* DD: Technische Einstellungen von Tabellen
DATA: lv_dd09l TYPE dd09l.

* View auf Basistabellen eines Views aus Tabelle DD26S
DATA: it_dd26v_tab TYPE STANDARD TABLE OF dd26v.
* View auf Felder eines SAP-Tabellenviews aus Tabelle DD27S
DATA: it_dd27p_tab TYPE STANDARD TABLE OF dd27p.
* Interne Struktur für Joins von Views
DATA: it_dd28j_tab TYPE STANDARD TABLE OF dd28j.
* View auf Selektionsbedingung
DATA: it_dd28v_tab TYPE STANDARD TABLE OF dd28v.

CALL FUNCTION 'DDIF_VIEW_GET'
  EXPORTING
    name          = p_view
  IMPORTING
    dd25v_wa      = lv_dd25v
    dd09l_wa      = lv_dd09l
  TABLES
    dd26v_tab     = it_dd26v_tab
    dd27p_tab     = it_dd27p_tab
    dd28j_tab     = it_dd28j_tab
    dd28v_tab     = it_dd28v_tab
  EXCEPTIONS
    illegal_input = 1
    OTHERS        = 2.

IF sy-subrc = 0.
  cl_demo_output=>write_data( lv_dd25v ).
  cl_demo_output=>write_data( lv_dd09l ).
  cl_demo_output=>write_data( it_dd26v_tab ).
  cl_demo_output=>write_data( it_dd27p_tab ).
  cl_demo_output=>write_data( it_dd28j_tab ).
  cl_demo_output=>write_data( it_dd28v_tab ).
  cl_demo_output=>display( ).
ENDIF.

[ABAP] Verfügbare DB-Views zu Tabellen suchen

TYPES : BEGIN OF ty_s_views,
          viewname  TYPE dd26s-viewname,
          ddtext    TYPE dd25t-ddtext,
          roottab   TYPE dd25l-roottab,
          viewclass TYPE dd02l-viewclass,
          viewgrant TYPE dd02l-viewgrant,
        END OF ty_s_views.

TYPES: ty_it_views TYPE STANDARD TABLE OF ty_s_views WITH DEFAULT KEY.

DATA: it_views TYPE ty_it_views.

CLASS lcl_events DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS: on_double_click FOR EVENT double_click OF cl_salv_events_table
      IMPORTING
          row
          column
          sender.
ENDCLASS.

CLASS lcl_events IMPLEMENTATION.
  METHOD on_double_click.
    DATA(lv_row) = it_views[ row ].
    ASSIGN COMPONENT column OF STRUCTURE lv_row TO FIELD-SYMBOL(<cell>).

* views mit texten
    DATA: lv_dd25v TYPE dd25v.
* DD: Technische Einstellungen von Tabellen
    DATA: lv_dd09l TYPE dd09l.

* View auf Basistabellen eines Views aus Tabelle DD26S
    DATA: it_dd26v_tab TYPE STANDARD TABLE OF dd26v.
* View auf Felder eines SAP-Tabellenviews aus Tabelle DD27S
    DATA: it_dd27p_tab TYPE STANDARD TABLE OF dd27p.
* Interne Struktur für Joins von Views
    DATA: it_dd28j_tab TYPE STANDARD TABLE OF dd28j.
* View auf Selektionsbedingung
    DATA: it_dd28v_tab TYPE STANDARD TABLE OF dd28v.

    CALL FUNCTION 'DDIF_VIEW_GET'
      EXPORTING
        name          = <cell>
      IMPORTING
        dd25v_wa      = lv_dd25v
        dd09l_wa      = lv_dd09l
      TABLES
        dd26v_tab     = it_dd26v_tab
        dd27p_tab     = it_dd27p_tab
        dd28j_tab     = it_dd28j_tab
        dd28v_tab     = it_dd28v_tab
      EXCEPTIONS
        illegal_input = 1
        OTHERS        = 2.

    IF sy-subrc = 0.
      cl_demo_output=>write_data( lv_dd25v ).
      cl_demo_output=>write_data( lv_dd09l ).
      cl_demo_output=>write_data( it_dd26v_tab ).
      cl_demo_output=>write_data( it_dd27p_tab ).
      cl_demo_output=>write_data( it_dd28j_tab ).
      cl_demo_output=>write_data( it_dd28v_tab ).
      cl_demo_output=>display( ).
    ENDIF.
  ENDMETHOD.
ENDCLASS.

DATA: lv_tab TYPE dd26s-fortabname.

SELECT-OPTIONS: so_tabs FOR lv_tab.

INITIALIZATION.

  so_tabs[] = VALUE #(
                       ( sign = 'I' option = 'EQ' low = 'MARA' high = '' )
                       ( sign = 'I' option = 'EQ' low = 'MARC' high = '' )
                     ).

START-OF-SELECTION.

  DATA(lv_lang) = cl_abap_syst=>get_logon_language( ).

  SELECT s~viewname,
         t~ddtext,
         r~roottab,
         l~viewclass,
         l~viewgrant
    INTO TABLE @it_views
    FROM dd26s AS s
    INNER JOIN dd02l AS l ON l~tabname = s~viewname
    INNER JOIN dd25l AS r ON r~viewname = l~tabname
    INNER JOIN dd25t AS t ON t~viewname = l~tabname
    WHERE s~fortabname IN @so_tabs
      AND l~as4local   = 'A'
      AND l~tabclass   = 'VIEW'
      AND t~ddlanguage = @lv_lang.

  IF sy-subrc = 0.

    SORT: it_views BY viewname.

    TRY.
        DATA: o_salv TYPE REF TO cl_salv_table.

        cl_salv_table=>factory( IMPORTING
                                  r_salv_table   = o_salv
                                CHANGING
                                  t_table        = it_views ).

        LOOP AT o_salv->get_columns( )->get( ) ASSIGNING FIELD-SYMBOL(<c>).
          DATA(o_col) = <c>-r_column.
          o_col->set_short_text( '' ).
          o_col->set_medium_text( '' ).
          o_col->set_long_text( |{ o_col->get_columnname( ) } [{ o_col->get_long_text( ) }]| ).
        ENDLOOP.

        o_salv->get_functions( )->set_all( abap_true ).
        o_salv->get_columns( )->set_optimize( abap_true ).
        o_salv->get_display_settings( )->set_list_header( |Views: { lines( it_views ) }| ).
        o_salv->get_display_settings( )->set_striped_pattern( abap_true ).
        o_salv->get_selections( )->set_selection_mode( if_salv_c_selection_mode=>row_column ).

        SET HANDLER lcl_events=>on_double_click FOR o_salv->get_event( ).

        o_salv->display( ).
      CATCH cx_root INTO DATA(e_txt).
        WRITE: / e_txt->get_text( ).
    ENDTRY.
  ENDIF.

[SAP] Archivobjekt anhand seiner ARC_DOC_ID lesen

* Archiv-ID aus Tabelle TOAAR
PARAMETERS: p_arc TYPE toaar-archiv_id.
* ARC_DOC_ID: Beispiel siehe Tabelle TOA01, TOA02, TOA03
PARAMETERS: p_docid TYPE saeardoid DEFAULT '41C0CC07B977349DE10000000A450668'.

START-OF-SELECTION.

  DATA: lv_toa0x TYPE toa01.

* Pr?fen, ob das Archivobjekt in der Tabelle TOA01, TOA02 oder TOA03 abgelegt ist
* Tabelle TOA01
  SELECT SINGLE *
    INTO @lv_toa0x
    FROM toa01
    WHERE arc_doc_id = @p_docid
      AND archiv_id  = @p_arc.

  IF sy-subrc <> 0.
* Tabelle TOA02
    SELECT SINGLE *
      INTO @lv_toa0x
      FROM toa02
      WHERE arc_doc_id = @p_docid
        AND archiv_id  = @p_arc.
  ENDIF.

  IF sy-subrc <> 0.
* Tabelle TOA03
    SELECT SINGLE *
      INTO @lv_toa0x
      FROM toa03
      WHERE arc_doc_id = @p_docid
        AND archiv_id  = @p_arc.
  ENDIF.

  IF sy-subrc = 0.

    WRITE: / lv_toa0x-sap_object.
    WRITE: / lv_toa0x-object_id.
    WRITE: / lv_toa0x-archiv_id.
    WRITE: / lv_toa0x-arc_doc_id.
    WRITE: / lv_toa0x-ar_object.
    WRITE: / lv_toa0x-ar_date.
    WRITE: / lv_toa0x-del_date.
    WRITE: / lv_toa0x-reserve.

    ULINE.

    DATA: lv_url TYPE swk_url.

* CMS:AO API Url für Dokumentzugriff
    CALL FUNCTION 'SCMS_AO_URL_READ'
      EXPORTING
        arc_id = p_arc
        doc_id = p_docid
      IMPORTING
        url    = lv_url
      EXCEPTIONS
        error  = 1
        OTHERS = 2.

    IF sy-subrc = 0.
* URL anzeigen, kann auch im cl_gui_html_viewer direkt angezeigt werden
      WRITE: / lv_url.
*      DATA(o_html) = new cl_gui_html_viewer( parent = cl_gui_container=>default_screen ).
*      o_html->show_url( lv_url ).
      ULINE.
    ELSE.
      WRITE: / 'URL-Error:', sy-subrc.
    ENDIF.

    DATA(lv_length) = 0.
    DATA: it_bin_data TYPE STANDARD TABLE OF tbl1024 WITH DEFAULT KEY.

    DATA: lv_status TYPE char64.
    DATA: lv_doc_type TYPE char64.
    DATA: lv_arch_date TYPE d.
    DATA: lv_arch_time TYPE t.
    DATA: lv_mimetype TYPE char64.
    DATA: it_scms_comps TYPE STANDARD TABLE OF scms_comps WITH DEFAULT KEY.
    DATA: it_scms_compsl TYPE STANDARD TABLE OF scms_compsl WITH DEFAULT KEY.

* Status des AO lesen
* CMS: AO API Statusabfrage
    CALL FUNCTION 'SCMS_AO_STATUS'
      EXPORTING
        arc_id       = p_arc
        doc_id       = p_docid
      IMPORTING
        status       = lv_status
        doc_type     = lv_doc_type
        arch_date    = lv_arch_date
        arch_time    = lv_arch_time
        mimetype     = lv_mimetype
      TABLES
        comps        = it_scms_comps
        compsl       = it_scms_compsl
      EXCEPTIONS
        error_http   = 1
        error_kernel = 2
        error_archiv = 3
        error_config = 4
        OTHERS       = 5.
    IF sy-subrc = 0.
      LOOP AT it_scms_comps ASSIGNING FIELD-SYMBOL(<c>).
        WRITE: / <c>-compid, <c>-mimetype, <c>-compsize, <c>-compdatec, <c>-comptimec, <c>-compdatem, <c>-comptimem, <c>-status.
      ENDLOOP.
    ELSE.
      WRITE: / 'Status-Error:', sy-subrc.
    ENDIF.

    ULINE.

* Bin?rdaten des AO lesen
* CMS: AO API Dokument bereitstellen Tabelle
    CALL FUNCTION 'SCMS_AO_TABLE_GET'
      EXPORTING
        arc_id       = p_arc
        doc_id       = p_docid
      IMPORTING
        length       = lv_length
      TABLES
        data         = it_bin_data
      EXCEPTIONS
        error_http   = 1
        error_archiv = 2
        error_kernel = 3
        error_config = 4
        OTHERS       = 5.

    IF sy-subrc = 0.
      DATA: lv_xstring TYPE xstring.

* Bin?rdaten in xstring konvertieren
      CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
        EXPORTING
          input_length = CONV i( lv_length )
        IMPORTING
          buffer       = lv_xstring
        TABLES
          binary_tab   = it_bin_data
        EXCEPTIONS
          failed       = 1
          OTHERS       = 2.

      IF sy-subrc = 0.
        ...
      ENDIF.
    ELSE.
      WRITE: / 'Error getting AO-data:', sy-subrc.
    ENDIF.
  ELSE.
    WRITE: / 'ARC_DOC_ID not found:', sy-subrc.
  ENDIF.

[ABAP] Infos zum Archiv lesen

*           Paket: SAOP
*                  SCMS
* Funktionsgruppe: SCMS_AO_API
* Tabellen: TOAAR: Kommunikationskonfigurationstabelle Ablagesysteme
*           TOADV: SAP ArchiveLink: Globale Dokumentarten SAP ArchiveLink
*           TOAOM: SAP ArchiveLink: Metatabelle für Verknüpfungen
*           TOADD: SAP ArchiveLink Prüftabelle DOK_Typ
*           TOJTB: Business Object Repository Grunddaten
*           TOA01: Verknüpfungstabelle 1
*           TOA02: Verknüpfungstabelle 2
*           TOA03: Verknüpfungstabelle 3
*           TOAAT: Table to store the File attributes
*           TOACO: Prüftabelle für die Verknüpfungstabellen

* Archiv-ID aus Tabelle TOAAR
PARAMETERS: p_arc TYPE toaar-archiv_id.

START-OF-SELECTION.

  DATA: lv_version TYPE char64.
  DATA: lv_protocol TYPE char64.
  DATA: lv_basicpath TYPE char255.
  DATA: lv_archivpath  TYPE char255.
  DATA: lv_spoolpath TYPE char255.
  DATA: lv_phys_basicpath TYPE char255.
  DATA: lv_phys_archivpath TYPE char255.
  DATA: lv_client_dependend TYPE sy-datar.
  DATA: lv_rep_type TYPE scms_crtyp.

* CMS: AO API Archivinformation
  CALL FUNCTION 'SCMS_ARCHIVE_INFO_GET'
    EXPORTING
      arc_id           = p_arc
    IMPORTING
      version          = lv_version
      protocol         = lv_protocol
      basicpath        = lv_basicpath
      archivpath       = lv_archivpath
      spoolpath        = lv_spoolpath
      phys_basicpath   = lv_phys_basicpath
      phys_archivpath  = lv_phys_archivpath
      client_dependend = lv_client_dependend
      rep_type         = lv_rep_type
    EXCEPTIONS
      error_config     = 1
      OTHERS           = 2.

  IF sy-subrc = 0.
    WRITE: / |Version: { lv_version }|.
    WRITE: / |Protokoll { lv_protocol }|.
    WRITE: / |BasicPath: { lv_basicpath }|.
    WRITE: / |ArchivPath: { lv_archivpath }|.
    WRITE: / |SpoolPath: { lv_spoolpath }|.
    WRITE: / |PhysBasicPath: { lv_phys_basicpath }|.
    WRITE: / |PhysArchivPath: { lv_phys_archivpath }|.
    WRITE: / |ClientDependend: { lv_client_dependend }|.
    WRITE: / |RepType: { lv_rep_type }|.
  ENDIF.

[ABAP] REDUCE: Fibonacci-Zahlen berechnen

* Stringtabelle erstellen
DATA(it_fib) = REDUCE stringtab(
* Initialwerte
                                 INIT ret = VALUE stringtab( ( |0| ) ( |1| ) )
                                      x TYPE string
                                      y TYPE string
* 100 Durchläufe
                                 FOR n = 1 WHILE n < 101
* letztes und vorletztes Element der Liste ermitteln
                                 NEXT x   = ret[ lines( ret ) ]
                                      y   = ret[ lines( ret ) - 1 ]
* addieren und an bestehende Liste anfügen
                                      ret = VALUE #( BASE ret
                                                     ( x + y )
                                                   )
                               ).

* Ausgabe
cl_demo_output=>display( it_fib ).