cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to get the label of a search field

tony_dagnillo2
Explorer
0 Kudos

Hello,

We are putting in custom validations around some of our searches in the ON_SEARCH methods of BSP views. When displaying an error for a search field entry we want the error to say what field the error is for. We don't want to display the technical field name but rather the field label on the view. In debug, I can see that I want to retrieve the contents in me->typed_context->search->view_descriptor->label_buffer and load into a table of type bsp_dlcs_field. Struggling to get a syntax that will generate, much less work. Any suggestions or code snipets are appreciated.

Thanks in Advance,

Tony

Accepted Solutions (0)

Answers (1)

Answers (1)

MichaelNe
Employee
Employee
0 Kudos

Hello Tony,

did you try something like from any view controller class method?

DATA lr_view_descr TYPE REF TO if_bsp_dlc_view_descriptor.

lr_view_descr = configuration_descr->get_property_descriptor( ).

lr_view_descr->get_field_label(

exporting

IV_ELEMENT_ID = your element id

iv_context_node = your context node

receiving

rv_result = label string ).

Hope this helps to solve your issue.

Best Regards,

Michael

tony_dagnillo2
Explorer
0 Kudos

Hello Micheal,

I believe I had gone down a similar path to your suggestion and had struggled with it. Ultimately the solution I found was very simple and is as follows:

data: lt_dquery_possible_fields type crmt_thtmlb_search_field_name.

lt_dquery_possible_fields = me->dquery_possible_fields.

Thanks,

Tony