cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic ALV: but with globally available dynamic table type

Former Member
0 Kudos

Hello,

I would like to create a dynamic node for a ALV and dynamic table types to fill and the ALV.

The ALV data can be changed so I need to read it again.

I have read all the threads about dynamic node create and i have no problem with it. I can create a structure and a table dynamically. thats also no issue for me.

But. I fill the ALV data in a method and read it in another method to save the changes in a data base table.

Thats also no problem

So where i need your help? I currently create the dynamic table and structure in both methods. That works, but why do the same thing twice?

I cant figure out by myself how to create a dynamic table/structure in a global way, so the dynamic table/structure is created once and then available in the whole WD4A view.

I tried is with a class type in se24 with reference to CL_ABAP_STRUCTDESCR but I cant make that run, because to access the type I created an attribute in se24 with reference to the class type that I now try in instance and fill in the method. But ABAP thinks that my attribute is not compatible anymore.

Any idea how to make a dynamic table globally available? That must be an ABAP god who can answer this question, hehe. So imagin me falling on my knees for the one who has an answer that really works

Kind regards,

Hendrik

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

This doesn't seem too difficult really. For a dynamic table you just need to declare the internal table as TYPE REF TO DATA.

Just more this declaration to the attributes of your Component Controller. So for instance in my component controller I have an attribute called i_data with the RefTo column checked and the associated type = DATA.

So now I could do the following:

create data wd_this->idata type table of (tablename).

Or however you are dynamically creating the table - maybe with TYPE HANDLE instead.

The point is that your dynamic table is now global to your entire component and you can read and write to it from different methods.

Is this what you were looking for? Without knowing more about your existing coding, it is difficult to say more.

Former Member
0 Kudos

Thanks Thomas!

Seems it did not saw the simplicity of the solution I appreciate your answer!

Regards,

Hendrik

Answers (0)