Calling BAPI_DOCUMENT_CHECKOUTVIEW2 using SAP .NET Connector 3.0 returns "RFC Callback server not available"

4.9k Views Asked by At

I am trying to get a document from SAP DMS using SAP .NET Connector 3.0. I need to get the document and display in ASP.Net.

I am using BAPI_DOCUMENT_CHECKOUTVIEW2 for calling the function. But when the invoke method is called, "RFC callback server not available" error is thrown.

The code I have used is below.

...
sap.RfcRepository repo = prd.Repository;
sap.IRfcFunction testBapi = repo.CreateFunction("BAPI_DOCUMENT_CHECKOUTVIEW2");
testBapi.SetValue("DOCUMENTNUMBER", docNumber);
testBapi.SetValue("DOCUMENTPART", docPart);
testBapi.SetValue("DOCUMENTVERSION", docVersion);
testBapi.SetValue("DOCUMENTTYPE", docType);
... 
the document file is created here using BAPI_DOCUMENT_GETDETAIL2
...
testBapi.SetValue("DOCUMENTFILE", struFile);
testBapi.SetValue("GETSTRUCTURE", "1");
testBapi.SetValue("GETHEADER", "X");
testBapi.SetValue("ORIGINALPATH", @"D:\");
testBapi.SetValue("PF_FTP_DEST", "SAPFTPA");

long result = RfcAllowStartProgram("sapftp; saphttp");
testBapi.Invoke(prd);

Thanks in advance

3

There are 3 best solutions below

2
On

Do you have more information on which RFC server connection is failing? If you know which connection is the problem, you can ask a SAP Basis/ABAP person to log on to the SAP server & check the RFC destinations in transaction SM59.

EDIT: Also check the authorizations of the .NET user.

0
On

I don't know this BAPI and I don't have a system at hand to check it, but I'd assume that somewhere during the execution, the BAPI tries to call "back" to the GUI that's supposed to be at the other end of the session. When it can't find a GUI, it dies. IF you have GUI access and debugging permissions (and knowledge :-)), you could try to find a CALL FUNCTION ... DESTINATION BACK statement on the way.

0
On

Try adding one more configuration parameter:

RfcConfigParameters.UseSAPGui with value = 1