SAP ABAP SYNTAX FOR COMMUNICATION PART THREE

Variant 4

COMMUNICATION SEND ID id BUFFER f.

Additions

1. ... RETURNCODE rc
2. ... LENGTH len

Effect

Sends data to the partner program. The data is stored in the field f which follows the key word parameter BUFFER . It is sent in the full length of the field f . If the partner program is part of a system which has a different character set, you must perform an appropriate conversion yourself. To do this, use the TRANSLATE statement.

Addition 1

... RETURNCODE rc

Effect

Stores the return code in the field rc .

Addition 2

... LENGTH leng

Effect

Sends the contents of the field f to the partner program in the specified length.

Example

 
TYPES: CONVERSATION_ID(8) TYPE C,
       DESTINATION(8)     TYPE C,
       RETURN_CODE        LIKE SY-SUBRC.
DATA:  CONVID  TYPE CONVERSATION_ID,
       DEST    TYPE DESTINATION VALUE 'C00',
       CPIC_RC TYPE RETURN_CODE.
INCLUDE RSCPICDF.
 
COMMUNICATION INIT DESTINATION DEST
                   ID          CONVID
                   RETURNCODE  CPIC_RC.
IF CPIC_RC NE CM_OK.
   WRITE: /'COMMUNICATION INIT, RC = ', CPIC_RC.
   EXIT.
ENDIF.
COMMUNICATION ALLOCATE ID CONVID                        RETURNCODE
CPIC_RC.
IF CPIC_RC NE CM_OK.
   WRITE: /'COMMUNICATION ALLOCATE, RC = ', CPIC_RC.
   EXIT.
ENDIF.
RECORD = 'The quick brown fox jumps over the lazy dog'.
COMMUNICATION SEND ID CONVID

                   BUFFER RECORD
                   LENGTH LENG
                   RETURNCODE CPIC_RC.
IF CPIC_RC NE CM_OK.
   WRITE: / 'COMMUNICATION SEND, RC = ', CPIC_RC.
   EXIT.
ENDIF.

Since the length is specified explicitly in this example, only the part ' The quick brown fox ' is transferred from the contents of the field RECORD .

No comments :

Post a Comment