Skip to Content
0

Question about filter table (ABAP 740 features)

Mar 03, 2017 at 12:55 PM

130

avatar image
    DATA(my_airlines) = FILTER ty_airlines(
                        VALUE ty_airlines(
                          FOR GROUPS carrid OF flight IN flights
                              GROUP BY flight-carrid
                                ( carrid = carrid
                                  carrnm = get_carrid_name( carrid ) )
                                )
                             IN VALUE ty_carrid_t(
                                       ( |AA| )
                                       ( |AZ| ) )
                             WHERE carrid = table_line ).

It's about the new ABAP 740 features...

Does anyone know if its' possible to have the filter table defined inline?

The above code does not work because "For operator "VALUE" the type cannot be derived from context.

Only the following works:

DATA ty_carrid_t TYPE SORTED TABLE OF s_carr_id WITH UNIQUE DEFAULT KEY.
[...]
IN VALUE ty_carrid_t(
          ( |AA| )
          ( |AZ| ) )
WHERE carrid = table_line ).
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Horst Keller
Mar 03, 2017 at 01:15 PM
0

Hi Enno,

I don't understand your question.

Your first example works:

TYPES ty_airlines TYPE TABLE OF scarr WITH EMPTY KEY.
TYPES ty_carrid_t TYPE SORTED TABLE OF s_carr_id WITH UNIQUE DEFAULT KEY.
DATA flights TYPE TABLE OF spfli.

DATA(my_airlines) = FILTER ty_airlines(
                        VALUE ty_airlines(
                          FOR GROUPS carrid OF flight IN flights
                              GROUP BY flight-carrid
                                ( carrid = carrid
                                  carrname = 'get_carrid_name( carrid )' )
                                )
                             IN VALUE ty_carrid_t(
                                       ( |AA| )
                                       ( |AZ| ) )
                             WHERE carrid = table_line ).
Show 2 Share
10 |10000 characters needed characters left characters exceeded

Sorry Horst, I forgot to remove the important part... :]

DATA(my_airlines) = FILTER ty_airlines( VALUE ty_airlines(
                         FOR GROUPS carrid OF flight IN flights
                              GROUP BY flight-carrid
                                ( carrid = carrid
                                  carrnm = get_carrid_name( carrid )))
                      IN VALUE #( (|AA|) (|AZ|) ) WHERE carrid =table_line ).

I was trying this:

IN VALUE #( (|AA|) (|AZ|) )

and had no idea why this is not working...

0

Hi Enno,

How should it work?

# stands for a given operand type, the compiler must be capable to infer from the operand position.

What's the given type you would expect here?

Horst

0