入门错误经由树液达网络连接器调用XBP功能模块时“没有在接口XBP登录”(Getting “Not

2019-10-23 15:06发布

我得到的错误,而调用BAPI_XBP_JOB_START_IMMEDIATELY

            IRfcFunction rfcFunc = repository.CreateFunction("BAPI_XMI_LOGON");
            rfcFunc.SetValue("extcompany", "testC");
            rfcFunc.SetValue("extproduct", "testP");
            rfcFunc.SetValue("interface", "XBP");
            rfcFunc.SetValue("version", "3.0");

            rfcFunc.Invoke(dest);

            rfcFunc = repository.CreateFunction("BAPI_XBP_JOB_START_IMMEDIATELY");
            rfcFunc.SetValue("jobname", "MYSCHEDULEDJOB");
            rfcFunc.SetValue("jobcount", "15530600");
            rfcFunc.SetValue("external_user_name", "username");

            rfcFunc.SetValue("target_server", "devsapsystem");
            rfcFunc.Invoke(dest);

第一功能模块是给在输出的sessionid,但第二XBP呼叫是给消息“没有登录在界面XBP”。 有没有办法,我传递或者我需要在这连续通话保持一定的会话中的任何问题的参数。

Answer 1:

您需要执行在一个会话的函数调用(状态模式)。 对此进行了详细的JCO文档中列出-基本上你将不得不包装你的逻辑到JCoContext方法调用是这样的:

try
{
  JCoContext.begin(destination); 
  try
  {
    // your function calls here
    // probably bapiTransactionCommit.execute(destination);
  }
  catch(AbapException ex)
  {
    // probably bapiTransactionRollback.execute(destination);
  } 
}
catch(JCoException ex)
{
  [...]
}
finally
{
  JCoContext.end(destination);
}


文章来源: Getting “Not logged on in interface XBP” error when calling XBP function module via sap .net connector