Create View Definitions

View Definitions used by the Retrieve View and Find View Exceptions actions are defined as XML code which has the following structure:

<VIEW_DEFN> section

Each View Definition is defined within a <VIEW_DEFN> section as follows:

<VIEW_DEFN>

</VIEW_DEFN>

<ALIAS_TABLE> sections

Each View Definition has one our more <ALIAS_TABLE> sections which provide aliases for the SAP tables to be retrieved. Parent tables in the View Definition are specified using the IsParent="True" tag.

<VIEW_DEFN>

<ALIAS_TABLE IsParent="true">ADVM

</ALIAS_TABLE>

</VIEW_DEFN>

<TABLE> section

Each <ALIAS_TABLE> section has a single <TABLE> section which specifies the name of the table to be retrieved.<VIEW_DEFN>

<ALIAS_TABLE IsParent="true">ADVM

<TABLE>SAPAPO/ADVM</TABLE>

...

</ALIAS_TABLE>

</VIEW_DEFN>

<USAGE> section

Each <ALIAS_TABLE> section has a single <USAGE> section. This is set to MAIN if the table is a main component of the View Definition, or to ADD_COL if the table is to be used to add columns to the View Definition.

<VIEW_DEFN>

<ALIAS_TABLE IsParent="true">ADVM

<TABLE>SAPAPO/ADVM</TABLE>

<USAGE>MAIN<USAGE>

</ALIAS_TABLE>

</VIEW_DEFN>

<ID_COLS> section

Each <ALIAS_TABLE> section has a single <ID_COLS> section which specifies the key fields in the SAP table to retrieve. Each field is specified in a <COL> section.

<VIEW_DEFN>

<ALIAS_TABLE IsParent="true">ADVM

<TABLE>SAPAPO/ADVM</TABLE>

<USAGE>MAIN<USAGE>

<ID_COLS>

<COL>LOCNO</COL>

</ID_COLS>

</ALIAS_TABLE>

</VIEW_DEFN>

<IGNORE_COLS> section

Each <ALIAS_TABLE> section has a single <COLS_TO_IGNORE> section which specifies fields that will not be retrieved as part of the View Definition. Each field is specified in a <COL> section.

<VIEW_DEFN>

<ALIAS_TABLE IsParent="true">ADVM

<TABLE>SAPAPO/ADVM</TABLE>

<USAGE>MAIN<USAGE>

<ID_COLS>

<COL>LOCNO</COL>

</ID_COLS>

<IGNORE_COLS>

<COL>LOCID</COL>

</IGNORE_COLS>

</ALIAS_TABLE>

</VIEW_DEFN>

<ADD_COL> sections

Each <ALIAS_TABLE> section may have one or more <ADD_COL> sections, which specify fields to be added to the View Definition from other tables. Each <ADD_COL> section contains the following:

  • A <COL> section specifying the name to be used for the added field.
  • A <SOURCE_ALIAS> section specifying a <TABLE_ALIAS> whose <USAGE> section is set to ADD_COL.
  • A <SOURCE_COL> section specifying a field name in the <SOURCE_ALIAS> table.

<VIEW_DEFN>

<ALIAS_TABLE IsParent="true">ADVM

<TABLE>SAPAPO/ADVM</TABLE>

<USAGE>MAIN<USAGE>

<ID_COLS>

<COL>LOCNO</COL>

</ID_COLS>

<IGNORE_COLS>

<COL>LOCID</COL>

</IGNORE_COLS>

<ADD_COL>

<COL>STORE_LOCNO</COL>

<SOURCE_ALIAS>LOC2</SOURCE_ALIAS>

<SOURCE_COL>LOCNO</SOURCE_COL>

</ADD_COL>

</ALIAS_TABLE>

</VIEW_DEFN>

<KEY_REL> sections

Each View Definition may have one or more <KEY_REL> sections, which specify the relationships between tables in the View Definition. Each <ADD_COL> section contains the following:

  • A <FROM_ALIAS> section specifying the parent table in the View Definition.
  • A <TO_ALIAS> section specifying the child table in the View Definition.
  • A <COLMAP> section specifying the fields to be linked in the parent and child tables. Each field is specified in a <COL> section. If two fields are specified, the first field in the parent table is matched with the second field in the parent table. If one field is specified, the same filed is matched in both tables.

<VIEW_DEFN>

<ALIAS_TABLE IsParent="true">ADVM

<TABLE>SAPAPO/ADVM</TABLE>

<USAGE>MAIN<USAGE>

<ID_COLS>

<COL>LOCNO</COL>

</ID_COLS>

<IGNORE_COLS>

<COL>LOCID</COL>

</IGNORE_COLS>

<ADD_COL>

<COL>STORE_LOCNO</COL>

<SOURCE_ALIAS>LOC2</SOURCE_ALIAS>

<SOURCE_COL>LOCNO</SOURCE_COL>

</ADD_COL>

</ALIAS_TABLE>

<KEY_REL>

<FROM_ALIAS>LOC</FROM_ALIAS>

<TO_ALIAS>LOCT</TO_ALIAS>

<COLMAP>

<COL>LOCID</COL>

</COLMAP>

</KEY_REL>

<KEY_REL>

<FROM_ALIAS>LOC</FROM_ALIAS>

<TO_ALIAS>LOC2</TO_ALIAS>

<COLMAP>

<COL>STORE</COL>

<COL>LOCID</COL>

</COLMAP>

</KEY_REL>

</VIEW_DEFN>

<VIEW_CONDITIONS> section

Each View Definition may have a <VIEW_CONDITIONS> section, which specifies conditions for the data to be retrieved from the View Definition’s tables. Each <VIEW_CONDITIONS> section has one or more <CONDITIONS> sections containing the following:

  • An <ALIAS> section specifying a table alias in the View Definition.
  • A <SELECT> section specifying a condition for a field in the aliased table. See the Select List parameters help topic for details.

<VIEW_DEFN>

<ALIAS_TABLE IsParent="true">ADVM

<TABLE>SAPAPO/ADVM</TABLE>

<USAGE>MAIN<USAGE>

<ID_COLS>

<COL>LOCNO</COL>

</ID_COLS>

<IGNORE_COLS>

<COL>LOCID</COL>

</IGNORE_COLS>

<ADD_COL>

<COL>STORE_LOCNO</COL>

<SOURCE_ALIAS>LOC2</SOURCE_ALIAS>

<SOURCE_COL>LOCNO</SOURCE_COL>

</ADD_COL>

</ALIAS_TABLE>

<KEY_REL>

<FROM_ALIAS>LOC</FROM_ALIAS>

<TO_ALIAS>LOCT</TO_ALIAS>

<COLMAP>

<COL>LOCID</COL>

</COLMAP>

</KEY_REL>

<KEY_REL>

<FROM_ALIAS>LOC</FROM_ALIAS>

<TO_ALIAS>LOC2</TO_ALIAS>

<COLMAP>

<COL>STORE</COL>

<COL>LOCID</COL>

</COLMAP>

</KEY_REL>

<VIEW_CONDITIONS>

<CONDITION>

<ALIAS>ADVM</ALIAS>

<SELECT Type="CDAT" Opr="BT" Lo="2015-01-01" Ie="I" Hi="2015-01-01"/>

</CONDITION>

</VIEW_CONDITIONS>

...

</VIEW_DEFN>For examples of View Definitions, please see the workflows in the Data/Templates/APO hierarchy folder.

View Definition parameters