RfcLastError 
You can use the following function to get more information on errors that have occurred:
int SAP_API RfcLastError(RFC_ERROR_INFO * error_info);
This function thus describes the last error reported by some function of the RFC API.
The errorinfo structure is:
Syntax
typedef struct
{char key[32];
char status[128];
char message[256];
char intstat[128];
}
RFC_ERROR_INFO;
The structure RFC_ERROR_INFO is filled with more information describing the error.
This function is defined in SAPRFC.H.
Returns 1 if no error occurred and 0 elsewhere.
error info
structure RFC_ERROR_INFO describing the error.