Java Architecture

The Java back end uses classes of type SAPObject to represent data objects sent to and from the client. Most of these classes are POJOS (Plain Old Java Objects), meaning they store data in fields, provide accessory/mutator methods, and know how to construct themselves when told to by other code.

SAPObjects

SAPObjects can be composed of other SAPObjects stored as arrays of SAPObjects (e.g., Notifications have NotificationItems, etc). Since fetch BAPIs will now bring down child objects as well, the logic will populate the children using a single BAPI call without the need for read steps.

StepHandler

Stephandler classes provide the calling interface to classes subclassing the Agentry Java API (steplets, data tables, complex tables). Methods in StepHandler classes should be static. StepHandler methods also provide an interface for JUnit test suites.

All of this metadata is encapsulated in the SAPObject class rather than in an external file.

BAPI

The BAPI class encapsulates all of the BAPI processing needed by the Java back end. It is abstract because there are specific kinds of BAPIs:

  • FetchBAPI: FetchBAPIs are the type of BAPIs that create SAPObjects from the exchange process. The SAPObjects are then parsed by Agentry for use on the client.
  • DataTableBAPI
  • ComplexTableBAPI
  • TransactionBAPI: TransactionBAPIs take an Agentry transaction on the client and turn it into one or more JCO.Tables, then run the BAPI passing the tables in order to update SAP.

The BAPI objects that the code will use will be subclasses of FetchBAPI, TransactionBAPI, DataTableBAPI or ComplexTableBAPI. Developers need to write these BAPI classes to call the BAPIs to do the things that the “application” needs to do. A developer-written BAPI is a specific ABAP function call for a particular application (i.e., fetch all work orders for a user, send up a locally added notification, etc.).

Note that there is not necessarily a one-to-one correspondence between BAPI classes and ABAP function names (e.g. /SYCLO/MM_DOPHYSINVDOC_GET).

BAPI classes do the following:

  • Create themselves out of the JCO.Repository when necessary. This is just before they are about to be called, but a developer might make these poolable/cacheable.
  • Set input values in JCO.Table parameters, such as search ranges in the case of FetchBAPIs or transaction data in the case of TransactionBAPIs.
  • Are executed when called (Get the results or post the data to SAP).
  • Report exceptions and errors back to calling code. This includes reading return tables and parsing for error messages when necessary.