FM参数在JCo中的反映

问题描述 投票:1回答:1

当我在SAP中调用Function模块(DESTINATION参数为SAP JCO SERVER),然后用Java处理(在SAP JCO Server中)时,我在动态接收参数列表及其值方面遇到了问题。

问题是,我需要一种动态的方式在JCO Server中获取信息(使用Java),了解在SAP中调用了什么SAP函数和什么参数(导入、导出、更改和表格)(因为我的JCO Server服务器 "监听 "SAP RFC调用,我必须存储这些来自SAP的调用信息)。

我知道(例如导入参数)使用命令。

JCoParameterList ParameterList = function.getImportParameterList(); 

在Java中,我可以接收这些数据,但是如何处理这个类型的变量?JCoParameterList? I.e. how can I get Informations from this Variable "ParameterList" on the name of the parameters, their types and the values with which they were called in SAP?

如果有任何建议,我将感激不尽,在Java中,我们如何能从类型为 JCoParameterList!

亲切的问候,安德鲁

java sap jco sapjco3
1个回答
2
投票

JCoParameterList 包含一个列表 JCoParameterField 的实例。JCoParameterField 反过来又继承自 JCoField提供了设置或获取参数值的方法。JCoParameterList 允许你遍历参数列表,检查它们是什么类型的参数,获取它们的值等。

JCoParameterList parameters = function.getImportParameterList();
JCoParameterFieldIterator it = parameters.getParameterFieldIterator();
while (it.hasNextField()) {
    JCoParameterField field = it.nextParameterField();
    // field.getName() gives you the name
    // field.getString() gives you the parameter value as string
    // field.getExtendedFieldMetaData() gives you the field metadata

}
© www.soinside.com 2019 - 2024. All rights reserved.