Function sapnwrfc::binding::RfcInstallBgRfcHandlers
[−]
[src]
pub unsafe extern "C" fn RfcInstallBgRfcHandlers(
sysId: *const SAP_UC,
onCheckFunction: RFC_ON_CHECK_UNIT,
onCommitFunction: RFC_ON_COMMIT_UNIT,
onRollbackFunction: RFC_ON_ROLLBACK_UNIT,
onConfirmFunction: RFC_ON_CONFIRM_UNIT,
onGetStateFunction: RFC_ON_GET_UNIT_STATE,
errorInfo: *mut RFC_ERROR_INFO
) -> RFC_RC
Installs the necessary callback functions for processing incoming bgRFC calls.
These functions need to be implemented by you and will be used by the RFC runtime in the following way: -# The RFC_ON_CHECK_UNIT function is called when a local background unit is starting. Since a background RFC call can be issued many times by the client system, the function is responsible for storing the unit ID and type in permanent storage. The return value should be one of the following: - RFC_OK\n Unit ID stored, LUW can be started. - RFC_EXECUTED\n This LUW has already been processed successfully in an earlier attempt. Skip the execution now. - RFC_EXTERNAL_FAILURE\n Currently unable to access my permanent storage. Raise an exception in the sending system, so that the sending system will try to resend the unit at a later time. -# The next step will be the execution of the RFC_SERVER_FUNCTIONs for all function modules contained in the LUW. -# If one of the RFC_SERVER_FUNCTION implementations returns an error code, RFC_ON_ROLLBACK_UNIT is called. Here you should roll back all the work of all the previous RFC_SERVER_FUNCTIONs. (The easiest way is to do a database ROLLBACK WORK here.)\n If all RFC_SERVER_FUNCTIONs complete successfully, RFC_ON_COMMIT_UNIT is called at the end. Persist all the changes here (e.g. do a COMMIT WORK).\n Note: Normally you'll only have "one-function-module LUWs", e.g. IDocs. In this case the RFC_SERVER_FUNCTION can already commit/rollback its own work, before returning RFC_OK or an error code. So the two functions RFC_ON_ROLLBACK_UNIT and RFC_ON_COMMIT_UNIT can be empty in this case. -# In the end RFC_ON_CONFIRM_UNIT will be called. All information stored about that LUW can now be discarded by the server, as it no longer needs to protect itself against duplicates. In general this function can be used to delete the unit ID from permanent storage. -# At various points in the processing of a background unit, the backend system may or may not inquire the status of the currently (or previously) processed unit by calling RFC_ON_GET_UNIT_STATE. Your implementation of this function should check your permanent storage for status information about the given unit ID and fill the RFC_UNIT_STATE* accordingly.
If you pass NULL as "sysId", the transaction handlers will be used for bgRFC calls from any backend system, for which no explicit handlers have been installed.
\in *sysId System ID of the SAP system for which to use this set of transaction handlers, or NULL. \in onCheckFunction Pointer to a function of type RFC_ON_CHECK_UNIT. \in onCommitFunction Pointer to a function of type RFC_ON_COMMIT_UNIT. \in onRollbackFunction Pointer to a function of type RFC_ON_ROLLBACK_UNIT. \in onConfirmFunction Pointer to a function of type RFC_ON_CONFIRM_UNIT. \in onGetStateFunction Pointer to a function of type RFC_ON_GET_UNIT_STATE. \out *errorInfo Additional information, in case the handlers could not be installed. \return RFC_RC