10-18-2017 6:00 PM
Hi All,
the following code dumps in some cases, not always:
SELECT * FROM jest INTO TABLE tb_jestDELETE tb_output INDEX sy-tabix.
because read table returns sy-subrc <> 0.
Can someone spot the problem ?
thanks a lot
Filippo
10-18-2017 6:04 PM
Debug and read the documentation about the statements involved ...
10-18-2017 6:04 PM
Debug and read the documentation about the statements involved ...
10-18-2017 8:58 PM
10-18-2017 9:12 PM
Why? What's the contents of sy-tabix? What does the short dump say?
10-18-2017 9:36 PM
found the problem.
In some minor cases, the table tb_jest have some duplicate entries(same objnr). So the first value in tb_jest deletes the corresponding entry in table tb_output and when it reaches the second value in tb_jest, it can't find a corresponding value in tb_output.
Thanks
Filippo
10-19-2017 7:17 AM
Which could only be determined by knowing your data, and debugging, as Horst said...
10-19-2017 1:52 PM
... and please don't do SELECT * on HANA (or any other database, but especially HANA)
10-20-2017 7:11 AM
+1 to Horst. As the short dump indicates probably an "index error" on the DELETE statement, read the ABAP documentation - DELETE itab - itab_line - Alternative 2 INDEX idx :
If idx contains a value of 0 or less, an exception is raised that cannot be handled.
Then debug and you'll see the value of sy-tabix after READ TABLE is zero when the line is not found (if you read the documentation again, you'll see it only states that sy-tabix is set when a line is found, so consider that you shouldn't use sy-tabix if the line is not found.
09-23-2019 3:03 PM
Hi,
You could use if sy-subrc is initial XXX endif.
after read statement.
if sy-subrc is initial.
DELETE tb_output INDEX sy-tabix.
endif.