The following figure illustrates the program flow logic:
The calling, external program uses the following functions from the RFC Software Development Kit (RFC-SDK):
· RfcOpen
Using this call, the system sets up an RFC connection to the server system. You can define the logon to the SAP system, including the server name of the SAP destination system, SAP logon, user ID, and so on in the C program or in the file saprfc.ini.
After the connection to the server system has been set up, you must call the following functions for the tRFC in the client program:
· RfcCreateTransID
The transaction identifier (TID) that was created in the server system is determined with this call.
· RfcIndirectCall
The RFC data, together with the TID, is transferred to the server system with this call.
If errors occur, the client program repeats this call.
Here the system must use the old TID with the call RfcCreateTransID. Otherwise, it cannot be guaranteed that the RFC function is executed only once in the SAP system.
For more information, see the documentation The RFC API or the documentation for RFC-SDK.
The data needs to be processed into IDoc format and placed in an internal table with structure EDI_DD40 (EDI_DD before 4.0). A control record must also be created for each IDoc and placed in an internal table for structure EDI_DC40 (EDI_DC before 4.0). The form of data transfer is also described in the documentation.