Skip to Content
0
Former Member
Dec 05, 2008 at 03:17 PM

Property "labelFor" of the label is empty

118 Views

Dear Experts,

I have created a simple project which contains a view and a service call and an ALV top of list.

Without the top of list, the project works perfectly. However, after I added the top of list,

The error message looks like the following:

Note 
The following error text was processed in the system SB4 : Adapter error in 
&VIEW_ELEMENT_TYPE& "_2D" of view "SALV_WD_TABLE.VIEW_TOP_OF_LIST_I": 
Property "labelFor" of the label is empty. It must always contain the ID of a UI element 

Here are the code in my WDDOINIT and WDDOMODIFYVIEW.

method WDDOINIT .
  data:
        node_top_of_list type ref to if_wd_context_node,
        elem_top_of_list type ref to if_wd_context_element,
        ls_top_of_list type if_componentcontroller=>element_top_of_list1.

  node_top_of_list = wd_context->get_child_node( name = 'TOP_OF_LIST1' ).
  elem_top_of_list = node_top_of_list->get_element( ).

  ls_top_of_list-date = sy-datum.
  ls_top_of_list-uname = sy-uname.

  elem_top_of_list->set_static_attributes(
    exporting
      static_attributes = ls_top_of_list ).

* handle ALV
  data:
        l_ref_com_usage type ref to if_wd_component_usage.

  l_ref_com_usage = wd_this->wd_cpuse_alv_table( ).
  if l_ref_com_usage->has_active_component( ) is initial.
    l_ref_com_usage->create_component( ).
  endif.

  data:
        l_ref_interfacecontroller type ref to iwci_salv_wd_table.
        l_ref_interfacecontroller = wd_this->wd_cpifc_alv_table( ).

  data:
        l_value type ref to cl_salv_wd_config_table.
        l_value = l_ref_interfacecontroller->get_model( ).

  data:
        lr_flow type ref to cl_salv_form_layout_grid,
        r_value type ref to cl_salv_form_label,
        r_value1 type ref to cl_salv_form_text.

create object lr_flow.
  r_value1  = lr_flow->create_text( row = 1 column = 2 text = sy-uname ).
  r_value = lr_flow->create_label( row = 1 column = 2 text = 'User: ' r_label_for = r_value1 ).

  r_value1  = lr_flow->create_text( row = 1 column = 2 text = sy-datum ).
  r_value = lr_flow->create_label( row = 1 column = 2  text = 'Date: ' r_label_for = r_value1 ).


  node_top_of_list = wd_context->get_child_node( name = 'TOP_OF_LIST' ).

  call method node_top_of_list->set_attribute
    exporting
        value = lr_flow
        name  = 'CONTENT'.

*  Set top of list
   l_value->if_salv_wd_table_settings~set_top_of_list_visible(
    value  = abap_true ).

endmethod.

method WDDOMODIFYVIEW .
  DATA lo_COMPONENTCONTROLLER TYPE REF TO IG_COMPONENTCONTROLLER .
  lo_COMPONENTCONTROLLER =   wd_this->get_componentcontroller_ctr( ).

    lo_componentcontroller->execute_zbapi_get_time(
    ).
endmethod.

Can someone help please?

Thanks,

AS