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

former_member206454
Participant
0 Kudos

Hi People ,

   I have to declare data dynamically . In my requirement there is an internal table in which there will be some record , I have to put loop on the internal table and declare data dynamically with the same name that is there in internal table .. 

Ex.      

Category
AA
BB
CC

I will put above internal table in loop and I have to dynamically declare data with character 2 with the name AA, BB, CC.

Please suggest me the coding for this .

Thanks

Kumar saurabh

3 REPLIES 3

Former Member
0 Kudos

Hi Kumar,

Firstly a direct solution will not be possible....

You can create a dynamic table with the field names as AA, BB, CC and create a line type of this dynamic table and use that with field symbols.

How to define a dynamic tab and use it.

http://wiki.sdn.sap.com/wiki/display/ABAP/Dynamic+Internal+table

Let me know if you need further help.

Regards

0 Kudos

Hi Yakub ,

   first of all thanks for your reply . See I just have to create dynamic variable with name AA, BB, CC .

similar to

  Data aa(2) type c .

   Data bb(2) type c .

  Data cc(2) type c .

0 Kudos

Yes Kumar I understand but how will you address something you don't know the name.....

SO you will need to collate these as a structure assignment you can referit directly in that case.

Still if you insist there is a possible solution of creating the entire report itself dynamically with include.

check this link.

http://www.sapdev.co.uk/tips/dynamic/dyn_prog.htm