04-12-2012 11:43 AM
Hi experts,
i have a class and i want to create a field-symbol but its showing syntax error
CLASS ZCL_COLLEGE DEFINITION ABSTRACT.
PUBLIC SECTION. " PUBLIC SCETION CONTAINS TWO ABSTRACT METHODS.
METHODS: SETVALUE IMPORTING LT_TBL1 TYPE ANY TABLE OPTIONAL,
GETVALUE IMPORTING LT_TBL2 TYPE ANY TABLE OPTIONAL
EXPORTING LT_RES TYPE ANY TABLE .
PRIVATE SECTION. "PRIVATE SECTION CONTAINS REF TYPE STRUCTURE.
FIELD-SYMBOLS: <FS_ITTAB> TYPE ANY,
<FS_WA> TYPE ANY.
DATA: LT_DYNTBL TYPE REF TO DATA,
LV_DYWA TYPE REF TO DATA.
ENDCLASS.
syntax error
Include ZZFMRASSIGN_TOP
You cannot use the current statement between "CLASS ... DEFINITION" and
"ENDCLASS".
Thanks.
Rohit Kumar
04-12-2012 11:52 AM
I think not. You can use variable of type ref to data. It will solve the same purpose.
You can use the filed symbols in the method implementation though
04-16-2012 1:12 PM
Hi,
You can refer to the link below:
http://help.sap.com/abapdocu_70/en/ABENABAP_OBJECTS_DIFF_FIELD_SYMBOL.htm
Hope it serves useful.
04-16-2012 2:06 PM
PRIVATE SECTION. "PRIVATE SECTION CONTAINS REF TYPE STRUCTURE.
FIELD-SYMBOLS: <FS_ITTAB> TYPE ANY,
This is not permitted.
You can use field symbols in implementation, here you can only use DATA ...
04-16-2012 3:56 PM
You can't use the Field-Symbols as attributes of the class.
You can create an attribute with TYPE REF TO DATA. In your method implementation, ASSIGN the data reference to field symbol to work with it.
Regards,
Naimesh Patel