8 Replies Latest reply: Jul 18, 2013 10:46 AM by Daniel Becker RSS

How to set JCO.Server to unicode

Dick Coopee
Currently Being Moderated


I'm trying to call a Java class (myExample5)from a R/3 that is unicode compliant.  Using example5 in the sapjco-ntintel-2.1.5.zip, I've created the ABAP program to call STFC_CONNECTION with the destination 'JCO'.  I get to my JAVA program, but the input it receives is null.  I think I need to set the JCO.Server to be unicode, but I can't figure out how. 

Can someone provide me with an example? 

Also, do I need to had any additional dll to my system32 directory?


Thanks ahead of time for any insight.

  • Re: How to set JCO.Server to unicode
    Octavian Iancu
    Currently Being Moderated

    Hi Dick,


    Combine the example with the following code:


    Properties properties = new Properties();


    properties.setProperty("jco.server.gwserv", gatewayservice);

    properties.setProperty("jco.server.gwhost", servername);

    properties.setProperty("jco.server.progid", programid);

    properties.setProperty("jco.server.unicode", "1" );

    JCO.Server server = new JCO.Server( properties, repository );


    Make sure that librfc32.dll and sapjcorfc.dll are in system32.




    • Re: How to set JCO.Server to unicode
      Dick Coopee
      Currently Being Moderated

      Hi Octavian,

      I did all the things you mentioned below.  Now it looks like the Java class(myExample5) is receiving the input from the ABAP program.  I'm still having problems.  Now I receive a warning saying non-unicode metadata is used for communication with unicode backend. Here's how the example sets up the metadata: 

      repository = new Repository("TestRepository");      

      JCO.MetaData fmeta = new JCO.MetaData("STFC_CONNECTION");

      fmeta.addInfo("REQUTEXT", JCO.TYPE_CHAR, 255,   0,     0,   JCO.IMPORT_PARAMETER, null);

      fmeta.addInfo("ECHOTEXT", JCO.TYPE_CHAR, 255,   0,     0,   JCO.EXPORT_PARAMETER, null);

      fmeta.addInfo("RESPTEXT", JCO.TYPE_CHAR, 255,   0,     0,   JCO.EXPORT_PARAMETER, null);



      any idea how I can make the metadata unicode?

      • Re: How to set JCO.Server to unicode
        Octavian Iancu
        Currently Being Moderated

        Hi Dick,


        I don't have an example, but have a look at the JCO API documentation. Here is an extract:


        public void addInfo(java.lang.String name,
                            int type,
                            int charlength,
                            int length,
                            int offset,
                            int decimals,
                            java.lang.String sdefault,
                            java.lang.String description,
                            int flags,
                            java.lang.Object tab_meta,
                            com.sap.mw.jco.IExtendedFieldMetaData extended)Adds a new field descriptor to the meta data object.
        Note: if the backend is an unicode enabled system use 
        addInfo(String name, int type, int charlength, int length, int offset, int decimals, String sdefault, String description, int flags, Object tab_meta, IExtendedFieldMetaData extended)
        Otherwise the parameters based on character data types cannot be interpreted correctly. Note: The preffered way to create meta data should be to use JCO.Repository. In this case the meta data fetched by Repository is correct independent on having unicode and non unicode backend.
        name - Field name for identifying this data field
        type - Data field type
        charlength - Data field length in character units
        length - Data field internal length in bytes
        offset - Data field offset in the internal JCO data buffer
        decimals - Data field number of decimals (only necessary for the data types JCO.TYPE_BCD and JCO.TYPE_FLOAT)
        sdefault - Data Field default value
        description - Description of data field
        flags - Bit-vector for additional attributes of the field. The vector can be ORed together from
        Flag  Description  
        IMPORT_PARAMETER  The field is an import parameter 
        EXPORT_PARAMETER  The field is an export parameter 
        OPTIONAL_PARAMETER  The field is optional parameter  
        INACTIVATE_PARAMETER Only used for table parameter,
        indicating that the content of the table will not be sent to the server 
        tab_meta - Meta-data if the field is a complex field, i.e. structure or table, null otherwise. If this field is a structure or table object only the meta data of those objects will we copied not reference to the objects ! Use setValue(...) to actually set the container object.
        extended - extended meta data for this field or null if none available.
        See Also: 
        JCO.Repository "


        • Re: How to set JCO.Server to unicode
          Dick Coopee
          Currently Being Moderated

          Hi Octavian,

          I see what you are saying, but I'm not sure what sdefault should be set to or the IExtendedFieldMetaData.  I put in " " for the sdefault and null for IExtendedFieldMetaData.  I get the same results.  I tried searching for an example.  All the examples show structures being returned from R/3.  What I have are just input and output fields.

  • Re: How to set JCO.Server to unicode
    Hans-Peter Stoltzenberg
    Currently Being Moderated

    I'm having the same problem. I get a warning that "non-unicode metadata is used for communication with a unicode backend".  I've verified that in SM59, it is set to Unicode.  It is declared as

    fmeta.addInfo("REF_RECNVA_SOURCE",  JCO.TYPE_NUM, 20,   0,  0);

        fmeta.addInfo("REF_RECNVA_ORIGINAL",  JCO.TYPE_NUM, 20,   0,  0);

        fmeta.addInfo("RECNO_ROOT_ORIGINAL",  JCO.TYPE_NUM, 20,   0,  0);


    Not sure how to use the new method signature for addinfo to support unicode. Please help!

  • Re: How to set JCO.Server to unicode
    Pushkar Dhale
    Currently Being Moderated

    Hello ,


    If you want to make outbound RFC calls from a Unicode SAP system to a JCo server instance, the server must be set up using the additional serverProperty


    You also need to set the unicode option for your RFC destination in transaction SM59 in transaction SM59 (tab page MDMP_Unicode).

    You can create Unicode Compatible JCOSERVER01  as follows


    static public class Server extends JCO.Server {


        public Server(String gwhost, String gwserv, String progid, boolean isUnicode, IRepository repository)



          this.setProperty("jco.server.unicode", isUnicode?"1":"0");



    for more details use following link :





    Pushkar Dhale

  • Re: How to set JCO.Server to unicode
    Daniel Becker
    Currently Being Moderated



    we are currently switching SAP systems to newer versions - and therefore to unicode. We are still using JCo 2.1.8 as a migration to 3.x is currently not in the budgets.


    We set "jco.server.unicode=1", we used "addInfo" with differing byte and length values for Strings and Chars, we set SAP System JCo Destination to unicode in sm59.


    Still we recieve "using non-unicode metadata with unicode back-end" and SAP.Server does not recieve any data. Where can we take a look? What are we doing wrong?


    By the way: we are not using JCo.Repository but a derived class from "JCo.BasicRepository" - Could that be a problem?


    Best Regards