2016 Dec 22 11:06 AM
Hey guys,
I have a program ZBR_PROGRAM and a function group ZBR_FUNCTIONGROUP. I would like to use the global variables of the ZBR_PROGRAM in the function modules of the ZBR_FUNCTIONGROUP, how could I achieve it. I tried to use the INCLUDE statement to include the top include of the ZBR_PROGRAM where the global variables are defined, but it does not work or probably I did it wrong. Remember, the ZBR_PROGRAM is not inside the ZBR_FUNCTIONGROUP.
Thank you, regards,
Róbert Birkus
2016 Dec 22 2:00 PM
I think it is because of the FUNCTION-POOL in the TOP-Include, that you're unable to include this.
You might have to create a new Include in the FunctionGroup and put your "multiple-purpose" variables there.
Then you can include that one to your Custom Program without Syntax-Error while also allowing accessibilty from the FunctionGroup ...
Consider the below Example :
REPORT ztmp_testreport.
*INCLUDE lztmp_testfg_top. "TOP-INCLUDE Contains GT_RETURN
INCLUDE ztmp_testfg_multi. "ADDITIONAL INCLUDE Contains GT_MULTI_RETURN
REFRESH gt_multi_return.
Using the TOP-Include will not work to get Access to 'GT_RETURN', but the Additional Include will have Access to 'GT_MULTI_RETURN' ...
2016 Dec 22 2:33 PM
There is a documented trick in ABAP, but not recommended. Therefore, find it out ...
2016 Dec 22 2:59 PM
Hmmm.
Firstly doesn't that tie your function module too closely to your program ? If you need to get at the global variables, why not make the FM a procedure in your program.
Another way round it would be to change your function group to a class and make the variables functional methods of the class so when you use them you can use them as you would variables, and yet they would still be available within the class.
Rich
2016 Dec 22 3:01 PM