RECEIVE


Basic form

RECEIVE RESULTS FROM FUNCTION func.

Additions



1. ... IMPORTING p1 = f1 ... pn = fn
2. ... TABLES p1 = itab1 ... pn = itabn
3. ... EXCEPTIONS except1 = rc1 ... exceptn = rcn

Effect

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.

Notes

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.

Addition 1

... IMPORTING p1 = f1 ... pn = fn

Effect

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.

Addition 2

... TABLES p1 = itab1 ... pn = itabn

Effect

The TABLES statement contains references to internal tables. All table parameters of the function module must be covered.

Addition 3

... EXCEPTIONS except1 = rc1 ... exceptn = rcn

Effect

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 (RAISE and MESSAGE ... RAISING ) not meant to be handled by the program itself,

Note

The following EXCEPIONS are predefined by the system and have a special meaning:

Example

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'. ... AT USER-COMMAND. * Return from FORM routine RETURN_INFO IF SYSTEM_MSG = SPACE. WRITE: 'Destination =', INFO-RFCDEST. ELSE. WRITE SYSTEM_MSG. ENDIF. ... 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 ENDFORM.

RECEIVE_ILLEGAL_SWITCH

Index
© SAP AG 1996