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.