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: 

When we go for dynamic internal tables in Abap ?

kabil_g
Active Participant
0 Kudos

Hi friends,

                 I m New for this community can you please help me out for this question..

1.>  what is the necessary to go for dynamic internal tables in abap ?

Moderator message: welcome to SCN!


Moderator message: please always search for available information before posting.

Message was edited by: Thomas Zloch

5 REPLIES 5

Former Member
0 Kudos

Data <variable name> type <fieldname > occurns 0 with header lines.

Data <variable name> type table of <Typename >.

Former Member
0 Kudos

Hi Kapil,

Welcome to scn.sap.com

When you don't know the structure of your internal table

or data type of internal tables are decided at runtime.

There are ample of methods you can use to create a dynamic internal table

these links might help you out for Further reading.

1) using cl_alv_table_create=>create_dynamic_table http://wiki.sdn.sap.com/wiki/display/ABAP/Dynamic+Internal+table

2) USiNG RTTI to create dynamic internal table oops way of creating dynamic internal table

http://wiki.sdn.sap.com/wiki/display/Snippets/Creating+Flat+and+Complex+Internal+Tables+Dynamically+...

RTTI itself is a very big topic for discussion

Regards

Gaurav Ahluwalia

Former Member
0 Kudos

Mostly when you decide the columns to be shown in runtime.

For example, lets say I want to see data for 3 months, and I want the data for each month in one column.

Now, I can have month selection in the selection screen. Then to satisfy the query, I will have to have a variable table structure.

eg.

I will have input as month in selection screen giving the option of range.

so, user can enter 1/1-3/1-12.

Very simple solution to this is - have 12 extra fields in the table and display only the relevant ones.

But when I want the data quite dynamically.

eg. reports that require data for all the entries that you input on selection screen.

lets say I want to see all the vendor data i enter on selection screen with one column for each vendor.

In this case, you dont know how many vendors user will enter. It is practically 1-n range. You cant have a fixed structure for this.

Or you want to see a characterwise report for each order, for the specific characteristics that you enter on selection screen.

there are many examples.

Basically, when you dont know the number of columns you want to display at design/report writing time, you need to go for dynamic structure.

Let me know if your question is still not answered.

0 Kudos

Hi chinmay kulkarni,

                                  I have the Requirement to display the no. of columns using dynamic internal table , i have looked out lot of example reports its all about in oops concept ,I didn't get that concept . And help me  to work and display on "classic or interactive and alv "without using oops concept