COMMUNICATION DEALLOCATE: Close the connection 
Use
A
conversation with a communications partner is closed and system resources in use are released. This statement can only be called in send status.Activities
Syntax
COMMUNICATION DEALLOCATE ID <conv_id>
[ RETURNCODE <rc> ]
Parameter Values
<conv_id>
Conversation
ID (input, type C(8))<rc>
Return code (output, type X(2))
Return Codes
Value |
Explanation |
CM_OK |
|
CM_PROGRAM_STATE_CHECK |
Program is not in send status |
CM_PROGRAM_PARAMETER_CHECK |
Invalid conversation ID |

DATA: CONV_ID(8) TYPE C,
RC LIKE SY-SUBRC.
COMMUNICATION DEALLOCATE ID CONV_ID RETURNCODE RC.
IF RC <> CM_OK....

Only the ABAP program, not the external partner program, can close the connection.