RFC Server Program Working With RfcDispatch
/* main program */
rfc_handle =
RfcAccept (...); /* Accept RFC connection */if (rfc_handle == RFC_HANDLE_NULL) /* Check return code */
{
rfc_error_handling("RfcAccept"); /* Handle error and get error */
return 1; /* specification via RfcLastError */
}
rfc_rc =
RfcInstallFunction ( ‘ABC’ , abc_function ,...);if (rfc_rc != RFC_OK) /* Check return code */
{
rfc_error_handling("Install function ‘ABC’);
/* Handle error and get error */
return 1; /* specification via RfcLastError */
}
do /* Wait for call or execution of */
{
rfc_rc =
} while ( rfc_rc == RFC_OK); /* connection is closed or */ /* terminated */
RfcClose
(...); /* Close RFC connection */
/* RFC function: ‘ABC’ */
static RFC_RC
abc_function (RFC_HANDLE rfc_handle) rfc_error_handling("RfcGetData");
/* Handle error and get error */
return 1; /* specification via RfcLastError */
}
... /* Process RFC data */
rfc_rc =
RfcSendData (...); /*Report result to ABAP program */return 0; /* Back to RFC Library */
}