2023 Sep 06 8:04 AM
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' ) ).
2023 Sep 06 8:17 AM
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.
2023 Sep 06 8:17 AM
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.
2023 Sep 06 8:18 AM
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' ) ).
2023 Sep 06 8:22 AM
Won't work. His issue is that he's addressing in r_matnr the header line of the range, not the table.