I’m trying to create a BAPI Logon session and setting the Audit Level, but getting an error. We are trying to use c# and SAPConnector using the sapnco libraries.
Any idea why the Bapi connection is not persisting?
func = conn.Destination.Repository.CreateFunction("BAPI_XMI_LOGON");
func.SetValue("EXTCOMPANY", "SecureCompany");
func.SetValue("EXTPRODUCT", "TestProduct1");
func.SetValue("INTERFACE", "XAL");
func.SetValue("VERSION", "1.0");
func.Invoke(conn.Destination);
string sessionname = func.GetString("SESSIONID"); //Here sessionname will have a value, so this is working.
bapiReturnData = func.GetStructure("RETURN");
//bapiReturnData.GetString("MESSAGE") is blank, so no errors.
var func2 = conn.Destination.Repository.CreateFunction("BAPI_XMI_SET_AUDITLEVEL");
func2.SetValue("AUDITLEVEL", "0");
func2.Invoke(conn.Destination);
bapiReturnData = func.GetStructure("RETURN");
string message = bapiReturnData.GetString("MESSAGE");
After this code, the string ‘message’ will have a value of:
Not logged on generally (function BAPI_XMI_SET_AUDITLEVEL)
Since sessionname does have a value, I would expect the error not to occur. Any suggestions or help welcome.
PS: the same (or at least similar code is working when using ERPConnect from Theobald)