Skip to Content
Author's profile photo Former Member

ABAP: Does it have a Compiler or an Interpreter?

I was quite surprised by the gamut of answers I received when I asked this question informally to various ABAP developers. They weren’t quite sure of it. Ok, everybody knows that ABAP is a fourth generation, high level language. But how many of us are sure as how an ABAP report is executed? Does it have a compiler or an Interpreter or both (hmm)?? Well, the answer is: “To some extent it has both”. To elaborate it: Before an ABAP program is executed, the ABAP compiler must translate it into an intermediate language. This form of program i.e. the program in this intermediate form is called an ABAP load. Then the ABAP virtual machine comes into the picture. ABAP virtual machine is an interpreter for ABAP loads, that is, it can execute ABAP loads. You can somewhat correlate the whole scenario with the process of Java compilation-interpret process.  Before continuing, we need to know what processing blocks are. Well, you might know that an ABAP program has a modular structure. These modules are called as processing blocks. It is just rephrasing stunt. Logically, if we see any ABAP program, it contains two parts: 1.     The first part has the global declarations.  2.     And the second part contains the processing blocks.  There are several types of processing blocks which includes dialog modules and subprograms. More precisely, there are the following types of processing blocks:  1. Dialog modules 2. Event blocks 3. Subprograms (subroutines, function modules and methods).  The dialog modules are called from the screen flow logic. The subprograms are called using ABAP statements which themselves are part of some other processing block and event blocks are called from outside an ABAP program.  Now the ABAP load contains processing blocks in one-to-one correspondence to the processing blocks of the ABAP program, that is, for each processing block in the ABAP program, there is exactly one processing block in the corresponding ABAP load.”  Before executing any processing block, it is first be determined whether the corresponding ABAP program has already been compiled or not. If it had been already compiled, the ABAP Virtual Machine can immediately begin executing the processing block; else the ABAP compiler must first translate the ABAP program into an ABAP load and then execute it.  This was a broad overview of the compilation process of ABAP program. I may write about the structure of ABAP Load and detailed process of compilation in my later blogs.   Btw just for the information, if you have access to the database, you can view the ABAP reports in D010S table and ABAP Loads in D010L table.  

Assigned Tags

      28 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member
      Thanx for the info Puru -:D A big question had been answered -:P

      Greetings,

      Blag.

      Author's profile photo Former Member
      Former Member
      this is very nice. thank you Puru!!

      Hari

      Author's profile photo Former Member
      Former Member
      hey Puru,

      Nice info, this question was in my mind since long, but i nvr took pains to find it out. Glad u did the job, and mst say job well done.

      Cheers!
      Ashish

      Author's profile photo Former Member
      Former Member
      Puru,

      Thanks, excellent info! I was always curious about this.

      Now the second big question -- what is bytecode format for these loads? Unfortunately, it seems to be not published by SAP...

      Just imaging that you can write program in Python or Ruby, then compile it to bytecode of ABAP VM and execute as regular ABAP code... Sweet dreams 😉

      VS

      Author's profile photo Peter Inotai
      Peter Inotai
      Hi Valery,
      It's a very good question.
      I can imagine it depends on the platform, if it's unicode or non-unicode system. Might depends on the OS, as well. I'm also very curious to know.
      Best regards,
      Peter
      Author's profile photo Former Member
      Former Member
      Blog Post Author
      Thanks. Yeah, I will soon write a blog on ABAP Load structure. Have patience. 🙂

      Regards
      Puru

      Author's profile photo Peter Inotai
      Peter Inotai
      It's a good news! Hope it will be before the Christmas 🙂
      Peter
      Author's profile photo Former Member
      Former Member
      Blog Post Author
      Or Perhaps it will be a Christmas gift for you 🙂
      Author's profile photo Ashutosh Rastogi
      Ashutosh Rastogi
      Good to Know ... even ABAP is compiled and interpreted as Java.

      Ashutosh

      Author's profile photo Former Member
      Former Member
      Blog Post Author
      Yeah, but not exactly by same process 🙂
      Author's profile photo Former Member
      Former Member
      Ashutosh,

      Nothing surprising, actually.
      Now it is de-facto standard to use managed environment and virtual machine. Besides Java and ABAP there is also .NET that folllows this model.

      VS

      Author's profile photo Former Member
      Former Member
      Blog Post Author
      Just wondering, with which language this standard(managed environment n VM) started with? Sailing back to history, I guess its ABAP, since this language was very much in existence when James gosling was even contemplating to write Java.

      Puru

      Author's profile photo Former Member
      Former Member
      AFAIK, Smalltalk also has own VM.
      Doesn't know who is older -- Smalltalk or ABAP...

      VS

      Author's profile photo Former Member
      Former Member
      You should notice that the abap code is not copmplied to real intermediate language!

      Part of the key of repoload table (which contains the loads), is the OS, that means, if you have one system with several diffrent WAS os (such as windows/unix), than the repoload table would have twice records.

      The compiler first be determined whether the corresponding ABAP program has already been compiled at the same operation system, if not is creates a new load only for the current operation system.

      That means, the abap compiler creates a new load for every program at every operation system, on-the-fly.

      Author's profile photo Former Member
      Former Member
      You should notice that the abap code
      is not copmplied to real intermediate language.

      Part of the key of "repoload" table (which contains the loads), is the OS, that means, if you have one system with several diffrent WAS os (such as windows/unix), than the repoload table would have twice records.

      The compiler first be determined whether the corresponding ABAP program has already been compiled at the same operation system, if not is creates a new load only for the current peration system.

      This means, that the compiler creats intermediate language for each operation system,
      on-the-fly.

      Author's profile photo Former Member
      Former Member
      Blog Post Author
      Bingo! he hits the point. Well thats what I meant when I wrote ""To some extent it has both".

      Regards
      Puru

      Author's profile photo Harel Gilor
      Harel Gilor
      The tables D010L & D010S are no longer exists in the ECC5 and ECC6 (I have checked for my self).

      I think that the main reason for this is because of the new model of enhancements spots.

      Would you rearrange my thoughts about please?

      Author's profile photo Former Member
      Former Member
      Blog Post Author
      I will definitely get you the exact reason within few days 🙂
      Author's profile photo Former Member
      Former Member
      They still are there in my system. How did you check?
      Author's profile photo Jijeesh VV
      Jijeesh VV
      D010S table and ABAP Loads in D010L - These tables are not available SAP systems starting with NW04 i think
      Author's profile photo Former Member
      Former Member
      I had read in an ABAP text book which says  that the ABAP programs are neither interpreted nor complied but they are generated.

      I m not sure how they are generated.

      Author's profile photo Former Member
      Former Member
      Very Good Explanation. Actuall I heared that Abap is interpretor. Now I Clarified. Thanks Lot.
      Author's profile photo Former Member
      Former Member
      i got some information
      Author's profile photo Former Member
      Former Member
      I like how SE16 generates a dump when you try to view REPLOAD.  I assume this is so that customer don't go messing around in this table and destroy their own systems.(or maybe there's an actual techie reason?)
      The DBA/Basis guys are probably happy to hear this.
      -Alex
      Author's profile photo Former Member
      Former Member
      Well, Impressive blog indeed...
      But  the question that is still there in my mind is what is the name of the compiler or the interpreter used so?

      could you plz let me know?

      Author's profile photo Former Member
      Former Member
      Hi Puru

      Great Blog.. simple n informative! Expects more of the sort!

      Thx

      Author's profile photo Former Member
      Former Member
      I waiting for your "the structure of ABAP Load and detailed process of compilation".
      Author's profile photo Former Member
      Former Member
      Thanks for the simple but very informative weblog.