Skip to Content
avatar image
Former Member

Export Idoc with JCo


I would like to export data with IDOC using JCo. There is a sample of program with some fonction which will help me to do this.

I understand how they connect to SAP server .But I still have a problem with the method who create the IDOC with the following code:

protected void handleRequest(JCO.Function function)


System.out.println("Incoming function request '" + function.getName() + "'...");

String filename = function.getName() + "_" +

timestampFormat.format(new java.util.Date()) + ".xml";

System.out.println("Storing function request as XML file '" + filename + "'...");

function.writeXML(incomingPath + filename);

I don't know what is the type JCO.Function and I have no idea what parameters I have to put in. For information we try to export the IDOC LOIPR01.

I found this help in JCo but it is not clear for me:

public static class JCO.Function

extends java.lang.Object


Class that represents a function. A function consists of name, an import parameter list, an export parameter list and a table parameter list.

JCO.Function(IFunctionTemplate template)

Creates an instance of the function from a template

JCO.Function(java.lang.String name)

Creates an instance of the function

JCO.Function(java.lang.String name, JCO.ParameterList input, JCO.ParameterList output, JCO.ParameterList tables)

Creates an instance of the function

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Jan 19, 2007 at 12:42 PM


    You have to understand how the JCo Server programs works. The JCo server program runs and waits for requests from an foreign system (ABAP or what else is supported).

    E.g. processing in ABAP works as followed. You have a function module which has a defined RFC connection which is defined in transaction SM59 and has as defined server program the JCo Server program id. If the function module is now executed it sends the request over the RFC connection to the JCo Server which now his states. Now handleRequest( ... ) is processed with the mapped function module as parameter.

    Have a look at the JCo examples to understand how this works. I thing that the processing of the IDOCs will be clearer.



    Add comment
    10|10000 characters needed characters exceeded