Entering content frame

Function documentation Calling Java Beans Locate the document in its SAP Library structure

Use

In connection with the Structure linkSAP J2EE Engine, which represents a Java server, from SAP Web AS 6.20 you can call Enterprise Java Beans (EJBs) from ABAP.

Integration

An SAP system uses HTTP to connect to the SAP J2EE engine and calls a servlet. The bean to be called is determined from the parameters specified with the call. Once it has been converted to type string, the return parameter is sent back to the SAP system via XML.

Prerequisites

Functions

You can display a list of all beans by executing program BSPJAVABEAN.

List of all Beans

This graphic is explained in the accompanying text

Column

Explanation

1

Name of the bean on the server

All beans that are available are listed together with their parameters.

2

Type of bean

A bean can be stateful, stateless or it can be an entity bean.

3

Name of the generated class (if available) and parameter name.

See also:

Function group EJB_CATALOG

Activities

To generate a corresponding class, proceed as follows:

  1. Double-click on a bean.
  2. This creates a corresponding proxy in the SAP system.

  3. Accept or change the default class names on the following screen:
  4. The class name consists of the prefix CL_EJB and the bean name.
    The name is truncated if the name is longer than 30 characters.
    You can also ignore the default name and assign another one to it.

    Caution

    Ensure that all classes that are generated in this context start with CL_EJB.

    Furthermore, you should ensure that the return parameter of a bean in the ABAP proxies that are generated is mapped to exporting parameters, due to technical restrictions.

  5. An HTTP client is generated in the class and the individual methods are implemented. Collections, hashes and so on are mapped to ABAP tables of type string.

For more information, refer to:

The FLUSH Method

Possible Return Values

Example

This example of a call generated an object, and then calls and sets parameters for methods:

data: mystring type ref to cl_ejb_simplestringbean,
      myinteger type ref to cl_ejb_simpleinteger,
      myint type i,
      myst type string.

call method mystring->returnstring
        exporting par0 = ‘a new string‘
        importing return = myst.

call method myinteger->returninteger
        importing return = myint.

call method cl_ejb_queue=>flush( ).

 

 

Leaving content frame