【问题标题】:JCoFunction how to set a field of a structured parameterJCoFunction如何设置结构化参数的字段
【发布时间】:2022-11-10 23:26:22
【问题描述】:

我有这个 RFC

如何设置 I_VALUE_DATA 键的内部值?

<z_atcws_t_test>
    <I_W_INFORMATION>str</I_W_INFORMATION>
    <I_VALUE_DATA>
        <E_DATA1>st</E_DATA1>
    </I_VALUE_DATA>
</z_atcws_t_test>
public static void TEST() throws JCoException{
        String RFC_NAME = "TEST";

        System.out.println(RFC_NAME);
       
        JCoDestination destination = JCoDestinationManager.getDestination(DestinationConcept.Destinations.TEST);    
          
        JCoFunction function = destination.getRepository().getFunction(RFC_NAME);


        if (function == null) throw new RuntimeException(RFC_NAME + " not found in SAP.");
        
        try {

            JCoParameterList input = function.getImportParameterList();

            function.getImportParameterList().setValue("I_W_INFORMATION",      "str");


            // Set the internal value here
            function.getImportParameterList().setValue("I_VALUE_DATA",      "str");
            

            function.setAbapClassExceptionMode(AbapClassException.Mode.FULL);
            function.execute(destination);

        } catch (AbapException e) {
            System.out.println(e);
            return;
        } catch (JCoException e) {
            System.out.println(e);
            return;
        }

    }

【问题讨论】:

  • 我不知道这个 XML 代表什么。我猜你的意思是I_VALUE_DATA是你的启用RFC的功能模块Z_ATCWS_T_TEST的结构化导入参数,其中包含组件E_DATA1,你问如何设置该组件的值?
  • 如何设置字段 E_DATA1 ?

标签: saprfc jco


【解决方案1】:

考虑到I_VALUE_DATA是你的启用RFC的功能模块Z_ATCWS_T_TEST的结构化导入参数,并且这个结构包含组件E_DATA1,下面是如何设置E_DATA1的值:

function.getImportParameterList().getStructure("I_VALUE_DATA").setValue("E_DATA1", "st");

【讨论】:

    猜你喜欢
    • 2015-11-21
    • 2011-11-28
    • 2018-12-25
    • 2021-11-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多