Quantcast
Channel: SCN : All Content - Web Dynpro ABAP
Viewing all articles
Browse latest Browse all 3667

Adding a column dynamically to the alv : dump

$
0
0

Hello ALL ,

 

I have a ALV with fixed fields . These fields are also part of context .

 

Now I have to add new fields to the table as columns and also populate the values dynamically .

 

To add new columns  , I add below code .

 

loop at fields into field

 

    CALL METHOD lv_value->if_salv_wd_column_settings~create_column

      EXPORTING

        id       = field

        position = lv_lines

      RECEIVING

        value    = lr_column.

 

    lo_column_header = lr_column->create_header( ) .

 

 

    lo_column_header->set_text( field ) .

 

* Create an attribute in the context

 

*     navigate from <CONTEXT> to <POSITIONS> via lead selection

    lo_nd_positions = wd_context->get_child_node( name = wd_this->wdctx_positions ).

 

 

    CALL METHOD lo_nd_positions->get_node_info

      RECEIVING

        node_info = lr_child_node_info.

 

 

    ls_context_attribute_info-name = field

    ls_context_attribute_info-type_name = 'CHAR30'.

    ls_context_attribute_info-is_static = abap_false.

 

    CALL METHOD lr_child_node_info->add_attribute

      EXPORTING

        attribute_info = ls_context_attribute_info.

 

 

* Create a cell editor with reference to column id .

    CREATE OBJECT lr_input

      EXPORTING

        value_fieldname = field.

 

 

    CALL METHOD lr_column->set_cell_editor

      EXPORTING

        value = lr_input.

 

endloop.

 

The issue is i am getting a dump as application says , not able to find the attribute field. I already added the attribute field to the context by using add atributte and based on this refrence , I am creating the input field . so now I have the field in the table and also the reference to this field  in the context and binding also exists .

 

whats the reason for dump .kindly advice .

Thanks..


Viewing all articles
Browse latest Browse all 3667

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>