Application Development and Automation 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: 
Read only

SET_ITEMS_FOR_COLUMN

deiamolina
Contributor
0 Likes
1,611

Hi all,

I'm walking in circles for a while tying to figure it out what is wrong in my ALV tree. I have a report that is working properly and I checked out the messages in the SDN to find the answer to my question. I copied and pasted from the working report to the not working one all the error pointed in the discussions opened in here and it is still not working.

So, I do hope that someone knows what is that:

1) The fieldcatalog is genarate dinamically using a type in declarations.

2) container declarations and set ups: CREATE OBJECT l_custom_container & CREATE OBJECT tree1

3) Table reference, titles, logo, background being created by CALL METHOD tree1->set_table_for_first_display

4) Hierarchy being created using CALL METHOD tree1->add_node

5) CALL METHOD tree1->update_calculations.

6) CALL METHOD tree1->frontend_update.


I can see the first screen perfectly, when I try to opend the 1st level I got this dump:

Runtime Errors         GETWA_NOT_ASSIGNED

ABAP Program           CL_ALV_TREE_BASE==============CP

Short text

    Field symbol has not yet been assigned.

METHOD: SET_ITEMS_FOR_COLUMN (CL_ALV_TREE_BASE)

   assign mt_outtab->* to <tab1>.

   " assign local copy of initial line of <tab1> to <wa>.

   create data l_dref_wa like line of <tab1>. ******************* The error is here

   assign l_dref_wa->* to <wa>.

I am using CALL METHOD tree1->set_table_for_first_display to set up mt_outtab->*

Just to make it really clear. I copied and paste it from another program that is working. It was working before and I made some changes, including a new field on the type declarations used to generate fieldcat, and it stopped to work.

Does anyone had this same problem before and know how to fix it or what am I missing or am I doing wrong?

I really want to understand what is wrong in here...

Thanks a million.

Regards,

Andréa

5 REPLIES 5
Read only

deiamolina
Contributor
0 Likes
1,109

Follow the code


*&---------------------------------------------------------------------*

*&      Module  PBO_100  OUTPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

module pbo_100 output.

   set pf-status 'MAIN'.

   if tree1 is initial.

     perform create_and_init_tree.

   endif.

endmodule.                 " PBO_100  OUTPUT



*&---------------------------------------------------------------------*

*&      Form  CREATE_AND_INIT_TREE

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

form create_and_init_tree.

   data: node_table type node_table_type,

         events     type cntl_simple_events,

         event      type cntl_simple_event.

   data: it_output_empty type table of ty_output.

* create container for alv-tree

   data: l_tree_container_name(30) type c,

         l_custom_container type ref to cl_gui_custom_container.

* create info-table for html-header

   data: lt_list_commentary type slis_t_listheader,

         l_logo             type sdydo_value.

* repid for saving variants

   data: ls_variant type disvariant.

   ls_variant-report = sy-repid.

   l_tree_container_name = 'TREE_CONTAINER'.

   if sy-batch is initial.

     create object l_custom_container

       exporting

         container_name              = l_tree_container_name

       exceptions

         cntl_error                  = 1

         cntl_system_error           = 2

         create_error                = 3

         lifetime_error              = 4

         lifetime_dynpro_dynpro_link = 5.

     if sy-subrc <> 0.

       message x208(00) with 'ERROR'.

     endif.

   endif.

* create tree control

   create object tree1

     exporting

       parent                      = l_custom_container

       node_selection_mode         = cl_gui_column_tree=>node_sel_mode_multiple

       item_selection              = 'X'

       no_html_header              = ''

       no_toolbar                  = ''

     exceptions

       cntl_error                  = 1

       cntl_system_error           = 2

       create_error                = 3

       lifetime_error              = 4

       illegal_node_selection_mode = 5

       failed                      = 6

       illegal_column_name         = 7.

   if sy-subrc <> 0.

     message x208(00) with 'ERROR'.

   endif.

* create hierarchy

   call method tree1->set_table_for_first_display

     exporting

       is_hierarchy_header = v_hierarchy_header

       it_list_commentary  = lt_list_commentary

       i_logo              = l_logo

       i_background_id     = 'Z_BICYCLE_BG'

       i_save              = 'A'

       is_variant          = ls_variant

     changing

       it_outtab           = it_output_empty

       it_fieldcatalog     = fieldcat.

