11-03-2015 6:25 PM
Hi,
I have a doubt regarding the use of 'includes' in programs. I understand why includes are used and how we can create a include/call a include in a program.
I was reading this reply from Mr. here Reuse routine for different transformation rout... | SCN
My question is what happens when the same include is called in two different programs at the same time?Will there be two different instances of it? What about the variables declared? Will the same variable be adjusted by both the calling programs?
Is there a difference between declaring the variable in TOP include vs inside the include itself?
I have mentioned BW transformation in my subject line because there are a few includes in BW transformations in my project and I just want to know if there is a downside to the include being called from two different transformation at the same time?
Please make your answers as simple as possible. I am a BW developer with minimal knowledge of ABAP
Thank You,
Benedict
11-03-2015 6:39 PM
With includes in two programs, they are entirely separate. It's just as if you copy pasted the text of the includes into the programs. There is absolutely no difference between declaring an include in a TOP include and in the body of the program. With an include, when the program is run, the interpreter (the thing that runs the programs), just inserts the text of the include at the point of the INCLUDE statement.
There are two uses of includes.
1. To organise code for ease of handling
2. To share code
Shared includes are quite common in old program, but they are to be avoided. The reason is that if you make a change to an include, all programs that use it will be regenerated (compiled) when you import the change into your production system - and that can take quite a while.
Far better to create shared code that is called from within the transformation. Anything other than classes or function modules is obsolete.
11-03-2015 6:39 PM
With includes in two programs, they are entirely separate. It's just as if you copy pasted the text of the includes into the programs. There is absolutely no difference between declaring an include in a TOP include and in the body of the program. With an include, when the program is run, the interpreter (the thing that runs the programs), just inserts the text of the include at the point of the INCLUDE statement.
There are two uses of includes.
1. To organise code for ease of handling
2. To share code
Shared includes are quite common in old program, but they are to be avoided. The reason is that if you make a change to an include, all programs that use it will be regenerated (compiled) when you import the change into your production system - and that can take quite a while.
Far better to create shared code that is called from within the transformation. Anything other than classes or function modules is obsolete.
11-03-2015 8:35 PM