How to download jco, for using in a test sap system?

Hello,
at the moment i am trying to program with java a connection to a sap test system (from the book abap objects).
Normally the conenction is built up by jco. My question is, because i haven´t got a login to the service marketplace,
is there any possibility to download and use jco for my test connection? I only try it for education.
Thank you very much
Bye

Hi GLM,
i just used the example from the jco package,
which i downloaded from sap service marketplace.
(I have changed the sap poperties).
With the jco 2 it works perfect. Only with new one
i got problems.
import java.io.File;
import java.io.FileOutputStream;
import java.util.Properties;
import java.util.concurrent.CountDownLatch;
import com.sap.conn.jco.AbapException;
import com.sap.conn.jco.JCoContext;
import com.sap.conn.jco.JCoDestination;
import com.sap.conn.jco.JCoDestinationManager;
import com.sap.conn.jco.JCoException;
import com.sap.conn.jco.JCoField;
import com.sap.conn.jco.JCoFunction;
import com.sap.conn.jco.JCoFunctionTemplate;
import com.sap.conn.jco.JCoStructure;
import com.sap.conn.jco.JCoTable;
import com.sap.conn.jco.ext.DestinationDataProvider;
public class StepByStepClient
    static String ABAP_AS = "ABAP_AS_WITHOUT_POOL";
    static String ABAP_AS_POOLED = "ABAP_AS_WITH_POOL";
    static String ABAP_MS = "ABAP_MS_WITHOUT_POOL";
    static
        Properties connectProperties = new Properties();
        connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "binmain");
        connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR,  "53");
        connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "000");
        connectProperties.setProperty(DestinationDataProvider.JCO_USER,   "JCOTEST");
        connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "JCOTEST");
        connectProperties.setProperty(DestinationDataProvider.JCO_LANG,   "en");
        createDataFile(ABAP_AS, "jcoDestination", connectProperties);
        connectProperties.setProperty(DestinationDataProvider.JCO_POOL_CAPACITY, "3");
        connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT,    "10");
        createDataFile(ABAP_AS_POOLED, "jcoDestination", connectProperties);
        connectProperties.clear();
        connectProperties.setProperty(DestinationDataProvider.JCO_MSHOST, "binmain");
        connectProperties.setProperty(DestinationDataProvider.JCO_R3NAME,  "BIN");
        connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "000");
        connectProperties.setProperty(DestinationDataProvider.JCO_USER,   "JCOTEST");
        connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "JCOTEST");
        connectProperties.setProperty(DestinationDataProvider.JCO_GROUP, "PUBLIC");
        connectProperties.setProperty(DestinationDataProvider.JCO_LANG,   "en");
        createDataFile(ABAP_MS, "jcoDestination", connectProperties);
    static void createDataFile(String name, String suffix, Properties properties)
        File cfg = new File(name+"."+suffix);
        if(!cfg.exists())
            try
                FileOutputStream fos = new FileOutputStream(cfg, false);
                properties.store(fos, "for tests only !");
                fos.close();
            catch (Exception e)
                throw new RuntimeException("Unable to create the destination file " + cfg.getName(), e);
    public static void step1Connect() throws JCoException
        JCoDestination destination = JCoDestinationManager.getDestination(ABAP_AS);
        System.out.println("Attributes:");
        System.out.println(destination.getAttributes());
        System.out.println();
        destination = JCoDestinationManager.getDestination(ABAP_MS);
        System.out.println("Attributes:");
        System.out.println(destination.getAttributes());
        System.out.println();
    public static void step2ConnectUsingPool() throws JCoException
        JCoDestination destination = JCoDestinationManager.getDestination(ABAP_AS_POOLED);
        destination.ping();
        System.out.println("Attributes:");
        System.out.println(destination.getAttributes());
        System.out.println();
    public static void step3SimpleCall() throws JCoException
        JCoDestination destination = JCoDestinationManager.getDestination(ABAP_AS_POOLED);
        JCoFunction function = destination.getRepository().getFunction("STFC_CONNECTION");
        if(function == null)
            throw new RuntimeException("BAPI_COMPANYCODE_GETLIST not found in SAP.");
        function.getImportParameterList().setValue("REQUTEXT", "Hello SAP");
        try
            function.execute(destination);
        catch(AbapException e)
            System.out.println(e.toString());
            return;
        System.out.println("STFC_CONNECTION finished:");
        System.out.println(" Echo: " + function.getExportParameterList().getString("ECHOTEXT"));
        System.out.println(" Response: " + function.getExportParameterList().getString("RESPTEXT"));
        System.out.println();
    public static void step3WorkWithStructure() throws JCoException
        JCoDestination destination = JCoDestinationManager.getDestination(ABAP_AS_POOLED);
        JCoFunction function = destination.getRepository().getFunction("RFC_SYSTEM_INFO");
        if(function == null)
            throw new RuntimeException("BAPI_COMPANYCODE_GETLIST not found in SAP.");
        try
            function.execute(destination);
        catch(AbapException e)
            System.out.println(e.toString());
            return;
        JCoStructure exportStructure = function.getExportParameterList().getStructure("RFCSI_EXPORT");
        System.out.println("System info for " + destination.getAttributes().getSystemID() + ":\n");
        for(int i = 0; i < exportStructure.getMetaData().getFieldCount(); i++)
            System.out.println(exportStructure.getMetaData().getName(i) + ":\t" + exportStructure.getString(i));
        System.out.println();
        //JCo still supports the JCoFields, but direct access via getXX is more efficient as field iterator
        System.out.println("The same using field iterator: \nSystem info for " + destination.getAttributes().getSystemID() + ":\n");
        for(JCoField field : exportStructure)
            System.out.println(field.getName() + ":\t" + field.getString());
        System.out.println();
    public static void step4WorkWithTable() throws JCoException
        JCoDestination destination = JCoDestinationManager.getDestination(ABAP_AS_POOLED);
        JCoFunction function = destination.getRepository().getFunction("BAPI_COMPANYCODE_GETLIST");
        if(function == null)
            throw new RuntimeException("BAPI_COMPANYCODE_GETLIST not found in SAP.");
        try
            function.execute(destination);
        catch(AbapException e)
            System.out.println(e.toString());
            return;
        JCoStructure returnStructure = function.getExportParameterList().getStructure("RETURN");
        if (! (returnStructure.getString("TYPE").equals("")||returnStructure.getString("TYPE").equals("S"))  )  
           throw new RuntimeException(returnStructure.getString("MESSAGE"));
        JCoTable codes = function.getTableParameterList().getTable("COMPANYCODE_LIST");
        for (int i = 0; i < codes.getNumRows(); i++)
            codes.setRow(i);
            System.out.println(codes.getString("COMP_CODE") + '\t' + codes.getString("COMP_NAME"));
        codes.firstRow();
        for (int i = 0; i < codes.getNumRows(); i++, codes.nextRow())
            function = destination.getRepository().getFunction("BAPI_COMPANYCODE_GETDETAIL");
            if (function == null)
                throw new RuntimeException("BAPI_COMPANYCODE_GETDETAIL not found in SAP.");
            function.getImportParameterList().setValue("COMPANYCODEID", codes.getString("COMP_CODE"));
            function.getExportParameterList().setActive("COMPANYCODE_ADDRESS",false);
            try
                function.execute(destination);
            catch (AbapException e)
                System.out.println(e.toString());
                return;
            returnStructure = function.getExportParameterList().getStructure("RETURN");
            if (! (returnStructure.getString("TYPE").equals("") ||
                   returnStructure.getString("TYPE").equals("S") ||
                   returnStructure.getString("TYPE").equals("W")) )
                throw new RuntimeException(returnStructure.getString("MESSAGE"));
            JCoStructure detail = function.getExportParameterList().getStructure("COMPANYCODE_DETAIL");
            System.out.println(detail.getString("COMP_CODE") + '\t' +
                               detail.getString("COUNTRY") + '\t' +
                               detail.getString("CITY"));
        }//for
     * this example shows the "simple" stateful call sequence. Since all calls belonging to one
     * session are executed within the same thread, the application does not need
     * to take care about the SessionReferenceProvider. MultithreadedExample.java
     * illustrates the more complex scenario, where the calls belonging to one session are
     * executed from different threads.
     * Note: this example uses Z_GET_COUNTER and Z_INCREMENT_COUNTER. The most ABAP systems
     * contain function modules GET_COUNTER and INCREMENT_COUNTER, that are not remote enabled.
     * Copy these functions to Z_GET_COUNTER and Z_INCREMENT_COUNTER (or implement as wrapper)
     * and mark they remote enabled
     * @throws JCoException
    public static void step4SimpleStatefulCalls() throws JCoException
        final JCoFunctionTemplate incrementCounterTemplate, getCounterTemplate;
        JCoDestination destination = JCoDestinationManager.getDestination(ABAP_MS);
        incrementCounterTemplate = destination.getRepository().getFunctionTemplate("Z_INCREMENT_COUNTER");
        getCounterTemplate = destination.getRepository().getFunctionTemplate("Z_GET_COUNTER");
        if(incrementCounterTemplate == null || getCounterTemplate == null)
            throw new RuntimeException("This example cannot run without Z_INCREMENT_COUNTER and Z_GET_COUNTER functions");
        final int threadCount = 5;
        final int loops = 5;
        final CountDownLatch startSignal = new CountDownLatch(threadCount);
        final CountDownLatch doneSignal = new CountDownLatch(threadCount);
        Runnable worker = new Runnable()
            public void run()
                startSignal.countDown();
                try
                    //wait for other threads
                    startSignal.await();
                    JCoDestination dest = JCoDestinationManager.getDestination(ABAP_MS);
                    JCoContext.begin(dest);
                    try
                        for(int i=0; i < loops; i++)
                            JCoFunction incrementCounter = incrementCounterTemplate.getFunction();
                            incrementCounter.execute(dest);
                        JCoFunction getCounter = getCounterTemplate.getFunction();
                        getCounter.execute(dest);
                        int remoteCounter = getCounter.getExportParameterList().getInt("GET_VALUE");
                        System.out.println("Thread-" + Thread.currentThread().getId() +
                                " finished. Remote counter has " + (loops==remoteCounter?"correct":"wrong") +
                                " value [" + remoteCounter + "]");
                    finally
                        JCoContext.end(dest);                   
                catch(Exception e)
                    System.out.println("Thread-" + Thread.currentThread().getId() + " ends with exception " + e.toString());
                doneSignal.countDown();
        for(int i = 0; i < threadCount; i++)
            new Thread(worker).start();
        try
            doneSignal.await();
        catch(Exception e)
    public static void main(String[] args) throws JCoException
        step1Connect();
        step2ConnectUsingPool();
        step3SimpleCall();
        step4WorkWithTable();
        step4SimpleStatefulCalls();
