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: 

Dynamic type definition

h_senden2
Active Contributor
0 Kudos

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

former_member194669
Active Contributor
0 Kudos

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

former_member735409
Participant
0 Kudos

It is possible.

0 Kudos

S Ray,

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

So my next question is :

how is it possible ?

Former Member
0 Kudos

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

0 Kudos

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

0 Kudos

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.

former_member194669
Active Contributor
0 Kudos

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