‎2008 Feb 27 11:17 AM
Experts outthere,
How to declare dynamic data types? I have a wa(Structure), the data type of which need to be defined dynamically.
Is it possible if so let me know..
Harikrishna.
‎2008 Feb 27 11:20 AM
see or [https://wiki.sdn.sap.com/wiki/display/Snippets/PrintTableContentswithoutknowingTableNameorStructurebeforeRunTime-2-]
Edited by: Mike Schernbeck on Feb 27, 2008 12:22 PM
‎2008 Feb 27 12:09 PM
Hi,
Check the following link:
http://www.sap-img.com/abap/how-can-we-give-dynamic-table-name-in-select-statement.htm
Regards,
Bhaskar
‎2008 Feb 27 6:49 PM
Hi harikrishna indugu
data:
lr_dynwa type ref to data.
field-symbols:
<dynwa> like wa.
create data lr_dynwa like wa.
assign lr_dynwa->* to <dynwa>.
Now you can use <dynwa> like you use wa.
But I do not understand what it is good for.
If you do not have a structure wa but the name of the DDIC structure, then it goes like
data:
lv_ddictype type tabname value 'BKPF', "just an example
lr_dynwa type ref to data.
field-symbols:
<dynwa> type any.
create data lr_dynwa type (lv_ddictype).
assign lr_dynwa->* to <dynwa>.
In this case, you can not access the fields of <dynwa> directly as i.e. <dynwa>-BELNR, this is a syntax error.
But you can ASSIGN COMPONENT 'BELNR' of structure <dynwa> to <ANY> if you declared a field-symbol <any> type any before.
Regards,
Clemens