public class BapiQuery extends AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
Use the class RfcQuery
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(ErpConfigContext)
use the class BapiQueryResult
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, remoteFunctionQueryErrorHandler
Constructor and Description |
---|
BapiQuery(String functionName)
Constructs a synchronous BAPI query for which the result will be committed.
|
BapiQuery(String functionName,
boolean commit)
Constructs a BAPI query.
|
BapiQuery(String functionName,
CommitStrategy commitStrategy)
Constructs a BAPI query.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
canEqual(Object other) |
boolean |
equals(Object o) |
BapiQueryResult |
execute(ErpConfigContext configContext)
Executes a given query using the given
ErpConfigContext . |
int |
hashCode() |
BapiQuery |
ignoringErrors()
Specifies to invoke a
RemoteFunctionQueryErrorHandler after the query execution which does not
inspect the BapiQueryResult and, therefore, does not throw a
RemoteFunctionException . |
protected BapiQuery |
instance()
Convenience method that returns the current instance.
|
BapiQuery |
propagatingErrorsAsExceptions()
Specifies to invoke a
RemoteFunctionQueryErrorHandler after the query execution which inspects the
BapiQueryResult and throws a
RemoteFunctionException or one of its more-specific
exceptions depending on the returned error messages of the query. |
String |
toString() |
BapiQuery |
withErrorHandler(RemoteFunctionQueryErrorHandler remoteFunctionQueryErrorHandler)
Specifies to invoke the provided
RemoteFunctionQueryErrorHandler after the query has been executed. |
BapiQuery |
withExporting(String name,
String dataType)
Adds an exporting parameter reflected by a data element.
|
BapiQuery |
withExporting(String name,
String dataType,
BigDecimal value)
Adds an exporting
BigDecimal parameter reflected by a data element. |
BapiQuery |
withExporting(String name,
String dataType,
BigInteger value)
Adds an exporting
BigInteger parameter reflected by a data element. |
BapiQuery |
withExporting(String name,
String dataType,
Boolean value)
Adds an exporting
Boolean parameter reflected by a data element. |
BapiQuery |
withExporting(String name,
String dataType,
Byte value)
Adds an exporting
Byte parameter reflected by a data element. |
BapiQuery |
withExporting(String name,
String dataType,
Character value)
Adds an exporting
Character parameter reflected by a data element. |
BapiQuery |
withExporting(String name,
String dataType,
Double value)
Adds an exporting
Double parameter reflected by a data element. |
BapiQuery |
withExporting(String name,
String dataType,
Float value)
Adds an exporting
Float parameter reflected by a data element. |
BapiQuery |
withExporting(String name,
String dataType,
Integer value)
Adds an exporting
Integer parameter reflected by a data element. |
BapiQuery |
withExporting(String name,
String dataType,
LocalDate value)
Adds an exporting
LocalDate parameter reflected by a data element. |
BapiQuery |
withExporting(String name,
String dataType,
Locale value)
Adds an exporting
Locale parameter reflected by a data element. |
BapiQuery |
withExporting(String name,
String dataType,
LocalTime value)
Adds an exporting
LocalTime parameter reflected by a data element. |
BapiQuery |
withExporting(String name,
String dataType,
Long value)
Adds an exporting
Long parameter reflected by a data element. |
BapiQuery |
withExporting(String name,
String dataType,
Short value)
Adds an exporting
Short parameter reflected by a data element. |
BapiQuery |
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> BapiQuery |
withExporting(String name,
String dataType,
T value,
ErpTypeConverter<T> typeConverter)
Adds an exporting parameter reflected by a data element.
|
BapiQuery |
withExporting(String name,
String dataType,
Year value)
Adds an exporting
Year parameter. |
ParameterFields<BapiQuery> |
withExportingFields(String name,
String dataType)
Adds an exporting parameter reflected by a structure.
|
BapiQuery |
withExportingFields(String name,
String dataType,
Fields fields)
Adds an exporting parameter reflected by a structure.
|
Table<BapiQuery> |
withExportingTable(String name,
String dataType)
Adds an exporting parameter reflected by a table type.
|
BapiQuery |
withImporting(String name,
String dataType)
Adds an importing parameter reflected by a data element.
|
BapiQuery |
withImporting(String name,
String dataType,
BigDecimal value)
Adds a importing
BigDecimal parameter reflected by a data element. |
BapiQuery |
withImporting(String name,
String dataType,
BigInteger value)
Adds a importing
BigInteger parameter reflected by a data element. |
BapiQuery |
withImporting(String name,
String dataType,
Boolean value)
Adds a importing
Boolean parameter reflected by a data element. |
BapiQuery |
withImporting(String name,
String dataType,
Byte value)
Adds a importing
Byte parameter reflected by a data element. |
BapiQuery |
withImporting(String name,
String dataType,
Character value)
Adds a importing
Character parameter reflected by a data element. |
BapiQuery |
withImporting(String name,
String dataType,
Double value)
Adds a importing
Double parameter reflected by a data element. |
BapiQuery |
withImporting(String name,
String dataType,
Float value)
Adds a importing
Float parameter reflected by a data element. |
BapiQuery |
withImporting(String name,
String dataType,
Integer value)
Adds a importing
Integer parameter reflected by a data element. |
BapiQuery |
withImporting(String name,
String dataType,
LocalDate value)
Adds a importing
LocalDate parameter reflected by a data element. |
BapiQuery |
withImporting(String name,
String dataType,
Locale value)
Adds a importing
Locale parameter reflected by a data element. |
BapiQuery |
withImporting(String name,
String dataType,
LocalTime value)
Adds a importing
LocalTime parameter reflected by a data element. |
BapiQuery |
withImporting(String name,
String dataType,
Long value)
Adds a importing
Long parameter reflected by a data element. |
BapiQuery |
withImporting(String name,
String dataType,
Short value)
Adds a importing
Short parameter reflected by a data element. |
BapiQuery |
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> BapiQuery |
withImporting(String name,
String dataType,
T value,
ErpTypeConverter<T> typeConverter)
Adds an importing parameter reflected by a data element.
|
BapiQuery |
withImporting(String name,
String dataType,
Year value)
Adds a importing
Year parameter reflected by a data element. |
BapiQuery |
withImportingAsReturn(String dataType)
Adds an importing parameter as a return parameter with the name defined by
AbstractRemoteFunctionQuery.RETURN_PARAMETER . |
BapiQuery |
withImportingAsReturn(String name,
String dataType)
Adds an importing parameter as a return parameter.
|
ParameterFields<BapiQuery> |
withImportingFields(String name,
String dataType)
Adds an importing parameter reflected by a structure.
|
BapiQuery |
withImportingFields(String name,
String dataType,
Fields fields)
Adds an importing parameter reflected by a structure.
|
Table<BapiQuery> |
withImportingTable(String name,
String dataType)
Adds an importing parameter reflected by a table type.
|
Table<BapiQuery> |
withTable(String name,
String dataType)
Adds a table parameter.
|
BapiQuery |
withTableAsReturn(String dataType)
Adds a table parameter as a return parameter with the name defined by
AbstractRemoteFunctionQuery.RETURN_PARAMETER . |
BapiQuery |
withTableAsReturn(String name,
String dataType)
Adds a table parameter as a return parameter.
|
BapiQuery |
withTypeConverters(ErpTypeConverter<?>... typeConverters)
Delegates to
AbstractRemoteFunctionQuery.withTypeConverters(Iterable) . |
BapiQuery |
withTypeConverters(Iterable<ErpTypeConverter<?>> typeConverters)
Registers the given
ErpTypeConverter s. |
doCommit, getCommitStrategy, getConstructedByMethod, getFunctionName, getTypeConverters, isPerformingTransactionalCommit, newParameter, newParameterWithValue, newParameterWithValueList, newParameterWithValueList
execute, getCustomHttpHeaders, getHeaderParameters, getLongRunningRequestThreshold, getReadAccessData, getRequestId, getThis, setLongRunningRequestThreshold, withCustomHttpHeader, withCustomHttpHeader, withSameCustomHttpHeadersAs
public BapiQuery(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 BapiQuery(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 BapiQuery(String, CommitStrategy)
.IllegalArgumentException
- If the given function is not a valid BAPI, i.e., its name does not start with the prefix "BAPI".public BapiQuery(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 query commit strategy is not supported.@Nonnull public BapiQueryResult execute(@Nonnull ErpConfigContext configContext) throws QuerySerializationException, QueryExecutionException, DestinationNotFoundException, DestinationAccessException
ErpConfigContext
.execute
in class Query<BapiQuery,BapiQueryResult>
configContext
- The ErpConfigContext
to be used for query execution.QuerySerializationException
- If there is an issue while serializing the query.QueryExecutionException
- If there is an issue while executing the query.DestinationNotFoundException
- If no destination with the name specified in the ErpConfigContext
can be found.DestinationAccessException
- If there is an issue while accessing destination information.@Nonnull protected BapiQuery instance()
instance
in class AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
@Nonnull public BapiQuery withTypeConverters(Iterable<ErpTypeConverter<?>> typeConverters)
AbstractRemoteFunctionQuery
ErpTypeConverter
s. Replaces existing converters for already existing types that have
been added before.withTypeConverters
in class AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
@Nonnull public BapiQuery withTypeConverters(ErpTypeConverter<?>... typeConverters)
AbstractRemoteFunctionQuery
AbstractRemoteFunctionQuery.withTypeConverters(Iterable)
.withTypeConverters
in class AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
@Nonnull public BapiQuery 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 AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.@Nonnull public <T extends ErpType<T>> BapiQuery 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 AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.value
- The value of the parameter.@Nonnull public <T> BapiQuery 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 AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
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 BapiQuery withExporting(String name, String dataType, Boolean value)
Boolean
parameter reflected by a data element.@Nonnull public BapiQuery withExporting(String name, String dataType, Byte value)
Byte
parameter reflected by a data element.@Nonnull public BapiQuery withExporting(String name, String dataType, Character value)
Character
parameter reflected by a data element.@Nonnull public BapiQuery withExporting(String name, String dataType, String value)
String
parameter reflected by a data element.@Nonnull public BapiQuery withExporting(String name, String dataType, Short value)
Short
parameter reflected by a data element.@Nonnull public BapiQuery withExporting(String name, String dataType, Integer value)
Integer
parameter reflected by a data element.@Nonnull public BapiQuery withExporting(String name, String dataType, Long value)
Long
parameter reflected by a data element.@Nonnull public BapiQuery withExporting(String name, String dataType, Float value)
Float
parameter reflected by a data element.@Nonnull public BapiQuery withExporting(String name, String dataType, Double value)
Double
parameter reflected by a data element.@Nonnull public BapiQuery withExporting(String name, String dataType, BigInteger value)
BigInteger
parameter reflected by a data element.@Nonnull public BapiQuery withExporting(String name, String dataType, BigDecimal value)
BigDecimal
parameter reflected by a data element.@Nonnull public BapiQuery withExporting(String name, String dataType, Locale value)
Locale
parameter reflected by a data element.@Nonnull public BapiQuery withExporting(String name, String dataType, Year value)
Year
parameter. reflected by a data element@Nonnull public BapiQuery withExporting(String name, String dataType, LocalDate value)
LocalDate
parameter reflected by a data element.@Nonnull public BapiQuery withExporting(String name, String dataType, LocalTime value)
LocalTime
parameter reflected by a data element.@Nonnull public ParameterFields<BapiQuery> 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 AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.@Nonnull public BapiQuery 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 AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.fields
- The exporting fields.@Nonnull public Table<BapiQuery> 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 AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.@Nonnull public BapiQuery 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 AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.@Nonnull public <T extends ErpType<T>> BapiQuery 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 AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.value
- The value of the parameter.@Nonnull public <T> BapiQuery 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 AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
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 BapiQuery withImporting(String name, String dataType, Boolean value)
Boolean
parameter reflected by a data element.@Nonnull public BapiQuery withImporting(String name, String dataType, Byte value)
Byte
parameter reflected by a data element.@Nonnull public BapiQuery withImporting(String name, String dataType, Character value)
Character
parameter reflected by a data element.@Nonnull public BapiQuery withImporting(String name, String dataType, String value)
String
parameter reflected by a data element.@Nonnull public BapiQuery withImporting(String name, String dataType, Short value)
Short
parameter reflected by a data element.@Nonnull public BapiQuery withImporting(String name, String dataType, Integer value)
Integer
parameter reflected by a data element.@Nonnull public BapiQuery withImporting(String name, String dataType, Long value)
Long
parameter reflected by a data element.@Nonnull public BapiQuery withImporting(String name, String dataType, Float value)
Float
parameter reflected by a data element.@Nonnull public BapiQuery withImporting(String name, String dataType, Double value)
Double
parameter reflected by a data element.@Nonnull public BapiQuery withImporting(String name, String dataType, BigInteger value)
BigInteger
parameter reflected by a data element.@Nonnull public BapiQuery withImporting(String name, String dataType, BigDecimal value)
BigDecimal
parameter reflected by a data element.@Nonnull public BapiQuery withImporting(String name, String dataType, Locale value)
Locale
parameter reflected by a data element.@Nonnull public BapiQuery withImporting(String name, String dataType, Year value)
Year
parameter reflected by a data element.@Nonnull public BapiQuery withImporting(String name, String dataType, LocalDate value)
LocalDate
parameter reflected by a data element.@Nonnull public BapiQuery withImporting(String name, String dataType, LocalTime value)
LocalTime
parameter reflected by a data element.@Nonnull public ParameterFields<BapiQuery> 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 AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.@Nonnull public BapiQuery 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 AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.fields
- The importing fields.@Nonnull public Table<BapiQuery> 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 AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.@Nonnull public BapiQuery withImportingAsReturn(String dataType)
AbstractRemoteFunctionQuery.RETURN_PARAMETER
.
Note that return parameters refer to parameters for which return messages will be parsed and translated to RemoteFunctionMessages.
withImportingAsReturn
in class AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
dataType
- The ABAP data type of the parameter.@Nonnull public BapiQuery 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 AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.@Nonnull public Table<BapiQuery> withTable(String name, String dataType)
withTable
in class AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.@Nonnull public BapiQuery withTableAsReturn(String dataType)
AbstractRemoteFunctionQuery.RETURN_PARAMETER
.
Note that return parameters refer to parameters for which return messages will be parsed and translated to RemoteFunctionMessages.
withTableAsReturn
in class AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
dataType
- The ABAP data type of the parameter.@Nonnull public BapiQuery 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 AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
name
- The parameter name.dataType
- The ABAP data type of the parameter.@Nonnull public BapiQuery withErrorHandler(@Nonnull RemoteFunctionQueryErrorHandler remoteFunctionQueryErrorHandler)
RemoteFunctionQueryErrorHandler
after the query has been executed.withErrorHandler
in class AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
remoteFunctionQueryErrorHandler
- The result handler to invoke after query execution@Nonnull public BapiQuery ignoringErrors()
RemoteFunctionQueryErrorHandler
after the query execution which does not
inspect the BapiQueryResult
and, therefore, does not throw a
RemoteFunctionException
.ignoringErrors
in class AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
@Nonnull public BapiQuery propagatingErrorsAsExceptions()
RemoteFunctionQueryErrorHandler
after the query execution which inspects the
BapiQueryResult
and throws a
RemoteFunctionException
or one of its more-specific
exceptions depending on the returned error messages of the query.propagatingErrorsAsExceptions
in class AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
public boolean equals(Object o)
equals
in class AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
protected boolean canEqual(Object other)
canEqual
in class AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
public int hashCode()
hashCode
in class AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
public String toString()
toString
in class AbstractRemoteFunctionQuery<BapiQuery,BapiQueryResult>
Copyright © 2019 SAP SE. All rights reserved.