com.ibm.dse.services.sap
Class SAPService

java.lang.Object
  |
  +--com.ibm.dse.base.DSENotifier
        |
        +--com.ibm.dse.base.Service
              |
              +--com.ibm.dse.services.sap.SAPService

public class SAPService
extends Service
implements SAPServiceInterface

The SAPService class is a service that allows a Java application to communicate with a SAP system and execute any SAP System RFC module. It uses the Java proxy beans for the RFC modules, which are generated by the SAP Access Builder.

See Also:
Serialized Form

Field Summary
protected  boolean checkAuthorization
          Keeps the checkAuthorization argument needed to set up the connection to the SAP R/3 System.
protected  java.lang.String client
          Keeps the client argument needed to set up the connection to the SAP R/3 System.
protected  int codePage
          Keeps the codePage argument needed to set up the connection to the SAP R/3 System.
protected  java.lang.String destination
          Keeps the destination argument needed to set up the connection to the SAP R/3 System.
protected  java.lang.String gatewayHost
          Keeps the gatewayHost argument needed to set up the connection to the SAP R/3 System.
protected  java.lang.String gatewayService
          Keeps the gatewayService argument needed to set up the connection to the SAP R/3 System.
protected  java.lang.String groupName
          Keeps the groupName argument needed to set up the connection to the SAP R/3 System.
protected  java.lang.String hostName
          Keeps the hostName argument needed to set up the connection to the SAP R/3 System.
protected  java.lang.String jpbPackage
          Keeps the package where the Java proxy beans generated by the SAP Access Builder have been added.
protected  java.lang.String language
          Keeps the language argument needed to set up the connection to the SAP R/3 System.
protected  boolean loadBalancing
          Keeps the loadBalancing argument needed to set up the connection to the SAP R/3 System.
protected  java.lang.String msgServer
          Keeps the msgServer argument needed to set up the connection to the SAP R/3 System.
protected  int rfcMode
          Keeps the rfcMode argument needed to set up the connection to the SAP R/3 System.
protected  java.lang.String systemName
          Keeps the systemName argument needed to set up the connection to the SAP R/3 System.
protected  int systemNo
          Keeps the systemNo argument needed to set up the connection to the SAP R/3 System.
 
Fields inherited from class com.ibm.dse.base.Service
externalizer
 
Fields inherited from class com.ibm.dse.base.DSENotifier
handlersList, name
 
Constructor Summary
SAPService()
          This constructor creates a SAPService object.
SAPService(java.lang.String aName)
          This constructor creates a SAPService object.
 
Method Summary
 void callRFCModule(java.lang.String bapiClassName, Hashtable importParams)
          Calls the RFC module named bapiClassName.
protected  java.lang.String constructFieldName(java.lang.String fieldName)
          Constructs the name of a RFC proxy bean attribute from the name that is externalized in the services SGML file.
protected  java.lang.String constructGetterName(java.lang.String exportParamName)
          Constructs the getter name for the export parameter named exportParamName.
protected  java.lang.String constructGetterNameForField(java.lang.String newFieldName)
          Constructs the getter name for a RFC proxy bean attribute identified by newFieldName.
protected  java.lang.String constructSetterName(java.lang.String exportParamName)
          Constructs the setter name for the export parameter named exportParamName.
 void establishConnection(Hashtable connectionParams)
          Creates a connection to the SAP R/3 System with the properties defined in the services SGML file.
 void execute(java.lang.String rfcModuleName, Hashtable importParams, Context aContext)
          Sets the operationContext service variable, opens the connection to the SAP R/3 System, and starts the RFC module execution.
 boolean getCheckAuthorization()
          Returns the checkAuthorization attribute value.
 java.lang.String getClient()
          Returns the client attribute value.
 int getCodePage()
          Returns the codePage attribute value.
 java.lang.String getDestination()
          Returns the destination attribute value.
protected  void getExportParameterString(java.lang.Class myBapiClass, java.lang.String exportParamName, java.lang.Object exportParam, java.lang.Object myFunction)
          Gets the String export parameter identified as exportParamName that is in the SAP System response and puts it in the operation context.
protected  void getExportParameterStructure(java.lang.Class myBapiClass, java.lang.String exportParamName, java.lang.Object exportParam, java.lang.Object myFunction)
          Gets the Structure export parameter identified as exportParamName that is in the SAP System response and puts it in the operation context.
