cancel
Showing results for 
Search instead for 
Did you mean: 

Howto find and change SAP std. search help

Former Member
0 Kudos

Hi all,

as it seems there is no chance to sort the columns of result list in SAP standard search help popup window. Since we really need this feature, my last idea is to change the SAP standard component for F4 search help.

Can anybody tell me how I can find (identify) this WD4A component?

Regards and TIA, Matthias

Accepted Solutions (1)

Accepted Solutions (1)

Yashpal
Active Contributor
0 Kudos

Hi Matthias ,

The standard component which is used to create a serch help at runtime is WDR_F4_ELEMENTARY . as functionality required by u can be implemented in this way..u need to enhance this comoponent...

enhance the view 'general' ,

create a attribute TABLE_METHOD_HANDLER type ref to IF_WD_TABLE_METHOD_HNDL

create a action 'SORTING' ,

and write the following code

wd_this->table_method_handler->apply_sorting( ).

now create a post-exit for the method wd_modify_view .

and write the following code .

data : lr_table type ref to cl_wd_table .

lr_table ?= view->get_element( 'GENERAL_VALUES_LIST' ).

if lr_table is bound .

lr_table->set_on_sort( 'SORTING' ).

endif.

now i think the output table will be of type sorted and sorting control will appear ..

Regards,

Yash

Former Member
0 Kudos

Thanks, I think that will do the trick, thanks.

Question: how have you found out that "WDR_F4_ELEMENTARY" is the used comp.?

Yashpal
Active Contributor
0 Kudos

just by hit and trail ... as for ovs there is wdr_ovs ..so for F4...

Regards

Yash

Former Member
0 Kudos

I found it thru debugging .. and i used the request handler class CL_WDR_MAIN_TASK as entry point ...

Former Member
0 Kudos

Hi Yash!

Well done!

Regards,

Volker

Answers (4)

Answers (4)

former_member557553
Participant
0 Kudos

Hello everybody,

me (& my problem ) was forwarded to this thread by Volker. In my case I want to manipulate the tooltips of the table on the dictionarys search help (in the following: "dsh"). I see the sugguestion of making a copy if it but this not my favorite way, because the whole application already exists. Now we are in a test phase.

Many thanks.

Christian

Former Member
0 Kudos

Hi folks.

Is this still a hot topic? I just enhancend WDR_F4_ELEMENTARY so that sorting is possible now. Might not be the best solution but it works.

So if someone needs the solution just let me know.

Cheers,

Sascha

Former Member
0 Kudos

Hi Sascha,

yes I am interested.

Could you please provide some details about your solution?

Regards, Matthias

Former Member
0 Kudos

Hi Matthias.

I guess it is not the best way but works for me.

Enhance component WDR_F4_ELEMENTARY the following way:

<b>component controller</b>:

copy method SET_OUTPUT_TABLE to SET_SORTED_OUTPUT_TABLE.

Add new import parameters to the copied method:

SORT_ATTRIBUTE_NAME type STRING

SORT_DIRECTION type WDUI_TABLE_COL_SORT_DIR

Find this code in the method:

* For each output table item: create element, set attributes and bind to output context node
 ASSIGN l_output_table->* TO <output_table>.

and add


* sort table
        case sort_direction.
          when '00'.
            sort <output_table> ASCENDING by (sort_attribute_name).
          when '01'.
            sort <output_table> DESCENDING by (sort_attribute_name).
        endcase.

<b>view GENERAL</b>:

add new controller attribute LR_VIEW type ref to IF_WD_VIEW.

add new post-exit for method wddomodifyview:


data:
        lr_table    type ref to CL_WD_TABLE.

* Activate sorting
  if first_time eq abap_true.
    lr_table ?= view->get_element( 'GENERAL_VALUES_LIST' ).
    lr_table->set_on_sort( 'SORT' ).
    wd_this->lr_view = view. " save local reference for later use in sort action
  endif.

add new action SORT to view controller:


DATA:
        lr_table  TYPE REF TO cl_wd_table,
        lr_column TYPE REF TO cl_wd_table_column,
        lr_text_view  type ref to cl_wd_text_view,
        lr_cell_variant type ref to cl_wd_table_sngl_mark_cell.

  DATA:
        lt_attr_strings type table of string.

  DATA:
        lv_name       TYPE string,
        lv_direction  TYPE wdui_table_col_sort_dir,
        lv_attr_name  TYPE string,
        lv_lines      type i.

* get event parameters to identify the column the user clicked on
  lv_name = wdevent->get_string( 'COL' ).
  wdevent->get_data(
    EXPORTING
      name = 'DIRECTION'
    IMPORTING
      value = lv_direction
  ).

* get the column
  lr_table ?= wd_this->lr_view->get_element( 'GENERAL_VALUES_LIST' ).
  lr_column = lr_table->get_column( id = lv_name ).

* try to get the cell editor either directly ...
  lr_text_view ?= lr_column->get_table_cell_editor( ).
  if lr_text_view is not bound.
*  ... or via the cell variant. We can not assume the cell variant id
*  so we take the first one.
   lr_cell_variant ?= lr_column->get_cell_variant( index = 1 ).
   if lr_cell_variant is bound.
     lr_text_view ?= lr_cell_variant->get_editor( ).
   endif.
  endif.

