Archived discussions are read-only. Learn more about SAP Q&A

Help with "Data object has no structure" with dynamically created <FS>

Hi,

I'm trying to update a dynamic created itab(<dyn_tab> from values from another itab(i_names). I use a dynamic created work area for reading i_names, however, when I read the i_names table using the dynamic <dyn_wa>-id, it's complaining about <dyn_wa> has no structure and therefore no component called ID, also there aren't any components called FNAME or LNAME either.

I've inserted my code below and would really appreciate some advice.

Thanks in advance,

C

DATA: dy_table TYPE REF TO data,

dy_line TYPE REF TO data,

xfc TYPE lvc_s_fcat,

ifc TYPE lvc_t_fcat.

FIELD-SYMBOLS: <dyn_tab> TYPE STANDARD TABLE,

<dyn_wa>.

  • Create dynamic internal table and assign to FS

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = ifc

IMPORTING

ep_table = dy_table.

ASSIGN dy_table->* TO <dyn_tab>.

  • Create dynamic work area and assign to FS

CREATE DATA dy_line LIKE LINE OF <dyn_tab>.

ASSIGN dy_line->* TO <dyn_wa>.

  • Get data.

SELECT (lt_fieldlist)

FROM DBTAB

INTO CORRESPONDING FIELDS OF TABLE <dyn_tab>

WHERE F1 = 'F1'

AND F2 = 'F2'.

  • Update <dyn_tab> table with names.

LOOP AT <dyn_tab> INTO <dyn_wa>.

  • Read names table using ID.

READ TABLE i_names ASSIGNING <names>

WITH TABLE KEY name_id = <dyn_wa>-id.

IF sy-subrc = 0 AND <names> IS ASSIGNED.

<dyn_wa>-fname = <names>-fname.

<dyn_wa-lname = <names>-lname.

ENDIF.

ENDLOOP.

Tags:
replied

DATA: dy_table TYPE REF TO data,

dy_line TYPE REF TO data,

xfc TYPE lvc_s_fcat,

ifc TYPE lvc_t_fcat.

<b>data : begin of wa ,

id(4) type c,

fname(10),

lname(10),

end of wa.</b>

FIELD-SYMBOLS: <dyn_tab> TYPE STANDARD TABLE,

<dyn_wa>.

  • Create dynamic internal table and assign to FS

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = ifc

IMPORTING

ep_table = dy_table.

ASSIGN dy_table->* TO <dyn_tab>.

  • Create dynamic work area and assign to FS

CREATE DATA dy_line LIKE LINE OF <dyn_tab>.

ASSIGN dy_line->* TO <dyn_wa>.

  • Get data.

SELECT (lt_fieldlist)

FROM DBTAB

INTO CORRESPONDING FIELDS OF TABLE <dyn_tab>

WHERE F1 = 'F1'

AND F2 = 'F2'.

  • Update <dyn_tab> table with names.

LOOP AT <dyn_tab> INTO <dyn_wa>.

  • Read names table using ID.

<b>move corresponding <dyn_wa> to wa.

READ TABLE i_names ASSIGNING <names>

WITH TABLE KEY name_id = wa-id.</b>

IF sy-subrc = 0 AND <names> IS ASSIGNED.

wa-fname = <names>-fname.

wa-lname = <names>-lname.

move corresponding wa to <dyn_wa>.

ENDIF.

ENDLOOP.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question