简体   繁体   English

JCo 中 FM 参数的反映

[英]Reflection of FM parameters in JCo

I have a problem with the dynamic receipt of the list of parameters and their values when calling the Function Module in SAP (with DESTINATION parameter as SAP JCO SERVER) and then processing it using Java (in SAP JCO Server).在 SAP 中调用 Function 模块(使用 DESTINATION 参数作为 SAP JCO SERVER)然后使用 Java(在 SAP JCO 服务器中)处理它时,动态接收参数列表及其值存在问题。

The point is that I need a dynamic way to get information in JCO Server (using Java) about what SAP function and with what parameters (Importing, Exporting, Changing and Tables) was called in SAP (because my JCO Server server "listens" for SAP RFC calls and I have to store information about these calls from SAP).关键是我需要一种动态方式在 JCO 服务器(使用 Java)中获取有关 SAP function 以及在 SAP 中调用哪些参数(导入、导出、更改和表)的信息(因为我的 JCO 服务器服务器“侦听” SAP RFC 调用,我必须存储有关这些来自 SAP 的调用的信息)。

I know that (for example for Importing Parameters) using command:我知道(例如对于导入参数)使用命令:

JCoParameterList ParameterList = function.getImportParameterList(); 

in Java I can receive this data, but how to deal with this variable of type JCoParameterList ?在 Java 我可以接收到这个数据,但是如何处理这个JCoParameterList类型的变量? Ie 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?即,如何从这个变量“ParameterList”中获取有关参数名称、它们的类型以及在 SAP 中调用它们的值的信息?

I will be grateful for any suggestions on how in Java we can retrieve this data from object of type JCoParameterList !对于如何在 Java 中我们可以从 JCoParameterList 类型的JCoParameterList检索这些数据的任何建议,我将不胜感激!

Kind regards, Andrew亲切的问候,安德鲁

JCoParameterList contains a list of JCoParameterField instances. JCoParameterList包含JCoParameterField实例的列表。 JCoParameterField in turn inherits from JCoField , which gives you methods to set or get the parameter value. JCoParameterField又继承自JCoField ,它为您提供设置或获取参数值的方法。 JCoParameterList allows you to iterate through the list of parameters, check what kind of parameter they are, get their value etc. 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

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM