Skip to Content
1
Aug 13, 2023 at 12:12 PM

ABAP "FOR GROUPS ... OF ... IN VALUE type( ... )" syntax error: No group is bound to "..."

161 Views Last edit Aug 14, 2023 at 05:45 PM 3 rev

Hi experts,

My program is running fine in ABAP 7.52 and 7.57:

REPORT.
TYPES ty_objectnames TYPE STANDARD TABLE OF ob_object WITH EMPTY KEY.
TYPES: BEGIN OF ty_int,
         int_id      TYPE i,
         objectnames TYPE ty_objectnames,
       END OF ty_int.
TYPES ty_ints TYPE STANDARD TABLE OF ty_int WITH EMPTY KEY.
TYPES ty_int_ids TYPE STANDARD TABLE OF ty_int-int_id WITH EMPTY KEY.
TYPES: BEGIN OF ty_object,
         objectname TYPE cus_actobj-objectname,
         int_ids    TYPE ty_int_ids,
       END OF ty_object.
TYPES ty_objects TYPE STANDARD TABLE OF ty_object WITH EMPTY KEY.

DATA(ints) = VALUE ty_ints(
    ( int_id = 1 objectnames = VALUE #( ( 'a' ) ) )
    ( int_id = 2 objectnames = VALUE #( ( 'a' ) ( 'b' ) ) ) ).

DATA(objects) = VALUE ty_objects(
            FOR <int> IN ints
            FOR <objectname> IN <int>-objectnames
            ( objectname = <objectname>
              int_ids    = VALUE #( ( <int>-int_id ) ) ) ).

DATA(objects_2) = VALUE ty_objects(
        FOR GROUPS <group_object> OF <object> IN objects
        GROUP BY ( objectname = <object>-objectname )
        ( objectname = <group_object>-objectname
          int_ids    = REDUCE #( INIT int_ids TYPE ty_int_ids
                                 FOR <object_2> IN GROUP <group_object>
                                 NEXT int_ids = VALUE #( BASE int_ids ( <object_2>-int_ids[ 1 ] ) ) ) ) ).

ASSERT objects_2 = VALUE ty_objects(
    ( objectname = 'a' int_ids = VALUE #( ( 1 ) ( 2 ) ) )
    ( objectname = 'b' int_ids = VALUE #( ( 2 ) ) ) ).
Now, I want to get rid of the intermediate "OBJECTS" internal table ("DATA(objects) = ..." and "FOR GROUPS ... IN objects"), so I replace the line "FOR GROUPS ... IN objects" with "FOR GROUPS ... IN VALUE ty_objects( ... )":
*        FOR GROUPS <group_object> OF <object> IN objects
        FOR GROUPS <group_object> OF <object> IN VALUE ty_objects(
            FOR <int> IN ints
            FOR <objectname> IN <int>-objectnames
            ( objectname = <objectname>
              int_ids    = VALUE #( ( <int>-int_id ) ) ) )

But I get the ABAP syntax error (MESSAGEGDZ in TRMSG) (both in ABAP 7.52 and ABAP 7.57):

  • No group is bound to "<GROUP_OBJECT>"

image.png

Is it a compiler error or by design? Is it documented? Or any other reason?

Thank you!

Sandra

Attachments

image.png (29.4 kB)