REPORT ZEXAMPLE.

DATA: BEGIN OF SERVER_LIST OCCURS 0 .

INCLUDE STRUCTURE MSXXLIST .

DATA: END OF SERVER_LIST .

DATA: MESSAGE_SERVER LIKE MSXXLIST-HOST,

V_LINE TYPE I,

COMM_MESSAGE(256),

SYST_MESSAGE(256).

CALL FUNCTION 'TH_SERVER_LIST'

TABLES

LIST = SERVER_LIST

EXCEPTIONS

OTHERS = 1.

IF SY-SUBRC NE 0.

CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'RDISP/MSHOST'

ID 'VALUE' FIELD MESSAGE_SERVER.

SERVER_LIST-NAME = MESSAGE_SERVER.

APPEND SERVER_LIST.

ENDIF.

DESCRIBE TABLE SERVER_LIST LINES V_LINE.

IF V_LINE GE 1.

READ TABLE SERVER_LIST INDEX 1. "RUN TXN ON FIRST SERVER FOUND

CALL FUNCTION 'TH_REMOTE_TRANSACTION'

EXPORTING

TCODE = 'SE37'

DEST = SERVER_LIST-NAME

IMPORTING

COMM_MESSAGE = COMM_MESSAGE

SYST_MESSAGE = SYST_MESSAGE.

IF COMM_MESSAGE <> SPACE.

WRITE:/ COMM_MESSAGE.

ELSE.

WRITE:/ SYST_MESSAGE.

ENDIF.

ELSE.

WRITE:/ 'NO SERVERS FOUND'.

ENDIF.