Skip to Content
0
Former Member
Jan 31, 2007 at 12:30 PM

counting only lines with different values for a charachteristic

16 Views

hello experts,

I want to count the number of trips in ODS1 and thus update the key figure numberOfBookings in a cube.

is there a way in ABAP to count only the lines where

trip_id is different from trip_id of preceeding line?

Because something like

IF comm_strukture-trip_id <> ' '.

return 1.

else.

return 0.

does obviously not worke in this scenario!

ODS1:

trip_id___participant_id___price_____trip date___

__101_____1___________25.00_____20070112

__101_____27__________12.50_____20070112

__102_____21__________55.00_____20070124

__102_____7___________55.00_____20070124

__102_____15__________35.00_____20070124

I need something like select distinct trip_id from ODS1...

If trip_id maches with trip_id in preceding line -> 0

If trip_id does not mach with trip_id in preceding line -> +1

So in the example above the result of numberOfTrips in Cube should be 2!

any suggestions??

kind regards

hiza