[ABAP] Worker Agent Infos vom Kernel holen

* Worker agent information
* ab Kernel 7.42
DATA(o_worker_info) = NEW cl_worker_info( ).

cl_demo_output=>write_data( o_worker_info->server_name ).

cl_demo_output=>write_data( o_worker_info->start_time ).

* Get process Id of the agent
cl_demo_output=>write_data( o_worker_info->get_pid( ) ).

* Nr des Work Prozess
cl_demo_output=>write_data( o_worker_info->index ).

* Get type of worker agent
DATA(worker_type) = o_worker_info->get_worker_type( ).

CASE worker_type.
  WHEN if_worker_types=>spool.
    cl_demo_output=>write_data( 'SPOOL' ).
  WHEN if_worker_types=>nowp.
    cl_demo_output=>write_data( 'NOWP' ).
  WHEN if_worker_types=>invalid.
    cl_demo_output=>write_data( 'INVALID' ).
  WHEN if_worker_types=>dialog.
    cl_demo_output=>write_data( 'DIALOG' ).
  WHEN if_worker_types=>update.
    cl_demo_output=>write_data( 'UPDATE' ).
  WHEN if_worker_types=>enqueue.
    cl_demo_output=>write_data( 'ENQUEUE' ).
  WHEN if_worker_types=>batch.
    cl_demo_output=>write_data( 'BATCH' ).
  WHEN if_worker_types=>update2.
    cl_demo_output=>write_data( 'UPDATE2' ).
ENDCASE.

* Get state of worker agent
DATA(worker_state) = o_worker_info->get_state( ).

CASE worker_state.
  WHEN if_worker_states=>worker_state_free.
    cl_demo_output=>write_data( 'FREE' ).
  WHEN if_worker_states=>worker_state_hold.
    cl_demo_output=>write_data( 'HOLD' ).
  WHEN if_worker_states=>worker_state_killed.
    cl_demo_output=>write_data( 'KILLED' ).
  WHEN if_worker_states=>worker_state_new.
    cl_demo_output=>write_data( 'NEW' ).
  WHEN if_worker_states=>worker_state_restricted.
    cl_demo_output=>write_data( 'RESTRICTED' ).
  WHEN if_worker_states=>worker_state_run.
    cl_demo_output=>write_data( 'RUN' ).
  WHEN if_worker_states=>worker_state_shutdown.
    cl_demo_output=>write_data( 'SHUTDOWM' ).
  WHEN if_worker_states=>worker_state_wait.
    cl_demo_output=>write_data( 'WAIT' ).
ENDCASE.

CASE o_worker_info->type.
  WHEN if_agent_types=>dispatcher.
    cl_demo_output=>write_data( 'DISPATCHER' ).
  WHEN if_agent_types=>invalid.
    cl_demo_output=>write_data( 'INVALID' ).
  WHEN if_agent_types=>gateway.
    cl_demo_output=>write_data( 'GATEWAY' ).
  WHEN if_agent_types=>icman.
    cl_demo_output=>write_data( 'ICMAN' ).
  WHEN if_agent_types=>terminal.
    cl_demo_output=>write_data( 'TERMINAL' ).
  WHEN if_agent_types=>message_server.
    cl_demo_output=>write_data( 'MESSAGE_SERVER' ).
  WHEN if_agent_types=>worker.
    cl_demo_output=>write_data( 'WORKER' ).
  WHEN if_agent_types=>ext_event.
    cl_demo_output=>write_data( 'EXT_EVENT' ).
  WHEN if_agent_types=>dp_monitor.
    cl_demo_output=>write_data( 'DP_MONITOR' ).
  WHEN if_agent_types=>ic_monitor.
    cl_demo_output=>write_data( 'IC_MONITOR' ).
ENDCASE.

* Write text into developer trace
*cl_worker_info=>write_trace( ).

* Get attribues of this worker
DATA(it_worker_attr) = o_worker_info->get_attributes( ).

cl_demo_output=>write_data( it_worker_attr ).

* 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        = 'Worker Info'
                              html_string  = lv_html
                              container    = cl_gui_container=>default_screen ).

* cl_gui_container=>default_screen erzwingen
WRITE: space.