Anfang des Inhaltsbereichs

Objektdokumentation RfcAbapException Class Dokument im Navigationsbaum lokalisieren

 

This class represents an exception raised by the ABAP program in the SAP system. Exceptions are a type of parameter for each SAP RFC. The connector provides strongly typed support for each RFC’s ABAP exceptions in the proxy.

 

[C#]

public class RfcAbapException : SAP.Connector.RfcException

 

In addition to the properties provided from RfcException. RfcAbapException provides the following property:

AbapException

A string containing the ABAP exception from the RFC

 

Example

In the SAP system you can navigate to the Function Builder (transaction code se37) and examine the exceptions for the function you wish to call. For RFC_FUNCTION_SEARCH you see the following exceptions:

 

·        NOTHING_SPECIFIED – this occurs when no input is specified.

·        NO_FUNCTION_FOUND – this occurs when no function matches the search selection.

Depending on what the ABAP exception is we might do different things. Therefore a switch statement is a good idea to deal with this exception.

 

catch (RfcAbapException ex)

   {

   switch (ex.AbapException)

     {

   case (SAPProxy1.No_Function_Found):

      MessageBox.Show("no function found");

      break;

   case(SAPProxy1.Nothing_Specified):

      MessageBox.Show("Nothing specified");

      break;

   default:

      MessageBox.Show("Some unknown abap error occurred");

      break;

     } //switch

}

 

Ende des Inhaltsbereichs