RECEIVE RESULTS FROM FUNCTION func.
1. ... IMPORTING p1 = f1 ... pn = fn
2. ... TABLES p1 = itab1 ... pn = itabn
3. ... EXCEPTIONS except1 = rc1 ... exceptn = rcn
Used within a FORM routine to receive the
results of an asynchronous function module call
(CALL FUNCTION func STARTING NEW TASK task name
) as IMPORTING or TABLES
parameters. In addition, the FORM routine must have a
placeholder to receive the task name (e.g. when you use USING task
name ). See example below.
This key word occurs only with the function module call
CALL FUNCTION func STARTING NEW TASK task name . If the function
module returns no results, this part need not be defined.
This key word is new from Release 3.0. Therefore, both partner systems
(client and server) must have Release 3.0 of the R/3 System.
... IMPORTING p1 = f1 ... pn = fn
IMPORTING returns the values of fields and field
strings from the function module to the calling program. In the
function module, the formal parameters are defined as export
parameters. You can pass any number of export parameters.
... TABLES p1 = itab1 ... pn = itabn
The TABLES statement contains references to
internal tables. All table parameters of the function module must be
... EXCEPTIONS except1 = rc1 ... exceptn =
Under EXCEPTIONS , you execute the exceptions
handled by the calling program itself. At the end of the exception
list, you can use OTHERS to refer to all remaining exceptions.
If one of the listed exceptions occurs, SY-SUBRC is set to the
assigned value rc (number literal!) and control passes to the
calling program. By specifying a return code, you can group exceptions
into classes. With the second form, without " = rc ",
SY-SUBRC is set to a value other than 0 if an exception occurs.
If the function module triggers an exception
MESSAGE ... RAISING ) not meant to be
handled by the program itself,
RAISE terminates the program with a runtime error;
MESSAGE ... RAISING outputs the message.
The following EXCEPIONS are predefined by the
system and have a special meaning:
OTHERS : Covers all user-defined exceptions in the calle
ERROR_MESSAGE : Specifcation of this exception means that S
messages, I messages and W messages are ignored until return from the
function module (although, in the case of background jobs, thery appear
in the log). If an E message or an A message occurs, the called
function module terminates, as if the exception ERROR_MESSAGE
had been triggered.
DATA: INFO LIKE RFCSI,
* Result of RFC_SYSTEM_INFO function
SYSTEM_MSG(80) VALUE SPACE.
* Exception handling
CALL FUNCTION 'RFC_SYSTEM_INFO'
STARTING NEW TASK 'INFO'
PERFORMING 'RETURN_INFO' ON END OF TASK.
WRITE: 'Wait for reply'.
* Return from FORM routine RETURN_INFO
IF SYSTEM_MSG = SPACE.
WRITE: 'Destination =', INFO-RFCDEST.
FORM RETURN_INFO USING TASKNAME.
RECEIVE RESULTS FROM FUNCTION 'RFC_SYSTEM_INFO'
IMPORTING RFCSI_EXPORT = INFO
EXCEPTIONS SYSTEM_FAILURE MESSAGE SYSTEM_MSG.
REFRESH SCREEN. "Simulate command field = return key
© SAP AG 1996