Application Development 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: 

acceptional handling

Former Member
0 Kudos

what is acceptional handling? tell me plzzz

5 REPLIES 5

Former Member
0 Kudos

Hi,

It is not 'acceptional handling', It is Exception Handling.

Generally when you are working with Fun Modules you have to define EXCEPTIONS which will trigger according to the error occurance.

Otherwise the program dupms, which is not a right one.

Regards,

Anji

Former Member
0 Kudos

R u talking abt exception handling?

If yes, then

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.

Former Member
0 Kudos

Hello,

Check this:

... EXCEPTIONS except1 = rc1 ...exceptn = rcn

Effect

EXCEPTIONS lists the exceptions to be handled by the calling program itself. At the end of the exception list, you can use OTHERS to refer to all the remaining exceptions.

If one of the listed exceptions occurs, SY-SUBRC is set to the appropriate value rc (a numeric literal!) and control passes back to the calling program. By specifying a return code, you can divided the exceptions into classes. With the second form, without "=rc", SY-SUBRC is set to a value other than 0 if an exception occurs.

If the function module triggers an exception (with the statements RAISE and MESSAGE ... RAISING) and the exception is not to be handled by the calling program itself,

RAISE terminates the program with a runtime error;

MESSAGE ... RAISING outputs the message.

Note

The following EXCEPTIONS are predefined by the system and have a special meaning:

OTHERS: Covers all user-defined exceptions in the called function module.

ERROR_MESSAGE: This exception instructs the system to ignore S messages, I messages and W messages until return from the function module (although they still appear in the log during background processing). When an E message or an A message occurs, the called function module terminates, as if the exception ERROR_MESSAGE has been triggered.

Example

DATA: WA_SFLIGHT TYPE SFLIGHT, 
      P_LOSS LIKE SFLIGHT-PAYMENTSUM, 
      P_REVENUE LIKE SFLIGHT-PRICE, 
      P_CARRID LIKE SFLIGHT-CARRID. 
... 
SELECT * FROM SFLIGHT INTO WA_SFLIGHT WHERE CARRID = P_CARRID ... . 
CALL FUNCTION 'CALCULATE_REVENUE_LOSS' 
     EXPORTING 
          PAYMENTSUM = WA_SFLIGHT-PAYMENTSUM 
          SEATSOCC   = WA_SFLIGHT-SEATSOCC 
          PRICE      = WA_SFLIGHT-PRICE 
     IMPORTING 
          LOSS       = P_LOSS 
          REVENUE    = P_REVENUE 
     EXCEPTIONS 
          OTHERS     = 1. 
... 
ENDSELECT. 
... 


Example 
TABLES SFLIGHT. 
DATA: ITAB TYPE STANDARD TABLE OF BCAXX WITH 
NON-UNIQUE DEFAULT KEY INITIAL SIZE 10. 
P_YEAR ... . 


CALL FUNCTION 'FILL_SEATTAB' 
     EXPORTING 

          YEAR     = P_YEAR 

     TABLES 
          SEATTAB  = ITAB 
     EXCEPTIONS 
          NO_ENTRY = 1 
          OTHERS   = 2. 

CASE SY-SUBRC. 

     WHEN 1. ... 
     WHEN 2. ... 

ENDCASE.

Vasanth

Former Member

amit_khare
Active Contributor
0 Kudos

I think u want to know abt EXCEPTIONAL HANDLING.

and it is - when ever there is the occurance of any situation which is not positive then to handle it and through some relevant information for users.

e.g. Division by zero, there might be a situation when in any of your calculation the number can get divided by zero, so in that case are you handling the situation properly to avoid that condition, becoz if not then this will result in dump.

Regards,

Amit

Reward all helpful replies.