protected  void getExportParameterTable(java.lang.Class myBapiClass, java.lang.String exportParamName, java.lang.Object exportParam, java.lang.Object myFunction)
          Gets the Table export parameter identified as exportParamName that is in the SAP System response and puts it in the operation context.
 java.lang.String getGatewayHost()
          Returns the gatewayHost attribute value.
 java.lang.String getGatewayService()
          Returns the gatewayService attribute value.
 java.lang.String getGroupName()
          Returns the groupName attribute value.
 java.lang.String getHostName()
          Returns the hostName attribute value.
 java.lang.String getJpbPackage()
          Returns the jpbPackage attribute value.
 java.lang.String getLanguage()
          Returns the language attribute value.
 boolean getLoadBalancing()
          Returns the loadBalancing attribute value.
 java.lang.String getMsgServer()
          Returns the msgServer attribute value.
 Hashtable getParamsTable()
          Returns the paramsTable attribute value.
 int getRfcMode()
          Returns the rfcMode attribute value.
 java.lang.String getSystemName()
          Returns the systemName attribute value.
 int getSystemNo()
          Returns the systemNo attribute value.
 java.lang.Object initializeFrom(Tag aTag)
          Used by the SAPService service externalizer to set the instance attributes as defined in the SGML file.
 java.lang.Object initializeMethodFrom(Tag aTag)
          Used by the SAPService service externalizer to create the contents of the paramsTable instance attribute.
 void setCheckAuthorization(boolean b)
          Sets the checkAuthorization attribute to the boolean provided as an argument.
 void setClient(java.lang.String s)
          Sets the client attribute to the string provided as an argument.
 void setCodePage(int i)
          Sets the codePage attribute to the integer provided as an argument.
 void setDestination(java.lang.String s)
          Sets the destination attribute to the string provided as an argument.
 void setGatewayHost(java.lang.String s)
          Sets the gatewayHost attribute to the string provided as an argument.
 void setGatewayService(java.lang.String s)
          Sets the gatewayService attribute to the string provided as an argument.
 void setGroupName(java.lang.String s)
          Sets the groupName attribute to the string provided as an argument.
 void setHostName(java.lang.String s)
          Sets the hostname attribute to the string provided as an argument.
 void setImportParameterDate(java.lang.Class myBapiClass, java.lang.Object myFunction, java.lang.String importParamName, java.util.Date importParamValue)
          Sets a Date import parameter value using the setter method generated by the SAP Access Builder for it.
protected  void setImportParameters(java.lang.String bapiClassName, java.lang.Class myBapiClass, java.lang.Object myFunction, Hashtable tableImportParams)
          Sets the import parameters using the setter methods generated by the SAP Access Builder for them.
 void setImportParameterString(java.lang.Class myBapiClass, java.lang.Object myFunction, java.lang.String importParamName, java.lang.String importParamValue)
          Sets a String import parameter value using the setter method generated by the SAP Access Builder for it.
 void setImportParameterStructure(java.lang.Class myBapiClass, java.lang.Object myFunction, java.lang.String importParamName, java.lang.String importParamType, java.util.Hashtable structureHashtable)
          Sets a Structure import parameter value using the setter method generated by the SAP Access Builder for it.
 void setImportParameterTable(java.lang.Class myBapiClass, java.lang.Object myFunction, java.lang.String importParamName, java.lang.String importParamType, java.util.Vector rowsVector)
          Sets a Table import parameter value using the setter method generated by the SAP Access Builder for it.
 void setJpbPackage(java.lang.String s)
          Sets the jpbPackage attribute to the string provided as an argument.
 void setLanguage(java.lang.String s)
          Sets the language attribute to the string provided as an argument.
 void setLoadBalancing(boolean b)
          Sets the loadBalancing attribute to the boolean provided as an argument.
 SAPMethod setMethodExportParamsFrom(Tag aTag, SAPMethod aSAPMethod)
          Sets the export parameters information of a BAPI function by reading it from the services SGML file.
 SAPMethod setMethodImportParamsFrom(Tag aTag, SAPMethod aSAPMethod)
          Sets the import parameters information of a BAPI function by reading it from the services SGML file.
 void setMsgServer(java.lang.String s)
          Sets the msgServer attribute to the string provided as an argument.
 void setParamsClassName(java.lang.String s)
          Sets the paramsClassName attribute to the string provided as an argument.
 void setParamsTable(Hashtable h)
          Sets the paramsTable attribute to a hash table.
 void setRfcMode(int i)
          Sets the rfcMode attribute to the integer provided as an argument.
 void setSystemName(java.lang.String s)
          Sets the systemName attribute to the string provided as an argument.
 void setSystemNo(int i)
          Sets the systemNo attribute to the integer provided as an argument.
 Vector toStrings()
          Used by the SAPService service externalizer to show the information that is defined in the SGML file for the SAPService instance.
 
