Class Descriptions

Team-Fly

The following sections outline the primary functions and useful aspects of the classes contained within the com.sap.rfc package.

com.sap.rfc.ComplexInfo

Every structure or table that is to be used in an RFC from Java must hold one instance of this class. This class stores information about objects, such as field type and length, and passes it to the RFC call. Remember that a ComplexInfo structure can be contained in another ComplexInfo structure.

The most common constructor for this class is

ComplexInfo(IfieldInfo[] fieldInfos, java.lang.String fieldname)

With this form you pass in an array of information about the fields contained within the structure, along with the name of the ComplexInfo object if it is a field of another ComplexInfo object. For stand-alone ComplexInfo structures, the name can be a null.

The following methods can be used with the structure:

  • clone(). Creates a copy of the ComplexInfo object.

  • equals(obj). Compares one ComplexInfo object to another. If the two objects are the same, the Boolean TRUE is returned.

  • findField(fieldname). Returns the index of the desired field. If the field is not found, then this method will throw the JRfcComplexDataNoSuchFieldException exception.

  • getcount(). Returns the number of objects in the ComplexInfo object.

  • getFieldInfo(fieldname or index). Returns an IFieldInfo object that describes the desired field.

  • getLength(). Returns the length of the ComplexInfo object.

  • isFilled(). Checks whether the ComplexInfo object is populated (you can use the constructor ComplexInfo(), which creates an empty object).

  • setComplexInfo(fieldInfos, FieldName). Populates the data in the object. This element is not a constructor but works the same way for the data population of the object.

com.sap.rfc.ConnectInfo

This class contains information about the connection to the SAP R/3 system. The constructor for this class, as shown below, has many parameters. Each of these parameters can also be viewed and set through methods.

ConnectInfo(Rfcmode, Destination, Hostname, System Number, Gateway Host, Gateway Service, System Name, Group Name, Message Server)
  • Rfcmode. The type of RFC connection, set to ConnectInfo.RFC_MODE_VERSION_3 for the current release.

  • Destination. The three-character SAP identifier for the system to which you want to connect.

  • Hostname. The name of the system that hosts the destination system. This name is usually specified with the full TCP address (or alias to this address).

  • System Number. The SAP number that identifies the destination.

  • Gateway Host. The name of the gateway host.

  • Gateway Service. The gateway service.

  • System Name. The SAP system name (used for load balancing only).

  • Group Name. The name of the specific group of application servers (again for load balancing only).

  • Message Server. The name of the message server (again for load balancing only).

Many methods are associated with the ConnectInfo class, most of which have to do with viewing or setting the variables just described. Each of the following Get methods has an associated Set method, which can be used to set the variables in the object.

  • addPropertyChangeListener(Listener). This method subscribes to changes for any of the ConnectInfo properties. An associated method is removePropertyChangeListener().

  • getDestination(). Returns the destination name of the target system.

  • getGatewayHost(). Returns the gateway host name.

  • getGatewayService(). Returns the gateway service.

  • getGroupName(). Returns the name of the specific group of application servers.

  • getHostName(). Returns the host machine name of the target system.

  • getLoadBalancing(). Returns the Boolean value of TRUE or FALSE, indicating whether load balancing is turned on or off.

  • getMsgServer(). Returns the host name of the message server.

  • getRfcMode(). Returns the current connection mode.

  • getSystemName(). Returns the SAP system name.

  • getSystemNo(). Returns the SAP system number.

com.sap.rfc.ConnectionEvent

The ConnectionEvent class supports the ConnectionListener interface and is instantiated when an RFC connection is opened or closed. The current release does not have any methods or variables.

com.sap.rfc.MethodEvent

The MethodEvent class supports the MethodListener interface. The constructor for this event takes on two forms. The first allows you to pass just the object that fires the event, and the other allows you to also pass the RfcModule used to perform the method call.

MethodEvent(object) or MethodEvent(object, rfcModule)

This class has two methods.

  • getRfcModule(). Returns the rfcModule property value.

  • setRfcModule(rfcModule). Sets the rfcModule property value.

