03-30-2006 3:23 AM
Hi everyone,
These days I found a strange problem of ABAP. When you test one function module, other function modules in the same group must have no syntex error. Or the test will fail. This is very confusing because there're no relationship between these function modules. How can such situation happen? Are there anyone can explain this to me?Then I'll be very thankful.
Regards
Golden
03-30-2006 3:29 AM
The function modules are related, because they are all included into one main program. The main program is the function group. If you look at the main program, you will see a series of includes, each include contants a function module. This is the reason for syntax errors in one function module preventing an execution of another in the same function group.
Regards,
Rich Heilman
03-30-2006 3:31 AM
03-30-2006 3:45 AM
Hi Heilman,
Thanks for your answer. But I'm still confusing why ABAP takes this way? The function modules in one function group may have no relationship between each other. We asign them into one group just because they may relate to some common topic. They should still be independent. What's more a function group isn't a class. It can't store any state. Function modules in one group also won't share the same object. At least they can't keep the changing of some variable like what can achieved in a class. I'm wondering the motivation of this way. Do you know the motivation?
Thanks + Regards
Golden
03-30-2006 3:52 AM
No, they are not a class, your right! I just mentioned that as a comparison. The function modules within a function group can share "Global" data between them during the same session.
Please read the following, it will back up my story a bit.
http://help.sap.com/saphelp_470/helpdata/en/9f/db992335c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_470/helpdata/en/c3/225b5954f411d194a60000e8353423/frameset.htm
Regards,
Rich Heilman
03-30-2006 4:31 AM
Golden,
The idea behind having a function group is to seggregate the functionality and at the same time incorporate some reusability.
Now, think of this, I create a function to do processing of my Pruchase order / Sales Orders. So, I create two different function group one for PO and one for SO.
So, with in the PO function group, I can write functions to change / create / get details etc etc functions and as most of these use the same structures I can have top include, where the variables are used across the functions.
So, finally it boils down to the developer how we want to design the function groups.
Hope this clarifies a little bit.
Regards,
Ravi
Note : Please mark the helpful answers