Edited by: Unicast on Sep 14, 2008 4:33 PM

Similar Messages

  • Hi i dont have a wifi broadband n i just bought the new ipod touch can anyone tell me how 2 download apps for my ipod without using wifi

    hi i dont have a wifi broadband n i just bought the new ipod touch can anyone tell me how 2 download apps for my ipod without using wifi

    Download the apps on your syncing computer and then sync to the iPod. Note that you can only sync apps for the one syncing computer you use with the iPod. You can manage music and videos among different computer.

  • HT1730 How do I download Rosetta for use in 10.5.8 ppc?

    How do I download Rosetta for use in ppc 10.5.8?

    Not so. Rosetta is a PPC emulator for Intel Macs running Intel versions of OS X up through Snow Leopard. Rosetta is not an Intel software emulator. There is no such animal for PPC machines other than Windows emulators and other non-Apple hardware emulators such as Atari.

  • How to download and upload TROY ECF fonts with SAP for check printing

    Can anyone explain how to download and upload TROY ECF fonts with SAP.I have downloaded  ECF font from TROY wesite as TTF format. but it is not getting upload with SAP.please kindly help me on this issue..

    Hi,
    You can use the SE73 Transaction and upload your TTF files.
    Please check the link here for more details:
    http://help.sap.com/saphelp_nw70/helpdata/en/36/5b3438fd263402e10000009b38f8cf/frameset.htm
    Regards,
    Siddhesh

  • How to download SDK for UPK 11.1.0 ?

    Hi All,
    Can anybody please guide me for how to download SDK for UPK 11.1.0 ?
    I tried to search this. I could able to search "In-Application Support SDK".
    But couldn't search SDK for developer.
    Also if available, which IDE can be used for coding purpose? Can we use Eclipse or NetBeans?
    Thank you in advance.
    Regards,
    Shital.

    In order to clarify any details regarding your licenses please contact the local Oracle Partner Business Center at one of the following contacts
    Email     [email protected]    
    Phone 1.800.323.7355    
    Hours of Operation: 6:30 am (PST) - 6:00: pm (PST) Monday to Friday excluding public holidays.
    More details are also available in the note:
    Who to Contact for Sales and New License Inquiries or Purchase New Product Inquiries (Doc ID 1226624.1)

  • How to download FaceTime for iPhone 4s?

    How to download FaceTime for iPhone 4s? I m using phone in UAE

    Almirh wrote:
    I have the iPhone 4S and it's on iOS 7 and it don't have facetime at all on it like its suppose to and I live in the USA
    Where did you purchase the device?

  • How to download presets for adobe softwares in CC

    How to download presets for adobe softwares in CC

    Arunesh please see http://forums.adobe.com/index.jspa?promoid=JZEFM for a list of the available forums.  I would recommend posting to the forum specific for the software title you are attempting to load presets.

  • HT2693 how to download skype for iphone 3g

    iphone mb489so how to download skype for iphone 3g?

    You're not going to be able to run Skype on your phone. Skype requires iOS 4.3 or better. The iPhone 3G can only support up to iOS 4.2.1.

  • How to download skype for ipad mini

    Please help me how to download skype for ipad mini..thanks!

    Access the App Store, search for Skype, download.

  • How to download jsk for webcenter sites 11.1.1.8

    How to download jsk for webcenter sites 11.1.1.8

    well you must have a paid account in oracle support.
    -Login to My Oracle Support (support.oracle.com).
    -Click the Patches & Updates tab
    -Search by "Product or Family" and enter "Oracle WebCenter Sites" for the Product.
    -Select "Sites 11GR1" for the Release and click Search.
    -You will see "Oracle WebCenter Sites 11gR1 Jump start Kit (Patch)"

  • How to downloads tally for mac book pro

    how to downloads tally for mac book pro

    What are you asking??  There really isn't anything that we need to get you any help.  More information can help us help you

  • HOW INSTALL ENCORE CS6 FOR USE IN PREMIERE PRO CC ?

    SOY AFICIONADO A LA EDICICION Y POSTPRODUCCION DE VIDEOS, Y ME HE ANIMADO A SUSCRIBIRME A CREATIVE CLOUD, PERO NO CONSIGO  INSTALAR ENCORE CS6 PARA PODER UTILIZARLO EN PREMIERE PRO CC, PIDO AYUDA A VER SI ALGUIEN PUDE AYUDARME, GRACIAS.

    Thanks a lot, it works perfectly.
    El 27/11/2014, a las 20:15, Ann Bens <[email protected]> escribió:
    HOW INSTALL ENCORE CS6 FOR USE IN PREMIERE PRO CC ?
    created by Ann Bens <https://forums.adobe.com/people/Ann+Bens> in Premiere Pro - View the full discussion <https://forums.adobe.com/message/6967716#6967716>
    https://forums.adobe.com/servlet/JiveServlet/downloadImage/2-6967716-699851/EncoreCS6-14.png <https://forums.adobe.com/servlet/JiveServlet/showImage/2-6967716-699851/EncoreCS6-14.png>
    If the reply above answers your question, please take a moment to mark this answer as correct by visiting: https://forums.adobe.com/message/6967716#6967716 and clicking ‘Correct’ below the answer
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
    Please note that the Adobe Forums do not accept email attachments. If you want to embed an image in your message please visit the thread in the forum and click the camera icon: https://forums.adobe.com/message/6967716#6967716
    To unsubscribe from this thread, please visit the message page at , click "Following" at the top right, & "Stop Following"
    Start a new discussion in Premiere Pro by email <mailto:[email protected]> or at Adobe Community <https://forums.adobe.com/choose-container.jspa?contentType=1&containerType=14&container=33 81>
    For more information about maintaining your forum email notifications please go to https://forums.adobe.com/thread/1516624 <https://forums.adobe.com/thread/1516624>.

  • How to Download sapgui for linux

    Hi
    How to Download sapgui for linux (Red hat 5.3)
    and how to install sapgui on red hat linux
    Thanks in Advance
    Regards
    Afsn

    Hi,
    As Bobby said, you need to install the SAPGUI for JAVA to access the SAP R/3 from your linux machine. The software is available in the following path,
    https://service.sap.com/swdc
    --> Installations and Upgrades
    --> Entry by Application Group
    --> SAP Frontend Components
    --> SAP GUI FOR JAVA
    --> SAP GUI FOR JAVA 7.20
    --> Installation
    The follwoing links gives an idea on how to install the SAP GUI for JAVA in Linux machines.
    [Link1|http://www.linuxquestions.org/questions/linux-software-2/how-to-run-sap-sapgui-on-linux-system-478821/]
    [Link2|http://sapbasis.wordpress.com/2007/08/22/installation-and-configuration-of-sapgui-for-java-on-linux/]
    Regards,
    Varadharajan M

  • How to download  iwork for mac os x lion for free?

    how to download  iwork for mac os x lion for free?

    The iWork apps are not freeware, and they no longer have Trial Versions as they did before the appearance of the Mac App Store. But, they are so inexpensive that they really don't need trial versions, and they are much more sophisticated than what we would expect to get at no cost. Once you purchase an iWork app on one Mac device, you can download additional copies for your other computers at no additional charge.
    Jerry

  • How to download photoshop for free to my computer window xp

    how to download photoshop for free to my computer window xp

    Photoshop CC is not supported on Windows XP.
    Here is the system requirement for Photoshop CC: http://helpx.adobe.com/x-productkb/policy-pricing/system-requirements-photoshop.html
    You can still download photoshop CS6 on XP.
    Try the following steps for downloading PS CS6:
    Download Adobe application Manager from: http://www.adobe.com/appsmanager/index.html
    Launch adobe application manager.
    Photoshop CS6 should be shown as available to install.
    Let us know if you need any other info.
    Regards
    Pragya

Maybe you are looking for

  • Creating a storage repository

    Hi, I'm having an issue creating a storage repository in VM manager 3.0.1. I have 2 blades connected via fiber channel to SAN storage. When discovering the server, the storage gets detected automatically as an "unmanaged fiber channel array". I am ho

  • Assign Valuation Area to work order type

    I  have created new order types but i am getting a stop error saying the valuation area is not defined when i put in the planning plant on the initial create work order screen. Can anyone advise of a solution? Thanks,

  • Starting Weblogic 6.1 failure extracting WAR classes

    Hi there, I'm getting several error-messages when starting my weblogic 6.1 saying: <Jan 10, 2002 9:07:32 AM CET> <Error> <HTTP> <[WebAppServletContext(4057696,cert ificate,/certificate)] failure extracting WAR classes java.io.IOException: Permission

  • Replacement HH being sent out. Told it wouldn't be...

    Hi everyone, I'm on infinity with the infinity HH 2.0. Encountered issues of wireless dropping, on average up to 5 times a day... for months! I've used other routers and never encountered the same amount of problems as I have with this. Anyway. After

  • E 72 gps mute?

    Hi, I have a e72 nokia running gps with no sound.. no words. Volumen is full but no sound.... What can I do? regards