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 type definition

h_senden2
Active Contributor
0 Likes
1,722

Hi,

is it possible in 6.20 to create a type dynamically ?

I have a type TY_OUTPUT with 3 fields F1, F2 and F3. And depending on some user selections i want to add several fields to the TY_OUTPUT type, for instance D1, D2, D3 and D4.

I know that it is possible in 6.40 with RTTS, but we're not on 6.40

regards,

Hans

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
840

Hi,

May this one help you.


parameters: p_tabnam type tabname default 'MARA'.
data: dref type ref to data.
field-symbols: <struc> type any.
create data dref type (p_tabnam).
assign dref->* to <struc>.
select single * from (p_tabnam) into <struc>.

aRs

6 REPLIES 6
Read only

Former Member
0 Likes
840

It is possible.

Read only

0 Likes
840

S Ray,

you answered my question, but i cannot give you points for that

So my next question is :

how is it possible ?

Read only

Former Member
0 Likes
840

I am not sure if you can create a type, you can have a structure or a table.

Take a look at these blogs which are based on WAS < 6.40

/people/ravikumar.allampallam/blog/2005/05/31/expand-the-list-of-columns-in-a-report-dynamically

/people/subramanian.venkateswaran2/blog/2004/11/19/dynamic-internal-table

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

Regards,

Ravi

Note - Please mark all the helpful answers

Read only

0 Likes
840

Hi Ravi,

i'm known with these blogs, but i was looking for a dynamic TYPE definition. In my program the type is used several times in several ways. So the most efficient way to modify the program is by modifying the TYPE on runtime.

regards,

Hans

Read only

0 Likes
840

Hans,

Did you find a way of defining a type dynamically? If you found a way I would appreciate it if you could let me know.

Thanks and regards

John.

Read only

former_member194669
Active Contributor
0 Likes
841

Hi,

May this one help you.


parameters: p_tabnam type tabname default 'MARA'.
data: dref type ref to data.
field-symbols: <struc> type any.
create data dref type (p_tabnam).
assign dref->* to <struc>.
select single * from (p_tabnam) into <struc>.

aRs