Exception Classes

For all you C++, Java and .NET developers, the concept of exception classes, which is relatively new in ABAP, will be easy to understand.

Exception classes are, as their name imply, classes that define exceptions.
Exception classes are created in a manner similar to creating regular ABAP classes. You can create exception classes in SE80, but you choose “Exception class” as the class type.

Java developers are probably familiar with the concept of checked exceptions and unchecked exceptions. ABAP has this concept as well. As the ABAP documentation explains:

• “If exceptions defined via subclasses of CX_STATIC_CHECK are propagated from a procedure, they must be explicitly declared in the interface of the procedure. The syntax check makes a static check of whether all exceptions triggered in the procedure with RAISE EXCEPTION or declared in the interfaces of the calling procedures are either handled with CATCH or explicitly declared in the interface and issues a warning if this is not the case.”

• “If exceptions defined via subclasses of CX_DYNAMIC_CHECK are propagated from a procedure, they must be explicitly declared in the interface of the procedure. However, this is not checked statically by the syntax check; instead, it is checked dynamically at the point in time when such an exception is propagated from a procedure.”

• “Exceptions that are defined via subclasses of CX_NO_CHECK may not be explicitly declared in the interface of the procedure. The CX_NO_CHECK class and its subclasses are always implicitly declared and are always propagated, whereby resumability is retained if it exists.”

You can therefore see the first type is like checked exceptions, the second and third types have some similarities to unchecked exceptions.

You can find more about ABAP Exception Categories here. You can find more about ABAP exceptions in general here.

SAP SDN also has a good article explaining the difference between the old exception using method and the new one. You can access it here, but you need to have an SDN account in order to read it.

Read more...

Lock Objects

Lock objects are used to manage database locking in your program. Locking is important in case you expect concurrent accesses to a database table.

You create lock objects in either SE11 or SE80 transactions (under the Dictionary Object in the navigation tree)

Each lock object you create is associated with a database table. You can choose by which fields in the table you lock. For example, in case you have an Employee table, you can choose to lock the table by the ID field of the table. After the creation of a locking object, two methods are available for your use – ENQUEUE_objectname and DEQUEUE_objectname, where objectname is the name of the lock object you created. The former allow you to lock an entry in the table, the latter releases the lock object.

There are many types of locks and we’ll not discuss them here. SAP’s official guide on locks can be found in the SAP Help. A nice step by step tutorial on locking objects can be found in Richard Sanots’ blog.

Read more...

Ten ABAP Transaction You Will Probably Use Most

SE80 – Object Navigator
SE80 is the most important transaction for the ABAP programmer. It’s the entry point for the workbench. From SE80 you can for example create new packages, classes, programs, dictionary objects (database tables) etc.

SE11 – Dictionary
Using SE11, you can create and maintain database objects such as Database tables, data types, and lock objects.

SE30 – Performance
SE30 is used for testing performance. Want to compare two bits of code that do the same thing and see which one runs quicker? SE30 is the place to do it.

SECATT – Extended Computer Aided Test Tool
Extended Computer Aided Test Tool (or ECATT) is a built-in tool to test SAP system. By using eCATT you can:
• Test transactions, reports, and scenarios
• Call BAPIs and function modules
• Test remote systems
• Check authorizations (user profiles)
• Test updates (database, applications, GUI)
• Test the effect of changes to customizing settings
• Check system messages

SU01 – User Maintenance
This is the place to maintain user data such as personal data, roles, logon data (passwords) etc. It’s kind of like SAP’s Java WAS’s User Management Engine (UME).

SE81 –Application Hierarchy
SE80’s less famous sister, SE81 allows you to browse SAP applications. Clicking on a node (application) on SE81 opens that application in SE80.

SE91 –Message Classes
SE91 allows creating and maintaining message classes.


SM12 –Lock Entries

Using this transaction you can see which lock objects are used by which user for a table of your desired. See the postregarding lock entries for more information...

SM30 – Maintain Table Views
Using this transaction you can maintain table views, manually adding, editing and removing information from existing tables for which you created a table view.

For a more extended list of frequently used ABAP Transactions, visit the list of ABAP transaction codes, courtesy of SAPTechies.com

Read more...

How I came to meet ABAP

I’ve been working as a software developer for 5 years now. During my career as a software developer, I had experience with many programming languages. I started as a C/C++ programmer(*), continued to Java and J2EE, and even had some experience with C#.
One day, not long ago, my manager announced that our project would require some programming in ABAP. He asked me to be one of the first developers that would make the transition to ABAP.
I was not overjoyed by the request, to say the least. ABAP seemed to me like an archaic programming language, a creature of the 80’s with an uncertain future. I had some experience with SAP systems written in ABAP, and I knew that almost all of SAP’s applications and systems were written in ABAP, but that’s pretty much everything I knew about the language. So I started to read more about ABAP.

Here are two surprising facts that I came to learn about ABAP:

1. The TIOBE Programming community index, in July 2009 ABAP was ranked in the 16th place in terms of popularity(**). Just for comparison, Java is ranked first, C# is ranked 6th, Pascal is ranked 15th, and Cobol is ranked 24th.
2. ABAP is an Object Oriented Language. To be more precise, ABAP has an extension which supports object oriented programming. Much like with C++, you can still write a mixture of procedural code and object-oriented code in ABAP. The concept of OO in ABAP is fairly new. It was introduced in 1999, along with R/3 release 4.6.

Anyway, I began programming in ABAP, and naturally I started to encounter some problems. I also bumped into some interesting material. As I do whenever I study a new subject, I kept some notes solutions to the problems I encountered and summaries of the topics I studied. Then I thought, why not turn these notes into a blog? If they could be useful to me, they would be useful to anyone starting to learn ABAP.
So here it is, my blog about ABAP. I invite you to join me on my journey exploring ABAP. I’ll try to share as many tips for the beginning ABAP developer as I can, and hopefully, with time, it’ll also contain some advanced topics.

(*) Yes, I know some people would be shocked from the fact that I’m even mentioning the two languages in the same sentence. But yes, there are some products out there that were written in a mixture of procedural C and Object Oriented C++. I got to work on one of them. Deal with it.

(**)
According to TIOBE, “the ratings are based on the number of skilled engineers world-wide, courses and third party vendors. The popular search engines Google, MSN, Yahoo!, Wikipedia and YouTube are used to calculate the ratings. Observe that the TIOBE index is not about the best programming language or the language in which most lines of code have been written.”

Read more...

About

This blog contains tips, tricks, tutorials, and stories about my personal experiences with the SAP ABAP language.

About the Author
Yours Truly has been a developer for more than 5 years now, with experience with C, C++, Java/J2EE, and, recently, with ABAP.

Read more...

About This Blog

This blog contains tips, tricks, tutorial, and some of my personal experiences with the SAP ABAP language.

FEEDJIT Live Traffic Feed

  © Blogger templates The Professional Template by Ourblogtemplates.com 2008

Back to TOP