Interface Descriptions

Team-Fly

The following interfaces are included in the com.sap.rfc package.

com.sap.rfc.IField

This interface is the building block interface for all data interfaces. Commonly used methods are as follows:

  • clear(). Clears the content of this field.

  • clone(). Clones the field.

  • getFieldInfo(). Returns information describing this field. See IFieldInfo in this chapter for more information.

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

com.sap.rfc.IComplexField

This interface is really just a collection of data fields that implement the IField interface; it holds data about structures and tables. Because fields within structures can be structures themselves, the nesting of field information can go on infinitely.

  • getComplexField(index or fieldname). Returns the complex field at a given field index position from the field list.

  • getComplexInfo(). Returns the complex info associated with this parameter.

  • getField(index or fieldname). Returns an IField structure for the requested field.

  • getFieldCount() Returns the number of fields in the field list.

  • getSimpleField(index or fieldname). Returns the simple field that matches the given name from the field list.

  • isEmpty(). Checks whether the field list is empty.

  • setField(index, field). Sets the field at the given field index position in the field list.

com.sap.rfc.IRow

This interface contains a group of data fields that represent a single table row. The only direct (noninherited) method in this interface is getTable(); this method returns the ITable object associated with the row.

Methods in the com.sap.rfc.IRow interface include the following:

  • getCurrentRow(). Returns the current row.

  • getFirstRow(). Returns the first row of the table.

  • getLastRow(). Returns the last row of the table.

  • getNextRow(). Returns the next row of the table. The fetch direction of the table determines the reading direction (see ITable in this chapter for more details).

  • getPosition(). Returns the current row index.

  • getPreviousRow(). Returns the previous row of the table. The fetch direction of the table determines the reading direction (see ITable in this chapter for more details).

com.sap.rfc.ISimpleField

This interface is used for classes which implement fields of various types; the various data types are listed next. Two methods can be used with all of these data types. The first is Get, for example, getBigDecimal(); this method returns the value of the field. If the data type of the field is not the same as the corresponding Get call, then the value is cast to the same type as the call. The other method is Set, for example, setBigDecimal(value). The Set method actually sets the value of the variable. The value that you send should be the same as the type of call; that is, you should not send an object of type BigDecimal through the call setByte(). If possible, the Set methods will do a type conversion, but they will throw the exception JRfcSimpleDataAbapConversionException if the conversion cannot be made. Also, the type property of the variable is set to match the value of the last Set call.

Types of Variables

The following types of variables are used: BigDecimal, BigInteger, Boolean, Byte, ByteArray, Char, Date, Double, Float, Int, Long, Short, SimpleInfo, String, Time, and Timestamp. You can also get a variable through the method getTypedValue. This method takes a parameter that indicates the type of variable you want to have returned. A similar method, called setTypedValue, allows you to set both the variable and data type.

There are also the methods getTypedValue(type) and setTypedValue(type, value), where type can be any of the following values:

SF_STRING, SF_CHAR, SF_BYTEARRAY, SF_BOOLEAN, SF_BYTE, SF_SHORT, SF_INTEGER, SF_LONG, SF_FLOAT, SF_DOUBLE, SF_BIGINTEGER, SF_LONG, SF_FLOAT, SF_DOUBLE, SF_BIGINTEGER, SF_BIGDECIMAL, SF_DATE, SF_TIME, SF_TIMESTAMP.

com.sap.rfc.ISimple

This interface is implemented by classes that contain data such as ISimpleField and ISimpleParam, as can be seen in the interface hierarchy shown earlier in this chapter. The com.sap.rfc.ISimple interface does not have any new methods.

com.sap.rfc.IFieldInfo

This interface is used to get the metadata (data about data definitions) for a field.

Methods for this interface include:

  • clone(). Makes a copy of an existing IFieldInfo object.

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

  • getLength(). Returns the length of the field/structure in bytes.

  • getType(). Returns the RFC data type.

  • isFilled(). Returns the Boolean value of TRUE or FALSE to indicate whether the IFieldInfo contains data.

