Can we use JCo connection with non-Web Dynpro J2EE project in NW

With Web Dynpro, we have the RFC wizard to call RFCs using JCo connection.  I am wondering, if I create a J2EE project in NW development studio, can I and how to use JCo connection to call RFCs?
Thanks.

yes, of course.
Add jar sapjco.jar then
import com.sap.mw.jco.*;
public class Bapi1 extends Object {
   JCO.Client mConnection;
   JCO.Repository mRepository;
   public Bapi1() {
      try {
         // Change the logon information to your own system/user
         mConnection =
            JCO.createClient("001", // SAP client
              "<userid>", // userid
              "****", // password
              null, // language
              "<hostname>", // application server host name
              "00"); // system number
        mConnection.connect();
        mRepository = new JCO.Repository("SAPJCo", mConnection);
      catch (Exception ex) {
        ex.printStackTrace();
        System.exit(1);
      JCO.Function function = null;
      JCO.Table codes = null;
      try {
         function = this.createFunction("BAPI_COMPANYCODE_GETLIST");
         if (function == null) {
           System.out.println("BAPI_COMPANYCODE_GETLIST" +
                              " not found in SAP.");
           System.exit(1);
         mConnection.execute(function);
         JCO.Structure returnStructure =
           function.getExportParameterList().getStructure("RETURN");
         if (! (returnStructure.getString("TYPE").equals("") ||
                returnStructure.getString("TYPE").equals("S")) ) {
           System.out.println(returnStructure.getString("MESSAGE"));
           System.exit(1);
         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"));
      catch (Exception ex) {
        ex.printStackTrace();
        System.exit(1);
      try {
        codes.firstRow();
        for (int i = 0; i < codes.getNumRows(); i++, codes.nextRow()) {
          function = this.createFunction("BAPI_COMPANYCODE_GETDETAIL");
          if (function == null) {
            System.out.println("BAPI_COMPANYCODE_GETDETAIL" +
                               " not found in SAP.");
            System.exit(1);
     function.getImportParameterList().
       setValue(codes.getString("COMP_CODE"), "COMPANYCODEID");
     function.getExportParameterList().
       setActive(false, "COMPANYCODE_ADDRESS");
     mConnection.execute(function);
     JCO.Structure returnStructure =
       function.getExportParameterList().getStructure("RETURN");
     if (! (returnStructure.getString("TYPE").equals("") ||
            returnStructure.getString("TYPE").equals("S") ||
            returnStructure.getString("TYPE").equals("W")) ) {
        System.out.println(returnStructure.getString("MESSAGE"));
     JCO.Structure detail =
       function.getExportParameterList().
       getStructure("COMPANYCODE_DETAIL");
     System.out.println(detail.getString("COMP_CODE") + '\t' +
                        detail.getString("COUNTRY") + '\t' +
                        detail.getString("CITY"));
  catch (Exception ex) {
    ex.printStackTrace();
    System.exit(1);
  mConnection.disconnect();
public JCO.Function createFunction(String name) throws Exception {
   try {
     IFunctionTemplate ft =
        mRepository.getFunctionTemplate(name.toUpperCase());
     if (ft == null)
       return null;
     return ft.getFunction();
   catch (Exception ex) {
     throw new Exception("Problem retrieving JCO.Function object.");
public static void main (String args[]) {
   Bapi1 app = new Bapi1();
Link: [http://help.sap.com/saphelp_nw04/helpdata/en/35/42e13d82fcfb34e10000000a114084/frameset.htm]

Similar Messages

  • Settings SLD and JCO connection for Java Web Dynpro

    Hi BI Gurus,
    I'm a Business Intelligence newbye and I'm a bit confused about Web Dynpro configurations.
    I try to execute, through Netweaver Developer Studio 7, a simple java Web Dynpro who call the standard Flight List BAPI.
    My configuration is: NW 2004s installed on BI server (with java instance and j2EE Server) and Flight List BAPI stored on R/3 ECC. 5 System in another server.
    Now, my doubt are:
    1) in SLD Data Supplier (J2EE Visual Admin on BI Server) CIM configuration, what are the connections parameter necessary?The BI host or R/3 host?
    2)if I set BW system parameters in SLD and in NWDS when I try to run my simple web dynpro an error occour This is the output:
    The initial exception that caused the request to fail, was:
       com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Failed to resolve JCO destination name 'WD_FLIGHTLIST_RFC_METADATA_DEST' in the SLD. No such JCO destination is defined in the SLD.
    Correction Hints
    Accessing the System Landsape Directory (SLD) failed. Depending on the concrete reason (see root cause) check the following:
    is the SLD Supplier in the J2EE engine configured correctly? See the SLD documentation for more details about the SLD and about how to configure it.
    are all JCO destinations maintained correctly? Use the preinstalled Web Dynpro Content Admin application to check/edit the destination. Use the Ping and Test functions of the Content Admin to verify that each destination is properly configured.
    Additional information about the System Landscape Directory and the Web Dynpro Content Admin can be found in the SAP Developer Network (SDN) and in the Online Help for the SAP Web Application Server (installed with SAP NetWeaver Developer Studio and available online).
    Note: the above hints are only a guess. They are automatically derived from the exception that occurred and therefore can't be guaranteed to address the original problem in all cases.
    3)where can I create new JCO connections?What are the requirements settings?
    I am always available for answers about the post!!
    Help me please!!
    Thanks thousand and sorry for my incorrect english!!

    Andrea,
    You can Create the JCo destination from Content Administrator. You must login as Administrator.
    use the link as
    http://<server>:<port>/webdynpro/welcome/Welcome.jsp, select Content Administator->Create JCo Destinations/Maintain JCo Destinations.
    Please have a look on the following links regarding creating/maintaining JCo destinations. The are usally asked questions regarding JCo destinations.
    Create JCo destinations:
    /message/4947478#4947478 [original link is broken]
    Creating JCO Destinations
    /message/5369333#5369333 [original link is broken]
    Rgs,
        Dni

  • Can I use RS232 library for RS485 communication? Alternatively, can I use NI Serial with non-NI 485 boards?

    Hi-
    I have successfully used RS232 library to communicate with one RS485 device.  I now have multiple devices using the same Rx and Tx lines.  Three of the 4 devices have their own dll and can communicate effectively despite each other.  My problem occurs when the one device I am talking to using the RS232 library now has to share the lines with the other devices.  Are there any ways around this? All I can think of is to see if I can use the NI Serial library commands with my non-NI PCIe card.  OR, buy the NI 485/422 card and use the NI Serial commands.  Any other suggestions? 
    Thanks.

    The fundamanetal difference between RS232 and RS485 is the ability to connect to multoiple devices. The devices also normally work in a "speak only when spoken to" mode and this is achieve by adding a device address in the protocol. The NI serial library is oblivious to most of this and doesn't care if it's RS232 or RS485. The problem with your 232 device is that it will speak everytime when any other device is adddressed, so you should make it comply to 485 standards. This can be done with RS232 to RS485 convertors. You can do a search on Google for this. The ones I use and have the least amount of problems with is either from Advantech (<http://www.advantech.com/products/search.aspx?keyword=RS-232#search> and <http://www.advantech.com/products/search.aspx?keyword=RS-232#search>) or BB Electronics. (<http://www.bb-elec.com/Products/Serial-Connectivity/Serial-Converters/Port-Powered-RS-232-to-RS-485-...>)
    Best Regards
    Jattie van der Linde
    Engineering Manager, Software & Automation
    TEL Magnetic Solutions Ltd

  • ERP2004: ESS JCO session handling in Web Dynpro apps?

    Hello,
    we run ESS/MSS Web Dynpro scenarios, running on WAS 6.40, SP12 in
    Enterprise Portal EP6 SP2 Patch 32. Our go live will be with > 1000 ESS users.
    1. When will the sessions in R/3 backend system be terminated by the
    Web Dynpro Application?
    How is the session handling in FPM (Floor Plan Manager) implemented?
    2. Are there any recommendations regarding the JCO connection settings
    in Web Dynpro Content Administrator (Maximum Pool Size, Maximum Connections,
    Connection Timeout, Maximum Wait Time) to reduce / optimize the load for the
    backend system? I found a documentation in SDN but it is not
    specific for ESS / MSS based on Web Dynpro.
    Background of questions above: The customer is worry about the load on
    SAP R/3 backend side: too much current users in the R/3 backend system,
    possibly bad performance etc. because the JCO sessions are open a long time.
    Are there any experiences with customers running productive ESS / MSS scenarios
    based on Web Dynpro?
    Thanks & Best regards,
    Daniel

    Hi,
    1. For best practices on JCO settings follow the tutorial below and do it accordingly for your no of users. YOu might have to do some trial and error procedure.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3103eb90-0201-0010-71af-be6f4a6f61d1
    2. For standards, security settings, cache management etc, SAP will give a TODO list after a remote audit of your project.
    regds,
    Sukanta Rudra

  • Adobe Flex 4 with ABAP web dynpro

    I currently am working with Flex 3 but wanted few features of Flex 4 for my project. Is there any way that I can use Flex 4 with ABAP web dynpro. I have tried using the 'Use Flex 3 compatibility mode' with 'merged into code' but this does not work. There is no data transfer happening. I see in the forums that this is not possible but all the posts are one year old. Just wanted to check if any new method is availabe.
    Kindly help.

    Hello,
    Flex 4 versions of the Islands SWC libraries were delivered via Support Packages(See Note 1614265).
    http://scn.sap.com/thread/3186643
    Best Regards,
    Tarun

  • Can I use a Power PC non intel Mac Mini as an external HD with my iMac 3.06

    Can I use a Power PC non intel Mac Mini as an external HD with my iMac 3.06 Intel Core Duo
    I can't figure out how to get this to work. Is it possible?

    WildBull wrote:
    Will it work if I connect via usb instead of firewire?
    No. There is no "USB Target Disk Mode".
    Just so we're clear, when you start your Mac mini in FireWire Target Disk Mode (TDM - holding T on startup), do you see a FireWire icon on the Mac mini's display? IIRC, it's not required that the Mac mini be connected to a display for TDM, but it would help diagnose whether or not the mini is actually starting in this mode.

  • I am trying to get an answer to whether or not I can successfully use Time Machine with an external HDD connected to an airport extreme?  Some forums say yes, some say no.

    I am trying to get an answer to whether or not I can successfuly use Time Machine with an external HDD connected to an airport extreme.  Some forums say yes, some say no.  I'm also curious about formatting the hard drive to work both on my wife's MacBook Pro and my PC.  Any help would definitely be appreciated.

    You may be going on a recollection, that I share, that at one time Apple stated this would be possible:
    In fact, Apple’s Time Machine Web page touted this very capability as recently as last Tuesday, as you can see from Google’s October 16 cache of the page
    Effortless meets wireless. With a hard disk connected to your AirPort Extreme Base Station, all the Macs in your house can use Time Machine to back up wirelessly. Simply select your AirPort Disk as the backup disk for each computer and the whole family can enjoy the benefits of Time Machine.
    But if you look at the current Time Machine page on Apple’s Web site, that text is nowhere to be found.
    That was a long time ago, it has never been officially implemented, and at present they specifically say it cannot be done.
    In summary, it may work, but probably won't, and even if it does it may not be reliable.
    Reference:
    Disks that can be used with Time Machine
    Time Machine can’t back up to an external disk connected to an AirPort Extreme, or...
    and
    Mac OS X v10.5: Time Machine doesn't back up to AirPort Extreme AirPort Disks

  • Can I use my iPad with airport extreme to retrieve files from a USB connected hard drive?

    Can I use my iPad with airport extreme to retrieve files from a USB connected hard drive?

    Yes, I believe so. Please check out the NetPortal app. I don't have an iPad, but I use it on my iPod Touch to access files on my Time Capsule. It is available from the iTunes App Store.

  • Can i use apple tv with my dish sat equipment and is it hard to connect

    can i use apple tv with my dish sat equipment.. how hard will it to connect?? what accesories to I need?? Will it find my wireless or do i need to enter wireless info??

    No, Apple TV connects directly to your TV. It's as simple as connecting via HDMI and then following the on scren instructions. It will find your networks but you will need to enter your password when setting it up.

  • After entering the Wlan password I can't use the „connect" button. The button is deactivated. Did somebody have a solution? I have an iPad 3 with IOS 8.0.2.

    After entering the Wlan password I can’t use the „connect“ button. The button is
    deactivated. Did somebody have a solution? I have an iPad 3 with IOS 8.0.2.

    Your iPhone's iOS must be same or newer than the one in backups. In your case it is older so you need to update your iPhone and then recover it with backup.

  • Tried my k3772-z modem to connect macbook air to internet and got the message: you can't use this application with this version of mac os x. Is there a setting that needs to be changed?

    Tried my k3772-z modem to connect macbook air to internet and got the message: you can't use this application with this version of mac os x. Is there a setting that needs to be changed?

    I can't help you with a direct answer.  For third-party devices you should contact the vendor (Vodafone). 
    If you have an iPhone (or an Android phone with hot-spot capability) you can use that to connect to the Internet without paying for a separate cellular service.

  • Identity SSO API with non-web based appilcations

    hi,
    i can appreciate hwo this works with cookies etc for web based applications that use the api or one of the agents on apache etc.
    but how does it go with non web based java and say windows applications?
    can anyone point me to some docs?
    thanks

    I don't work for Sun but here are my thoughts
    1. Yes, if you don't want to use the AM SDK then the
    XML auth service is the way to go.
    2 & 3. dunno
    4. I think if you pass around the SSOToken ID
    generated by AM then any application can issue a SAML
    query to see if the session is still valid and get
    identity/auth attributes back
    5. I think SAML 2.0 supports authentication and
    single signoff
    6. If you are doing a lot of thick client apps you
    should use kerberos instead of AM web based
    Authentication. AM supports kerberos authentication,
    most modern browsers support SPEGNO for passing
    credentials to web server, AD supports Kerberos, and
    even Solaris 10 comes with a free KDC built into the
    OS. There is plenty of documentation around kerberos
    and the JDK out of the box supports GSS-API for
    Kerberos authenticationThank you for your feedback.
    We looked at the use of kerberos as well, but this is not really an option as we are dealing with fat clients installed on desktops of clients. So these desktops do not fall within our span control (multiple domain controllers etc.).
    Regards,
    Thomas

  • Exceptions in Flights Webdynpro using JCO Connection

    I followed all the steps that are in the help for creating a webdynpro accessing ABAP BAPI calls and
    Flights webdynpro using JCO Connection,
    Carried out,,
    ===================
    1) All necessary codings.
    2) Deploying the application.
    3) SLD .
    4) JCO Connections to model data and meta data.
    5) At the time of running the application ,, getting the stack trace errors like this,,
    Web Dynpro product information:
    Product: null, Vendor: SAP AG, Version: null, Build ID: 6.3003.00.0000.20031125134518.0000, Build Date: Tue Dec 14 19:17:19 GMT+05:30 2004
    Error stacktrace:
    java.lang.NullPointerException
         at com.sap.dictionary.runtime.ProviderFactory$PhysicalBackendProviderKey.hashCode(ProviderFactory.java:131)
         at java.util.HashMap.hash(HashMap.java:261)
         at java.util.HashMap.get(HashMap.java:317)
         at com.sap.dictionary.runtime.ProviderFactory.internalGetProvider(ProviderFactory.java:227)
         at com.sap.dictionary.runtime.ProviderFactory.getProvider(ProviderFactory.java:178)
         at com.sap.dictionary.runtime.DdDictionaryPool.getDictionary(DdDictionaryPool.java:53)
         at com.sap.dictionary.runtime.DdBroker.getDataType(DdBroker.java:137)
         at com.sap.dictionary.runtime.DdBroker.getStructure(DdBroker.java:201)
         at com.sap.tc.webdynpro.services.datatypes.core.DataTypeBroker.getStructure(DataTypeBroker.java:290)
         at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:743)
         at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:751)
         at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:751)
         at com.sap.tc.webdynpro.progmodel.context.Node.init(Node.java:215)
         at com.sap.tc.webdynpro.progmodel.context.Context.init(Context.java:36)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:177)
         at com.sap.tc.webdynpro.progmodel.controller.Component.getCustomControllerInternal(Component.java:359)
         at com.sap.tc.webdynpro.progmodel.controller.Component.getMappableContext(Component.java:300)
         at com.sap.tc.webdynpro.progmodel.controller.Component.getMappableContext(Component.java:328)
         at com.sap.tc.webdynpro.progmodel.context.MappingInfo.init(MappingInfo.java:132)
         at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:736)
         at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:751)
         at com.sap.tc.webdynpro.progmodel.context.Node.init(Node.java:215)
         at com.sap.tc.webdynpro.progmodel.context.Context.init(Context.java:36)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:177)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:513)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.bind(ViewManager.java:371)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:528)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.bindRoot(ViewManager.java:395)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.init(ViewManager.java:113)
         at com.sap.tc.webdynpro.progmodel.view.InterfaceView.initController(InterfaceView.java:40)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:178)
         at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.displayToplevelComponent(ClientComponent.java:133)
         at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:347)
         at com.sap.tc.webdynpro.clientserver.task.Task.createApplication(Task.java:177)
         at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:485)
         at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:48)
         at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:236)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:137)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:100)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:37)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:363)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:222)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:301)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:682)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:220)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:94)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:142)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
         at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

    Hi Kishore
      Going by the error, there is some attribute which does not have a value at runtime. Hence you must be getting the Null Pointer Exception.
    Can you let me know the following so that i could be able to help you further.
    1. Name of the SLD connections. Have you tested them
    2. Where are you making a call to the BAPI. Is it inside the wdDoInit() method.
    3. How are you passing the parameters to the BAPI_FLIGHT_GETLIST.
    I have done this example and there is no problem. If you let me know the above points i would be able to help you further.
    regards
    Ravi

  • I cannot open my Yahoo Mail but everything else is OK.  When I click Yahoo Mail Icon, I get this error message "Safari Cannot open this page.  Safari can not establish secure connection with Yahoo Mail.

    I cannot open my Yahoo Mail but everything else is OK.  When I click Yahoo Mail Icon, I get this error message "Safari Cannot open this page.  Safari can not establish secure connection with Yahoo Mail.

    It sounds as though a script on the site, or an advertisement, is not working quite right...
    When you have a problem with one particular site, a good "first thing to try" is clearing your Firefox cache and deleting your saved cookies for the site.
    (1) Bypass Firefox's Cache
    Use Ctrl+Shift+r to reload the page fresh from the server.
    (You also can clear Firefox's cache completely using:
    orange Firefox button ''or'' Tools menu > Options > Advanced
    On the Network mini-tab > Cached Web Content : "Clear Now")
    (2) Remove the site's cookies using either of these. Save any pending work first.
    While viewing a page on the site:
    * right-click and choose View Page Info > Security > "View Cookies"
    * Alt+t (open the classic Tools menu) > Page Info > Security > "View Cookies"
    Then try reloading the page. Does that help?

  • Can we use our ipods with other music services?

    I have not been able to get into the music store for close to 3 weeks now, I have been round and round with these discussion boards and articles and unanswered emails to Apple... I want to leave and go with rhapsody or someone else, BUT can I use my ipod with these sites or does it HAVE to be Itunes??

    a service like itunes is subscripiton based is it not?
    No, the iTunes Music Store is not a subscription. It's a single-time pay; once you buy a track, you own it forever. Subscription sites are ones where you pay every month (or whatever) to listen to the tracks they make available. If you stop paying, you lose access to all the tracks.
    And if you pay for a song, why wouldnt you be able to burn it onto a cd, or do they just let you put it on your pc?
    It depends on the site. Not all allow you to burn audio CDs, even if you pay outright for the track. None of the subscription services allow burning to audio CD.
    And do you mean napster or bearshare sites?
    Napster yes. Bearshare is a Gnutella client which is just another P2P network like Limewire, and similarly consists mostly of pirated tracks, viruses, worms and trojans.
    helful as eveyone has been, none of these solutions has fixed the problem!
    Again, sorry, but as I said, you didn't answer the most important questions. For instance, you said you were using a corporate network, but you never said whether or not you'd addressed the issue with your network administrators, something that Toonz asked you two or three times. If your company's firewall is blocking the addresses and ports needed to connect to the iTMS, there's nothing you nor Apple can do to fix the problem.

Maybe you are looking for