Methods inherited from class com.ibm.dse.base.Service
externalizer, getExternalizer, getTagName, readExternal, readExternal, readObject, removeExternal, setExternalizer, terminate, toString, toTags, writeExternal, writeExternal
 
Methods inherited from class com.ibm.dse.base.DSENotifier
addHandler, getHandlersList, getName, removeHandler, setName, signalEvent, signalEvent, signalEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

jpbPackage

protected java.lang.String jpbPackage
Keeps the package where the Java proxy beans generated by the SAP Access Builder have been added.

rfcMode

protected int rfcMode
Keeps the rfcMode argument needed to set up the connection to the SAP R/3 System.

destination

protected java.lang.String destination
Keeps the destination argument needed to set up the connection to the SAP R/3 System.

hostName

protected java.lang.String hostName
Keeps the hostName argument needed to set up the connection to the SAP R/3 System.

systemNo

protected int systemNo
Keeps the systemNo argument needed to set up the connection to the SAP R/3 System.

gatewayHost

protected java.lang.String gatewayHost
Keeps the gatewayHost argument needed to set up the connection to the SAP R/3 System.

gatewayService

protected java.lang.String gatewayService
Keeps the gatewayService argument needed to set up the connection to the SAP R/3 System.

systemName

protected java.lang.String systemName
Keeps the systemName argument needed to set up the connection to the SAP R/3 System.

groupName

protected java.lang.String groupName
Keeps the groupName argument needed to set up the connection to the SAP R/3 System.

msgServer

protected java.lang.String msgServer
Keeps the msgServer argument needed to set up the connection to the SAP R/3 System.

loadBalancing

protected boolean loadBalancing
Keeps the loadBalancing argument needed to set up the connection to the SAP R/3 System.

checkAuthorization

protected boolean checkAuthorization
Keeps the checkAuthorization argument needed to set up the connection to the SAP R/3 System.

client

protected java.lang.String client
Keeps the client argument needed to set up the connection to the SAP R/3 System. Default value is "100".

language

protected java.lang.String language
Keeps the language argument needed to set up the connection to the SAP R/3 System. Default value is "en".

codePage

protected int codePage
Keeps the codePage argument needed to set up the connection to the SAP R/3 System. Default value is 1103.
Constructor Detail

SAPService

public SAPService()
This constructor creates a SAPService object.

SAPService

public SAPService(java.lang.String aName)
           throws java.io.IOException
This constructor creates a SAPService object. The String aName is used by the services externalizer to read the service details from the SGML file.
Parameters:
aName - java.lang.String
Throws:
java.io.IOException - Exception raised by the externalizer when the service definition cannot be found in the SGML file.
Method Detail

callRFCModule

public void callRFCModule(java.lang.String bapiClassName,
                          Hashtable importParams)
                   throws java.lang.Exception
Calls the RFC module named bapiClassName. The interface used by the service to call the RFC module is RFC_module_instance.execute(IRfcConnection connection_to_SAPSystem). The method dynamically builds the RFC proxy bean class instance that corresponds to the bapiClassName and sets the import parameters to the values that are in the importParams hash table. When the execute method returns, it calls the get methods to retrieve the export parameters and puts these export parameters into the operation context.
Specified by:
callRFCModule in interface SAPServiceInterface

constructFieldName

protected java.lang.String constructFieldName(java.lang.String fieldName)
Constructs the name of a RFC proxy bean attribute from the name that is externalized in the services SGML file.
Parameters:
fieldName - java.lang.String
Returns:
java.lang.String

constructGetterName

protected java.lang.String constructGetterName(java.lang.String exportParamName)
Constructs the getter name for the export parameter named exportParamName.
Parameters:
fieldName - java.lang.String
Returns:
java.lang.String

constructGetterNameForField

protected java.lang.String constructGetterNameForField(java.lang.String newFieldName)
Constructs the getter name for a RFC proxy bean attribute identified by newFieldName.
Parameters:
fieldName - java.lang.String
Returns:
java.lang.String

constructSetterName

protected java.lang.String constructSetterName(java.lang.String exportParamName)
Constructs the setter name for the export parameter named exportParamName.
Parameters:
fieldName - java.lang.String
Returns:
java.lang.String

establishConnection

public void establishConnection(Hashtable connectionParams)
                         throws com.sap.rfc.exception.JRfcRemoteException
Creates a connection to the SAP R/3 System with the properties defined in the services SGML file.
Specified by:
establishConnection in interface SAPServiceInterface
Returns:
com.ibm.sap.bapi.Connection

execute

public void execute(java.lang.String rfcModuleName,
                    Hashtable importParams,
                    Context aContext)
             throws java.lang.Exception
