‎2010 Mar 29 3:06 PM
Hi experts,
I got a report with the following includes
INCLUDE ztest_top. "top include
INCLUDE ztest_c01. "local class
INCLUDE ztest_e01. "events
INCLUDE ztest_f01. "functionsIn my top include, I define a reference variable of my local class lcl_test defined in the c01 include. Therefore I need the
CLASS lcl_test DEFINITION DEFERRED.
line in my top include.
So far so good.
In my f01 include I got a form (called from e01 include), where I create my object. If I check my code now, I get an error(!) message saying
components of classes declared using "CLASS LCL_TEST DEFINITION DEFERRED" can only be accessed after you have defined the class (CLASS LCL_TEST DEFINITION)Althought it's an error message, I can activate the program and run it without getting any errors. If I check it again afterwards, the errors show up again.
I don't really get this, the class definition and the implementation are in the c01 include, so the form in the f01 should know the class, shouldn't it?
Can anyone explain this to me?
Thanks in advance!
Regards,
Tobi
‎2010 Mar 29 3:34 PM
Hi Tobias,
I cheked it in some quick example program. It seems that I received this message too, until I activated all the includes. This caused the error gone.
Regards
Marcin
‎2010 Mar 29 3:34 PM
Hi Tobias,
I cheked it in some quick example program. It seems that I received this message too, until I activated all the includes. This caused the error gone.
Regards
Marcin
‎2010 Mar 30 7:14 AM
Hi Marcin,
thanks for your answer.
All my includes are activated as well, but when I code check again, the error reappears. This looks like a compiler error to me.
Regards,
Tobi
‎2010 Apr 01 1:34 PM
Hi Tobias,
Its not a compiler problem . Goto main program of the Function Group you created and check for syntax error .
You will not get the error message . If you check for syntax error anywhere outside, you will get error message .
Regards,
S.Sivakumar
‎2010 Apr 12 1:52 PM
Hello S.Sivakumar,
I don't really understand what you mean? Could you explain?
I only get the error when i code check the f01 include.`
Regards,
Tobi
‎2010 Apr 13 12:34 PM
Hi Tobias,
Just go to main program of the Function group and check code . No error occurs .
The fact is when you check the code inside an include , the declaration part of the class which u are accessing inside the include is not available . So because of that u r getting the error message .
Regards,
S.Sivakumar
‎2010 Apr 13 1:20 PM
Hi S.Sivakumar,
thanks for the reply.
Why should the declaration part not be available? All data defined in the top include is available as well.
If I replace my "definition deferred" command in the top include with "INCLUDE ztest_c01.", I get no error message when code checking the f01 as well? Where is the difference if I include the c01 in the main programm or in the top include? In both cases, the creation of the object happens after the declaration?!
Still don't get it...
Regards,
Tobi
‎2010 Apr 13 3:41 PM
Hello Thomas,
as far as I know the ABAP editors do a kind of simulation when you perform a syntax-check within an include. The simulation works like this way the top include is combined with the current include into a temp. program which gets fed to the compiler. Cllass definition deferred in the top include does not work out in such a scenario. By moving the class definition statement into the TOP Include the true behavior should come closer to the expected one.
Best Regards
Klaus