cancel
Showing results for 
Search instead for 
Did you mean: 

Query with filter and grouping?

Former Member
0 Kudos

Hello!

An InfoProvider contains, say, the following data:

ObjectVersionGroupValue
10011A10
10012C20
10013B15
10021B100
10023A200
10025C600
10031B50
10034C40
10035C60
10036B70
10045C900

I am interested in only one record per "Object", namely that with the highest version.

They are those:

ObjectVersionGroupValue
10013B15
10025C600
10036B70
10045C900

Furthermore, the result should be less detailed. I don't need the Objects in the result, but only one result for every "Group".

The final result should look like this:

GroupSum of Value
B85
C1500

Can this be done with a query?

Thanks, regards,

Alfred

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Alfred,

This can not be done in query designer - as long as you have Group in rows all three records for object 1001 are taken into account.

This has to be done in transformation e.g. using http://help.sap.com/abapdocu_731/en/abapdelete_duplicates.htm.

BR

Ondrej

Former Member
0 Kudos

Dear Ondrej,

it is possible to obtain the list with highest version only.

(Create a Formula Variable on "Version", use it in a formula. Then create a condition with TOP N, N = 1 on that formula.)

But to obtain this via condition, it is necessary, that "Object" and "Version" are the leftmost characteristics.

And now I am not sure, if it is possible, based on this result, to do further aggregation along "Group".

Thanks and best regards,

Alfred

Former Member
0 Kudos

Well conditions are evaluated after aggregation, so you can get last version, but you can not aggregate any further (with query designer).

The only other option would be exception aggregation, where you can get last value for version, but when you use group in rows, it gets last version value of object for each group.

BR

Ondrej