如何从类方法中返回动态内表。
如何从类方法中返回动态内表。
class-methods aggregation importing value(i_table) type table exporting value(o_table) type table value(o_table2) type ref to data .
types: begin of t_line, col1 type i , col2 type i , col3 type i , end of t_line.
data: l_line type t_line. data: lt_line type table of t_line.
field-symbols: <fs_table> type table.
"一定要通过create data创建,不能直接用lt_line,
"因为lt_line会在方法执行完后,被释放掉。
create data o_table2 like lt_line.
assign o_table2->* to <fs_table>.
loop at i_table assigning <dyn_wa>. l_line-col1 = 1111. append l_line to <fs_table> . endloop.