com.sap.rfc.IParameter

The com.sap.rfc.IParameter interface is used for classes that work with parameters in RFC functions. Methods associated with this interface include the following:

  • clone(). Creates an exact copy of the object.

  • getFieldInfo(). Returns the field info object of this parameter.

  • getParameterName(). Returns the name of this parameter used during an RFC call.

  • setFieldInfo(fieldInfo). Sets the field info for this parameter.

  • setParameterName(name). Sets the parameter name for this parameter.

com.sap.rfc.IComplexParam

This interface is used for complex parameters of RFC functions, such as structures and tables. Only two methods are directly related to this interface: getComplexInfo() and setComplexInfo(complexInfo). Both methods are simply used to get or set the objects related to the parameter interface. The sections on IStructure and ITable in this chapter specify additional methods that can be used for accessing more detailed information on the structure or table.

com.sap.rfc.IStructure

This interface manages a list of data fields for remote function calls. The IStructure interface is implemented by classes that require a series of fields to be associated together. The important methods for this interface are inherited from the interface IComplexField(); see IComplexField for a list of methods.

com.sap.rfc.ITable

The ITable interface is implemented by classes that require an array of structures (remember that these structures may be as simple as a single field). The methods for this interface are as follows:

  • acceptUpdates(). Performs the middleware's acceptUpdates method.

  • appendRow(row). Appends a row to the bottom of the current table object.

  • copyFrom(table). Copies the contents of one table to another, completely overwriting the contents of the destination table.

  • createCursor(index). Creates a new cursor for this table at the specified row number. A cursor is a kind of pointer that indicates the position of the current read operation. When you start reading from a table, the cursor is set to 1 to indicate that the first row to be read is row 1. After that row is read, the cursor is set to 2.

  • createEmptyRow(). Returns a structure that is the same as the table object. The contents of the table are not affected. Typically, you perform this call to get the exact table structure; then you fill up the fields of the structure and append or insert the row into the table.

  • deleteAllRows(). Deletes all rows from the table.

  • deleteRow(index). Deletes a specific row from the table.

  • getDefaultCursor(). Returns a reference to the default cursor for the table. The default cursor is created when the table is created.

  • getReadBufferSize(). Returns the number of bytes in the table fetch cache.

  • getResultSet(readOnly). Returns an object like the standard java.sql.ResultSet interface, which is used in SQL queries. Because we are not really going against a real database but an array of data, several of the properties and methods of this object have no meaning and will return a NULL or FALSE value. More details on this interface can be found on Sun's Java Web page (see Appendix A, 'Other Web Resources,' for this and other useful URLs).

  • getRow(index). Returns the specified row, or next row as indicated by the cursor if no index is passed.

  • getRowCount(). Returns the total number of rows in the table.

  • getRowLength(). Returns the length (in bytes) of a row of a table. Note that in SAP all rows in a table have the same length.

  • getTableName(). Returns the name of the table.

  • getUpdatePolicy(). Returns the update policy of the table.

  • insertRow(index, row). Inserts a row into the table. Following the insertion, the new row will have the index number passed as a calling parameter.

  • isEmpty(). Returns a Boolean TRUE or FALSE to indicate whether the table contains any data.

  • isFetchForward(). Returns a TRUE if the direction of the fetch for the table is forward.

  • moveFrom(table). Moves the contents of the passed table into the current table object.

  • setFetchForward(isFetchForward). Sets the fetching direction of the table (TRUE for forward, FALSE for backward).

  • setReadBufferSize(number of rows). Sets the number of rows of the table to read into the buffer.

  • setUpdatePolicy(updatePolicy). Sets whether the table is allowed to be updated (TRUE indicates that it can be updated).

  • updateRow(index, row). Updates a specific row in the table.

com.sap.rfc.IImpExpParam

This interface is for classes that import and export parameters in RFC functions. Refer to interface/class ISimpleParam and IStructure for details on methods.

com.sap.rfc.ISimpleParam

