This is second part in this series, where we will have a look at how to add search help for the fields. Creating an input help for a field is a common requirement in most of the EBP developments, where you need add new fields to shopping cart or purchase order.
This is actually done in 2 ways. If the new field is added in the basic data of shopping cart, then you need to create a new field in the standard customer include structures ( Example : CI_BBP_ITEM_SC ) and providing the search help for this fields in the SAP GUI automatically creates a search help button ( with Binocular symbol ) in the front end. In the second case, if you have to add a field a tab other than “Basic data” you have to add the field in the corresponding screen in SAP GUI. Adding a search help to this field in SAP GUI does not create the search help in the front end. This needs changes in the HTML template of the corresponding screen. This article talks about these changes that need to be done for creating the input help for a field.
Creating a search help involves two steps.
- Create a search help for a field in your structure or table in the SAP GUI. ( It has been assumed that the reader know, how to create a search help )
- Change the HTML template of the screen on which this filed exists.
Let us take the example of field CATEGORY in the table YMOVIE. A search help called ZCATHELP has been created and assigned to the field CATEGORY.
Note: – Before changing the HTML template just check whether the search help is working perfectly in SAP GUI or not.
Once you are sure that the search help is working well in SAP GUI, find out the screen where this particular filed is used.
A module pool program ZYMOVIE1 has been created with screen 9000. (As mentioned in part 1).The corresponding HTML template for this screen is ZYMOVIE1_9000 in the Internet service ZYMOVIE1. (This can be accessed through SE80)
Once you are in template identify where you are defining the field CATEGORY in template. This is the place where the field category has been defined in the front end.
`TD(class="label")`<label for="`YMOVIE-CATEGORY.name`"> `YMOVIE-CATEGORY.label`</label>
`if (YMOVIE-CATEGORY.disabled)`
`TD(YMOVIE-CATEGORY.value, class="data", active="")`
`else`
`TD(class="data")` <input type=text id="`YMOVIE-CATEGORY.name`" name="`YMOVIE-CATEGORY.name`" value="`YMOVIE-CATEGORY.value`" maxlength="04" size="04">
`end`
Now immediately after this include the following code:
`TD()` `F4HelpButton(bbpformname,
"YMOVIE-CATEGORY",
"#Z_SELECT_SHELP_SC_NUM_BY_PO",
"category")`
F4HelpButton is a standard HTMLB function given by SAP. This function is available in service BBPGLOBAL and template BBPFUNCTIONS.
The first parameter is the form name, second parameter is the field name to which search help has to be added, third parameter is the name of search help and the fourth parameter is the heading that will be displayed when you click on binocular button.
When we add F4HelpButton function binocular icon automatically appears in the front end:
Along with this we need to add the searchhelp template to the Internet service. This is done by creating the new template in the internet service and adding the below mentioned code:
`include (~service="bbpsearchhelp", ~theme="99", ~language="", ~name="searchhelp.html")`
After doing this save the changes and publish the entire service.
Now clicking on the binocular button will take you to another screen where the search help results are displayed:
Useful links:
- For learning HTML and Javascript, the best starting point would be w3schools.com
- For learning HTMLB, I haven’t found anything better than this link
Sankar Rao Bhatta is an SAP NetWeaver Consultant with Intel, India. After completing M.Tech from IIT Bombay, he worked with IBM as SAP Consultant before joining Intel. Other areas of his expertise include SAP SRM and ABAP.