Skip to Content

When learning a new programming language it’s desirable to write down its syntax for if you can’t remember, for example, how to declare a class, you can always take a peek at your notes and remind yourself of the keywords that will make it happen.

 

After writing a few notes, they will need to be organized into groups, for if they aren’t, it will be hard to quickly find related syntactic notes. A piece of paper on which these notes are organised are commonly known as a cheatsheet or reference sheet.

 

Every programming language, from C to Python and beyond has a cheatsheet and they are all different depending on which person designed them and for what purpose. Some cheatsheets are aimed at language learners; these cheatsheets have lots of comments that explain what are the consequences of using a statement and omit complicated syntactic features. Some cheatsheets are aimed at proficient users; these cheatsheets rarely have comments as they try to fit as many syntactic notes as possible onto a single piece of paper, for such users already know what are the consequences of invoking a statement, they just need to remind themselves of the proper statement syntax.

 

During the process of learning ABAP, I’ve noticed a distinct lack of ABAP cheatsheets of the Internet, especially those aimed at proficient users, so I’ve written my own ABAP cheatsheet.

 

The first page is complete and is an example of how I want the other pages to look like. It is dense: every line is filled with characters and there are 6,8 characters per square centimeter. Similar syntax is close to each other: class declaration near data declaration, internal tables near OpenSQL.

Dense ABAP Syntax Cheatsheet

 

The other pages have room for additional notes and are not complete, which is part of the reason why I’m publishing the cheatsheet. I’d like to hear your feedback on how I can improve the cheatsheet: what notes should be on there and how can I write the syntax more concisely. My email address can be found at the bottom of the cheatsheet.

 

Enjoy programming in ABAP!

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

  1. Matthew Billingham

    OK – in Java and other languages this would be useful, but with ABAP and the help built in, I’m not so sure. Even when I was a newbie, I just used ABAP F1 help to get the syntax. I still do that 20 years later (or use the ADT code completion).

    (2) 
  2. Mislav Jaksic Post author

    Thank you on your feedback!

    In reference to the ABAP F1 built-in help being better or more useful compared to this cheatsheet: I’m not sure that’s obviously true. One of the reasons why I’ve decided to write the cheatsheet is precisely because I was dissatisfied with the built-in help.

    When I am writing an ABAP program, I want to write the simplest, most basic statements with the least amount of keywords, but that will still get executed. I believe programs in general should be made up of statements that are as simple as possible, so that the program can be read easily by both learners and experts. This is where the built-in doesn’t help me.

    The built-in help is far too verbose for my taste. Take for example the most basic of statements: DATA. After pressing F1, you will be shown information about every possible optional keyword and told that DATA can take many forms, with links to other pages that are also chock full of information. Expert users will, I’m sure, appreciate the fullness of syntax the help provides and I do too if I’m looking for some very specific language construct, but most of the time, I’d just like to know what is the minimum number of keywords that I have to write to make the statement work.

    I believe this will more clearly elucidate the purpose of the cheatsheet. It is not a replacement for the built-in help or the online version (7.51) of it, but a supplement that will help you write easily readable programs made up of simple statements.

    Thank you on your criticism, keep it coming!

     

    (0) 
    1. Jacques Nomssi

      Hello Mislav,

      I ound the last page of your list the most useful, but I have different questions.Today I would have like to lookup

      • the syntax of some string functions that replace statements
      • Operators, Expressions: e.g. How to FILTER with lookup table, CORRESPONDING with mapping..
      • the syntax of the GROUP BY addition to LOOP,
      • annotations in CDS views, why are SQL expressions are not allowed in GROUP BY for CDS views, how to work around this limitation with a CDS view hierarchy
      • Operand positions: declaration position, general expression positions, functional operand position, numeric expression position.. things that make ABAP syntax imprevisible  (oops, I cannot use an inline declaration in an expression)

      and of course the list will be different tomorrow. I use a reference book (1000+ pages) for older statements, the online help for newer statement and Horst Keller’s blogs in this forum.

      The ABAP language evolved from a reporting tool to a swiss army knife. Now with over 700 keywords and growing, the developer targeting a moving target (Netweaver 7.0, or 7.02 or 7.31 or 7.40 or 7.5x) must remember today’s state of the art method to shoot yourself in the foot in ABAP will be obsolete tomorrow.

      Modern ABAP introduced expressions, creating a conflict almost by design as new features were hitherto added to ABAP as new statements.

      • A statement does something: statements work on data, they are imperative and must be applied in sequence.
      • An expression returns some value: a pure functions (without side effect) is composable. They can be functional, but the ABAP type system does not support complex data types.

      With this, we can discuss expressive ABAP code. What do the ABAP developer need?

      A developer create Useful Software(TM) in ABAP using a subset of the language. This works well for the typical ERP expert with an understanding of business processes and domain specific database tables wo do not think of herself as language expert but as a data professional. Those ABAPers do not plan to rewrite the SORT statement to increase performance by 10% in some special case, they add value by translating functional requirements into queries, with ABAP acting as a glue around the query language without getting in the way.

      We understand what to build/change, even if they are struggling on how to do it. I think SAP is committed to support this user base, e.g a new programming model as seems to makes sure the Data Professional can produce modern Fiori UI without spending years to learn JavaScript.

      This makes business sense for SAP, but this means ABAP will continue to evolve and the keyword list will grow.

      best regards,

      JNN

      (1) 
  3. saurabh chikate

    Hi Mislav,

    Thank you very much for the compilation.

    It is really helpful for people like me who like to have all things in front of eyes in the least space possible. Yay! I am not alone 😛

    (0) 

Leave a Reply