* create hierarchy

   perform create_hierarchy.

   perform events.

*    PERFORM change_toolbar.

* Expand all nodes

   if v_expandall is not initial.

     delete adjacent duplicates from it_expand_nodes.

     call method tree1->expand_nodes

       exporting

         it_node_key             = it_expand_nodes

       exceptions

         failed                  = 1

         cntl_system_error       = 2

         error_in_node_key_table = 3

         dp_error                = 4

         node_not_found          = 5.

   endif.

* optimize column-width

   call method tree1->column_optimize

     exporting

       i_start_column = tree1->c_hierarchy_column_name

       i_end_column   = tree1->c_hierarchy_column_name.

* calculate totals

   call method tree1->update_calculations.

* Send data to frontend.

   call method tree1->frontend_update.

endform.                    " CREATE_AND_INIT_TREE


*&---------------------------------------------------------------------*

*&      Form  CREATE_HIERARCHY

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

form create_hierarchy .

* add data to tree

   data: l_last_key  type lvc_nkey,

         l_kotabnr   type vakevb-kotabnr,

         l_knuma     type vakevb-knuma,

         l_desc(100) type c,

         l_kschl     type vakevb-kschl.

   data: l_param_key  type lvc_nkey,

         l_param2_key type lvc_nkey,

         l_param3_key type lvc_nkey,

         l_param4_key type lvc_nkey,

         l_param5_key type lvc_nkey.

   loop at it_output into wa_output.

*** Agreement type

     on change of wa_output-typed.

       perform level1 using ''

                                   '@3P@'

                             changing l_param_key.

       clear: l_knuma,

              l_kotabnr,

              l_desc,

              l_kschl.

       append l_param_key to it_expand_nodes.

     endon.

*** Recipient Description

     if l_desc ne wa_output-desc.

       perform level2 using l_param_key  'ICON_CUSTOMER'

                        changing l_param2_key.

       clear: l_knuma,

              l_kotabnr,

              l_kschl.

       append l_param2_key to it_expand_nodes.

     endif.

*** Agreement number

     if l_knuma ne wa_output-knuma.

       perform level3 using l_param2_key 'ICON_RENTAL_AGREEMENT'

                         changing l_param3_key .

       clear: l_kotabnr,

              l_kschl.

       append  l_param3_key to it_expand_nodes.

     endif.

**** Condition

     if l_kotabnr ne wa_output-kotabnr or

        l_kschl   ne wa_output-kschl.

       perform level4 using l_param3_key 4 ''

                             changing l_param4_key .

       append l_param4_key to it_expand_nodes.

     endif.

     perform add_complete_line using l_param4_key  5

                               changing l_last_key.

     l_kotabnr = wa_output-kotabnr.

     l_knuma   = wa_output-knuma.

     l_desc    = wa_output-desc.

     l_kschl   = wa_output-kschl.

   endloop.

* calculate totals

   call method tree1->update_calculations.

* this method must be called to send the data to the frontend

   call method tree1->frontend_update.

endform.                    " CREATE_HIERARCHY



LEVEL 2 to 4 are almost the same


*&---------------------------------------------------------------------*

*&      Form  LEVEL1

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

form level1  using  p_relat_key type lvc_nkey

                     p_icon

              changing p_node_key.

   data: l_node_text type lvc_value,

         relat       type int4,

         wa_refe     type tab_type,

         wa_level   type ty_output.

* set item-layout

   data: lt_item_layout type lvc_t_layi,

         ls_item_layout type lvc_s_layi.

   data: ls_node type lvc_s_layn.

   ls_node-n_image   = space.

   ls_node-exp_image = space.

   ls_item_layout-t_image = p_icon.

   ls_item_layout-style   = cl_gui_column_tree=>style_intensified.

   ls_item_layout-fieldname = tree1->c_hierarchy_column_name.

   append ls_item_layout to lt_item_layout.

