[ABAP] Ermittlung der Anmeldedaten incl. des Rechnernamens

* Ermittlung der Anmeldedaten incl. des Rechnernamens
TRY.
    DATA(lv_server_info) = NEW cl_server_info( ).

* Server related information, Liste aller Sessions
*  SERVER_NAME Name des Applikations-Servers
*  LOGON_HDL Anmeldungs-Schlüssel
*  LOGON_ID Anmeldungs-ID
*  SESSION_HDL Backend-Session-Handle
*  USER_NAME Benutzer-ID
*  LOGON_TYPE Typ der Anmeldung
*  LOGON_SUB_TYPE Zusatzinformation zum Anmeldungs-Typ
*  TENANT Name des Mandanten
*  REQUEST_TIME Zeit-Stempel (Anzahl Sekunden seit dem 1.1.1979)
*  MEMORY In Extended Memory (EM) belegter Speicher
*  LOCATION_INFO Informationen über den Client-Rechner des Benutzers
*  APPLICATION Anwendung
*  APPLICATION_INFO Zusatzinformationen zur Anwendung
*  RFC_HDL Conversation-ID
*  RFC_TYPE RFC Typ
*  TRACE Trace-Level
*  PRIORITY Priorität
*  MEMORY_BRUTTO In Extended Segments (ES) belegter Speicher
*  MEMORY_ABAP Von der ABAP-VM belegter Speicher
*  MEMORY_HYPER Größe des Session übergreifenden Speichers
*  MEMORY_HEAP In Prozess lokalem Heap belegter Speicher
*  OPEN_TASKS Offene Aufgaben (open Tasks) dieser Session
*  ACT_PROGRAM Name des Hauptprogrammes
*  WEBSOCKET_HANDLE WebSocket-Handle

    DATA(it_session_list) = lv_server_info->get_session_list( tenant = sy-mandt ).

    cl_demo_output=>write_data( it_session_list ).
* HTML-Code vom Demo-Output holen
    DATA(lv_html) = cl_demo_output=>get( ).

* Daten im Inline-Browser im SAP-Fenster anzeigen
    cl_abap_browser=>show_html( EXPORTING title       = 'CL_SERVER_INFO'
                                          html_string = lv_html
                                          container   = cl_gui_container=>default_screen ).

* cl_gui_container=>default_screen erzwingen
    WRITE: space.

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

[ABAP] Serverinfo holen

TRY.
    DATA(o_server_info) = NEW cl_server_info( ).

    DATA(lv_startup_time) = o_server_info->get_startup_time( ).

    WRITE: / '       startup time:', lv_startup_time.

    WRITE: / '             worker:'.
    LOOP AT o_server_info->get_worker_list( ) ASSIGNING FIELD-SYMBOL(<w>).
      WRITE: / '                  ',  <w>-logon_id, <w>-logon_type, <w>-logon_hdl, <w>-application, <w>-user_name, <w>-main_program, <w>-wp_program.
    ENDLOOP.

    DATA(lv_release_info) = o_server_info->get_release_info( ).

    WRITE: / '        server name:', lv_release_info->server_name.
    WRITE: / '            release:', lv_release_info->release.
    WRITE: / '       compile date:', lv_release_info->compile_date.
    WRITE: / '       compile time:', lv_release_info->compile_time.
    WRITE: / '         patchlevel:', lv_release_info->patchlevel.
    WRITE: / '        patchnumber:', lv_release_info->patchnumber.
    WRITE: / '           sourceid:', lv_release_info->sourceid.
    WRITE: / 'compatibility_level:', lv_release_info->compatibility_level.
    WRITE: / '       make_variant:', lv_release_info->make_variant.
    WRITE: / '              dblib:', lv_release_info->dblib.
    WRITE: / '       supportlevel:', lv_release_info->supportlevel.

    WRITE: / '       supported OS:'.
    LOOP AT lv_release_info->supported_os ASSIGNING FIELD-SYMBOL(<os>).
      WRITE: / '                    ', <os>.
    ENDLOOP.

    WRITE: / '     supported ABAP:'.
    LOOP AT lv_release_info->supported_abap ASSIGNING FIELD-SYMBOL(<a>).
      WRITE: / '                    ', <a>.
    ENDLOOP.

    WRITE: / '       supported DB:'.
    LOOP AT lv_release_info->supported_db ASSIGNING FIELD-SYMBOL(<db>).
      WRITE: / '                    ', <db>.
    ENDLOOP.

    WRITE: / '      patch comment:'.
    LOOP AT lv_release_info->patchcomment ASSIGNING FIELD-SYMBOL(<p>).
      WRITE: / '                    ', <p>.
    ENDLOOP.
  CATCH cx_root INTO DATA(e_txt).
    WRITE: / e_txt->get_text( ).
ENDTRY.