[ABAP] Akt. Server-Liste / Workprozesse holen

DATA: it_server_list_v4 TYPE STANDARD TABLE OF msxxlist WITH DEFAULT KEY.
DATA: it_server_list_v6 TYPE STANDARD TABLE OF msxxlist_v6 WITH DEFAULT KEY.
DATA: it_wpinfo TYPE STANDARD TABLE OF wpinfo WITH DEFAULT KEY.

* Server-Liste besorgen
CALL FUNCTION 'TH_SERVER_LIST'
  TABLES
    list           = it_server_list_v4
    list_ipv6      = it_server_list_v6
  EXCEPTIONS
    no_server_list = 1
    OTHERS         = 2.

IF sy-subrc = 0.
  LOOP AT it_server_list_v6 ASSIGNING FIELD-SYMBOL(<fs_srv>).
    WRITE: / <fs_srv>-name,
             <fs_srv>-host,
             <fs_srv>-serv,
             <fs_srv>-msgtypes,
             <fs_srv>-hostadr,
             <fs_srv>-servno,
             <fs_srv>-state,
             <fs_srv>-hostnamelong,
             <fs_srv>-hostaddr_v4_str,
             <fs_srv>-hostaddr_v6_str,
             <fs_srv>-sysservice0,
             <fs_srv>-sysservice1,
             <fs_srv>-sysservice2,
             <fs_srv>-sysservice3.

* Liste der Work-Prozesse ermitteln
    CALL FUNCTION 'TH_WPINFO'
      EXPORTING
        srvname       = <fs_srv>-name
        with_cpu      = '1'
        with_mtx_info = '1'
      TABLES
        wplist        = it_wpinfo
      EXCEPTIONS
        send_error    = 1
        OTHERS        = 2.

    IF sy-subrc = 0.
      LOOP AT it_wpinfo ASSIGNING FIELD-SYMBOL(<fs_wp>).
        WRITE: / <fs_wp>-wp_index,
                 <fs_wp>-wp_itype,
                 <fs_wp>-wp_typ,
                 <fs_wp>-wp_pid,
                 <fs_wp>-wp_istatus,
                 <fs_wp>-wp_status,
                 <fs_wp>-wp_iwait,
                 <fs_wp>-wp_waiting,
                 <fs_wp>-wp_sem,
                 <fs_wp>-wp_irestrt,
                 <fs_wp>-wp_restart,
                 <fs_wp>-wp_dumps,
                 <fs_wp>-wp_cpu,
                 <fs_wp>-wp_eltime,
                 <fs_wp>-wp_mandt,
                 <fs_wp>-wp_bname,
                 <fs_wp>-wp_report,
                 <fs_wp>-wp_iaction,
                 <fs_wp>-wp_action,
                 <fs_wp>-wp_table,
                 <fs_wp>-wp_server,
                 <fs_wp>-wp_waitinf,
                 <fs_wp>-wp_waittim,
                 <fs_wp>-wp_semstat,
                 <fs_wp>-wp_sem1,
                 <fs_wp>-wp_sem2,
                 <fs_wp>-wp_sem3,
                 <fs_wp>-wp_sem4,
                 <fs_wp>-wp_sem5,
                 <fs_wp>-wp_sem_locking,
                 <fs_wp>-wp_mtx,
                 <fs_wp>-wp_mtx_excl,
                 <fs_wp>-wp_mtx_shrd.
      ENDLOOP.
    ELSE.
      WRITE: / 'send_error'.
    ENDIF.
  ENDLOOP.
ELSE.
  WRITE: / 'no_server_list'.
ENDIF.