public class BapiRequest extends AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
Use the class RfmRequest
to call remote-enabled function modules (RFC modules).
The signature of BAPIs consists of importing, exporting, and tables parameters.
From the perspective of the BAPI caller, input data is considered as exporting, output data is considered as importing and tables parameters can be used for both directions. The methods of this class are named following the caller's perspective.
From the perspective of the BAPI, importing means input data, exporting means output data, and tables parameters can be used for both directions.
Example:
Calling a BAPI with one importing parameter (from BAPI perspective) requires to utilize the method
withExporting(String, String)
. Consider all existing variants of this method depending on the Java data type
of the parameter, e.g. use withExporting(String, String, String)
to pass a String object.
The data type (i.e. the data dictionary object) of importing and exporting parameters (regardless of the perspective) can either be a data element, a structure, or a table type.
withExporting(String, String)
and its data type dependent variants to supply an exporting BAPI
parameter reflected by a data element.withExportingFields(String, String, Fields)
to supply an exporting BAPI parameter reflected by a
structure.withExportingTable(String, String)
to supply an exporting BAPI parameter reflected by a table
type.
After calling execute(Destination)
use the class BapiRequestResult
to access the results of the BAPI
call (e.g. the exporting parameters from the BAPI perspective respectively the importing parameters from the caller's
perspective).
commitStrategy, constructedByMethod, functionName, remoteFunctionRequestErrorHandler
Constructor and Description |
---|
BapiRequest(String functionName)
Constructs a synchronous BAPI request for which the result will be committed.
|
BapiRequest(String functionName,
boolean commit)
Constructs a BAPI request.
|
BapiRequest(String functionName,
CommitStrategy commitStrategy)
Constructs a BAPI request.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
canEqual(Object other) |
boolean |
equals(Object o) |
BapiRequestResult |
execute(Destination destination)
Executes a given request using the given
Destination . |
int |
hashCode() |
BapiRequest |
ignoringErrors()
Specifies to invoke a
RemoteFunctionRequestErrorHandler after the request execution which does not
inspect the BapiRequestResult and, therefore, does not throw a
RemoteFunctionException . |
protected BapiRequest |
instance()
Convenience method that returns the current instance.
|
BapiRequest |
propagatingErrorsAsExceptions()
Specifies to invoke a
RemoteFunctionRequestErrorHandler after the request execution which inspects the
BapiRequestResult and throws a
RemoteFunctionException or one of its more-specific
exceptions depending on the returned error messages of the request. |
String |
toString() |
BapiRequest |
withErrorHandler(RemoteFunctionRequestErrorHandler remoteFunctionRequestErrorHandler)
Specifies to invoke the provided
RemoteFunctionRequestErrorHandler after the request has been executed. |
BapiRequest |
withExporting(String name,
String dataType)
Adds an exporting parameter reflected by a data element.
|
BapiRequest |
withExporting(String name,
String dataType,
BigDecimal value)
Adds an exporting
BigDecimal parameter reflected by a data element. |
BapiRequest |
withExporting(String name,
String dataType,
BigInteger value)
Adds an exporting
BigInteger parameter reflected by a data element. |
BapiRequest |
withExporting(String name,
String dataType,
Boolean value)
Adds an exporting
Boolean parameter reflected by a data element. |
BapiRequest |
withExporting(String name,
String dataType,
Byte value)
Adds an exporting
Byte parameter reflected by a data element. |
BapiRequest |
withExporting(String name,
String dataType,
Character value)
Adds an exporting
Character parameter reflected by a data element. |
BapiRequest |
withExporting(String name,
String dataType,
Double value)
Adds an exporting
Double parameter reflected by a data element. |
BapiRequest |
withExporting(String name,
String dataType,
Float value)
Adds an exporting
Float parameter reflected by a data element. |
BapiRequest |
withExporting(String name,
String dataType,
Integer value)
Adds an exporting
Integer parameter reflected by a data element. |
BapiRequest |
withExporting(String name,
String dataType,
LocalDate value)
Adds an exporting
LocalDate parameter reflected by a data element. |
BapiRequest |
withExporting(String name,
String dataType,
Locale value)
Adds an exporting
Locale parameter reflected by a data element. |
BapiRequest |
withExporting(String name,
String dataType,
LocalTime value)
Adds an exporting
LocalTime parameter reflected by a data element. |
BapiRequest |
withExporting(String name,
String dataType,
Long value)
Adds an exporting
Long parameter reflected by a data element. |
BapiRequest |
withExporting(String name,
String dataType,
Short value)
Adds an exporting
Short parameter reflected by a data element. |
BapiRequest |
withExporting(String name,
String dataType,
String value)
Adds an exporting
String parameter reflected by a data element. |
<T extends ErpType<T>> |
withExporting(String name,
String dataType,
T value)
Adds an exporting parameter reflected by a data element.
|
<T> BapiRequest |
withExporting(String name,
String dataType,
T value,
ErpTypeConverter<T> typeConverter)
Adds an exporting parameter reflected by a data element.
|
BapiRequest |
withExporting(String name,
String dataType,
Year value)
Adds an exporting
Year parameter. |
ParameterFields<BapiRequest> |
withExportingFields(String name,
String dataType)
Adds an exporting parameter reflected by a structure.
|
BapiRequest |
withExportingFields(String name,
String dataType,
Fields fields)
Adds an exporting parameter reflected by a structure.
|
Table<BapiRequest> |
withExportingTable(String name,
String dataType)
Adds an exporting parameter reflected by a table type.
|
BapiRequest |
withImporting(String name,
String dataType)
Adds an importing parameter reflected by a data element.
|
BapiRequest |
withImporting(String name,
String dataType,
BigDecimal value)
Adds a importing
BigDecimal parameter reflected by a data element. |
BapiRequest |
withImporting(String name,
String dataType,
BigInteger value)
Adds a importing
BigInteger parameter reflected by a data element. |
BapiRequest |
withImporting(String name,
String dataType,
Boolean value)
Adds a importing
Boolean parameter reflected by a data element. |
BapiRequest |
withImporting(String name,
String dataType,
Byte value)
Adds a importing
Byte parameter reflected by a data element. |
BapiRequest |
withImporting(String name,
String dataType,
Character value)
Adds a importing
Character parameter reflected by a data element. |
BapiRequest |
withImporting(String name,
String dataType,
Double value)
Adds a importing
Double parameter reflected by a data element. |
BapiRequest |
withImporting(String name,
String dataType,
Float value)
Adds a importing
Float parameter reflected by a data element. |
BapiRequest |
withImporting(String name,
String dataType,
Integer value)
Adds a importing
Integer parameter reflected by a data element. |
BapiRequest |
withImporting(String name,
String dataType,
LocalDate value)
Adds a importing
LocalDate parameter reflected by a data element. |
BapiRequest |
withImporting(String name,
String dataType,
Locale value)
Adds a importing
Locale parameter reflected by a data element. |
BapiRequest |
withImporting(String name,
String dataType,
LocalTime value)
Adds a importing
LocalTime parameter reflected by a data element. |
BapiRequest |
withImporting(String name,
String dataType,
Long value)
Adds a importing
Long parameter reflected by a data element. |
BapiRequest |
withImporting(String name,
String dataType,
Short value)
Adds a importing
Short parameter reflected by a data element. |
BapiRequest |
withImporting(String name,
String dataType,
String value)
Adds a importing
String parameter reflected by a data element. |
<T extends ErpType<T>> |
withImporting(String name,
String dataType,
T value)
Adds an importing parameter reflected by a data element.
|
<T> BapiRequest |
withImporting(String name,
String dataType,
T value,
ErpTypeConverter<T> typeConverter)
Adds an importing parameter reflected by a data element.
|
BapiRequest |
withImporting(String name,
String dataType,
Year value)
Adds a importing
Year parameter reflected by a data element. |
BapiRequest |
withImportingAsReturn(String dataType)
Adds an importing parameter as a return parameter with the name defined by
AbstractRemoteFunctionRequest.RETURN_PARAMETER . |
BapiRequest |
withImportingAsReturn(String name,
String dataType)
Adds an importing parameter as a return parameter.
|
ParameterFields<BapiRequest> |
withImportingFields(String name,
String dataType)
Adds an importing parameter reflected by a structure.
|
BapiRequest |
withImportingFields(String name,
String dataType,
Fields fields)
Adds an importing parameter reflected by a structure.
|
Table<BapiRequest> |
withImportingTable(String name,
String dataType)
Adds an importing parameter reflected by a table type.
|
Table<BapiRequest> |
withTable(String name,
String dataType)
Adds a table parameter.
|
BapiRequest |
withTableAsReturn(String dataType)
Adds a table parameter as a return parameter with the name defined by
AbstractRemoteFunctionRequest.RETURN_PARAMETER . |
BapiRequest |
withTableAsReturn(String name,
String dataType)
Adds a table parameter as a return parameter.
|
BapiRequest |
withTypeConverters(ErpTypeConverter<?>... typeConverters)
|
BapiRequest |
withTypeConverters(Iterable<ErpTypeConverter<?>> typeConverters)
Registers the given
ErpTypeConverter s. |
getCommitStrategy, getConstructedByMethod, getFunctionName, getTypeConverters, isPerformingTransactionalCommit, newParameter, newParameterWithValue, newParameterWithValueList, newParameterWithValueList
getCustomHttpHeaders, getLongRunningRequestThreshold, getReadAccessData, getRequestId, getThis, setLongRunningRequestThreshold, withHeader, withHeader, withSameCustomHttpHeadersAs
public BapiRequest(String functionName) throws IllegalArgumentException
functionName
- The name of the BAPI to be called.IllegalArgumentException
- If the given function is not a valid BAPI, i.e., its name does not start with the prefix "BAPI".public BapiRequest(String functionName, boolean commit) throws IllegalArgumentException
functionName
- The name of the BAPI to be called.commit
- Decides whether to commit the result of the BAPI call. If the commit parameter is true, the
transaction is executed synchronously by default. The transaction can also be executed asynchronously
by using the constructor BapiRequest(String, CommitStrategy)
.IllegalArgumentException
- If the given function is not a valid BAPI, i.e., its name does not start with the prefix "BAPI".public BapiRequest(String functionName, @Nonnull CommitStrategy commitStrategy) throws IllegalArgumentException
functionName
- The name of the BAPI to be called.commitStrategy
- Decides on the CommitStrategy
IllegalArgumentException
- If the given function is not a valid BAPI, i.e., its name does not start with the prefix "BAPI". Or
if the request commit strategy is not supported.@Nonnull public BapiRequestResult execute(@Nonnull Destination destination) throws RequestSerializationException, RequestExecutionException, DestinationNotFoundException, DestinationAccessException
Destination
.execute
in class Request<BapiRequest,BapiRequestResult>
destination
- The Destination
to be used for request execution.RequestSerializationException
- If there is an issue while serializing the request.RequestExecutionException
- If there is an issue while executing the request.DestinationNotFoundException
- If no destination with the name specified in the Destination
can be found.DestinationAccessException
- If there is an issue while accessing destination information.@Nonnull protected BapiRequest instance()
instance
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
@Nonnull public BapiRequest withTypeConverters(Iterable<ErpTypeConverter<?>> typeConverters)
AbstractRemoteFunctionRequest
ErpTypeConverter
s. Replaces existing converters for already existing types that have
been added before.withTypeConverters
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
@Nonnull public BapiRequest withTypeConverters(ErpTypeConverter<?>... typeConverters)
AbstractRemoteFunctionRequest
withTypeConverters
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
@Nonnull public BapiRequest withExporting(String name, String dataType)
Note: Exporting refers to the point of view of the caller. Thus, when a parameter is declared as importing on ABAP side, you have to specify it as exporting here.
withExporting
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.@Nonnull public <T extends ErpType<T>> BapiRequest withExporting(String name, String dataType, T value)
Note: Exporting refers to the point of view of the caller. Thus, when a parameter is declared as importing on ABAP side, you have to specify it as exporting here.
withExporting
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.value
- The value of the parameter.@Nonnull public <T> BapiRequest withExporting(String name, String dataType, T value, ErpTypeConverter<T> typeConverter)
Note: Exporting refers to the point of view of the caller. Thus, when a parameter is declared as importing on ABAP side, you have to specify it as exporting here.
withExporting
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.value
- The value of the parameter.typeConverter
- A type converter defining how to convert the type of the given value to its ERP representation.@Nonnull public BapiRequest withExporting(String name, String dataType, Boolean value)
Boolean
parameter reflected by a data element.@Nonnull public BapiRequest withExporting(String name, String dataType, Byte value)
Byte
parameter reflected by a data element.@Nonnull public BapiRequest withExporting(String name, String dataType, Character value)
Character
parameter reflected by a data element.@Nonnull public BapiRequest withExporting(String name, String dataType, String value)
String
parameter reflected by a data element.@Nonnull public BapiRequest withExporting(String name, String dataType, Short value)
Short
parameter reflected by a data element.@Nonnull public BapiRequest withExporting(String name, String dataType, Integer value)
Integer
parameter reflected by a data element.@Nonnull public BapiRequest withExporting(String name, String dataType, Long value)
Long
parameter reflected by a data element.@Nonnull public BapiRequest withExporting(String name, String dataType, Float value)
Float
parameter reflected by a data element.@Nonnull public BapiRequest withExporting(String name, String dataType, Double value)
Double
parameter reflected by a data element.@Nonnull public BapiRequest withExporting(String name, String dataType, BigInteger value)
BigInteger
parameter reflected by a data element.@Nonnull public BapiRequest withExporting(String name, String dataType, BigDecimal value)
BigDecimal
parameter reflected by a data element.@Nonnull public BapiRequest withExporting(String name, String dataType, Locale value)
Locale
parameter reflected by a data element.@Nonnull public BapiRequest withExporting(String name, String dataType, Year value)
Year
parameter. reflected by a data element@Nonnull public BapiRequest withExporting(String name, String dataType, LocalDate value)
LocalDate
parameter reflected by a data element.@Nonnull public BapiRequest withExporting(String name, String dataType, LocalTime value)
LocalTime
parameter reflected by a data element.@Nonnull public ParameterFields<BapiRequest> withExportingFields(String name, String dataType)
Note: Exporting refers to the point of view of the caller. Thus, when a parameter is declared as importing on ABAP side, you have to specify it as exporting here.
withExportingFields
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.@Nonnull public BapiRequest withExportingFields(String name, String dataType, Fields fields)
Note: Exporting refers to the point of view of the caller. Thus, when a parameter is declared as importing on ABAP side, you have to specify it as exporting here.
withExportingFields
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.fields
- The exporting fields.@Nonnull public Table<BapiRequest> withExportingTable(String name, String dataType)
Note: Exporting refers to the point of view of the caller. Thus, when a parameter is declared as importing on ABAP side, you have to specify it as exporting here.
withExportingTable
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.@Nonnull public BapiRequest withImporting(String name, String dataType)
Note that importing is related to the point of view of the caller. Thus, when a parameter is declared as exporting on ABAP side, you have to specify it as importing here.
withImporting
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.@Nonnull public <T extends ErpType<T>> BapiRequest withImporting(String name, String dataType, T value)
Note that importing is related to the point of view of the caller. Thus, when a parameter is declared as exporting on ABAP side, you have to specify it as importing here.
withImporting
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.value
- The value of the parameter.@Nonnull public <T> BapiRequest withImporting(String name, String dataType, T value, ErpTypeConverter<T> typeConverter)
Note that importing is related to the point of view of the caller. Thus, when a parameter is declared as exporting on ABAP side, you have to specify it as importing here.
withImporting
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.value
- The value of the parameter.typeConverter
- A type converter defining how to convert the type of the given value to its ERP representation.@Nonnull public BapiRequest withImporting(String name, String dataType, Boolean value)
Boolean
parameter reflected by a data element.@Nonnull public BapiRequest withImporting(String name, String dataType, Byte value)
Byte
parameter reflected by a data element.@Nonnull public BapiRequest withImporting(String name, String dataType, Character value)
Character
parameter reflected by a data element.@Nonnull public BapiRequest withImporting(String name, String dataType, String value)
String
parameter reflected by a data element.@Nonnull public BapiRequest withImporting(String name, String dataType, Short value)
Short
parameter reflected by a data element.@Nonnull public BapiRequest withImporting(String name, String dataType, Integer value)
Integer
parameter reflected by a data element.@Nonnull public BapiRequest withImporting(String name, String dataType, Long value)
Long
parameter reflected by a data element.@Nonnull public BapiRequest withImporting(String name, String dataType, Float value)
Float
parameter reflected by a data element.@Nonnull public BapiRequest withImporting(String name, String dataType, Double value)
Double
parameter reflected by a data element.@Nonnull public BapiRequest withImporting(String name, String dataType, BigInteger value)
BigInteger
parameter reflected by a data element.@Nonnull public BapiRequest withImporting(String name, String dataType, BigDecimal value)
BigDecimal
parameter reflected by a data element.@Nonnull public BapiRequest withImporting(String name, String dataType, Locale value)
Locale
parameter reflected by a data element.@Nonnull public BapiRequest withImporting(String name, String dataType, Year value)
Year
parameter reflected by a data element.@Nonnull public BapiRequest withImporting(String name, String dataType, LocalDate value)
LocalDate
parameter reflected by a data element.@Nonnull public BapiRequest withImporting(String name, String dataType, LocalTime value)
LocalTime
parameter reflected by a data element.@Nonnull public ParameterFields<BapiRequest> withImportingFields(String name, String dataType)
Note that importing is related to the point of view of the caller. Thus, when a parameter is declared as exporting on ABAP side, you have to specify it as importing here.
withImportingFields
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.@Nonnull public BapiRequest withImportingFields(String name, String dataType, Fields fields)
Note that importing is related to the point of view of the caller. Thus, when a parameter is declared as exporting on ABAP side, you have to specify it as importing here.
withImportingFields
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.fields
- The importing fields.@Nonnull public Table<BapiRequest> withImportingTable(String name, String dataType)
Note that importing is related to the point of view of the caller. Thus, when a parameter is declared as exporting on ABAP side, you have to specify it as importing here.
withImportingTable
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.@Nonnull public BapiRequest withImportingAsReturn(String dataType)
AbstractRemoteFunctionRequest.RETURN_PARAMETER
.
Note that return parameters refer to parameters for which return messages will be parsed and translated to RemoteFunctionMessages.
withImportingAsReturn
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
dataType
- The ABAP data type of the parameter.@Nonnull public BapiRequest withImportingAsReturn(String name, String dataType)
Note that return parameters refer to parameters for which return messages will be parsed and translated to RemoteFunctionMessages.
withImportingAsReturn
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.@Nonnull public Table<BapiRequest> withTable(String name, String dataType)
withTable
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.@Nonnull public BapiRequest withTableAsReturn(String dataType)
AbstractRemoteFunctionRequest.RETURN_PARAMETER
.
Note that return parameters refer to parameters for which return messages will be parsed and translated to RemoteFunctionMessages.
withTableAsReturn
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
dataType
- The ABAP data type of the parameter.@Nonnull public BapiRequest withTableAsReturn(String name, String dataType)
Note that return parameters refer to parameters for which return messages will be parsed and translated to RemoteFunctionMessages.
withTableAsReturn
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.@Nonnull public BapiRequest withErrorHandler(@Nonnull RemoteFunctionRequestErrorHandler remoteFunctionRequestErrorHandler)
RemoteFunctionRequestErrorHandler
after the request has been executed.withErrorHandler
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
remoteFunctionRequestErrorHandler
- The result handler to invoke after request execution@Nonnull public BapiRequest ignoringErrors()
RemoteFunctionRequestErrorHandler
after the request execution which does not
inspect the BapiRequestResult
and, therefore, does not throw a
RemoteFunctionException
.ignoringErrors
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
@Nonnull public BapiRequest propagatingErrorsAsExceptions()
RemoteFunctionRequestErrorHandler
after the request execution which inspects the
BapiRequestResult
and throws a
RemoteFunctionException
or one of its more-specific
exceptions depending on the returned error messages of the request.propagatingErrorsAsExceptions
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
public boolean equals(Object o)
equals
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
protected boolean canEqual(Object other)
canEqual
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
public int hashCode()
hashCode
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
public String toString()
toString
in class AbstractRemoteFunctionRequest<BapiRequest,BapiRequestResult>
Copyright © 2019 SAP SE. All rights reserved.