Saturday, 18 October 2014

Want to create your own search help exit in the search help?

Search Help Exit!
Search Help Exit is a function module with some predefined changing and tables parameter which is used to modify/filter the F4 values selected by Elementary or collective search help from the DB table.


Step1.  These are the below records present in the SPFLI table.























 

Step2. Create a report and declare a parameter and execute it.












 

Step3. So with the field no search help is assigned, so no F4 option is available.














 

Step4. Go to SE11 and create a elementary search help with the table SPFLI.



















 

Step5. Now in the report assign the search help to the field and execute the report.














 


Step6. So in the I/P field the F4 option available and click on the F4 option.















 

Step7. So here we receive all the records that are present in the table. Select a particular line.























 

Step8. So here the value of CONNID is assigned to the field P_CONNID.















 


Step9. Here we want that when the user clicks on the F4 option, it should show only those records from SPFLI where the COUNTRYFR is US. So for that we have to create a search help exit. Lets create a Function group and inside that create a function module.



















 


Step10. This is a special function module which is used for the search help exit functionality. There is no importing parameter.















 


Step11. There is no exporting parameter.















 


Step12. In the changing section we have to predefined parameters.

















 

Step13. In the tables section we have also two parameters with the below predefined name.


















 


Step14. When a search help exit is assigned to a search help and the search help is assigned to a i/P parameter, when the user press the F4 option, then the search help exit function module is executed multiple times with different events. The different options are given in the case statement with the order of execution. Just put a debug point so that we can test it later.




















 


Step15. Assign the FM as a search help exit in the search help.


















 


Step16. Now press the F4 option.

















 


Step17. Here the search help exit FM is triggered with the event 'SELONE'.



















 



Step18. Press F8 button the again event 'PRESEL1' is triggered.



















 

Step19. Again press F8 then the SELECT event is triggered. You can find that the internal table 'RECORD_TAB[]'  is still not filled.




















 



Step20. Again press F8 then the event DISP is triggered and the table RECORD_TAB is filled with all the record form SPFLI table. Noe in the  particular switch case delete all those records where countryfr is not equal to US.



















 


Step21. Here we have 20 records in the record_tab[].


















 

Step22. Our code in the DISP section deletes all the records where countyfr is not equal to US. This is some kind of filtration we are doing in the search help exit function module.



















 


Step23. Sp we have the desired records in the RECORD_TAB[]. Press F8.


















 



Step24. After the DISP event , all the records available in the RECORD_TAB[] appears in the UI.


























 


Step25. Select one, Again the FM is triggered with an event RETURN and there is only one record in the RECORD_TBA[].


















 



Step26. So the selected row appears in the RECORD_TAB[]. Again click F8.















 

Step27. So here the selected CONNID is filled in the I/P field.












------------------------------------------------------------------------------------------------------------------------

No comments:

Comments system

Disqus Shortname