‎2009 Dec 16 9:46 PM
Hello everyone
I need to create a type in a customized class that will be used to have multi level table.
The first type is the structure of the final table. Inside that structure there is a field that is type table of string:
TYPES: BEGIN OF ty_data,
Extension TYPE CHAR04,
Delimiter TYPE CHAR01,
line TYPE TABLE OF string,
END OF ty_data.
TYPES: lt_data TYPE TABLE OF ty_data.The problem is when I am creating the TYPE ty_data, the system give me the following error message.
"You cannot use generic type definitions within structures"
Is anyone have an idea on how I can have that king of structure definition inside a class?
I even try to have something like:
TYPES: ty_string TYPE TABLE OF string.
TYPES: BEGIN OF ty_data,
Extension TYPE CHAR04,
Delimiter TYPE CHAR01,
line TYPE ty_string,
END OF ty_data.
TYPES: lt_data TYPE TABLE OF ty_data.That doesn't work either.
any suggestion?
Regards
DSTJ
‎2009 Dec 16 10:18 PM
Hi,
I tried this.
TYPES: ty_string TYPE TABLE OF string.
DATA : BEGIN OF ty_data,
extension TYPE char04,
delimiter TYPE char01,
line TYPE ty_string,
END OF ty_data.
TYPES: lt_data LIKE TABLE OF ty_data.
And it worked.
Regards
Prasenjit
‎2009 Dec 16 10:56 PM
Hello Prasenjit
Thank you for your answer.
But it will not work. We cannot use "LIKE" in unicode programming into a class.
But I found the solution. I need to use an already existing table type
types: BEGIN OF TY_DATA,
extension TYPE CHAR04,
delimiter TYPE CHAR01,
lines TYPE SCR_STRINGS,
END OF TY_DATA .The type SCR_STRINGS exist into the SAP dictionary.
Now I can create a variable that is:
DATA: lt_data TYPE TABLE OF ty_data.
Regards
dstj