Professional Documents
Culture Documents
eu
http://sapuniversity.eu/how-to-create-a-search-help-with-an-exit/
Every SAP user knows the user-friendly search help that offers a list of possible values for a given zone after
pressing F4.
Thanks to this option, it is possible to choose easily an entry without any need for controlling its relevance, since it
is automatically supported by the search help functionality.
If you have luck, you would find a standard search help with adequate filters that fulfill your requirement. But, it is
not so obvious to find the right search help!
For instance, the standard search help MAT1 contains several tabs with different filters to refine the search for
material numbers. Even though, it is not possible to fulfill complex conditions like Display only materials whose
valuation class correspond to a given cost element group
In such cases, you need to create your own search help and implement the specific conditions on your own, using
search help exits.
In this blog, I will explain how to create a search help that fulfills the condition mentioned above:
Display only materials whose valuation class correspond to a given cost element group
For those who are not familiar with the concept of valuation classes in MM:
Go to transaction MM03 and choose a material number then select the Accounting 1 view
Enter the plant in next popup then confirm.
The valuation class could be found under
Current valuation.
The valuation class permits in combination with other factors- to determine the G/L account on which the
stock values have to be posted.
G/L accounts are assigned to valuation classes via transaction OBYC.
The FI G/L accounts correspond to primary cost elements in CO. Those are categorized into cost element
groups that could be visualized using transaction KAH3.
We have now in mind the relationship between valuations classes in MM and cost element groups in CO. Lets
create the search help that realizes our requirement.
Table parameters:
Get importing parameters For this purpose, use parameter SHLP as follows:
Go to SE37 and create the function module Z_PS_GET_KSTAR_FROM_GROUP with the following
parameters:
Create a function module that returns materials with valuation classes that correspond to a given
cost element group.
Create the following structure which will contain the parameters needed for valuation class selection.
Go back to search help exit Z_PS_F4_EXIT_MATNR and add a call to the function module
Z_PS_GET_RESSOURCE_BY_GRPNAME :
Constitute result list
Select descriptions of materials found in
last step. The dialog box parameters
have to be taken into account in the
selection.
Append the result to search help hit list
To recapitulate, here is the complete code
of search help exit
Z_PS_F4_EXIT_MATNR
Generate a maintenance dialog for the table to be able to maintain it via SM30.
Go now to SM30 and add a new entry in the table. Enter group name, company code and controlling area.
Use the search help of zone Material to get relevant values. When you execute it, only material numbers
corresponding to the group name value are listed.
Change the group name and notice the effect in search help result
You can also display the dialog box to enable more filtering options
Kind Regards
Imen
Sap University Team