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

RTTS - Dynamic Structure/Type Generation

Former Member
0 Likes
526

Hi,

my apologies if this question has been asked before and in the wrong forum.

Is it possible to dynamically create a structure/type of variable length without using a fixed type? e.g. I want to create a structure with 4 'fixed' fields followed by a number of variable entries dependent upon an external source. I would normally do something like ..

types : begin of ty_data,

matnr type matnr,

werks type werks,

lifnr type lifnr,

menge_01 type menge_d,

menge_02 type menge_d,

.

.

.

end of ty_data.

data : it_data type sorted table of ty_data with unique key ...

I want to define he whole structure dynamically at runtime.

Could someone point me to a blog/bar/exit or better still give me an answer?

Thanks in advance

1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
483

Hello Terry

Of course you can create all kinds of structures / table types dynamically, e.g.:

[Creating Flat and Complex Internal Tables Dynamically using RTTI|https://wiki.sdn.sap.com/wiki/display/Snippets/CreatingFlatandComplexInternalTablesDynamicallyusingRTTI]

Your external source must provide you with the meta-data about the structure. This you can use as input for RTTI in order to create your dynamic data objects.

Regards

Uwe

2 REPLIES 2
Read only

uwe_schieferstein
Active Contributor
0 Likes
484

Hello Terry

Of course you can create all kinds of structures / table types dynamically, e.g.:

[Creating Flat and Complex Internal Tables Dynamically using RTTI|https://wiki.sdn.sap.com/wiki/display/Snippets/CreatingFlatandComplexInternalTablesDynamicallyusingRTTI]

Your external source must provide you with the meta-data about the structure. This you can use as input for RTTI in order to create your dynamic data objects.

Regards

Uwe

Read only

0 Likes
483

Hi Uwe,

you are a scholar and a gentleman sir, I knew there must be a way.

Thanks Again

Terry