cancel
Showing results for 
Search instead for 
Did you mean: 

Property "labelFor" of the label is empty

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Anna,

which context node is bound to alv context node TOP_OF_LIST?

There are two nodes in your application (TOP_OF_LIST1 + TOP_OF_LIST).

Regards

Former Member
0 Kudos

Hi Danny,

The TOP_OF_LIST context node is bound to alv context node.

The TOP_OF_LIST1 is a node contains two attributes UNAME and DATE. These are the

information I want to put on the top of the ALV.

Thanks for your help.

AS

Former Member
0 Kudos

Anna,

are you sure r_value1 is not empty.

debug the code and find it out

Thanks

Bala Duvvuri

Former Member
0 Kudos

Hello ,

I think the problem is with ALV . Check the Attributes of the node which is mapped to the DATA node of ALV . If any of the attribute contains a data type as String or some implicit data type then generally this type of dump occurs .

Hope this will help you .

Regards

Vivek

Former Member
0 Kudos

Hi Vivek,

Yes, I have used the String type for the UNAME to obtain the user's login name. If I don't use String,

what should I use then.

Thanks,

AS

Former Member
0 Kudos

Hi Bala,

I just made some modification to the following and it works fines now.

 
 r_value1  = lr_flow->create_text( row = 1 column = 2 text = sy-uname ).

To: 
r_value1  = lr_flow->create_text( row = 1 column = 2 text = 'Test' ).

How can I display sy-name rather than some text input?

Thanks,

AS

Former Member
0 Kudos

Anna,

i execute the same code

r_value1 = lr_flow->create_text( row = 1 column = 2 text = sy-uname ).

and it is working fine.

put a break point at this line

r_value1 = lr_flow->create_text( row = 1 column = 2 text = sy-uname ). and checl r_value1->text

Thanks

Bala Duvvuri

Former Member
0 Kudos

Thanks, everyone.

It works fine now. Yeah!

AS

Answers (0)