AMDP - Avoiding FOR ALL ENTRIES and Pushing Calculation To Database Layer - SAP Blogs
AMDP - Avoiding FOR ALL ENTRIES and Pushing Calculation To Database Layer - SAP Blogs
https://blogs.sap.com/2018/06/19/amdp-avoiding-for-all-entries-and-pushing-calculation-to-database-layer/ 1/11
8/9/23, 15:11 AMDP: Avoiding FOR ALL ENTRIES and pushing calculation to Database Layer | SAP Blogs
MATNR MATNR
WERKS WERKS_D
LGORT LGORT_D
Output Tables:
MATNR MATNR
WERKS WERKS_D
ERFMG ERFMG
(SUM)
3. Understanding
limitation in FOR ALL
ENTRIES select statement
In a select query, with FOR ALL ENTRIES, one can’t use
Group BY clause. The addition GROUP BY has no effect
if FOR ALL ENTRIES is used.
https://blogs.sap.com/2018/06/19/amdp-avoiding-for-all-entries-and-pushing-calculation-to-database-layer/ 2/11
8/9/23, 15:11 AMDP: Avoiding FOR ALL ENTRIES and pushing calculation to Database Layer | SAP Blogs
1010 0002 0
4. Configuration
The following steps explain step by step configuration:
https://blogs.sap.com/2018/06/19/amdp-avoiding-for-all-entries-and-pushing-calculation-to-database-layer/ 3/11
8/9/23, 15:11 AMDP: Avoiding FOR ALL ENTRIES and pushing calculation to Database Layer | SAP Blogs
https://blogs.sap.com/2018/06/19/amdp-avoiding-for-all-entries-and-pushing-calculation-to-database-layer/ 4/11
8/9/23, 15:11 AMDP: Avoiding FOR ALL ENTRIES and pushing calculation to Database Layer | SAP Blogs
5. Test
Now run the AMDP method by executing class from SE24
transaction. It should open the window to test the method.
https://blogs.sap.com/2018/06/19/amdp-avoiding-for-all-entries-and-pushing-calculation-to-database-layer/ 5/11
8/9/23, 15:11 AMDP: Avoiding FOR ALL ENTRIES and pushing calculation to Database Layer | SAP Blogs
6. Coding
Coding part follows standard SQL Script references. Here
select statement is broken into multiple steps depending
upon select options.
https://blogs.sap.com/2018/06/19/amdp-avoiding-for-all-entries-and-pushing-calculation-to-database-layer/ 6/11
8/9/23, 15:11 AMDP: Avoiding FOR ALL ENTRIES and pushing calculation to Database Layer | SAP Blogs
7. Limitation
All standard limitations of AMDP such as:
https://blogs.sap.com/2018/06/19/amdp-avoiding-for-all-entries-and-pushing-calculation-to-database-layer/ 7/11
8/9/23, 15:11 AMDP: Avoiding FOR ALL ENTRIES and pushing calculation to Database Layer | SAP Blogs
Alert Moderator
10 Comments
Gaurav Sharan
June 19, 2018 at 10:24 am
Like 1Share
Mehmet Dagnilak
June 20, 2018 at 9:04 am
I loved the ideas of joining with an internal table and selecting from an local internal table
with grouping. Thank you very much for pointing these!
I wonder how Hana handles selecting from an internal table. Does it read all the data
into the internal table and then summarize it, or does it do all the calculations in one
step?
Like 0Share
Hi Mehmet
Follow
I guess it would be similar to any other DB tables i.e. fetch all the data then do
the summation.
Like
Thanks
RSS Ankit
Feed
Like 0Share
https://blogs.sap.com/2018/06/19/amdp-avoiding-for-all-entries-and-pushing-calculation-to-database-layer/ 8/11
8/9/23, 15:11 AMDP: Avoiding FOR ALL ENTRIES and pushing calculation to Database Layer | SAP Blogs
Zhe Zhao
June 21, 2018 at 5:38 am
With ABAP 7.52, an internal table can be specified as a data source data source of a
query. So we can join an internal table with datebase table directly by using Open SQL.
However, it is not possible to use more than one internal table in an SQL command.
Like 3Share
Mehmet Dagnilak
June 25, 2018 at 6:40 am
I loved this even better 🙂 I wish companies could upgrade more often..
Like 0Share
Like 0Share
Sijin Chandran
September 19, 2018 at 7:26 am
Hi Ankit,
can't we have more than one Table reference in the using part ( highlighted below ).
USING kna1
https://blogs.sap.com/2018/06/19/amdp-avoiding-for-all-entries-and-pushing-calculation-to-database-layer/ 9/11
8/9/23, 15:11 AMDP: Avoiding FOR ALL ENTRIES and pushing calculation to Database Layer | SAP Blogs
In my case in the same method I want to fetch from various related tables like knvv, knvp
etc and at this part am not able to mention more than one table.
Thanks,
Sijin
Like 0Share
Sijin Chandran
September 20, 2018 at 1:16 pm
Yes we can :
https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-
US/abenamdp_functions_abexa.htm
Like 0Share
S Patil
May 22, 2019 at 2:53 pm
Hi Ankit,
Thanks,
Sourabh
Like 0Share
B@lu .
October 27, 2019 at 12:08 pm
1.can we use AMDP for SAP supported Database(s) other than HANA?
2.if a CDS view is implemented with AMDP Table Functions. so can we access it by
Open SQL statements?
https://blogs.sap.com/2018/06/19/amdp-avoiding-for-all-entries-and-pushing-calculation-to-database-layer/ 10/11
8/9/23, 15:11 AMDP: Avoiding FOR ALL ENTRIES and pushing calculation to Database Layer | SAP Blogs
https://blogs.sap.com/2018/06/19/amdp-avoiding-for-all-entries-and-pushing-calculation-to-database-layer/ 11/11