Sap 如何在Netweaver上使用JCo3创建自定义目标(使用我自己的服务器名、客户端、用户名等)?
由于Netweaver附带有自己的DestinationDataProvider,因此我们无法注册自己的自定义目标数据提供程序。是否意味着我们必须使用Netweaver的目标管理器来定义目标并在应用程序中使用它?有没有一种方法可以连接到任何SAP服务器并创建我们自己的目的地,而无需使用Netweaver的目的地管理器?在JCO 3中执行此操作的方式略有不同。其思想是创建属性&从中可以检索到它的位置(平面文件、ldap等),然后在您想要连接到sap服务器时检索相同的属性 //因此,首先使用以下代码创建连接参数Sap 如何在Netweaver上使用JCo3创建自定义目标(使用我自己的服务器名、客户端、用户名等)?,sap,jco,netweaver,Sap,Jco,Netweaver,由于Netweaver附带有自己的DestinationDataProvider,因此我们无法注册自己的自定义目标数据提供程序。是否意味着我们必须使用Netweaver的目标管理器来定义目标并在应用程序中使用它?有没有一种方法可以连接到任何SAP服务器并创建我们自己的目的地,而无需使用Netweaver的目的地管理器?在JCO 3中执行此操作的方式略有不同。其思想是创建属性&从中可以检索到它的位置(平面文件、ldap等),然后在您想要连接到sap服务器时检索相同的属性 //因此,首先使用以下代码
static String DESTINATION_NAME1 = "ABAP_AS_WITHOUT_POOL";
static String DESTINATION_NAME2 = "ABAP_AS_WITH_POOL";
static
{
Properties connectProperties = new Properties();
connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "sap.dsc.com");
connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "76");
connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "800");
connectProperties.setProperty(DestinationDataProvider.JCO_USER, "dsc007");
connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "passwd");
connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "en");
createDestinationDataFile(DESTINATION_NAME1, connectProperties);
connectProperties.setProperty(DestinationDataProvider.JCO_POOL_CAPACITY, "3");
connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT, "10");
createDestinationDataFile(DESTINATION_NAME2, connectProperties);
}
static void createDestinationDataFile(String destinationName, Properties connectProperties)
{
File destCfg = new File(destinationName+".jcoDestination");
try
{
FileOutputStream fos = new FileOutputStream(destCfg, false);
connectProperties.store(fos, "for tests only !");
fos.close();
}
catch (Exception e)
{
throw new RuntimeException("Unable to create the destination files", e);
}
}
//然后,可以在其他地方使用以下代码段连接到sap服务器
static String DESTINATION_NAME1 = "ABAP_AS_WITHOUT_POOL";
static String DESTINATION_NAME2 = "ABAP_AS_WITH_POOL";
public static void step1Connect() throws JCoException
{
JCoDestination destination = JCoDestinationManager.getDestination(DESTINATION_NAME1);
System.out.println("Attributes:");
System.out.println(destination.getAttributes());
System.out.println();
}
您必须使用NetWeaver的目标服务。可以通过NetWeaver管理UI创建RFC目标,也可以通过提供的API以编程方式创建RFC目标,以管理目标配置。
不过,您也可以基于从
jcodestationmanager
检索的jcodestationation
实例创建JCoCustomDestination
实例。您的答案来自原始SAP Jco 3文档。但是,这在Netweaver上不起作用。它仅在使用独立的Jco3 jar库时有效,并且在Netweaver上预装了不同的Jco3实现。