<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d34883048\x26blogName\x3dYour+Friendly+ABAPer\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttps://friendlyabaper.blogspot.com/search\x26blogLocale\x3den_US\x26v\x3d2\x26homepageUrl\x3dhttp://friendlyabaper.blogspot.com/\x26vt\x3d-8534208955155839123', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

Search help

I was hoping to get more details on the subject but, unfortunately, had to work on something else. If I get a chance to explore this more, I’ll just comment on this post or write a “part II”, as seems to be very fashionable among the SAP webloggers.

One of the sites that we support uses two names on the customer master (XD03). Our customers are only other companies and sometimes trade name and legal name are different. For example, a Joe’s Crab Shack restaurant might legally be an ACME Corporation. There are 2 lines for the name in XD03 (KNA1-NAME1 and KNA1-NAME2 respectively) and most of the sites enter the trade name (Joe’s Crab Shack) in NAME1 but legal name in NAME2. On the invoices (i.e. billing documents) the names are also printed in the same order: first NAME1, then NAME2. (This is just a preamble – hold on, we are getting there.)

But one site, due to the legal requirements in their state, had to print legal name first and trade name second. To avoid changing the invoice form (which is standard for the whole enterprise) we just asked them to enter the names in their order on the Customer Master. Sure thing, pretty soon they started to complain that the customer search in the order entry screen (VA01) only works by NAME1 or by some mysterious “first name”, which we don’t use at all (by the way, when I double-clicked on it, it displayed “Name 2” in the description, but it does not search by NAME2 field).

Honestly, so far I’ve never had anything to do with the search help but I gave it a try. Quick search in SAP Help (by the way, I usually simply use Google for searching – never really warmed up to that SAP help interface) provided some good starting points. First of all, I discovered that there is an elementary search help and a collective search help (collective is actually just a collection of the elementary ones). Then I learned that both are maintained in SE11.

Obviously, next I had to find out which search help is VA01 using for the customer (or, as it’s called there ‘Sold-to Partner’ or ‘Ship-to Partner’). Search by description in SE11 was not very successful, so I did a little debugging and finally found the name SD_DEBI in MC_OBJ field in MV45AF0K_KUNDE_GET_F4HELP.

Then in SE11 I discovered that SD_DEBI is a collective search help, consisting of 4 elementary ones (this might depend on the config, so don’t be surprised if it’s different in your system). Each elementary search help basically translates into a tab on the help screen with the tab names in the ‘Short text’ field.

Much to my surprise, I was able to create my own elementary search help and simply add it to SD_DEBI without any requests for an access key and, in fact, without much hassle. Here are the steps that I have gone through.

1. Create an elementary search help (Z_NAME2). This is quite intuitive: in SE11, select ‘Search help’, enter the name and click [Create] button. Then in the pop-up window select ‘Elementary’. I used the other search helps from SD_DEBI to fill in the details:


Did not quite figure the ‘Selection method’ thing. DEBIA, for example, had selection method M_DEBIA with the description ‘Generated View for Matchcode ID DEBI’. Not sure how they generated it but for now I just out the table name (KNA1) in there and it worked. I’ve chosen the ‘Dialog with value restriction’ option so that my new tab behaves the same way as the other ones. If you chose ‘Display values immediately’, it will display the whole list (which doesn’t make any sense if there are hundreds of items). The third option is somewhere in the middle and basically lets the system to choose between the two options based on the number of entries.

IMP and EXP columns tell what needs to be passed to the search help from the input field (IMP) and back (EXP). If you check IMP then, if a user has entered some value and then clicked on help, that value will be passed to the help screen. If you check EXP, the value will be passed back to the input field. It’s a no-brainer that one field should have EXP checked (I checked both just for the heck of it).

Numbers in the ‘LPos’ column tell in which order the fields will appear on the screen (I out name first). ‘Hot key’, as I figured from the documentation, seems more trouble than it’s worth, so I left it empty. Don’t forget to activate your new search help before leaving the screen.

2. Add your new elementary search help to a collective one. Just to be clear: this is not a required step but I had to do it to add my search to SD_DEBI. Again, in SE11, select ‘Search help’, enter the name and click [Change] button. Then on the ‘Included search helps’ tab add your new help, like this:

The last step is to select the line with your search help and to click on the ‘Parameter assignment’. There was an option to automatically propose the parameter, which I used. This parameter basically tells how the collective and elementary searches are linked together (in my case – by customer number KUNNR). And don’t forget to activate the collective search as well.

After these steps I was able to see the new tab on the customer search help in VA01:

The users, as usually is the case, were happy with my new screen only for the first hour or so and pretty soon came up with the new requirements. Now they wanted to add the Sales Organization (VKORG) field, so that the search is limited to only their customers. This meant that I could not use KNA1 as a search method because it does not include (VKORG). Luckily, there was a view already defined on KNA1 and KNVV (KNA1VV), which I was able to use. So I replaced KNA1 with KNA1VV, added VKORG to the field list and clicked ‘Activate’.

This time the activation did not go as smoothly and I got a warning message ‘Dialog type C makes no sense for search help w/o selection popup window’. Not sure why it was qualified as a warning because the search help was not working until I took care of this problem. Surprisingly, the diagnosis for this error message was very specific and pointed out that all my fields had 0 in the SPos column. Here is the new Z_NAME2:

You might notice that I’ve added the memory ID VKO to the VKORG field so that the users wouldn’t have to type in their sales org all the time. Also when I added VKORG field, it automatically put a check mark in the ‘Modified’ column. I tried to read the documentation for it but the only thing I understood was that I didn’t need that, so I unchecked it.

I’ve also removed unnecessary IMP checkmark and figured out what’s the deal with LPos and SPos columns. Since the users want to search by Sales Org and Name 2, they don’t really care for the Customer [Number] field on the search help tab. But when they enter, say *Crab*, they want to see the list of possible customers with their names and numbers. I’ve achieved that by leaving SPos blank for KUNNR (it removes it from the tab) but setting LPos = 3 (which puts KUNNR on the list of the customers found by search help). Let’s say we have 2 customers: number 700001 (Joe’s Crab Shack) and number 700004 (Jane’s Crab Cakes). The list for *Crab* (Name 2 is case-sensitive for some reason) will displayed like this:

Joe’s Crab Shack 700001
Jane’s Crab Cakes 700004

As you might have noticed, there is also an option to create a search help user exit, but I haven’t gone that far yet.

Just one more thing. From version 4.6 SAP has introduced a central address area. All addresses have a unique ID and are linked to other master data by the field ADRNR. The main address table is ADRC, which also contains NAME1 and NAME2 fields. Fields in KNA1 have length of 35 while fields in ADRC are 40 characters long. If you need to use the whole 40, go with the ADRC table. DEBIX is the elementary search for KUNNR on ADRC, but, as I mentioned, it does not quite work the way we need.

Some links that might be useful:
1. SAP Help article
2. Some minimalistic info on search help (good reference though)
3. SDN topic on the customer search help in VA01
4. Attach a Search Help to the Screen Field (ABAP code)

posted by Your Friendly ABAPer @ 21:29,
Direct link to this post

1 Comments:

At 1/12/09 03:55, Anonymous Anonymous said...

Thanks a million. You just saved me having to contact our programmers to do a time estimate on something which apparently I was quite capable of doing.

Keep up the good work !

Geert from Sweden

 

Post a Comment

<< Home