This interface is also for classes and interfaces that import and export parameters for RFC functions. The two main methods associated with this interface are

  • getSimpleInfo(). Returns an object of type SimpleInfo.

  • setSimpleInfo(). Sets the SimpleInfo information for this object.

Refer to SimpleInfo for more details on methods.

com.sap.rfc.ConnectionListener

The interface ConnectionListener sets events based on the communication status between your Java program and the middleware. Events that can be raised include:

  • connected(event). Is raised when a new SAP connection is established.

  • disconnected(event). Is raised when an existing SAP connection is closed.

  • failed(event). Is raised when a new SAP connection cannot be established.

com.sap.rfc.MethodListener

The MethodListener interface defines events that are related to the execution of RFCs in SAP.

  • executed(event). A synchronous SAP function call that finishes successfully.

  • failed(event). A synchronous SAP function call that fails.

com.sap.rfc.ICursor

The ICursor interface is used with the ITable object. This interface merely serves as a tool for table handling. ICursor offers no functionality that cannot be solved by using the methods of ITable (and the associated IRow objects).

com.sap.rfc.IRfcConnection

This interface is the main interface for the SAP RFC connection. IRfcConnection is responsible for managing all R/3 connection information. The methods associated with this interface follow.

  • abort(string). Actively shuts down the connection to R/3 with the associated string as an error message.

  • addConnectionListener(Listener). Adds a new connection listener.

  • addPropertyChangeListener(Listener). Adds a new PropertyChangeListener.

  • clear(). Clears the user and connection info in this connection.

  • close(). Closes the connection to the SAP R/3 system.

  • getConnectInfo(). Returns the ConnectInfo object used in the connection to the SAP R/3 system.

  • getR3Release(). Returns the actual R/3 Release property. This property is part of the information retrieved by the method getSystemInfo().

  • getRFCTraceLevel(). Returns the RFC trace level on the server side.

  • getSystemInfo(). Returns the system information from the SAP R/3 system. The function module RFC_SYSTEM_INFO retrieves the information.

  • getUserInfo(). Returns the UserInfo object used in the connection to the SAP system.

  • isValid(). Returns a Boolean value to indicate whether the connection to the SAP system is still valid.

  • open(). Opens a connection to an SAP R/3 system. This connection is established by using the information in ConnectionInfo and UserInfo.

  • removeConnectionListener(listener). Removes a connection listener.

  • removePropertyChangeListener(listener). Removes a PropertyChangeListener.

  • setConnectInfo(connectInfo). Sets the connectInfo object to be used in opening a connection.

  • setRFCTraceLevel(newTraceLevel). Sets the trace level (at the server side).

  • setUserInfo(userInfo). Sets the userInfo object to be used in opening a connection to SAP.

com.sap.rfc.IRfcConnectionFactory

This interface is used by all of the factories that create instances of classes by implementing the IRfcConnection interface. The only method associated with this interface is createRfcConnection(ConnectInfo, UserInfo). This method creates the IRfcConnection object; that is why it is called the IRfcConnection 'factory.'

com.sap.rfc.IRfcModule