Sets the operationContext service variable, opens the connection to the SAP R/3 System, and starts the RFC module execution. When the execution is completed, the connection is closed.
Specified by:
execute in interface SAPServiceInterface
Parameters:
aContext - com.ibm.dse.base.Context

getCheckAuthorization

public boolean getCheckAuthorization()
Returns the checkAuthorization attribute value.
Returns:
boolean

getClient

public java.lang.String getClient()
Returns the client attribute value.
Returns:
java.lang.String

getCodePage

public int getCodePage()
Returns the codePage attribute value.
Returns:
int

getDestination

public java.lang.String getDestination()
Returns the destination attribute value.
Returns:
java.lang.String

getExportParameterString

protected void getExportParameterString(java.lang.Class myBapiClass,
                                        java.lang.String exportParamName,
                                        java.lang.Object exportParam,
                                        java.lang.Object myFunction)
                                 throws java.lang.Exception
Gets the String export parameter identified as exportParamName that is in the SAP System response and puts it in the operation context.

getExportParameterStructure

protected void getExportParameterStructure(java.lang.Class myBapiClass,
                                           java.lang.String exportParamName,
                                           java.lang.Object exportParam,
                                           java.lang.Object myFunction)
                                    throws java.lang.Exception
Gets the Structure export parameter identified as exportParamName that is in the SAP System response and puts it in the operation context. Each element in the Structure will be a different data field in the operation context.

getExportParameterTable

protected void getExportParameterTable(java.lang.Class myBapiClass,
                                       java.lang.String exportParamName,
                                       java.lang.Object exportParam,
                                       java.lang.Object myFunction)
                                throws java.lang.Exception
Gets the Table export parameter identified as exportParamName that is in the SAP System response and puts it in the operation context. The table rows will be converted into KeyedCollections and the full table will be an IndexedCollection of KeyedCollections.

getGatewayHost

public java.lang.String getGatewayHost()
Returns the gatewayHost attribute value.
Returns:
java.lang.String

getGatewayService

public java.lang.String getGatewayService()
Returns the gatewayService attribute value.
Returns:
java.lang.String

getGroupName

public java.lang.String getGroupName()
Returns the groupName attribute value.
Returns:
java.lang.String

getHostName

public java.lang.String getHostName()
Returns the hostName attribute value.
Returns:
java.lang.String

getJpbPackage

public java.lang.String getJpbPackage()
Returns the jpbPackage attribute value.
Returns:
java.lang.String

getLanguage

public java.lang.String getLanguage()
Returns the language attribute value.
Returns:
java.lang.String

getLoadBalancing

public boolean getLoadBalancing()
Returns the loadBalancing attribute value.
Returns:
java.lang.Boolean

getMsgServer

public java.lang.String getMsgServer()
Returns the msgServer attribute value.
Returns:
java.lang.String

getParamsTable

public Hashtable getParamsTable()
Returns the paramsTable attribute value.
Returns:
com.ibm.dse.base.Hashtable

getRfcMode

public int getRfcMode()
Returns the rfcMode attribute value.
Returns:
java.lang.String

getSystemName

public java.lang.String getSystemName()
Returns the systemName attribute value.
Returns:
java.lang.String

getSystemNo

public int getSystemNo()
Returns the systemNo attribute value.
Returns:
int

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws java.io.IOException
Used by the SAPService service externalizer to set the instance attributes as defined in the SGML file.
Overrides:
initializeFrom in class Service
Parameters:
aTag - com.ibm.dse.base.Tag
Returns:
java.lang.Object
Throws:
IOException - if an I/O Exception has occurred

initializeMethodFrom

public java.lang.Object initializeMethodFrom(Tag aTag)
                                      throws java.io.IOException
Used by the SAPService service externalizer to create the contents of the paramsTable instance attribute. The paramsTable is a hash table with a key equal to the SAP BAPI function name and a value equal to a SAPMethod instance, which keeps information about the import and export parameters owned by the function.
Parameters:
aTag - com.ibm.dse.base.Tag
Returns:
java.lang.Object

setCheckAuthorization

public void setCheckAuthorization(boolean b)
Sets the checkAuthorization attribute to the boolean provided as an argument.
Parameters:
b - boolean

setClient

public void setClient(java.lang.String s)
Sets the client attribute to the string provided as an argument.
Parameters:
s - java.lang.String

setCodePage

public void setCodePage(int i)
Sets the codePage attribute to the integer provided as an argument.
Parameters:
i - int

setDestination

public void setDestination(java.lang.String s)
Sets the destination attribute to the string provided as an argument.
Parameters:
s - java.lang.String

setGatewayHost

