Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

type table

Former Member
0 Likes
868

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

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
839

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

9 REPLIES 9
Read only

naimesh_patel
Active Contributor
0 Likes
840

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

Read only

0 Likes
839

This message was moderated.

Read only

0 Likes
839

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.

Read only

0 Likes
839

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

Read only

0 Likes
839

Bharat

what is <tab> for a type

create data dy_row like line of <tab>.

Read only

0 Likes
839

Hi,

I miss typed it.

Its not <tab> its <fs_table>.

regards,

Bharat.

Read only

Former Member
0 Likes
839

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.

Read only

matt
Active Contributor
0 Likes
839

> 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

Read only

Former Member
0 Likes
839
EXPORTING
   REFERENCE(ET_SUBLIST) TYPE TABLE

ET_SUBLIST is an Exprting paramter of an existing Function Module,

therefore I will really not change it