Application Development 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: 

Create Data type table in 46B

IanStubbings
Active Participant
0 Kudos
240

Hi

Quick one, can I dynamically create tables in 46B using the 'create data dref type table of ty_table' in 46B. It seems not but I just wanted to check. Otherwise I will resort to using the construct below:

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING it_fieldcatalog = gt_fieldcat

IMPORTING ep_table = gp_table.

From what I can see the RTTS has not been fully implemented yet.

Cheers

Ian

1 ACCEPTED SOLUTION

Former Member
0 Kudos
112

Hi,

See this weblog and the related comments.

/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap

Svetlin

6 REPLIES 6

Former Member
0 Kudos
113

Hi,

See this weblog and the related comments.

/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap

Svetlin

0 Kudos
112

Thanks Svetlin but I can already create my table like this. What I wanted was a 'cleaner' version so that I can have for example:

if p_plant = 'X'.

create data dref type table of ty_plant.

elseif p_workcentre = 'X'.

create data dref type table of ty_workcentre.

endif.

assign dref->* to <gt_output>.

However I get a syntax error when I use the above or even when I create a table such such as;

begin of ty_gbp,

plant TYPE qals-werk,

insp_end TYPE qals-paendterm,

workcentre TYPE QAQEE-PRPLATZ,

lwr TYPE qals-zz_lwr,

insp_lot TYPE qals-prueflos,

end of ty_gbp,

ty_gbp_table type table of ty_gbp.

create data dref type ty_gbp_table.

It says the type specification of ty_gbp_table is incomplete.

Ian

0 Kudos
112

Hi´Ian,

it's not possible with rel. 4.6 (B / C)

-> 6.1 / 6.2

regards Andreas

0 Kudos
112

Thanks Andreas.

0 Kudos
112

Hi Ian,

I think that using this sample code you can create a dynamic table even in 46B.

DATA: dref TYPE REF TO DATA.

FIELD-SYMBOLS: <fs> TYPE ANY.

data: booking TYPE sbook occurs 0.

CREATE DATA dref like booking[].

ASSIGN dref->* TO <fs>.

Regards,

Svetlin

0 Kudos
112

Hi Ian,

You seem to be quite fast in post closing

Svetlin