Show TOC

Creating and Changing QueriesLocate this document in the navigation structure

Context

Business Object Builder (BO Builder) provides you with a wizard for creating a query.

Procedure

  1. Starting the Wizard
    Note

    You can assign queries only to the following types of nodes:

    The system marks these black in the Node Browser navigation.

    • Extensible nodes that are created in the business object that is currently open

    • Extensible nodes that are created in the business object enhancement (enhancement) that is currently open

    • Extensible nodes that are created in the base object of the enhancement

    Open the business object or the enhancement in which you want to create the query.

    In the Node Browser navigation, choose the node you need to extend with the query.

    To start the Create Query wizard, choose Create Query in the context menu of the node.

    Note

    The result of the query contains a subset of node instances corresponding to the node to which the query is assigned. It is, for example, not possible to assign a query to the ROOT node, which returns instances or their keys of the ITEM node.

  2. Name and Description

    In this step, you enter the name and the description of the query.

    Input Field

    Description

    Node Name

    This displays the node to which the query is assigned in the model of the business object or of the enhancement.

    Query Name

    The name of the query must be unique in the business object. If the query is created in an enhancement, it must start with the namespace or the prefix of the enhancement. This ensures that the entities of different enhancements are clearly separated.

    The namespace or prefix must be completed with a query name.

    Example

    <namespace or prefix>_<query name>

    Description

    Enter a short description of the query.

  3. Query Type

    Queries can be either a Node Attribute Query or a Custom Query, as follows:

    • Node Attribute Query

      The advantage of the node attribute query is that their logic is fully provided from Business Object Processing Framework (BOPF) and therefore they must not be implemented.

      However, the set of query input parameters correspond to the set of attributes of the node to which the query is assigned. The input parameters are resolved similar to common range selections.

    • Custom Query

      Use custom queries to implement the entire query logic and to freely define the input parameters of the query.

  4. Configuring the Query

    This wizard step appears only if you have selected the query type Custom Query.

    In this step, you configure the query.

    Entry Field

    Description

    Implementing Class

    The implementing class contains the business logic of the query. The system automatically creates the implementing class after finishing the wizard. You must implement it manually.

    Since the implementing class name must meet naming conventions, the wizard automatically suggests a valid class name.

    You can also define an existing class by implementing the /BOBF/IF_FRW_QUERY interface. This is useful if the business logic of another query can be reused. The system does not overwrite existing implementing classes.

    Data Type

    If the consumer of the query is able to hand over dynamic query input parameters at runtime, the data type of the query must be specified. Technically, it is a structure and each of its components corresponds to one single selection criteria.

    Example

    If the query returns instances that that display costs higher than a certain amount, the structure must contain the component AMOUNT.

    Result Type

    (optional)

    The result type is any data type which can be returned as the result of an custom query, for example, to provide a denormalized read-only list of business object data for the UI.

    Result Table Type

    (optional)

    The result table type is a result table which has the result type as the row type.

  5. Finishing the Wizard

    To create the query and finish the wizard, see Finishing the Wizard in Creating and Changing a Business Object.

Results

  • The system adds the new query to the model of the business object or of the enhancement..

    The system displays the query in the Entity Browser navigation when you select the corresponding node in the Node Browser navigation.

  • If you have chosen to create a custom query, the implementing class of the query is generated and must be implemented.

  • The constants interface of the business object or of the enhancement is regenerated and contains a unique constant identifying this query.

    The consumer needs this constant to execute the query.

After you have created a query, you can change the following specifications:

  • Query Name

  • Description

  • Query Type

  • Query Configuration

    Note

    This specification can be changed only if you have selected the Custom Query type.