Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

What is the difference between FIELD-GROUPS:Internal tables

Former Member
0 Kudos

What is the difference between FIELD-GROUPS:

INTERNAL TABLES.

In what scenarios we will go for FIELD-GROUPS,

and what scenarios we will go for INTERNAL TABLES.

1 REPLY 1

Former Member
0 Kudos

Syntax Diagram

SELECT - group

Syntax

... GROUP BY { {col1 col2 ...} | (column_syntax) } ... .

Effect

The addition GROUP BY combines groups of rows that have the same content in their specified columns col1 col2 ... in the resulting set into a single row.

The use of GROUP BY has the prerequisite that SELECT only individual columns, not all the columns, are specified using *. If GROUP BY is used, all columns that are specified directly after SELECT and not specified as an argument of an aggregate function must be listed there. Conversely, if GROUP BY is used, all the columns listed after SELECT that are not specified after GROUP BY must be specified as an argument of an aggregate function. The aggregate functions define how the content of these columns is determined in the combined row from the contents of all the rows of a group.

After GROUP BY, the same column identifiers must be specified as after SELECT. The specification can either be specified statically as a list col1 col2 ... or dynamically as a brackted data object column_syntax that - at execution of the statement - contains the syntax of the staticspecification or is set to initial value. For column_syntax, the same applies as for the dynamic column specification after SELECT.

If the content of column_syntax initial, either all the rows or no rows at all are grouped together. The columns after SELECT must then be listed either solely as arguments of aggregate functions or solely directly. If not, prior to Release 6.10 you could trigger a runtime error. As of Release 6.10, this would trigger an exception CX_SY_OPEN_SQL_DB that can be handled.

The columns listed after GROUP BY must not be of type STRING or RAWSTRING, and if GROUP BY is used, pool or cluster tables cannot be accessed.

Note

With the use of GROUP BY, the statement SELECT avoids the SAP buffering.

FIELD-GROUPS

Syntax

FIELD-GROUPS { header | field_group }.

Effect

Declaration of a field group for the extract dataset of the program. Each field group represents the name of a line structure of the extract dataset. You can create as many field groups as you wish in a program. You define the actual components of a field group with the statement INSERT.

The denominator of a field group is either the predefined name header or any name field_group. If you declare a field group header, it automatically becomes the beginning part of all remaining field groups of the program and its components constitute the standard sort key of the extract dataset for the statement SORT.

The statement FIELD-GROUPS is possible in the global declaration-part of an ABAP program, as well as in the subprograms and function modules. Field groups that are declared in procedures are visible only there.

Note

As you can only define global data objects as components of field groups with the statement INSERT, we recommend to declare field groups only in the global declaration part as well.

Example

Siehe INSERT.