‎2008 Jan 16 10:27 AM
Hello!
What's here a problem? My program says is smth. wrong. Thank you!!
CLASS int_table DEFINITION.
PUBLIC SECTION.
TYPES: BEGIN OF table1,
mfirst TYPE i,
msecond TYPE i,
END OF table1.
CLASS-DATA wa1 LIKE TABLE OF table1 WITH HEADER LINE.
CLASS-METHODS myinterne.
ENDCLASS.
‎2008 Jan 16 10:34 AM
CLASS-DATA wa1 LIKE TABLE OF table1 WITH HEADER LINE.
internal tables with header lines are not allowed in Object Oriented ABAP!
‎2008 Jan 16 10:32 AM
Hi,
CLASS int_table DEFINITION.
PUBLIC SECTION.
TYPES: BEGIN OF table1,
mfirst TYPE i,
msecond TYPE i,
END OF table1.
CLASS-DATA wa1 type TABLE of table1.
ENDCLASs.
regards,
Santosh Thorat.
‎2008 Jan 16 10:34 AM
CLASS-DATA wa1 LIKE TABLE OF table1 WITH HEADER LINE.
internal tables with header lines are not allowed in Object Oriented ABAP!
‎2008 Jan 16 10:46 AM
Ok, but if I write the method:
METHOD myinterne.
wa1-mfirst = 2.
ENDMETHOD.
The program says "wa1 is a table without a header line and therefore has no component called mfirst". What's here wrong?
Thanks!
‎2008 Jan 16 10:48 AM
you have to define a work area (structure) as well, same as your internal table. assign values to the work area and APPEND it to the internal table.
‎2008 Jan 16 10:56 AM
‎2008 Jan 16 11:05 AM
definition:
work area
CLASS-DATA wa1 type table1.
internal table
CLASS-DATA itab_wa1 type TABLE of table1.
assign data to work area
wa1-mfirst = 2.
append line to internal table
APPEND wa1 TO itab-wa1.