* add node

   l_node_text = <field1>.

   wa_level-level   = 1.

   ls_node-isfolder = 'X'.

   call method tree1->add_node

     exporting

       i_relat_node_key     = p_relat_key

       i_relationship       = cl_gui_column_tree=>relat_last_child

       i_node_text          = l_node_text

       is_outtab_line       = wa_level

       is_node_layout       = ls_node

       it_item_layout       = lt_item_layout

     importing

       e_new_node_key       = p_node_key

     exceptions

       relat_node_not_found = 1

       node_not_found       = 2

       others               = 3.


*&---------------------------------------------------------------------*

*&      Form  LEVEL2

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->P_L_PARAM1_KEY  text

*      -->P_2      text

*      -->P_1721   text

*      <--P_L_PARAM2_KEY  text

*----------------------------------------------------------------------*

form level2  using p_relat_key type lvc_nkey

                       hierarchy

                       icon

                 changing p_node_key type lvc_nkey.

* set item-layout

   data: lt_item_layout type lvc_t_layi,

         l_node_text    type lvc_value,

         ls_item_layout type lvc_s_layi,

         relat          type int4,

         wa_level      type ty_output.

   ls_item_layout-t_image = icon.

   ls_item_layout-style   cl_gui_column_tree=>style_intensified.

   ls_item_layout-fieldname = tree1->c_hierarchy_column_name.

   append ls_item_layout to lt_item_layout.

* add node

   l_node_text = <field2>.

   wa_level-level = hierarchy.

   relat = cl_gui_column_tree=>relat_last_child.

   call method tree1->add_node

     exporting

       i_relat_node_key = p_relat_key

       i_relationship   = relat

       i_node_text      = l_node_text

       is_outtab_line   = wa_level

       it_item_layout   = lt_item_layout

     importing

       e_new_node_key   = p_node_key.

*&---------------------------------------------------------------------*

*&      Form  add_cmplete_line

*&---------------------------------------------------------------------*

*       add hierarchy-level 3 to tree

*----------------------------------------------------------------------*

*      -->P_LS_SFLIGHT  sflight

*      -->P_RELEATKEY   relatkey

*     <-->p_node_key    new node-key

*----------------------------------------------------------------------*

form add_complete_line using  p_relat_key type lvc_nkey

                               hierarchy

                     changing  p_node_key type lvc_nkey.

   data: l_node_text type lvc_value.

* set item-layout

   data: lt_item_layout type lvc_t_layi,

         ls_item_layout type lvc_s_layi.

   ls_item_layout-fieldname = tree1->c_hierarchy_column_name.

   append ls_item_layout to lt_item_layout.

   l_node_text = wa_output-bonem.

   if l_node_text is initial.

     message s021(zgeral) display like 'E'.

     leave list-processing.

   endif.

   data: ls_node type lvc_s_layn.

   ls_node-n_image   = space.

   ls_node-exp_image = space.

   wa_output-level = hierarchy.

   call method tree1->add_node

     exporting

       i_relat_node_key = p_relat_key

       i_relationship   = cl_gui_column_tree=>relat_last_child

       is_outtab_line   = wa_output

       i_node_text      = l_node_text

       is_node_layout   = ls_node

       it_item_layout   = lt_item_layout

     importing

       e_new_node_key   = p_node_key.

endform.                               " add_complete_line

endform.                    " LEVEL2

endform.                    " LEVEL1


Read only

0 Likes
1,109

Hi Andrea,

Pls check ur fieldcatlog, make sure that all fieldname does't have any small letter or any special characters.

And the first letter of fieldcatlog fieldname is start with a Alphabet.

Regards

Sreekanth

Read only

0 Likes
1,109

Hi

I checked that and it seems ok to me. Follow the fieldcat file maybe I'm missing something.

Thanks,

Andréa

Read only

deiamolina
Contributor
0 Likes
1,109

I'm still debugging to find this error and I found something weird.

Comparing the onw that is working and the one that is generating this dump I notice that untill the output the mt_outtab is declarated and contains data. After that, when I try to open the hierarchy the one that finishs in dump miss the link with mt_outtab that was declarated and filled. So, it is not ther. That's is the error. But I'm still quite lost why it is missing the link.

Error on method: HANDLE_EXPAND_NC (CL_GUI_ALV_TREE) 

Read only

0 Likes
1,109

I just created a new discussion since now I know better the problem. Follow the link: