7.4 Release News - Inline Declaration I.


After finishing the blog post series, called 5 Ways to Improve the Readability of Your ABAP Code, I was thinking a lot about the topic of the next blog post series.

In the last few months, I worked with many 7.4 based SAP systems, developed many ABAP programs, and thanks to this, I had chances to try out the different new features, that the SAP has implemented. Since during my works, these improvements helped me a lot, and found them very useful, I decided to share them with you.

5 Ways to Improve the Readability of Your ABAP Code Part V. - The Proper Use of Comments


In the last few posts we have talked about why to use meaningful identifier names, why to avoid magic numbers, the benefits of organizing our code with functions, and the role of formatting

Now, I want to talk about the last part of my readability puzzle, the comments.

Comments serve as annotations in our source code, usually we leave these kind of notes to make ourselves and the others remember what the given portion code is actually doing.

However there are cases when these notes creates misunderstandings, for example when it's not up to date with the associated code.

5 Ways to Improve the Readability of Your ABAP Code Part IV. - Formatting Does Matter


First of all Happy and Successful New Year to my dear readers! I hope you all had a great holiday with your family, could relax a bit, and you are ready to improve further our ABAP coding style.

I skipped two weeks of writting posts, because I didn't want to bother you with boring ABAP codes during the holidays, but today we are going to continue our work. Let me refresh what we learn until now!

In the previous posts we talked about using meaningful identifier names, why to avoid magic numbers, and the benefits of organizing our code with functions. As you have experienced, these methods require more time to invest (choosing the best identifier name, how to structure the code with functions, and so on), but at the end it pays off multiple times.

5 Ways to Improve the Readability of Your ABAP Code Part III. - Organizing with Functions


In the last two blog posts, I have showed you the benefits of using meaningful names and avoiding magic numbers. As I told you, it really does matter how readable your code is.

In the last few days, I was thinking a lot about the WHYs, why many-many developers write their source code with poor readability and transparency:

  • faster development => okay, it can be faster in the first few iterations, but then the development time increases largely, when the lines of the source code hits a certain numbers,
  • hiding information => it's my program! I don't want anybody to understand it! I want to keep that information! It's ok, but you are going to hide that info from yourself also, since a year later you won't understand neither,
  • laziness => I have no explanation :)

5 Ways to Improve the Readability of Your ABAP Code Part II. - Avoid Magic Numbers


After showing you the real benefits of using meaningful names, I want to share you another useful tip that can help you to improve the readability of your code. Usually, it's not advisable to use many hard-coded values in your source code, but there are cases when you need them. For example, you want to calculate the total working hours of a month, based on the working days, using the following formula:

total_working_hours = working_days * 8.

5 Ways to Improve the Readability of Your ABAP Code Part I. - Using Meaningful Names


Today, I'm going to start a new series of posts about improving the readability of your code. In this post series, I will share you my top 5 approaches that can help to make your and your colleagues' life easier.

In the past, I have seen many-many ABAP source codes with the lack of readability. These coders usually choose poor names for their programs, classes, methods, subroutines, function modules, variables, and so on, which makes their own and our business more complicated.

I know that in ABAP, we are a bit limited in the length of the identifiers, but usually we have enough characters to express our thoughts (depending on the type of the indentifiers). I don't think it belongs only to these length limitations, I think it's more about your exactitude. Don't be afraid using meaningful names!

Simple XML Processing in ABAP Part V. – Processing XML Attributes

In the previous post, we finished our framework program that is able to call our previously constructed Simple Transformation to parse the content of the XML into SAP database table, ZCUSTOMER.

Today, I want to share you another challenging use case for processing XML documents, namely how to process XML attributes in the XML document using Simple Transformation. It may sound a bit difficult, but we will see that SAP makes our job really easy. We can perform all mentioned operation below via the source code editor or the visual editor. As you got familiar with the visual editor in the previous posts, now I am going to demonstrate the steps in the source code editor (Note: it doesn't matter which IDE you use, it has the same effect).

Simple XML Processing in ABAP Part IV. – Create Framework Program to Process XML Files

Main responsibilities

We did a great job with the Simple Transformations, so from now on we are ready to call it from the framework program. To make it simpler, first I am going to introduce the main responsibilities of the framework program: first let's upload the content of the XML file, then parse this content into an SAP internal format, and at last insert the parsed data into the database. I like to write transparent codes, so we are going to use subroutines to separate these different responsibilities, and keep our code readable. We are going to construct three subroutines, namely UPLOAD_XML, PARSE_XML, and INSERT_INTO_DATABASE.

Simple XML Processing in ABAP Part III. – Create Simple Transformation to Parse XML Content

Create the Simple Transformation

As we are ready with creating ABAP Dictionary objects, let’s move on, and open the transaction, called STRANS to create the Simple Transformation that will parse the content of the XML document into the internal format of the SAP. In the Transformation Editor, first let’s give a name to our transformation like ZCUSTOMER_ST, and hit the Create button.