07-06-2009 10:42 AM
Hi Gurus,
I have a question. Will the code inside try...endtry be executed if TRY statement fails.
To be specific, see my scenario below. itab is an internal table with only one field 'line' of type c and length 100. cx_sy_conversion_codepage is used to handle unicode error. How will the code below work if itab-line has a unicode error?
Will it skip that particular line or will that line be moved to the unix file?
LOOP AT itab.
TRY.
TRANSFER itab-line TO unix_file.
CATCH cx_sy_conversion_codepage.
ENDTRY.
ENDLOOP.
Thank you,
Nobin
07-06-2009 10:45 AM
As per ur sample code. The exception will be caught. No DUMP will happen.
U can you that exception & raise a message or do the further processing.
Regards,
Bhargava
07-06-2009 10:50 AM
Hi,
Will that particular record be moved to the unix file or will that be skipped?
Thanks
07-06-2009 10:56 AM
Hi,
The record won't be moved if an exception occurs.
Regards,
Anand Patil.
07-06-2009 11:04 AM
- No program will continue after the ENDTRY.(no code after CATCH)
- If you want to do something, it should be executed in the appropriate CATCH block
- TRY/CATCH will only disable the Dump, it will not correct the error causes
Regards,
Raymond
07-06-2009 10:58 AM
The catch statement will only handle the class-based exception in the try block, since the error in your case is not the class based one, it will not be handled. It is handled by the system in the same way as it is written outside the try block.