SAP Material Search Component
You can extend the SAP Material Search Component by adding up to 10 fields at the end of the search result table. You can also replace the standard search with a custom selection.
The SAP Material Search Component calls BAdI /ENSXSFCI/MM_MATERIAL_SEARCH.
The BAdI contains two methods: SEARCH and ADDITIONAL_FIELDS.
Method SEARCH
The SEARCH method receives the IS_CONTEXT results and the IV_ORDERBY results generated by the paging logic and returns the CT_KEY material search structure (it contains the Customer Number). The CV_IMPLEMENTED flag should be set if this method is implemented. You can use the CUSTOM tab in the Context to pass extra selection fields from the front-end.
The SAP Material Search Component logic checks the CV_IMPLEMENTED flag and ignores the standard search if it's set.
Method ADDITIONAL_FIELDS
The ADDITIONAL_FIELDS method receives the CT_DATASET search result table and lets you add values to the CUSTOM01 - CUSTOM10 fields in the table. This method is called after all the SAP Material Search Component logic is executed.
Method SEARCH_BY_CHANGED_DATE
The SEARCH_BY_CHANGED_DATE method receives the IS_CONTEXT results and returns the CT_KEY material search structure (it contains the Customer Number). The CV_IMPLEMENTED flag should be set if this method is implemented. You can use the CUSTOM tab in the Context to pass extra selection fields from the front-end.
Example Implementation
We provide an example implementation class: /ENSXSFCI/CL_MAT_SEARCH_BADI. You can copy the example implementation and add/replace it with your own logic and fields.
In the SEARCH method, this class receives User That Created the object keys using the ERNAM key in the CUSTOM tab of the Context and filters the results by User.
In the ADDITIONAL_FIELDS method, the ERNAM field (User That Created the Object) is returned in field CUSTOM01 of CT_DATASET.