Ever wondered how to use ABAP search help in MII? Even I didn’t till I got this requirement to extend the search help functionality of R/3 system to a MII screen .I will give a brief about my requirement.
I had an input field in my MII dashboard to enter the material group.Search help was required to be given to this input field to help the user put in the existing material group.The material group list will have to be taken from the R/3 system.There were a host of ways to achieve this but I preferred using a search help which was already present in R/3 system which returns the material group.This will be more useful in cases where scenario demands for search help with an exit ,as writing an RFC for MII requirement would be too tedious. I will be dividing the entire configuration into three parts.1) The ABAP configuration and coding 2) The MII configuration 3) The java script code
Let’s take the parts one by one:
1) The ABAP configuration and coding : “ZS935_HELP” was the present search help in R/3.The function “F4IF_FIELD_VALUE_REQUEST” is used to call the search help dynamically.The standard function is a normal function.So I created a ‘Z’ RFC function to call this standard function.The standard function requires the search help name and value (ref fig.) as import parameter and it returns a table with the values.This table can be used in MII to retrieve the values.
2) The MII configuartion : A transaction was created as shown in figure below.
The transaction calls the RFC we have developed and the returned values filtered using a distinct value extractor which in turn is used to create a document.I have passed the name of my search help and an input string the user puts to refine his search as inputs to the RFC.The transaction and the RFC can be reused as search help name is passed as parameter.To call this transaction on a html page a dummy applet is used.The applet is called dummy because its width and height as 0. Grid is used as the display template of the applet.
3) The Java Script Code : Now once you have the values extracted from SAP all you have to do is display them and use the selected value .Again there are number of ways to display the values and use them.I have shown the values in the div made on the screen.I have restricted myself to displaying the values as i wanted to keep the code simple.The java script can be checked from the entire code given at the last.
The ABAP and MII configuration will more or less be the same to call a search help in R/3. The java script can be changed according to the requirement to display the values.The entire code is shown below which can be used as reusable object with some tweak.