Skip to Content
This blog continues where the other blog left of and explains how to call the R/3 Back-end from our Flex application and show the results. The easiest way to call remote procedures from Flex is to use remote objects. Remote Object Service, one of the keys services in BlazeDS, enables Flex applications make remote procedure calls to the Java server via the AMF (Action Messaging Format) protocol. With the Remote Object Service, Flex applications could invoke methods from Java classes hosted on the server.  Alternatively you could decide to use SOAP calls, but as remote objects use AMF as its foundation instead of XML, remote objects work magnitudes  (http://www.jamesward.com/census/) faster. Thanks to the pure binary protocol, AMF is much more efficient than the chatty SOAP/XML calls. Especially when your Flex application loads large amounts of data, and speed/bandwidth is a priority, you should consider leveraging the Remote Object Service.  Once a method is called on the Java-end, it is easiest to use SAP’s Jco connector to make a call to the R/3 back-end. SAP recommends not to use Jco directly anymore though, but recommends calling it through the standard JRA (Java Resource Adapter) layer, which is part of the J2EE architecture.imageIn this blog, the example is built up around function module “BAPI_USER_GETLIST”, that retrieves a list of users from SAP R/3. h2. Set-up the SAP landscape  To be able to call RFC functions on a R/3 system from a CE system, a destination should be created that links the two. Destinations can be created using the netweaver administrator: {code:html}http://ce-server:50000/nwa/destinations{code}. A destination can be created using the following steps:  0.1. In the destinations application, click on the “Create” button to create a new destination. 0.2. In the first step of the destination Wizard, Enter a name (e.g. SAPR3) and use destination type “RFC” 0.3. In the connection and transport security settings step, check “No” for option “Load Balancing” (considering this is a development environment|), leave “Local system connection” unchecked, and enter the host details of the R/3 machine. Gateway host and service are not compulsory. 0.4. In the logon data step, enter the (technical) user credentials that you can access the R/3 system with. Destination name can be left empty. 0.5. Accept the defaults in the Specific Settings step and the destination will be created 0.6. To see whether the destination works, you could “Ping” the destination.  Because SAP recommends calling Jco’s through JRA, we need the necessary application resource in place that links to this destination. Application resources can be created using the Netweaver administrator as well: {code:html}http://sapce.phoqus.nl:50000/nwa/app-resources{code}, and can be created using the following steps:  Start the Application Resources application ({code:html}http://sapce.phoqus.nl:50000/nwa/app-resources{code}), select “JCA resources” from the “Show” drop-down box and select SAPJavaResourceAdapter15. This is the resource adapter that is able to link to R/3 systems through RFC. image0.1. Click on “Copy and Add New JCA Connection Factory” to create a connection factory for the R/3 system that you will be connecting to. 0.2. Enter the name of the connection factory in input-box “JNDI Name”, e.g. eis/SAPR3 0.3. Click on tab “Configuration properties” and add a new Property “DestinationName”. Set this property to the destination name you created earlier (SAPR3). The other parameters don’t need be filled in, as the destination that was just created contains them already. image
To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. L. van Hengel
    Hi Jan,

    Great and very detailed blog about Flex development on Netweaver. I always like it when people use other UI technologies to connect to SAP data and Flex has always been one of my favourite UI frameworks.

    Cheers,
    Leo

    (0) 
    1. Jan Penninkhof
      I like that fact that it is so easy to build a user-interface with Flex. And besides that, you won’t run into several browser-incompatibility issues, which increases development quite a bit. So I guess I’m as pro-flex as you are.

      Cheers,
      Jan

      (0) 
    1. Jan Penninkhof
      Thank you! I indeed planned to write a third blog about this subject explain how you can push information from your SAP back-end to the Flex application.

      Cheers,
      Jan

      (0) 

Leave a Reply