com.sap.rfc.FactoryManager

This class manages factories for specific middleware. Methods for the com.sap.rfc.FactoryManager class include:

  • getAPIRelease(). Returns the release number of the common RFC interface for Java.

  • getMiddlewareInfo(). Returns the middlewareInfo property value, which can be used at run time to determine which middleware is being used.

  • getRfcConnectionFactory(). Returns a reference to a factory for IRfcConnections.

  • getRfcModuleFactory(). Returns a reference to a factory for IRfcModules.

  • getSimpleFactory() Returns a reference to a factory for ISimples.

  • getSingleInstance(). Returns a single instance of the class FactoryManager.

  • getStructureFactory() Returns a reference to a factory for IStructures.

  • getTableFactory(). Returns a reference to a factory for ITables.

  • setMiddlewareInfo(middlewareInfo). Sets the middlewareInfo property of the FactoryManager.

com.sap.rfc.MiddlewareInfo

The com.sap.rfc.MiddlewareInfo class holds the data for a specific type of middleware and must be instantiated before factories can be retrieved from the factory manager. This class contains constructors and methods that can implement a new middleware. Such development, however, is complicated and beyond the scope of this introductory book.

com.sap.rfc.SimpleInfo

The class implements the IFieldInfo interface and stores information for a simple data type. Each piece of data that will be either imported or exported through an RFC interface must be instantiated by the com.sap.rfc.SimpleInfo class.

The constructor for this class allows you to define the name, type, and length of the variable and the number of decimals (in the case of floating-point data). The format is as follows:

SimpleInfo(name, type, length, decimals)

Methods that can be used with the com.sap.rfc.SimpleInfo class include:

  • clone(). Creates a copy of an existing SimpleInfo object.

  • equals(object). Allows you to compare to field definitions. Remember that this method does not compare the value of the object, simply the data declaration.

  • getDecimals(). Returns the number of decimals defined.

  • getFieldName(). Returns the name of the variable.

  • getLength(). Returns the length of the variable.

  • getOffset(). Returns the offset of the variable.

  • getType(). Returns the type of variable. This type is the RFC data type and hence is an SAP data type.

  • isFilled(). Returns a Boolean TRUE or FALSE to indicate whether the object has been populated.

  • setOffset(offset). Sets the offset of the data field.

  • setSimpleInfo(name, type, length, decimals). This method is similar to the constructor and allows you to set the meta information for an object in a single call.

com.sap.rfc.SystemInfo

This class holds information related to the R/3 system to which you are connected. The information is returned through the RFC RFC_SYSTEM_INFO. To use this class you must define a list of system variables to be retrieved through the constructor; this list is an array of IField objects.

SystemInfo(systemParams[])

After the object has been constructed, you can use the method getItem (index or variable name) to retrieve the value of the variables. The method getItemCount() will return the number of variables used in the construction of this object.

com.sap.rfc.UserInfo

This class holds the user logon information. Through the constructor, you pass through the user name, password, and so on, which are then combined with the ConnectInfo class to establish the connection with the R/3 system.

UserInfo(User Name, Password, Client, Language)

Methods for the com.sap.rfc.UserInfo class include most of the standard methods that you have already seen, for example, clone(), and methods to get and set all the properties in the object. Note that each Get method has a corresponding Set method.

  • addPropertyChangeListener(Listener). Subscribes the object to any change that may occur in the UserInfo properties.

  • clone(). Creates a duplicate instance of the object.

  • equals(object). Returns a Boolean value to indicate whether two objects are identical.

  • getClient(). Returns the client of the UserInfo object.

  • getLanguage(). Returns the language of the UserInfo object.

  • getPassword(). Returns the password of the UserInfo object.

  • getUserName(). Returns the username of the UserInfo object.


Team-Fly


Java & BAPI Technology for SAP
Java & BAPI Technology for SAP
ISBN: 761523057
EAN: N/A
Year: 1998
Pages: 199

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net