This interface deals with SAP RFC function calls and the related parameters used in the function module calls. Methods for this interface are as follows (note that when referencing import and export parameters by index, index numbers start at 0):

  • addExportParam(param). Adds an export parameter to the RFC module (the parameter is returned from the function module). You can associate a parameter with only one function module; attempting to associate a parameter with more than one function module will throw an exception.

  • addImportParam(param). Adds an import parameter to the RFC module (the parameter is sent to the function module). You can associate a parameter with only one function module; attempting to associate a parameter with more than one function module will throw an exception.

  • addTableParam(table). Adds a table parameter to the RFC module. As with import and export parameters, a table can only be associated with one RFC function at a time. Unlike import and export parameters, however, data in tables is passed both ways (both to and from the RFC function module).

  • call(). Invokes a one-way call to the SAP system by passing import parameters and table data.

  • callReceive(). Invokes a two-way call to the SAP system by sending the import parameters and table data to the RFC and then receiving the export parameters and table data. This one method is equivalent to performing a call() and a receive(). This method can return one of three values:

  • RFC_OK. Signifies that the call was successful.

  • RFC_CLOSED. Signifies that the connection was closed by the other end.

  • RFC_CALL. Signifies that the SAP system is issuing an RFC call to the original object that performed the initial call.

  • createTransID(). Returns a transaction ID from the SAP system. The transaction ID is stored inside an object on the server side and can be used for subsequent calls for the same logical unit of work. This method allows you to perform many related calls and to keep a common thread among them.

  • getConnection(). Returns the RFC connection referenced by the RFC module object.

  • getExportParam(index or name). Returns an export parameter referenced either by index or name.

  • getExportParamCount(). Returns the total number of export parameters that are associated with an RFC function.

  • getFunctionName(). Returns the name of the function module.

  • getImportParam(index or name). Returns an import referenced either by index or by name.

  • getImportParamCount(). Returns the total number of import parameters that are associated with an RFC function.

  • getSimpleExportParam(index or name). Returns a Simple export parameter.

  • getSimpleImportParam(index or name). Returns a Simple import parameter.

  • getStructExportParam(index or name). Returns an export parameter that is a structure.

  • getStructImportParam(index or name). Returns an import parameter that is a structure.

  • getTableParam(index or name). Returns a table referenced either by index or by name.

  • getTableParamCount(). Returns the total number of tables that may be used in the RFC function.

  • getTransID(). Returns a previously created transaction ID.

  • indirectCall(). Makes a one-way transactional call to the R/3 system. Ensures that a transaction ID has been obtained either through createTransID() or getTransID().

  • listen(). Checks whether an RFC request is available. Returns RFC_OK if an RFC event is pending, RFC_RETRY if nothing has arrived, and RFC_FAILURE if an error has occurred.

  • receive(). Makes a one-way call to R/3 receiving both export parameters and table data. This method can be called only after a call() is issued.

  • removeExportParam(param index or name). Removes a previously assigned Export parameter. After this method is called, you can assign the parameter to another RFC.

  • removeImportParam(param index or name). Removes a previously assigned Import parameter. After this method is called, you can assign the parameter to another RFC.

  • removeTableParam(table index or name). Removes a previously assigned table from an RFC. After this method is called, you can assign the table to another RFC.

  • replaceExportParam(newparam). Replaces one export parameter with another.

  • replaceImportParam(newparam). Replaces one import parameter with another.

  • replaceTableParam(newtable). Replaces one table parameter with another.

  • setConnection(value). Sets the RFC connection referenced by this function object.

  • setFunctionName(name). Sets the name of the function module represented by this RFC module object.

  • setTransID(id). Sets the transaction ID stored in this RFC module.

com.sap.rfc.IRfcModuleFactory

This interface is a factory in which to create IRfcModule interfaces. Following are the two ways in which these interfaces can be created.

  • autoCreateRfcModule(connection, rfcModuleName). Creates an IRfcModule instance with the name specified and a connection to an SAP R/3 system.

  • createRfcModule(connection, rfcModuleName, importParams, exportParams, tableParams). Creates an IRfcModule instance with the connection, the name, and all import, export, and table parameters.

com.sap.rfc.ISimpleFactory

This interface is a factory for the creation of ISimple interfaces. It has one basic method, createSimple(simpleInfo, paramName), which creates a simple field with the specified name and field information.

com.sap.rfc.IStructureFactory

This interface is a factory for the creation of IStructure interfaces. Two basic methods are associated with this interface:

  • autoCreateStructure(paramName, connection, structureName). Creates a structure parameter retrieving the meta information for the R/3 system.

  • createStructure(complexInfo, paramName). Creates a structure parameter after all meta data has been given.

com.sap.rfc.ITableFactory

This interface is a factory for creating ITable interfaces. Like IStructureFactory, ITableFactory has two methods:

  • autoCreateTable(paramName, connection, tableName). Creates an object with the ITable interface using the specified information.

  • createTable(complexInfo, paramName). Creates an object with the ITable interface using the specified meta data.


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