PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, August 5, 2022

[FIXED] How to use local exception classes?

 August 05, 2022     abap, class, exception     No comments   

Issue

I want to write and use a local exception class in ABAP. Keeping it easy, helps me to understand, so I simplified my case:

Lets say I have an account class with the method "withdraw". If I withdrew more than my current balance allows, an "account_overdrawn" exception class should be raised.


Solution

You must use the statement RAISE EXCEPTION TYPE (class name), assuming that the class name is in the scope in which you are doing this.

Depending on how you declared your class, you may have to pass something to its constructor. The RAISE EXCEPTION TYPE statement works just like CREATE OBJECT, but instead, you are creating an instance of an exception object.



Answered By - mydoghasworms
Answer Checked By - Timothy Miller (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing