问题
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
回答1:
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.
回答2:
Try adding one more configuration parameter:
RfcConfigParameters.UseSAPGui
with value = 1
回答3:
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.
来源:https://stackoverflow.com/questions/8047227/calling-bapi-document-checkoutview2-using-sap-net-connector-3-0-returns-rfc-cal