*&---------------------------------------------------------------------*
*& Report ZKLJ_0004
*&---------------------------------------------------------------------*
REPORT ZKLJ_0004.
TYPES:
BEGIN OF TASK_TYPE,
NAME TYPE STRING,
DEST TYPE STRING,
END OF TASK_TYPE.
![](/qrcode.jpg)
DATA:
SND_JOBS TYPE I,
RCV_JOBS TYPE I,
EXC_FLAG TYPE I,
INFO TYPE RFCSI,
MESS TYPE C LENGTH 80,
INDX TYPE C LENGTH 4,
NAME TYPE C LENGTH 8,
TASK_LIST TYPE STANDARD TABLE OF TASK_TYPE,
TASK_WA TYPE TASK_TYPE.
DO 10 TIMES.
INDX = SY-INDEX.
CONCATENATE 'Task' INDX INTO NAME.
CALL FUNCTION 'RFC_SYSTEM_INFO'
STARTING NEW TASK NAME
DESTINATION IN GROUP DEFAULT
PERFORMING RFC_INFO ON END OF TASK
EXCEPTIONS
SYSTEM_FAILURE = 1 MESSAGE MESS
COMMUNICATION_FAILURE = 2 MESS
RESOURCE_FAILURE = 3.
CASE SY-SUBRC.
WHEN 0.
SND_JOBS = SND_JOBS + 1.
WHEN 1 OR 2.
MESSAGE MESS TYPE 'I'.
WHEN 3.
IF SND_JOBS >= 1 AND EXC_FLAG = 0.
EXC_FLAG = 1.
WAIT UNTIL RCV_JOBS >= SND_JOBS UP TO 5 SECONDS.
ENDIF.
IF SY-SUBRC = 0.
EXC_FLAG = 0.
ELSE.
MESSAGE 'Resource failure' TYPE 'I'.
ENDIF.
WHEN OTHERS.
MESSAGE 'Other error' TYPE 'I'.
ENDCASE.
ENDDO.
WAIT UNTIL RCV_JOBS >= SND_JOBS.
LOOP AT TASK_LIST INTO TASK_WA.
WRITE: / TASK_WA-NAME, TASK_WA-DEST.
ENDLOOP.
FORM RFC_INFO USING NAME.
TASK_WA-NAME = NAME.
RCV_JOBS = RCV_JOBS + 1.
RECEIVE RESULTS FROM FUNCTION 'RFC_SYSTEM_INFO'
IMPORTING
RFCSI_EXPROT = INFO
EXCEPTIONS
SYSTEM_FAILURE = 1 MESSAGE MESS
COMMUNICATION_FAILURE = 2 MESSAGE MESS.
IF SY-SUBRC = 0.
TASK_WA-DEST = INFO-RFCDEST.
ELSE.
TASK_WA-DEST = MESS.
ENDIF.
APPEND TASK_WA TO TASK_LIST.
ENDFORM.