Skip to Content
0
Former Member
Mar 26, 2009 at 10:18 AM

Default Search Value for Category in Account Search won't work

63 Views

Hi everyone,

I have a request to set the Category for the Account Search as default to "Corporate Account" instead of "All Accounts" (it's the very first picklist if you go into the Account Search saying "Search for" in front of it).

So I found out Component, View, Context Node and Attribute...

Component: BP_HEAD_SEARCH

View: MainSearchShuffler

Context Node: SEARCH

Attribute: CATEGORY

So I've extended that view and redefined the method GET_CATEGORY. There I set the value = '2' (which means Corporate Account), but only when my (own) static attribute G_FIRST_TIME is set to true. Here the coding (only that which I've changed):

*--> begin - 26/03/09 - M.Lauber
  " if this search page is called or recalled 'for the first time'...
  if me->g_first_time = abap_true.
    "...set category to 'Corporate Account'
    value = '2'.
    " clear first time flag
    clear me->g_first_time.
  endif.
*<-- end   - 26/03/09

To set my static attribute to true whenever the account search is being called, I also redefined method IF_BSP_MODEL~INIT where I simply set my static attribute to true. Here the coding (only that which I've changed):

*--> begin - 17/03/09 - M.Lauber
  " set first time flag
  me->g_first_time = abap_true.
*<-- end   - 17/03/09

This change works perfectly, concerning the default value for the category. BUT something really strange happens too. Whenever I freshly log on the Web UI, go to account search and search for accounts I don't get any result table displayed. I do get results (I've also debugged it) and also the "result title" says something like "Result List: 1 Account found". But no account is displayed.

Also strange... if I typed in e.g. an account id, that one disappears too from the search screen.

If I click on Search again or any search after this very first search works perfectly.

Now I've been debugging and debugging and I can't find a way to fix this.

And as soon as I change value = '2' back to value = '' (in GET_CATEGORY) it also works in the very first search. How can a simple value cause such a big flaw? I really have no more ideas 😔

Has anyone an idea, what I need to do or what I've done wrong?

Help is very appreciated, because I really need this urgently!

Best regards,

Melanie