Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Error: ")" expected, not "(". when using VALUE operator

sharmasudeep
Discoverer
0 Kudos
1,618

With the following code, error ")" expected, not "(". is returned in syntax check. What could be the reason ?

RANGES r_matnr FOR mara-matnr.

r_matnr = VALUE #( sign = 'I' option = 'EQ' ( low = '32000' )
( low = '32300' )
( low = '39000' ) ).
1 ACCEPTED SOLUTION

matt
Active Contributor
1,479

I changed the definition of R_MATNR to the modern way of doing it, and it works. I'm puzzled why though.

DATA r_matnr TYPE RANGE OF mara-matnr.
r_matnr = value #( sign = 'I' option = 'EQ' ( low = '32000' )
                                            ( low = '32300' )
                                            ( low = '39000' ) ).

OK, I've figured out why. Using RANGES gives you a table with a header line. You have to tell the compiler explicitly that you mean the table.

DATA r_matnr TYPE RANGE OF mara-matnr.
r_matnr[] = value #( sign = 'I' option = 'EQ' ( low = '32000' )
                                              ( low = '32300' )
                                              ( low = '39000' ) ).

This is why you should use the modern syntax. RANGES is obsolete precisely because it is ambiguous.

3 REPLIES 3

matt
Active Contributor
1,480

I changed the definition of R_MATNR to the modern way of doing it, and it works. I'm puzzled why though.

DATA r_matnr TYPE RANGE OF mara-matnr.
r_matnr = value #( sign = 'I' option = 'EQ' ( low = '32000' )
                                            ( low = '32300' )
                                            ( low = '39000' ) ).

OK, I've figured out why. Using RANGES gives you a table with a header line. You have to tell the compiler explicitly that you mean the table.

DATA r_matnr TYPE RANGE OF mara-matnr.
r_matnr[] = value #( sign = 'I' option = 'EQ' ( low = '32000' )
                                              ( low = '32300' )
                                              ( low = '39000' ) ).

This is why you should use the modern syntax. RANGES is obsolete precisely because it is ambiguous.

ansari_mobbasher
Explorer
1,479

Refrain from using obsolete syntax. 'RANGES' is obsolete syntax. Use 'DATA : <var> TYPE RANGE OF <DATATYPE>'. Error will be resolved after this.

RANGES r_matnr FOR mara-matnr. "Obsolete syntax
DATA : r_matnr TYPE RANGE OF mara-matnr. "New Sytax

r_matnr = VALUE #( sign = 'I' option = 'EQ' ( low = '32000' )
( low = '32300' )
( low = '39000' ) ).

matt
Active Contributor
1,479

Won't work. His issue is that he's addressing in r_matnr the header line of the range, not the table.