-2

I have this RFC

How do I set the internal value of the I_VALUE_DATA key?

<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;
        }

    }
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Gustavo
  • 5
  • 1
  • I don't know what represents this XML. I guess you mean that `I_VALUE_DATA` is a structured importing parameter of your RFC-enabled function module `Z_ATCWS_T_TEST`, which contains the component `E_DATA1`, and you're asking how to set the value of that component? – Sandra Rossi Nov 09 '22 at 08:41
  • How can i set the field E_DATA1 ? – Gustavo Nov 10 '22 at 00:42

1 Answers1

0

Considering that I_VALUE_DATA is a structured importing parameter of your RFC-enabled function module Z_ATCWS_T_TEST, and this structure contains the component E_DATA1, here is how to set the value of E_DATA1:

function.getImportParameterList().getStructure("I_VALUE_DATA").setValue("E_DATA1", "st");
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48