public void setGatewayHost(java.lang.String s)
Sets the gatewayHost attribute to the string provided as an argument.
Parameters:
s - java.lang.String

setGatewayService

public void setGatewayService(java.lang.String s)
Sets the gatewayService attribute to the string provided as an argument.
Parameters:
s - java.lang.String

setGroupName

public void setGroupName(java.lang.String s)
Sets the groupName attribute to the string provided as an argument.
Parameters:
s - java.lang.String

setHostName

public void setHostName(java.lang.String s)
Sets the hostname attribute to the string provided as an argument.
Parameters:
s - java.lang.String

setImportParameterDate

public void setImportParameterDate(java.lang.Class myBapiClass,
                                   java.lang.Object myFunction,
                                   java.lang.String importParamName,
                                   java.util.Date importParamValue)
                            throws java.lang.Exception
Sets a Date import parameter value using the setter method generated by the SAP Access Builder for it.

setImportParameters

protected void setImportParameters(java.lang.String bapiClassName,
                                   java.lang.Class myBapiClass,
                                   java.lang.Object myFunction,
                                   Hashtable tableImportParams)
                            throws java.lang.Exception
Sets the import parameters using the setter methods generated by the SAP Access Builder for them. It calls the different setters depending on the import parameter type.

setImportParameterString

public void setImportParameterString(java.lang.Class myBapiClass,
                                     java.lang.Object myFunction,
                                     java.lang.String importParamName,
                                     java.lang.String importParamValue)
                              throws java.lang.Exception
Sets a String import parameter value using the setter method generated by the SAP Access Builder for it.

setImportParameterStructure

public void setImportParameterStructure(java.lang.Class myBapiClass,
                                        java.lang.Object myFunction,
                                        java.lang.String importParamName,
                                        java.lang.String importParamType,
                                        java.util.Hashtable structureHashtable)
                                 throws java.lang.Exception
Sets a Structure import parameter value using the setter method generated by the SAP Access Builder for it.

setImportParameterTable

public void setImportParameterTable(java.lang.Class myBapiClass,
                                    java.lang.Object myFunction,
                                    java.lang.String importParamName,
                                    java.lang.String importParamType,
                                    java.util.Vector rowsVector)
                             throws java.lang.Exception
Sets a Table import parameter value using the setter method generated by the SAP Access Builder for it.

setJpbPackage

public void setJpbPackage(java.lang.String s)
Sets the jpbPackage attribute to the string provided as an argument.
Parameters:
s - java.lang.String

setLanguage

public void setLanguage(java.lang.String s)
Sets the language attribute to the string provided as an argument.
Parameters:
s - java.lang.String

setLoadBalancing

public void setLoadBalancing(boolean b)
Sets the loadBalancing attribute to the boolean provided as an argument.
Parameters:
b - boolean

setMethodExportParamsFrom

public SAPMethod setMethodExportParamsFrom(Tag aTag,
                                           SAPMethod aSAPMethod)
Sets the export parameters information of a BAPI function by reading it from the services SGML file.
Parameters:
aTag - com.ibm.dse.base.Tag
aSAPMethod - SAPMethod
Returns:
SAPMethod

setMethodImportParamsFrom

public SAPMethod setMethodImportParamsFrom(Tag aTag,
                                           SAPMethod aSAPMethod)
Sets the import parameters information of a BAPI function by reading it from the services SGML file.
Parameters:
aTag - com.ibm.dse.base.Tag
aSAPMethod - SAPMethod
Returns:
SAPMethod

setMsgServer

public void setMsgServer(java.lang.String s)
Sets the msgServer attribute to the string provided as an argument.
Parameters:
s - java.lang.String

setParamsClassName

public void setParamsClassName(java.lang.String s)
Sets the paramsClassName attribute to the string provided as an argument.
Parameters:
s - java.lang.String

setParamsTable

public void setParamsTable(Hashtable h)
Sets the paramsTable attribute to a hash table.
Parameters:
h - com.ibm.dse.base.Hashtable

setRfcMode

public void setRfcMode(int i)
Sets the rfcMode attribute to the integer provided as an argument.
Parameters:
i - int

setSystemName

public void setSystemName(java.lang.String s)
Sets the systemName attribute to the string provided as an argument.
Parameters:
s - java.lang.String

setSystemNo

public void setSystemNo(int i)
Sets the systemNo attribute to the integer provided as an argument.
Parameters:
i - int

toStrings

public Vector toStrings()
Used by the SAPService service externalizer to show the information that is defined in the SGML file for the SAPService instance.
Overrides:
toStrings in class Service
Returns:
com.ibm.dse.base.Vector