COMMUNICATION RECEIVE: Receive data 

Use

The statement COMMUNICATION RECEIVE causes the program to wait for data from the partner. Incoming data is placed in the available buffer. In addition to the data, information on the completeness of the data and the communication status is reported.

If a program has send status and transmits COMMUNICATION RECEIVE, it passes the send authorization to the partner. The communications direction can be changed several times.

Activities

Syntax

COMMUNICATION RECEIVE ID <conv_id>

BUFFER <buf>

DATAINFO <di>

STATUSINFO <si>

[ HOLD ]

[ RECEIVED <n> ]

[ LENGTH <rlen> ]

[ RETURNCODE <rc> ]

Parameter Values

<conv_id>

Conversation ID (input, C(8))

<buf>

Data buffer (output, type C(?) or structure): Data range/structure, which contains the received data

<di>

Data information (output, type X(4))

Data fully buffered, or not fully buffered if the buffer defined is too small.

CM_NO_DATA_RECEIVED

CM_COMPLETE_DATA_RECEIVED

CM_INCOMPLETE_DATA_RECEIVED

<si>

Status information (output, type X(4))

Send authorization received or not (IMS: Always set)

CM_SEND_RECEIVED

CM_NO_STATUS_RECEIVED

HOLD

If you use COMMUNICATION RECEIVE with parameter HOLD (as of R/3 Release 2.1), no roll-out and roll-in will be performed for RECEIVE. The previously requested task will be held instead.

<n>

Data length (output, type X(4))

Number of received characters in the buffer

<rlen>

Maximum length of the receivable buffer (input, type P)

If none is defined, the length of the buffer is used internally.

<rc>

Return code (output, type X(2))

Alternatively, you can check the value directly via SY-SUBRC.

Return Codes

Value

Explanation

CM_OK

 

CM_DEALLOCATED_ABEND

Partner has closed the connection UTM

CM_DEALLOCATED_NORMAL

Partner has closed the connection normally

DATA: CONV_ID(8) TYPE C,

BUF(255),

DI(4) TYPE X,

SI(4) TYPE X,

RL(4) TYPE X,

RC LIKE SY-SUBRC.

COMMUNICATION RECEIVE ID CONV_ID

BUFFER BUF

DATAINFO DI

STATUSINFO SI

HOLD

RECEIVED RLEN

RETURNCODE RC.

IF RC <> CM_OK....