cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic binding in alv, then retrieving that node info

Former Member
0 Kudos

Hi All.

We have around 5 internal tables which can be shown in an ALV. Based on certain checks, we bind the correct table to the ALV using the SET_DATA method.

That works fine.

But now, when user does some action, we need to retrieve the data back from the node. How do I dynamically create my internal tables? I know there is a bad way of using lots of if-then-else and create itab statically.

Is there not any method in ALV which will return me the node information based on which i can declare my elements structure into which to get the data?

If it is not clear, let me elaborate: If itab2 is showing, when we get back data using GET_STATIC_ATTRIBUTES_TABLE method, we need to pass itab2 structure to the method, and same way for other internal tables. We don't want to hardcode it.

Any suggestions please?

Thanks in adv.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

you could receive the attributes of the node by calling method get_attributes of the node info object.

Afterwards you have to instantiate a RTTI object (cl_abap_structdescr) with a description of the attributes.

Then you have to create the structure by using create data.

Example:


  DATA  lo_struc_type TYPE REF TO cl_abap_structdescr.
  DATA: struc_comp_table TYPE cl_abap_structdescr=>component_table.
  DATA: dref TYPE REF TO data.
  FIELD-SYMBOLS: <struc> TYPE ANY.

  lo_struc_type = cl_abap_structdescr=>create( struc_comp_table ).

  CREATE DATA dref TYPE HANDLE lo_struc_type.
  ASSIGN dref->* TO <struc>.

In my opinion it is too complicated to realize your requirement in this way...

Kind regards

Answers (0)