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

Dynamic Internal table

Former Member
0 Likes
284

Hi,

Can you please exlpain what is purpose of code in which is in Bold.

  • 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_table>.*

    • Create dynamic work area and assign to FS*

create data dy_line like line of <dyn_table>.

assign dy_line-> to <dyn_wa>.*

Regards

Sandeep Reddy

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
261

Hi

It's to define dynamically an internal table, the variable DY_TABLE is a generic DATA:

DATA: DY_TABLE TYPE REF TO DATA.

So u can't direclty work on it, but it needs to use a field-symbol:

FIELD-SYMBOLS: <DYN_TABLE> TYPE TABLE.

ASSIGN DY_TABLE->*  TO <DYN_TABLE>.

Now the table <DYN_TABLE> is without headerline, so it needs to use a workarea to read it:

DATA: DY_LINE TYPE REF TO DATA.
FIELD-SYMBOLS: <DYN_WA> TYPE ANY.

* Create a workare for <DYN_TABLE>
CREATE DATA DY_LINE LIKE LINE OF <DYN_TABLE>.
ASSIGN DY_LINE->* <DYN_WA>.

It can do the same thing while looping <DYN_TABLE>

LOOP AT <DYN_TABLE> ASSIGNING <DYN_WA>.
ENDLOOP.

Max

1 REPLY 1
Read only

Former Member
0 Likes
262

Hi

It's to define dynamically an internal table, the variable DY_TABLE is a generic DATA:

DATA: DY_TABLE TYPE REF TO DATA.

So u can't direclty work on it, but it needs to use a field-symbol:

FIELD-SYMBOLS: <DYN_TABLE> TYPE TABLE.

ASSIGN DY_TABLE->*  TO <DYN_TABLE>.

Now the table <DYN_TABLE> is without headerline, so it needs to use a workarea to read it:

DATA: DY_LINE TYPE REF TO DATA.
FIELD-SYMBOLS: <DYN_WA> TYPE ANY.

* Create a workare for <DYN_TABLE>
CREATE DATA DY_LINE LIKE LINE OF <DYN_TABLE>.
ASSIGN DY_LINE->* <DYN_WA>.

It can do the same thing while looping <DYN_TABLE>

LOOP AT <DYN_TABLE> ASSIGNING <DYN_WA>.
ENDLOOP.

Max