cancel
Showing results for 
Search instead for 
Did you mean: 

Display the exception in a calculation view through an odata

Former Member
0 Kudos

Hi,

I have a calculation view which is exposed through an odata. I have used exception handling for handling a user defined error.

I have attached a snippet of the code

  DECLARE CUSTOMCONDITION CONDITION FOR SQL_ERROR_CODE 10001;/* Custom Error Code = 10001*/

  DECLARE EXIT HANDLER FOR CUSTOMCONDITION RESIGNAL;

a=SELECT 'a' AS ID FROM DUMMY;

  CALL "storedprocedure"(

  :a,

  😛

  );

IF :b= 0 THEN

  SIGNAL CUSTOMCONDITION SET MESSAGE_TEXT = 'NOT AUTHORIZED';

END IF;

When i expose this through an odata the error that is displayed is

How can i display the message 'NOT AUTHORIZED' as set in the calculation view.

Do I need to make some changes in the calculation view or the odata

Is it possible to show the message

Thanks,

Shruthi

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member210482
Active Participant
0 Kudos

Hi Shruthi,

You dont have to use semicolon(:) for b here,

ie, IF b= 0 THEN, this will be sufficient.

Let me know if you are still facing the issue..


Regards,

Safiyu

Former Member
0 Kudos

Hi Safiyu,

You are right,the semicolon isn't needed.

However my issue is slightly different.

When i execute the calculation view through sql console,I get the correct error message

ie

When i expose this through the odata the error message that i get is

However i would like to display the message 'NOT AUTHORIZED'  in the odata.

Is there any way to do this in the odata?

Thanks,

Shruthi

former_member210482
Active Participant
0 Kudos

Hi Shruthi,

Go through these similar threads.

http://scn.sap.com/thread/3513929

Hope it helps,

Regards,

Safiyu