Credits

Tuesday, July 6, 2010

LESSON 31 SAP QUARY ADMINSTRATION

When you create a user group, you must assign a name and a description to the user group.

To maintain a user group, you can use the following options:You can assign users and functional areas to a user group.You can assign a user to various user groups.You can assign a functional area to various user groups.

You can assign every user in the SAP System to one or more user groups.

There are basically two mechanisms for determining who can do what with a query.

The first restriction involves the assignment to a user group. Users who have not been assigned to any user groups cannot use the query. Users who have been assigned to at least one user group can start queries.

The second mechanism is field ACTVT in authorization object S_QUERY. You can use this field to authorize users to change queries as well (ACTVT = 02).

ACTVT = 23 is required to maintain functional areas and user groups (typical administration tasks).An administrator does not necessarily have to be assigned to a user group.

A separate authorization (ACTVT = 67) is required to compile the query.

When you define a functional area, you must first decide on a primary dataset (functional area type).

You can assign secondary datasets (tables, supplementary fields) to the primary dataset.

You can choose all the fields of the primary dataset and the secondary dataset. You choose fields by assigning them to a functional group.

Users cannot access fields that are not assigned to a functional group.

For the end user it is irrelevant whether a field belongs to primary or secondary data.

There are different types of functional areas:Creating a functional area from a logical database provides data retrieval for logical databases (GET ).Creating a functional area from a table join allows access to data in tables that are linked with an INNER or OUTER JOIN (SELECT).Creating a functional area from a table evaluates data from a table or from a database view (SELECT).Creating a functional area from a program evaluates data read by a predefined program.Creating a functional area from a sequential file reads data stored in a sequential file (READ DATASET).For the end user, it is irrelevant which type of functional area is used.When you create a functional area, you have to enter a title and select the type of functional area.You can force every query in a functional area to be allocated to an authorization group (provides protection of the generated program, object S_PROGRAM).After header maintenance, you can divide the available fields into functional groups.You can read additional tables and use additional fields.You can define parameters and selection options (determination of the selection screen).When you create a functional area, you must allocate it to the user group with which it is to work.The system administers every functional area in two versions: a generated version and a revised version. After you change a functional area, you must generate it so that the changes become known.Queries work only with the generated versions of functional areas.You can delete a functional area only when it contains no queries.You can user the directory function to see an overview of the available functional areas along with their contents and all queries created from a given functional area (menu path AQA-1).For practical purposes, retrieval of supplemental data (table accesses, supplemental fields) is an extension of the tables already present.When you define table accesses and supplemental fields, you must specify the time and the order (of access).You can also use ABAP statements to allocate various events.A functional group is the grouping of several fields into a logical unit. They serve to simplify field selection for the user.The functional group is displayed using a two-part tree structure:The first sub-tree contains the functional groups. This sub-tree is flat: all functional groups exist next to each other at the same level. Each functional group contains the fields that have been assigned to it.The second sub-tree describes the structure of the data that will be read. The structure of functional areas with logical databases corresponds to the structure of the logical database and contains all the nodes and the hierarchical relationships defined between the nodes. In the case of a table join, the structure contains all the tables of the join in a flat structure.Functional groups can be created using the Create icon or from the menu. You must assign an ID code and a long text when creating a functional group.To allocate fields to a functional area, you must choose or select it. The system highlights the selected functional areas in color.To allocate a field to a functional area, you must first make the field visible by expanding the corresponding table in the second partial tree. A special icon next to the field name indicates if the field has been allocated to a functional area. If the icon is a minus sign, the field has not been allocated to a functional group. A single click on the icon allocates the field to the currently marked functional area. The icon behind the ID code of the functional group then changes from a minus sign to a plus sign.A single click on a plus-icon cancels the allocation. You can only cancel the field-functional area allocation if the field has not yet been used in queries.You can define additional tables, additional fields, and ABAP statements either at the GET event or during record processing for each table in the second sub-tree.You can reach these enhancements with the Extras function. The enhancements are summarized for each table.To maintain additions for a particular table, you must position the cursor on a field in the table and then call the function. A window appears that displays all additional tables, additional fields, and statements allocated to the table.The number in the first column indicates the order of the code sections in the generated program. This number becomes important when individual enhancements are dependent upon each other.Multiple allocation of additional tables (alias tables):Alias tables enable repeated use of a table.You can assign multiple alias names for a table. You can then address the table with its various names.You allocate an additional table as follows:Call the Create function on the screen.Enter the name of the additional table and set the selection button on the additional table.Enter the order of the coding section and the WHERE clause in the following screen.A query performs a table access only when the query requires this table field.You allocate an additional field as follows:Call the Create function on the screen.Enter the name of the additional field and select the Additional field radio button.On the following screen, define the code section's sequence and the field itself.You can enter the format specifications directly using the data type or by referring to an ABAP Dictionary field.This screen does not contain ABAP statements for the additional field. To maintain such statements, you must branch to the Editor using the Editor function. The Editor syntax check is available there.You can use include programs, external form routines, and function modules.Selection criteria must always refer to primary data fields or to fields that have been defined in a DATA statement in the functional area.When you specify the order, you also determine the output sequence of individual selection criteria and parameters. However, all the standard selections of the logical database appear in the lead positions on the selection screen.If selections have been defined in addition to the logical database, and these selections refer to a node that does not support free selections, then you have to use a CHECK statement to check the collected data.