Defining aliases - SAP BO

Aliases are references to existing tables in a schema. An Alias is a table that is an exact duplicate of the original table (base table), with a different name. The data in the table is exactly the same as the original table, but the different name "tricks" the SQL of a query to accept that you are using two different tables.

The Beach universe schema contains two alias tables; Resort_Country (the alias for the Country table) and Sponsor (the alias for the Customer table).

How are Aliases Used in a Schema?

You use aliases for two main reasons:

  • To use the table more than once in a query. This is the main reason for using aliases, and includes using aliases to solve loops and fan traps. The example Beach universe contains 2 aliases; Resort_Country for Country, and Sponsor for Customer.
  • To abbreviate the table name to save typing when writing freehand SQL.

Tip:Another possible use of aliases is to create an alias for each table as it is inserted into the schema. You then build the schema using the alias tables, not the original base tables. You place the base tables together away from the main universe structure. This allows you to give meaningful names to tables, and prevents the need to rebuild major sections of a universe structure should a base table need to be aliased at a later stage.

Using aliases to solve loops

The most common use of aliases in universe development is to solve potential loops in the use of common tables. A loop is a set of joins that defines a closed path through a set of tables in a schema. Loops occur when joins form multiple paths between lookup tablesYou use an alias to break a loop by providing alternative table for an original lookup table that is being used for multiple query paths.

Using aliases to solve fan traps

Aliases are also used to solve potential fan traps. These can occur in a serial one-to-many join path that can return inflated results when aggregates are summed at the "many" end of the joins.

Creating Aliases

You can create aliases manually, or let Designer automatically detect potential aliases that will solve a join path loop.

You need to create an alias manually to solve a fan trap. You also create aliases manually if you are creating a schema using only aliases and not the base tables.

Creating an alias manually

To create an alias manually:

  1. Click the table that you want to use to create an alias.
  2. Select Insert > Alias
  3. Or
    Click the Insert Alias button.

    The Creating an Alias box appears. It prompts you to enter a name for the new alias.

    Creating an alias manually

  4. Enter a new name for the aliased table, or keep the one proposed.
  5. Note:The name that you give to an alias should be relevant to the role of the alias todistinguish it from the base table. For example, Resort country is an alias for Country. Resort Country is used for queries returning data for resort countries, the base table Country is used in queries returning data for customer countries.

  6. Click OK.
  7. The aliased table appears in the Structure pane.
  8. Create any joins necessary between the alias and other tables in the schema.

Tip:To avoid confusing base tables with aliases, you can display the alias with the name of the base table it represents in the table title as follows: Select Tools > Options > Graphics, and then select the Aliased Name check box.

Renaming an alias

You can rename an alias at any time. Alias and table naming conventions are RDBMS dependent. You can rename an alias directly by renaming the table, or from a list of aliases in the universe.

Renaming an alias directly

To rename an alias directly:

  1. Click a table and select Edit > Rename Table.
  2. Or
    Right click a table and select Rename table from the contextual menu.

    The Rename Table dialog box appears.

    Renaming an alias

  3. Type a new name in the Table Name box.
  4. The availability of the Owner and Qualification fields is database specific. If they are active, then you can modify these as necessary.

  5. Select the Upper case check box if you want the alias name to be shown as all uppercase.
  6. Or
    Select the Lower case check box if you want the alias name to be shown as alllowercase.
  7. Click OK.

Renaming an alias from a list

To rename an alias from a list:

  1. Select Tools > List of Aliases.
  2. The List of Aliases appears. It lists all the aliases in the active universe.
  3. Click an alias name in the list.
  4. Type a new name for the selected alias in the New Name text box.
  5. Click Apply.
  6. Click OK.

Deleting an alias

You delete an alias in the same way that you delete a table. If you have defined objects using the alias, you must modify these objects before you delete the alias, so that they use another table, or delete the objects if they are no longer necessary.If you do not modify or remove the objects using a deleted alias, queries using those objects will generate errors in Web Intelligence.

To delete an alias:

  1. Click an alias and select Edit > Clear.
  2. Or

    Right click an alias and select Clear from the contextual menu.

    Or

    Click an alias and press the DELETE key.

    If any objects use the alias, the following message appears:

    Deleting an alias

    If no objects use the alias, you do not receive a confirmation box. The alias is deletedimmediately.

  3. Click Yes.
  4. The alias is deleted from the Structure pane.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

SAP BO Topics