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.
Greetings,
Blag.
Hari
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
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
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
Regards
Puru
Peter
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
Puru
Doesn't know who is older -- Smalltalk or ABAP...
VS
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.
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.
Regards
Puru
I think that the main reason for this is because of the new model of enhancements spots.
Would you rearrange my thoughts about please?
I m not sure how they are generated.
The DBA/Basis guys are probably happy to hear this.
-Alex
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?
Great Blog.. simple n informative! Expects more of the sort!
Thx