16.2.11

SAP Note 22556 - ABAP/4 query: Syntax error in query report

Symptom:

When executing a query report, an error message is issued, stating that client specification is not permitted:
- Client specification: MANDT not allowed
or
- Without the addition of CLIENT SPECIFIED, the client field MANDT may not be entered in the WHERE requirement.
Key words: Query, direct read operation, client

Cause and prerequisites

The functional area in which the query is defined, is a functional area which reads a table from the SAP System using the 'direct read operation' method. This table is client-specific.
The 'direct read operation' method is always converted into a SELECT statement without the addition of CLIENT SPECIFIED - that is, for a functional area of this type, it is not possible to perform client-independent reads.
In the previous error, however, the client field is included in a functional group of the functional area. Additionally, it was determined that, when definiting the query, a select option for this client field should be supplied. In functional areas with a direct read operation, this select option as a WHERE requirement is passed on to the SELECT statement.
The WHERE ... MANDT IN xxxxxx construction, which requires the CLIENT SPECIFIED addition and therefore causes the error, appears in the generated report in the WHERE requirement.

Solution
The client fields of tables should generally not be included in the functional areas as the query usually only picks data from a client. The client field, therefore, always has the same value and is thus of no essential informative value. If a functional area contains no client fields, syntax errors of the type discussed here cannot occur.
If an exceptional read should be carried out for all clients, a functional area which works with a separate data supply program must be created. In this data supply program, a read on all clients can be programmed with SELECT and the CLIENT SPECIFIED addition as a method for data retrieval. The WHERE requirement must contain a query in the client field as otherwise the data supply program is syntactically incorrect and no generation of the functional area possible. In a functional area of this type, it is useful to include the client field in the functional area.

No comments:

Post a Comment