* if we have the cell edito we can get the name of the attribute
* it is bound to.
  if lr_text_view is bound.
    lv_attr_name = lr_text_view->bound_text( ).
    split lv_attr_name at '.' into table lt_attr_strings.
    describe TABLE lt_attr_strings LINES lv_lines.
    read TABLE lt_attr_strings INDEX lv_lines into lv_attr_name.
    wd_comp_controller->SET_SORTED_OUTPUT_TABLE(
      CONTEXT_NODE = wd_context
      CREATE_INTERVALS_TABLE = abap_true
      SORT_ATTRIBUTE_NAME = lv_attr_name
      sort_direction  = lv_direction
    ).
  endif.

The problem is the copy of the component controller method. If this method change in future patch levels you have to copy the method again.

If you have any idea on how to refactor the code above to do not hesitate do discuss this here.

Cheers,

Sascha

Former Member
0 Kudos

Hi Sascha,

thanks for you input. On the first sight it looks good, I have to check it further. Now I can't modify the SAP standard, because we are two weeks before roll-out. But I will continue with that issue, maybe for the next release ...

Thanks a lot!

Regards, Matthias

Former Member
0 Kudos

Hi Yash,

I have a problem with your solution. When I try to hit sort on a table column now, the application dumps, because the new attribute of view (wd_this->table_method_handler) is NULL, therefore I can't make the call:

wd_this->table_method_handler->apply_sorting( ).

So I changed your code to:

IF lr_table IS BOUND.

wd_this->table_method_handler ?= lr_table->_method_handler.

lr_table->set_on_sort( 'SORTING' ).

ENDIF.

Now the attribute is not NULL any longer, but I get another dump, telling me that the ASSERT-condition was broken (error type ASSERTION_FAILED).

Any ideas?

Former Member
0 Kudos

Create a normal "Z" abap function module by copying function module F4IF_SHLP_EXIT_EXAMPLE.

Look out for statement if callcontrol-step = 'DISP'.

  • insert the following code between statement if callcontrol-step = 'DISP'.

and endif.

sort record_tab.

exit.

Attach the function module to your search help and activiate the serach help. Result will be displayed in Sort order.

Regards

Rohit Chowdhary

Former Member
0 Kudos

Thanks Rohit, but thats not exactly what I need. Your way would sort the results of search help hard coded. The use has no way of selection which column he wants to sort, and in which direction ...

My point is sort the columns by clicking on them direclty on popup, not in the search help exit. I tried to modify the SAP standard WD4A component as we have discussed, but it seems there is no practical solution for thi problem. Maybe I really have to create my own search help for this issue.

I really don't understand why sorting of the result table columns is not standard feature

Yashpal
Active Contributor
0 Kudos

sorry i din't know that ...while sorting we have to provide the key attribute of the node... i tried with some combinations like adding a attribute to the output node and giving the table index sy-tabix to the attribute .. then giving this attribute as a key attribute to table but it didn;t worked ..... then i tried to give a attribute as a key which are dynamically created at runtime for the search help result ... but that didnt worked because .... when i call the apply_sorting method. it search the key attribute name in the node ..and it only search the static_attributes... and there no method to get the dyanmically added attributes that why its giving me some null reference exception .. so i think the functionally u required is not possible...

SAP should come with some solution in this area .. also method to get the dynamically created attribute should be there....

Regards

Yash

Former Member
0 Kudos

... you're right, SAP should provide a solution to this. I already wrote them, but they only told me that it's not possible now and that I can create a development request. But I need a solution now, not with the next release.

Anyway, thanks for your effort and help.

I will write a customized help for business partner search now.

Regards, Matthias

Former Member
0 Kudos

... Question now answered?

Regards,

Volker

Former Member
0 Kudos

Hi Matthias.

As Volker said, you can develop your own search help as freely programmed serach help. Here you can use any WD4A element so you could implement the sort function.

I do not think that copying will resolve your issue because the standard search helps are sortable already and it seems that this feature is just not provided in the dynamically generated WD4A serach help.

Cheers,

Sascha

Former Member
0 Kudos

Hello,

I know how to create a new search help object in SE11, and I know how to change to this new search help in WD4A context. My problem is: I don't know how to change the popup window itself. As said, the selected data is not the problem. But I need to make the result table columns sortable, therefore I need to change or copy the standard F4 search help WD4A component.

My question now: How can I find out which component I have to copy or modify?

Former Member
0 Kudos

Hi Matthias.

I think the standard search helps are generated dynamically on the fly as WebDynpro Component when the serach help is called. There are no

WebDynpro Serach Help components for all standard search helps.

So you would have to change the class or whatever it is that dynmically translates the standard search help to WD4A. I do not know what class this is.

I did not ask you to create a new search help in SE11 I asked you to create a freely programmed search help in WebDynpro where you can use a table control which will be sortable and use this search help.

Cheers,

Sascha

Former Member
0 Kudos

Hi Matthias.

Seems that this component:

WDR_F4_ELEMENTARY

Is used when you click the search help in a WD4A aplication.

Maybe you can do your enhancements there ... there is the interface controller method init(). If you set a break point here the debugger will start as soon as you click on the search help icon.

Hope this helps,

Sascha

Former Member
0 Kudos

But caution: as far as I know WDR_... objects are not released by SAP to be used directly. The docu says the same.

If you modify this component you may get problems when you need SAP support. Furthermore these objects maybe changed or removed by SAP without further notice.

I think the free developed search help is the best way although maybe not the fastest ...

Regards,

Volker

Former Member
0 Kudos

Hi!

In your Component Controller edit the relevant field(s)/attribute(s) in controller's context. There you have several choices to define the kind of value help:

deactivate,

automatic,

Dictionary Search Help

Object Value Selector

free programmed

I think the easiest way is to copy the SAP search help and make your changes to the copied search help. Then define the new one in controllers context.

Hope this helps!

Regards,

Volker