2009 Jun 26 12:03 PM
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
2009 Jun 26 12:30 PM
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
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
2009 Jun 26 12:30 PM
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
2009 Jun 28 5:55 PM
Hi Uwe,
you are a scholar and a gentleman sir, I knew there must be a way.
Thanks Again
Terry
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |