2007 May 21 7:39 AM
Hi,
I use SE11 to create database view from a table. I wonder if it is possible to specify a 'GROUP BY' clause? Basically I need a database view that looks like this:-
SELECT FISCAL_PERIOD, SUM(QUANTITY)
FROM TABLE A
GROUP BY FISCAL_PERIOD
Please help!
Thanks,
CH
2007 May 21 8:00 AM
hi
u can use GROUP BY clause in a view
read this for further details
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/select.htm
if helpful, reward
Sathish. R
2007 May 21 8:00 AM
hi
u can use GROUP BY clause in a view
read this for further details
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/select.htm
if helpful, reward
Sathish. R
2007 May 21 8:06 AM
Thanks but it doesn't tell me how to create a view with GROUP BY clause.
I tried in SE11 but it doesn't have the option to create a view with GROUP BY clause.
2007 May 21 8:40 AM
hi
u mean to say that while creating a view in se11, is there any option to specify group by anywhere? couldn't understand exactly what you say...group by is an addition that's used with the select statement, which can be put on db table as well as views...revert back for queries, if any
if helpful, reward
Sathish. R
2007 May 21 8:46 AM
Yes. I want to create a view that has values that are already aggregated by a field.
Example view that i created directly in SQL database:
CREATE VIEW ABC (F1, SUM_QTY)
AS SELECT F1, SUM(QTY)
FROM TABLE1
GROUP BY F1
My question is how to achieve the same result using Database view in SAP through transaction SE11 or any others?
Thanks,
CH
2007 May 21 8:49 AM
Hi,
its not possible to give the GROUP BY claue when u are creating db view.
<b>reward if helpful</b>
rgds,
bharat.
2007 May 21 9:09 AM
hi
no standard settings in se11, as of i know, that will allow you to give group by for any field while creating the view...you have to do it in the abap editor by using group by clause with the select
if helpful, reward
Sathish. R
2007 May 21 11:14 AM
Thanks for all the helpful answers. So disappointed that SAP doesn't have the group by option when creating view. Anyway, I will do the group by in ABAP.
Thanks,
CH
2007 May 21 9:03 AM
you can get the group by result in coding.
steps:
firstly you create the view and then call it in somewhere.
where you call it, transfer the data into an internal table(you can define a type and from the type, you can get an internal table).
After you filled the internal table, (assume internal table is itab) you can say
collect itab.
that groups the data and prevenst double recording from the same data.
Hope helps.
Deniz.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |