2023 Oct 10 3:32 PM
Hello,
I have the following SELECT statement in a program that is used productively.
SELECT (lv_header_line) FROM (i_view) WHERE (lv_where)
ORDER BY (lv_header_line) INTO CORRESPONDING FIELDS OF TABLE @<gt_data>
OFFSET @( lv_skip_pkg_cnt * pkg_size ) UP TO @pkg_size ROWS.
Today I wanted to make a modification to the code, and was surpised to see that the initial source code
which is currently active, doesn't compile.
It throws a syntax error:
"OFFSET" is invalid here (due to grammar). contains an invalid character or it is a
I'm not sure what is causing it now, because the same syntax was correct a few months ago and allowed me to activate the program.
This syntax error is also now present in the rest of the BW systems in the landscape when I execute a check on the code.
Any ideas how to resolve it?
Thanks,
Dimitar
2023 Oct 10 4:30 PM
Formatting issue (<BR> everywhere). Best formatting:
SELECT (lv_header_line)
FROM (i_view)
WHERE (lv_where)
ORDER BY (lv_header_line)
INTO CORRESPONDING FIELDS OF TABLE @<gt_data>
OFFSET @( lv_skip_pkg_cnt * pkg_size )
UP TO @pkg_size ROWS.
2023 Oct 10 4:44 PM
sandra.rossi, thanks for following up. I tried copying your suggested formatting of the statement without success. I had also tried that prior to posting the question here but forgot to mention it. Pretty printer didn't help either.
2023 Oct 10 6:09 PM
2023 Oct 10 6:59 PM
sandra.rossi, (Ctrl+Shift+V) doesn't do anything in ADT nor in the GUI ABAP editor.
2023 Oct 11 7:48 AM
Please use the COMMENT button for comments, asking for complements, adding details, replying to a comment or a proposed solution or to the OP question, etc., ANSWER is only to propose a solution, dixit SAP text at the right of the answer area.
2023 Oct 11 7:49 AM
2023 Oct 11 7:53 AM
When the GUI editor is in edit mode, copypasting will give these artifacts. Switching to display mode before copying fixes the issue.
2023 Oct 11 8:00 AM
2023 Oct 11 6:47 PM
2023 Oct 12 6:52 AM
This was referring to the formatting issue you pointed out initially. I still have the syntax error.
2023 Oct 12 2:03 PM
Be careful when choosing between Answer and Comment ("I fixed it" is not a solution for your question). Moderators would like you to choose carefully to avoid intervening.
2023 Oct 11 3:52 PM
This code compiles in ABAP version 7.57. If it doesn't compile on your system, it means you are using an old version.
FIELD-SYMBOLS <gt_data> TYPE table.
DATA(lv_header_line) = ``.
DATA(i_view) = ``.
DATA(lv_where) = ``.
DATA(lv_skip_pkg_cnt) = 0.
DATA(pkg_size) = 0.
SELECT (lv_header_line)
FROM (i_view)
WHERE (lv_where)
ORDER BY (lv_header_line)
INTO CORRESPONDING FIELDS OF TABLE @<gt_data>
OFFSET @( lv_skip_pkg_cnt * pkg_size )
UP TO @pkg_size ROWS.
2023 Oct 11 4:04 PM
Yes, that's true. We don't have 757 installed, but why did the code compile in the first place? I have this code active and running across the landscape.
2023 Oct 12 2:01 PM
It's difficult to help if you just say you "don't have ABAP 7.57".
If you want to know why the code compiled in the first place, there could be many reasons, SAP notes, kernel, activation forced, etc., but nobody can say without details, so better ask SAP Support to connect to your system.
2024 Jun 27 5:02 PM - edited 2024 Jun 27 5:15 PM
Hello
I'm having the same problem.
SAP 740 SP24
Just trying to do this simple example:
SELECT FROM demo_expressions
FIELDS id, num1 AS number, numlong1 AS result
ORDER BY id, num1
INTO TABLE @DATA(itab)
OFFSET @o
UP TO @n ROWS.
When try to activate I have this error message:
"OFFSET" is invalid here (due to grammar). contains an invalid character or it is a keyword. (It might be possible to escape it using !). Or a space is missing or there is one space too many.
If any one knows something please share.
2024 Jun 27 7:22 PM
OFFSET is not supported in ABAP 7.40. See the ABAP 7.40 documentation.
2024 Jun 28 8:15 AM
Hi Sandra
Thank you for your answer.
Yes, I did. I was in doubt how this is can be true.
Just confirmed.
Thank you.
2024 Jun 28 12:25 PM
In the version 7.51 release documentation : New Addition OFFSET in SELECT