RECEIVE is a keyword used in SAP ABAP programming.This tutorial covers its introduction & syntax details.
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,
RAISE terminates the program with a runtime error;
MESSAGE ... RAISING outputs the message.
Note
The following EXCEPIONS are predefined by the system and have a special meaning:
OTHERS : Covers all user-defined exceptions in the calle function module
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.
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
Related 10 ABAP Syntax Tutorials
Most readed SAP Tutorials
- WRITE - Output to a list ( SAP ABAP Keyword)
WRITE ( Output to a list ) is a keyword used in SAP ABAP programming.This tutorial covers its introduction & syntax details. - List of SAP HR TABLES and Infotypes tables
Detailed full list of tables and infotypes used in SAP HR module. - List of SAP MM Transaction codes
This documentation covers the details of SAP MM Transaction codes - SELECT-OPTIONS ( SAP ABAP Keyword)
SELECT-OPTIONS is a keyword used in SAP ABAP programming.This tutorial covers its introduction & syntax details. - FI Accounts Receivable and Accounts Payable | SAP FI PDF manual
The following topics are an introduction to the Accounts Receivable and Accounts Payable application components. - SELECT clause ( SAP ABAP Keyword)
SELECT clause is a keyword used in SAP ABAP programming.This tutorial covers its introduction & syntax details. - SAP MM Process Flow
The typical procurement cycle for a service or material consists of the following phases:
Latest Added SAP documents
- 9KE9 Transaction code
Details about SAP transaction code 9KE9 - 9KE8 Transaction code
Details about SAP transaction code 9KE8 - 9KE7 Transaction code
Details about SAP transaction code 9KE7 - 9KE6 Transaction code
Details about SAP transaction code 9KE6 - 9KE5 Transaction code
Details about SAP transaction code 9KE5 - 9KE4 Transaction code
Details about SAP transaction code 9KE4 - 9KE3 Transaction code
Details about SAP transaction code 9KE3 - 9KE2 Transaction code
Details about SAP transaction code 9KE2 - 9KE1 Transaction code
Details about SAP transaction code 9KE1 - 9KE0 Transaction code
Details about SAP transaction code 9KE0