‎2008 Feb 15 10:26 AM
Hi all,
Please help me with this.I ahve written a code like this.
CLASS LCL_AIRPLANE DEFINITION.
PUBLIC SECTION.
PRIVATE SECTION.
types:BEGIN OF TY_PLANETYPES,
PLANETYPE TYPE SAPLANE-PLANETYPE,
END OF TY_PLANETYPES.
DATA: wa_LIST_OF_PLANETYPES TYPE TY_PLANETYPES,
LIST_OF_PLANETYPES TYPE STANDARD TABLE OF TY_PLANETYPES.
ENDCLASS. "lcl_airplane DEFINITION
CLASS LCL_AIRPLANE IMPLEMENTATION.
METHOD class_constructor.
SELECT * FROM saplane INTO TABLE list_of_planetypes.
ENDMETHOD.
ENDCLASS .
So now i am getting an error like this
'Within a static method ,you can only access class attributes without further specifications'...What can be the problem.Please correct the code.How to declare an internal table in OOPS ABAP.
Thanks in advance.
Alex.
‎2008 Feb 15 10:31 AM
Try using "constructor" instead of "class_constructor" for the name of your constructor.
That should work. If not, try selecting into table me->LIST_OF_PLANETYPES instead of just LIST_OF_PLANETYPES.
Hope that works.
‎2008 Feb 15 10:32 AM
Since your coding is within a CLASS-CONSTRUCTOR you should define your internal table not with statement DATA but with CLASS-DATA.
Regards,
John.
‎2008 Feb 15 10:40 AM
This would also work. You should decide if you want to declare your internal table as class-data or object data.