Collect usage for SAP-ABAP

Source: Internet
Author: User

Original post address: http://qiqeloveyou.blogbus.com/logs/28574615.html

 

Copyright Notice
: During reprinting, please use hyperlinks to indicate the original source and author information of the article and this statement

Http://qiqeloveyou.blogbus.com/logs/28574615.html

 

Collect statements are embedded in
Select --- endselect
Used in
,
In
Frequently Used in report development
,
The role is based on
Table
Of
Unique
Key,
Automatically accumulate other fields in the table
,
It is generally used to aggregate some data.
Statistics
.

Example:

Data: Begin of mytable,

Keyfield
Like XXX,

Fliedl1
Like
XXX,

Field2

Like XXX,

End of mytable.

Data:
Mytable_col like hashed table of mytable


With
Unique key keyfield with headline.

 

Select keyfield fliedl1 field2 from
Table_system

Into (mytable-
Keyfield, mytable-fliedl1, mytable-field2 ).

Collect mytable into mytable_col.

Endselect.

 

The purpose of this example is
Keyfield
Is the primary key
,
Set
Fliedl1
And
Fliedl2
Of
Accumulate data
,
Computing belongs to each
Keyfield
Of
Fliedl1
And
Fliedl1
Of
Sum
.

Collect
Enable
There are two conditions
:

<! -- [If! Supportlists] --> 1.


<! -- [Endif] --> tired
The time when the table is added to must be
Hashed table
Or
Sorted
Table,
That is, you must have a unique
Key.

<! -- [If
! Supportlists] --> 2.


<! -- [Endif] -->
Key
Of
Other attributes must be font-shaped
,
Can be accumulated
.

Of course
Mytable
And
Mytable_col.
Of
The table types must be completely consistent.
.

When a general report is generated
Need to calculate a large amount of data
,
Use
Collect
Language
The advantage of a sentence is that you do not need to retrieve the data locally.
Loop
Accumulate
,
Drop
Low report pressure on the System
.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.