Challenge
You want to search for documents, which are linked to material masters. Your search is mainly defined by document properties, the only material related property is the material number of the linked material. You want to have only one input dialog to input all document related properties and the material number.
Solution
Since ECTR 5.2.3/1.1.3 there is a new feature available "Enable search for documents via given material number (PLM-27421, Improvement Request 227030)"
See WhatsNew, release notes from ECTR 5.2.3/1.1.3
Alternative Solution (before 5.2.3/1.1.3)
- Create a new class in SAP using transaction CL01, name it e.g. ECTR_HELP_SEARCH, class type 017.
Create a new characteristic in SAP using transaction CT04, name it e.g. ECTR_HELP_SEARCH_MATNR, data type - character, number of chars - 18 and assign it to the class from step 1 (e.g. ECTR_HELP_SEARCH).
Define your own search mask (System -> Maintain Search Masks).
- Create new a new serach mask for Document and name it e.g. DOC_WITH_MATNR.
- Add desired document properties to the search mask.
- Now, add the previously created characteristic (e.g. ECTR_HELP_SEARCH_MATNR) to the search mask using "Add Class Characteristic".
- Save the search mask.
- Create a new search wizard "macro search_dis_with_mat.txt" with following content:
doc_search_params = GET_MASK_INPUT("DOC_WITH_MATNR","Search Documents with Material Number","DOC","search doc with mat.number")
mat_search_params = PARAMETER_MAP("mat_fields")
mat_search_params.MATERIALNUMBER = doc_search_params["017/ECTR_HELP_SEARCH/ECTR_HELP_SEARCH_MATNR"]
delete doc_search_params["017/ECTR_HELP_SEARCH/ECTR_HELP_SEARCH_MATNR"]
search_results = SEARCH( "mat", mat_search_params )
transform_results = TRANSFORM_SET( search_results, "mat_to_doc" )
filtered_results = FILTER(transform_results, "doc", doc_search_params )
documents = KEYLIST_FROM_SET(filtered_results)
WRITE_RESULTLIST(documents) Save the file "macro search_dis_with_mat.txt" in the following directory of your ECTR-installation.
%ECTR-INSTDIR%/customize/scripts/macros/wizard/
Define a new Query using "Newe Search".
- Select your macro within the new query:
- The search mask appears, where you can enter your search criteria into the search mask.
Restrictions
Because the document search parameters are used for filtering (remember FILTER(transform_results, "doc", doc_search_params )), not all fields can be used in the document search mask. E.g. the longtext can't be used in filter, so this field will not be very helpful if added to the document search mask.
Dictionary und Icon
Dictionaries can be defined as follow:
plm.macro.wizard.value.for.<filename> = <your text>
Icons can be defined as follow:
plm.macro.wizard.icon.for.<filename> = <icon>