‎2006 Aug 28 1:32 PM
Hi all,
I'm curious about the return code for a SQl statment embedded in my ABAP program. The help states that any code other than 0 suggests there was an error executing the SQL statement. So...I include the following to test for an error:
IF SY-SUBRC <> 0.
MESSAGE I000(38) WITH 'Error retrieving data from MAKT MARA MARC'(M01).
LEAVE LIST-PROCESSING.
ENDIF.
I notice that if no records are returned my app throws the message and exits. Why? No records returned doesn't necessarily mean an error..it just means the query returned no records. Also...what would be the correct way to handle the error so no recoreds returned doesn't poop on me?
regards,
Mat
‎2006 Aug 28 2:13 PM
Hi,
then it will return sy-subrc 4 you can write case endcase.
with the different actions to take on each return
grtz
Koen
‎2006 Aug 28 2:13 PM
Hi,
then it will return sy-subrc 4 you can write case endcase.
with the different actions to take on each return
grtz
Koen
‎2006 Aug 28 2:14 PM
‎2006 Aug 28 3:28 PM
The return code for a SELECT statement just tells you if any records were returned or not. If there is an SQL error, the program will likely dump.
Rob