Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

What are exceptions?....

Former Member
0 Likes
1,345

Hi Experts,

What are exceptions?...and how to rectify if exceptions occurs while executing

a programme.

Thanks in Advance.

Regards,

Ashok kumar

Hi Experts,

What are exceptions?...and how to rectify if exceptions occurs while executing

a programme.

Thanks in Advance.

Regards,

Ashok kumar

5 REPLIES 5
Read only

Former Member
0 Likes
1,096

Hi

Error situation during execution of an ABAP program. Exceptions are treatable (statements TRY, CATCH) or untreatable. Untreated exceptions result in a runtime error. An exception is triggered either by the ABAP runtime environment due to error situations that are not foreseeable by the static program check, or by the RAISE EXCEPTION statement. Before release 6.10, exceptions could be defined only in interfaces of function modules and methods. As of release 6.10, there are class-based exceptions, which include the catchable runtime errors.

Treatable Exception

Exception that can be treated in the program and that does not lead to a runtime error when treated. As of Release 6.10, all treatable exceptions are implemented by means of exception objects and can be treated using TRY-CATCH-ENDTRY statements. Before Release 6.10, selected runtime errors could be caught with CATCH-ENDCATCH.

Regards

Preeti

Read only

Former Member
0 Likes
1,096

Hi,

Exceptions are situations that occur while an ABAP program is being executed, in which normal continuation of the program does not make any sense. Exceptions can be raised either implicitly in the ABAP runtime environment or explicitly in the ABAP program. For example, division by zero leads to an exception in the ABAP runtime environment. It is possible to determine this situation through a query in the ABAP program and to trigger an exception there.

There are two main types of exceptions: those that can be handled and those that cannot be handled.

· Exceptions that can be handled occur in error situations in the runtime environment or in the ABAP program, where the program can continue executing after the ABAP program has handled the exception, without the system ending up in a critical state. If such an exception is not handled, a runtime error occurs.

· The second type of exceptions are those that cannot be handled. These are critical error situations in the runtime environment. Handling with ABAP means is not possible and they always cause a runtime error.

As of Release 6.10, exceptions and their handling are generally based on exception classes. This concept covers the functions of the preceding concepts, enhances them, and thus replaces them.

For More Info,

http://help.sap.com/saphelp_nw04s/helpdata/en/a0/ff934258a5c76ae10000000a155106/frameset.htm

http://help.sap.com/saphelp_nw04s/helpdata/en/cf/f2bbc8142c11d3b93a0000e8353423/frameset.htm

http://help.sap.com/saphelp_nw04/helpdata/en/83/636d1d12fc11d5991e00508b5d5211/frameset.htm

Regards,

Padmam.

Read only

varma_narayana
Active Contributor
0 Likes
1,096

Hi..

Exceptions are the Situations that cannot be handled by the Runtime system during the Execution of a Program.

For Eg: DIVIDE BY ZERO

ARITHMETIC OVERFLOW.

We can use the CATCH .. ENDCATCH statements to handle the Exceptions in a program to Prevent the runtime errors.

Press F1 ON CATCH statement to See more info..

<b>Reward if Helpful</b>

Read only

Former Member
0 Likes
1,096

Hi Ashok

exceptions are nothing but breaking the shortdump errors, instead of sisplaying shortdump errors( end users dont know shortdump informations) so in this cases we use exceptions by checking the sy-subrc value and we can define our own messages accordingg to exceptions....

reward points to all helpful answers

kiran.M

Read only

Former Member
0 Likes
1,096

Hi

reward if usefull

Definition:-

An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program's instructions.

if an exception occurs you can handle that exception by througing an Error message like this

example :-

when creating the function module

<b>

RAISE EXECPTION NAME</b>

in report program

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\NARESH\NARESH.TXT'

  • FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • VIRUS_SCAN_PROFILE =

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = ITAB

<b>EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_READ_ERROR = 2

NO_BATCH = 3

GUI_REFUSE_FILETRANSFER = 4

INVALID_TYPE = 5

NO_AUTHORITY = 6

UNKNOWN_ERROR = 7

BAD_DATA_FORMAT = 8

HEADER_NOT_ALLOWED = 9

SEPARATOR_NOT_ALLOWED = 10

HEADER_TOO_LONG = 11

UNKNOWN_DP_ERROR = 12

ACCESS_DENIED = 13

DP_OUT_OF_MEMORY = 14

DISK_FULL = 15

DP_TIMEOUT = 16

OTHERS = 17

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.</b>