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 Data types

Former Member
0 Likes
496

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.

3 REPLIES 3
Read only

Former Member
0 Likes
469

see or [https://wiki.sdn.sap.com/wiki/display/Snippets/PrintTableContentswithoutknowingTableNameorStructurebeforeRunTime-2-]

Edited by: Mike Schernbeck on Feb 27, 2008 12:22 PM

Read only

Former Member
0 Likes
469
Read only

Clemenss
Active Contributor
0 Likes
469

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