What is ABAP?

Hidden waterwheel

First and foremost ABAP is a programming language. It is the “main” programming language of SAP. It is possible to also write code in Java (and now Javascript for the frontend) but the majority of code written in SAP is written in ABAP.

See the Wikipedia entry on ABAP:
“ABAP (Advanced Business Application Programming, originally Allgemeiner Berichts-Aufbereitungs-Prozessor, German for “general report creation processor”) is a high-level programming language created by the German software company SAP SE. It is currently positioned, alongside Java, as the language for programming the SAP Application Server, which is part of the NetWeaver platform for building business applications.”
https://en.wikipedia.org/wiki/ABAP

In SAP ABAP is used to create reports, interactive programs (called Dialog programs), Function modules, to implement SAP enhancements and for many other uses.

One of the big advantages of ABAP is how integrated it is with other programming artifacts. For instance ABAP is fully integrated with OpenSQL. This means that you can write OpenSQL directly in ABAP (with no wrapping code at all). Within ABAP you can call function modules, instantiate objects, access global data definitions within the ABAP Data Dictionary, etc. ABAP while being restricted to run only on SAP is also a very powerful and flexible language.

Below is an example of ABAP code which could be described as quite “procedural”:


  METHOD application_log_proc_msg.

*   Add the records to the actual log
    LOOP AT application_log ASSIGNING FIELD-SYMBOL(<fs_msg>) .

      CALL FUNCTION 'BAL_LOG_MSG_ADD'
        EXPORTING
          i_log_handle     = log_handle
          i_s_msg          = <fs_msg>
        EXCEPTIONS
          log_not_found    = 1
          msg_inconsistent = 2
          log_is_full      = 3
          OTHERS           = 4.
      IF sy-subrc <> 0.
*       add in error handling here
      ENDIF.

    ENDLOOP .

  ENDMETHOD.

Another example, but this one is much more “object oriented”:

*&---------------------------------------------------------------------*
*& Report ZMC_SIMPLE_ALV_EG
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zmc_simple_alv_eg.

DATA:
  lt_t001 TYPE STANDARD TABLE OF t001,
  go_alv  TYPE REF TO cl_salv_table.

START-OF-SELECTION.
  SELECT * FROM t001 INTO TABLE lt_t001.

  cl_salv_table=>factory( IMPORTING r_salv_table   = go_alv
                           CHANGING t_table        = lt_t001 ).

  go_alv->get_functions( )->set_all( ).
  go_alv->get_display_settings( )->set_striped_pattern( abap_true ).
  go_alv->get_columns( )->set_optimize( ).
  go_alv->display( ).

That report will have this output when executed:

And if you select the line above and press the little magnifying glass to see the details, you get this popup:

All of that has been produced with very little code. That is a good example of the power of ABAP. We started with an embedded OpenSQL statement, implemented a factory method, did a few more method calls and a whole comprehensive output screen was produced for the user.

While you may produce apps with other programming languages which you cannot reproduce in ABAP I feel ABAP is able to produce usable output in an attractive format with far less effort than any other programming language out there.

Have fun programming.

Martin.

Categories ABAP Programming, DefinitionTags ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close