‎2009 Jun 20 5:25 PM
Dear All,
ET_SUBLIST has type table and it hasn't a header line.
How can create the workarea now.
Because I cant say:
data workrea type table or
data workrea like line of ET_SUBLIST ...
all that is not working. Is there a workaround ?
EXPORTING
REFERENCE(ET_SUBLIST) TYPE TABLE
LOOP AT et_sublist INTO workarea.
ENDLOOP.Regards
ertas
‎2009 Jun 20 5:35 PM
If you know the type of the table, than instead of using the generic type TYPE TABLE, use the actual table. Than you can use the declaration as you have tried.
data: la_list like line of et_sublist.
Regards,
Naimesh Patel
‎2009 Jun 20 5:35 PM
If you know the type of the table, than instead of using the generic type TYPE TABLE, use the actual table. Than you can use the declaration as you have tried.
data: la_list like line of et_sublist.
Regards,
Naimesh Patel
‎2009 Jun 20 5:44 PM
‎2009 Jun 20 5:51 PM
Hi,
Try like this.
field-symbols: <fs_table> TYPE table,
<fs_wa> TYPE data.
DATA: dy_table type ref to data,
dy_row type ref to data.
CREATE DATA dy_table TYPE HANDLE ET_SUBLIST.
ASSIGN dy_table->* TO <fs_table>. " <fs_table> works as internal table
create data dy_row like line of <tab>.
assign dy_row->* to <fs_wa>. " <fs_wa> This works as Work Area
Regards,
Bharat.
‎2009 Jun 20 5:55 PM
You don't need to wonder too much..!
If you read carefully my previous post, it says
If you know the type of the table, than instead of using the generic type TYPE TABLE, use the actual table. Than you can use the declaration as you have tried.
There is a big IF.
Regards,
Naimesh Patel
‎2009 Jun 20 6:10 PM
Bharat
what is <tab> for a type
create data dy_row like line of <tab>.
‎2009 Jun 21 12:53 PM
Hi,
I miss typed it.
Its not <tab> its <fs_table>.regards,
Bharat.
‎2009 Jun 20 5:54 PM
Experts why so complicated ?
Just do it like ...
FIELD-SYMBOLS: <fs_sublist> TYPE any.
LOOP AT et_sublist ASSIGNING <fs_sublist>.
IF <fs_sublist> IS ASSIGNED.
.........
ENDIF.
ENDLOOP.
‎2009 Jun 22 6:51 AM
> IF <fs_sublist> IS ASSIGNED.
" This statement NOT required, as the loop can only be here if <fs_sublist> is assigned.
Sometimes it's necessary to do a loop at into. Or you might want to do a read. In this case, use:
DATA: lp_data TYPE REF TO DATA.
CREATE DATA LIKE LINE OF <the_table>.
ASSIGN lp_data->* TO <the_work_area>.
READ TABLE <the_table> INTO <the_work_area> WITH KEY ('FIELDNAME') = some_value.or
DATA: lp_data TYPE REF TO DATA.
CREATE DATA LIKE LINE OF <the_table>.
ASSIGN lp_data->* TO <the_work_area>.
ASSIGN FIELD 'FIELDNAME' OF STRUCTURE <the_work_area> TO <some_field>.
LOOP AT <the_table> INTO <the_work_area>.
* Do stuff with <some_field>.
which is more efficient than:
LOOP AT <the_table> INTO <the_work_area>.
ASSIGN FIELD 'FIELDNAME' OF STRUCTURE <the_work_area> TO <some_field>.
* Do stuff with <some_field>.
matt
Edited by: Matt on Jun 22, 2009 7:52 AM
‎2009 Jun 20 6:06 PM
EXPORTING
REFERENCE(ET_SUBLIST) TYPE TABLEET_SUBLIST is an Exprting paramter of an existing Function Module,
therefore I will really not change it